Team Kinde Project 1:Part 1

line Group Name: Kinde
Group Members: Eric Miller, Adam Koshorek, David Wigell
About Project 1
Base code for Project 1, came from Eric's Step 3 code.
These were the problems of the original Step 3 code:
Step 3 problems: -2 Author : Enter_your_name_here +1 for free -2 Compile Warnings -3 load did not work properly -2 program is cranky (especially after trumping) cc
I was not sure about what some of them even meant, and I emailed the TA about what the mark downs meant but haven't heard back from him yet. I don't want the group to get marked down if these are recurring problems and I didn't hear back in time to fix them. I wasn't sure why the load function doesn't work, it seemed to work fine and continues to work fine in Project 1. "Program is cranky" is an extremely general comment and wasn't sure what it meant. The other errors I understood.
Now, for Project 1, we decided to put the Zoom and Scroll buttons right below the trash can, they work as described on the website. There are three overall modes, Regular, Zoom, and Scroll. We have it so nothing like the trash, the toolbar, or dragging tiles is possible while in Zoom or Scroll mode. Zooming also doesn't affect the toolbar and there is a minimum and maximum to where the user can zoom (.5 - 1.5).
The Status Bar is split into three sections. The first doesn't really do anything yet, we were saving that for Part 2. The second tells if there are anything overlapping tiles, we made sure this works even when first loading a file. The third indicates the number of tiles on the screen, again, it instantly tells when the tiles are changed, including in the event of an open.
Ideas for Part 2
Wasn't really sure how specific to get into this, so here's what we got.
We were thinking about utilizing commerce, population, and a new happiness factor which affects how much income the city takes in. As our city's income increases, we are able to buy certain tiles for the general public. New tiles, such as school districts and many other tiles would be created in order to affect the happiness factor, all of which require money to buy. You will only be able to drag and create a certain tile if you have enough income. There will be a new menu option to show how much each tile cost. The spartan stadium is the most expensive tile and once you purchase this tile, you win!
Also, to make the city as realistic as possible I was thinking to add a variable that after x amount of time there is a small chance that a disaster will happen(it would not be a large chance, maybe 1/50 every 30 seconds--obviously we need to play around with this to get a good balance.) For this we would need to find images online that will go nicely with our city, so this idea depends largely on that. Some distasters could be fire, tornado, or maybe even an animated monster.
Individual Work
Eric Miller
Group Responsibilites:
I was responsible for implementing the latter part of Scrolling (#1), we worked together on the basic part of obtaining the offset and clicking the hand and magnifying glass. I also implemented Zooming function (#2). I worked together with Adam on the Status bar (#3).
Individual Task:
I was in charge of Commerce and was unclear about certain features of individual tiles.
In the top right corner, I displayed the current Housing/Industry and Housing/Market ratio, which I determined to be bad below .8 and above 1.5.
You mention this: "I recommend creating three classes, one for shopping, one for production, and one for housing, and having enums to indicate the specific factory, building, or other tiles you are using in each case." Below includes questions I had about it. I hope I don't get marked down for the misunderstandings, I can make the changes in Part 2 if you tell me what they are, I just wasn't sure and time for running out. Everytime you change the tiles it is updated.
We already had a class for shopping called "CTileMarket" so I just kept that and altered it. You mention: "For each shopping center, define a number of customers that can be served." I was confused because there is only one market image.
For production, you mention specific factories, but there's only one toolbar icon for industry with multiple images of that industry. So, what I did was once you drag the industry tile down, it cycles through the industry phases (images) just like the market tile does (except not random). I didn't know if you actually wanted us to use all of the industry tiles including coalmines, warehouses, mills, etc. It was a little unclear.
For Housing, I noticed multiple housing images, but again, one toolbar icon. So I have it where if you drag a house down, it randomizes between the housing images in the constructor and then stays that way. Each image is also associated with a different population increase, thus affecting the ratios differently. The load function makes sure to load the same house everytime.
Adam Koshorek
Group Responsibility:
I was responsible for making the stutus bar properties and setting them to be displayed on various events. I worked with Eric on displaying the tiles that were counted and seeing if they were overlapping or not. I also worked with Eric on the beginning part of setting the offset for scrolling. We all worked together on creating the toolbar images to display the Zoom/Scroll icon.David I was responsible for cleaning up un-needed code and commenting all functions and implementations. At first we did not display a good sense of communication and all had seperate local copies on our machines. Due to this, I was responsible for putting together the code after we all committed and fixing various bugs and redundancies. David and I worked together to create our 200 tile city.I created the SVN and website. I came up with the ideas for Part 2.
Individual Task:
I was responsible for Construction.
I decided to create an enum that is origanlly set to the grass tile originally dragged down. When you double-click on the tile it puts it into a state of clearing and displays the appropriate image. When it gets to the end it randomly creates one of three tile types- Beaumont Tower, Monument Tux, or Cricket Court(which when I actually looked at the tile realized it was a basketball court.)After it does this it deletes the old Construction tile in the method you showed us in class. For some reason it the randomize function creates more Critcket Court tiles then anything else by a huge margin. In part two I might change the randomize function to make it harder to create the Cricket Court court.
I implemented the double click function for the group to use and used that to set the construction tile to start clearing.
In my construction tile draw function I have a switch statement that tells which process you are currently on and which tiles to draw. I know a handbook violation is no warnings allowed. However in my switch I am not putting a break at the end of one of them and this is drawing a warning. This is not unintentional and I am using that specific flexability of the switch statement for my code and for that reason I do not think it should be a warning/markdown for handbook violation.
David Wigell
Group Responsibilities:
I helped in the earlier stages of the implementation of the scrolling/zooming feature. I also helped with creating the city for the website.
Individual Task********
Basic Reasoning:
I was resposible for the implementation of the transportation feature. First I created the transportation tool bar in CFrame. Then I created an enum that mapped each item in the tool bar. I then created a base class called CTileTransportation which was derived from CTile. This class included pure virtual fuctions Draw(wxDC &dc), SetType(), and RotateTile(). It also includes fuctions AcceptVisitor(CTileVisitor *visitor), XmlSave() and XmlLoad(wxXmlNode *node). Then I created a class for each transportation tile: CTileCar, CTileRoads, CTileTurns, CTileThreewayInt, CTileFourwayInt, CTileLowerRamp, CTileUpperRamp, and CTileBridge. All of these classes are derived from CTileTransportation. Finally, I created a visitor called CTileTransportationVisitor that implements the rotation feature on each of the tiles.
Derived Classes:
Each derived class contains an enum for the type of tile and a static const int for the total images possible for that tile(excluding CTileFourwayInt because it does not need to be rotated). They each contain a wxBitmap variable, an enum variable, and an integer used to help change the tile type. Also at the top of each .cpp file, there are constant strings that actually identify the specific .png file.
* Constructor - sets the wxBitmap variable to city->GetCachedImage(appropriate .png file)
- sets the enum variable to the corresponding image in the toolbar
- sets the integer variable to 0
* Draw - uses the function SetType() to find the type of the tile
- sets the wxBitmap variable to that corresponding type
- draws the tile
* XmlSave - creates a wxXmlNode *node = CTile::XmlSave()
- finds the integer value type
- adds the appropriate type and status properties
- returns the node
* XmlLoad - uses a wxString to help tell the class what type of tile to load
- sets the type and numType of tile
* AcceptVisitor - visitor->VisitTransportation(this);
* RotateTile - uses the current mNumType to change it to the next type
- returns the mNumType
* SetTile - creates a wstring variable
- uses the wsrting variable to determine the value of the mNumType
- returns mNumType
Visitor class:
This class has an integer member variable called mChangedTile set to 0 in the constructor. It then has a function called VisitTransportation(CTileTransportation *tile) which then contains { mChangedTile = tile->RotateTile(); }.
In the load fuction I included an extra else if statement for each of the tiles in the while loop
The toolbar is added to the constructor. The toolbar is drawn in the OnPaint function. A switch statement is used in the OnLeftButtonDown function to add the tile to the city when the user clicks on it. In the OnLeftDoubleClick function, a Transportation visitor is activated when a tile is double clicked.

MEMBER: Eric Miller, Adam Koshorek, David Wigell

Winning Conditions:
1) We have 5 ratios set up that are displayed in the bottom right corner, which all have to be good (or green) in order for the game to be won.

- Housing/Road Ratio: There needs to be at least one road for every 50 population.
- Housing/Power Ratio: There needs to be at least one power tile for every 50 population
- Fresh Air/Pollution Ratio: Every building creates pollution (or bad air), the most pollution filled being the Industry tile. Every grass or tree tile gives fresh air (or good air). There needs to be a ratio of fresh air to pollution of at least 1.0 or greater in order to win. - Housing/Industry Ratio: There needs to be a ratio of .8 to 1.5 between population and industry tiles (Just the one industry tile).
- Housing/Market Ratio: There needs to be a ratio of .8 to 1.5 between population and market tiles (Just the one market tile).
2) The income of the city (which is based on the population) needs to be at least 10,000 to win the game.
3) The population of the city (which is based on housing tiles) needs to be at least 500.
- "YOU WIN" will appear on screen if you meet the conditions

Losing Conditions:

1) If the winning conditions are not met and income drops to 0.

- "YOU LOSE" will appear when you lose.

Changes from Part 1:

- The market and industry tiles no longer animate, it was lagging the game.
- Power tiles and transportation tiles were all moved into a new base class called "CTilePublicServices"
- Load function now works for commerce
- Housing tiles are not chosen randomly, you start out with the biggest house tile and you can double-click through them all


- "On About" now tells you the winning conditions
- We added all the power tiles and functionality for rotating them
- We now have 3 new ratios: Housing/Road Ratio, Housing/Power Ratio, Fresh Air/Pollution Ratio
- We added an income for the city which is based on two things:
- Taxes: Money automatically gained from the population of the city
- NOTE: Although more population gets you more money, more population means you need to build more of everything else
- Expenses: Money taken away from the income based on the number of road and power tiles
- NOTE: Expenses are greater than taxes in the game
- New Status Bar: Includes income, total population, if any tiles are overlapping, number of tiles, and a happiness factor
- Happiness Factor is based on the 5 ratios, depending on how many are green
- Five Possibilities in Happiness Factor: No Population, Very Angry, Angry, Annoyed, Content, Happy, Very Happy (needed to win the game)
- More new tiles added: Port, FireStation, University, Warehouse, Park, Trees
- Toolbar can now be hidden with the click of the green double arrows