The Capitalism Simulator Project - Object-Oriented Programming | C SC 335, Study Guides, Projects, Research of Computer Science

Material Type: Project; Class: Object-Oriented Programming and Design; Subject: COMPUTER SCIENCE; University: University of Arizona; Term: Spring 2009;

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 08/31/2009

koofers-user-ay7
koofers-user-ay7 🇺🇸

10 documents

1 / 14

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
TradingSim – The Capitalism Simulator
C Sc 335 Spring 2009 – Final Project
Author: Alexander “Apollon” Jerabek
Grader: Eric Stewart
TradingSim is a game in which players buy and sell goods in order to earn money and beat
out their competitors. They play the “middlemen” of a capitalist society; players neither produce nor
consume the products, but rather take them from places of great supply to places of great demand.
Players will win by making more money faster than the other players within the game’s economic
system.
Your job is to design this game. You will make a large-scale object-oriented program to do
this. The program’s model will consist of the players, the goods, the towns, and a whole host of other
elements (as set out later in this document.) A GUI will also need to be created in order to allow players
an easy-to-use, intuitive interface from which they can interact with the model. To finalize this game,
you will apply your creativity to make a unique product. TradingSim can be made for nearly any setting:
the 17th century Caribbean, a distant galaxy, a medieval caravan, whatever you think will be fun to make
and play.
In order to fulfill the requirements of this project, your game must follow two guidelines: the
common specification and this document. TradingSim in particular has several required components,
several optional pieces (of which you must choose some to implement,) and a few extra credit
opportunities.
Required Concepts:
Players: What’s a game without people playing it? Your game must support multiple
players per game, both human and computer-controlled. You may choose the upper and
lower-limit of the number of players per game, with two restrictions: You must force a
minimum of two players (Why at least two? The point of capitalism is competition. This
isn’t a Monopoly ;-).) You must also allow the game to include eight players. If you feel
only having two players in a game makes the game play suffer, feel free to set your own
limit. In short, your range is 2 ≤ lower limit ≤ 8 ≤ upper limit. In the game Gazillionaire (the
game I blatantly stole this idea from) has a player size of between 7 and 13, which would
meet all the requirements. Finally, the game must support between one and four human
players in any given game (you may raise the upper limit if you like.) AI players should be
added (or chosen by the user to be added) as needed.
In addition to numbers, players need names. Human players should be able to
pick their own names (or pick from a list, should your theme mandate that.) AI players
should have names generated for them. Picking the number of players and name selection
should be done before the game is underway, when the option for a new game is selected.
Commodities: In order to buy and sell goods, you need… goods (commodities, cargo, products
—these will be used interchangeably.) Your game should include at least 10 different items
for trading. Every good should know its price range, the amount available/possessed by the
player, and the price purchased at/current price in town to buy or sell. You may include other
attributes as you see fit.
Commodities are not sold and bought on an individual basis; traders buy things
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download The Capitalism Simulator Project - Object-Oriented Programming | C SC 335 and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

TradingSim – The Capitalism Simulator

C Sc 335 Spring 2009 – Final Project Author: Alexander “Apollon” Jerabek Grader: Eric Stewart TradingSim is a game in which players buy and sell goods in order to earn money and beat out their competitors. They play the “middlemen” of a capitalist society; players neither produce nor consume the products, but rather take them from places of great supply to places of great demand. Players will win by making more money faster than the other players within the game’s economic system. Your job is to design this game. You will make a large-scale object-oriented program to do this. The program’s model will consist of the players, the goods, the towns, and a whole host of other elements (as set out later in this document.) A GUI will also need to be created in order to allow players an easy-to-use, intuitive interface from which they can interact with the model. To finalize this game, you will apply your creativity to make a unique product. TradingSim can be made for nearly any setting: the 17th^ century Caribbean, a distant galaxy, a medieval caravan, whatever you think will be fun to make and play. In order to fulfill the requirements of this project, your game must follow two guidelines: the common specification and this document. TradingSim in particular has several required components, several optional pieces (of which you must choose some to implement,) and a few extra credit opportunities.

Required Concepts:

Players : What’s a game without people playing it? Your game must support multiple players per game, both human and computer-controlled. You may choose the upper and lower-limit of the number of players per game, with two restrictions: You must force a minimum of two players (Why at least two? The point of capitalism is competition. This isn’t a Monopoly ;-).) You must also allow the game to include eight players. If you feel only having two players in a game makes the game play suffer, feel free to set your own limit. In short, your range is 2 ≤ lower limit ≤ 8 ≤ upper limit. In the game Gazillionaire (the game I blatantly stole this idea from) has a player size of between 7 and 13, which would meet all the requirements. Finally, the game must support between one and four human players in any given game (you may raise the upper limit if you like.) AI players should be added (or chosen by the user to be added) as needed. In addition to numbers, players need names. Human players should be able to pick their own names (or pick from a list, should your theme mandate that.) AI players should have names generated for them. Picking the number of players and name selection should be done before the game is underway, when the option for a new game is selected. Commodities : In order to buy and sell goods, you need… goods (commodities, cargo, products —these will be used interchangeably.) Your game should include at least 10 different items for trading. Every good should know its price range, the amount available/possessed by the player, and the price purchased at/current price in town to buy or sell. You may include other attributes as you see fit. Commodities are not sold and bought on an individual basis; traders buy things

in bulk. Your units of measurement should reflect this, whether they be tons, pounds, or some fictional unit of measurement. Also note that one unit of a good should not be the only things bought or sold in a turn; that is not fun or interesting. Instead, your transport (better described later) should be able to hold many units (not as few as 2 or 3, but not as big as 100,000, keep things reasonable.) Sample Commodity Data Good Amt. You Have Amt. in Town Price You Paid Current Price Price Range Toasters 30 5 100 312 90- In the above sample, we see the commodity “Toasters”. Apparently, the player bought 30 units of Toasters somewhere at the price of 100 per unit. Where ever the player currently is has a few units of Toasters (5), but seems to have a shortage, as they are paying a lot of money to buy them (312,) which is fairly close to the maximum price. The player would make 212 * 30 in profit if she sold her Toasters here (however, she would receive 312

  • 30 for the sale.) Please note that the “Price You Paid” field should be an average; if the player bought 15 units of Toasters at 90 and 15 at 110, this price would be correct (the current price of the town should be changed during the span of one turn.) Money: The goal of the game is to earn money. Naturally, your game must include the notion of money. This will be in at least three forms: cash, banks (invested money), and loans. A player can have money tied to any or all of these categories. Cash can be used by the player at any (reasonable) time to do anything relevant to the game. A bank earns the player interest per turn and may or may not have restrictions on when the money can be accessed (your design decision.) Loans give the player cash, but need to be paid back eventually. They accumulate interest every turn as well, probably at a higher rate than the bank gives you interest. Loans also have a credit limit; if you exceed this, you’ve gone bankrupt (your game should not have those annoying “get-out-of-debt-fast” people.) When you go bankrupt, you’ll have to sell your transport and other assets and you will lose. To win, you’ll need to have a net worth of some large amount. Net worth is the amount of money your trader has, not including the price of her transport. Net worth is equal to cash + bank amount – loan amount + (cargo * minimum price for cargo) + any other investments (stocks, factories, etc.) – any outstanding fees (crew wages, taxes, etc.) You should start players in debt. Have everyone begin the game with a loan for their transport. This slows down game play in the beginning and forces good business practices to overcome loan interest. It may be easier or make more sense in your game’s story to have this loan come from a different source than the creditor’s loan. If you have more than one loan, only make one able to give the player additional money. Any and all loans will need credit limits. A credit limit is defined as the maximum amount the loan can be without there being problems. A player will lose if they end a turn (turns will be discussed later) with a loan’s credit limit exceeded. Players can exceed their credit limit when money is involuntarily deducted from them (the random events section will outline some possible cases for this.) Make sure your players can actually make profit and win. If players make an average of X per turn, and pay 4* X in taxes and crew wages every four turns, something’s wrong. That said, don’t be so formulaic. Players may, and probably should, lose money as they begin the game. They’ll make investments in products and other things (as described

have the user setup the towns before the game proper starts. Complex Economies: In the real world, prices of goods vary and traders aren’t the only ones affecting the supply of goods. Towns will produce certain amounts of goods every turn and consume some every turn. These production and consumption amounts will slowly vary over time. The current market price will be based on amount of production versus consumption. More specifically, it will be based the amount leftover for selling and the ability to rebuild the stockpile of goods. Goods will accumulate where production exceeds consumption. These are the goods players have access to trade. Because players may eventually exhaust trade routes (if a town can’t produce as fast as traders can purchase things), eventually the price will rise as supply gets more limited. If you choose to implement advertising, the amount given to the town will affect the amount available to buy, not the production. This is because those goods are being used by locals. If you “reserve” the goods, they will go to the marketplace first, not the local populace. World Information : Players need to know about the world before they can make good purchasing decisions. You must provide two things: a map showing each town and the distance between them, and a chart with the current market for each commodity. This chart can be done two ways by showing either every good’s current price in every town, or by showing a “supply percent” – this means the current ratio of supply to demand (a supply percent of 100% would mean the good would sell for its minimum price, whereas 0% would sell for maximum.) The supply percent chart may work better for a complex economy (see the optional addition section later on.) If your prices are static, these should always be the same. If not, this chart reflects the current turn’s state, not the next. Players will use the data given to plan their next turn, but it may change by the time they get to the next town. Here’s a sample of each, with the same data: Current Prices Good Town A Town B Town C Town D Jelly Beans 53 20 60 40 Umbrellas 102 320 150 320 X Fuels 640 320 600 500 Supply Percent Good Town A Town B Town C Town D Jelly Beans 45% 100% 33% 66% Umbrellas 91% 0% 71% 0% X Fuels 0% 33% 9% 31% Transports : Traders generally don’t walk from town to town with their goods in their arms. Instead, they have something to carry their stuff for them. What this is depends on your theme, which will be covered later. A transport needs at least two technical elements: cargo capacity and speed. It should also have a name and picture (GUIs, remember?) Other

variables will come if you opt for certain other features, like crew, passengers, or fuel capacity. You should provide a variety of transports. You need at least three: one with a smaller cargo capacity and faster speed, one with a large capacity and slower speed, and one middle-of the-road ship. It must be possible to win with every ship, so don’t make the differences too drastic. Transports cost money. You will have your players start in debt by the amount the transport costs. You may wish to have all your transports cost the same amount to make this easier, but different costs could make for interesting game play as better transports force players into more debt. Transports should be selected before the game is underway: at or immediately following the player selection. You may wish to have players get unique ships, so that no two players have the same ship. You may also want AI players to get their own ships that human players don’t have access to. Turns : As it has been alluded to, this game will be turn-based. One turn consists of every player buying and selling goods, conducting any other business (loan payments, picking-up passengers, etc.), traveling to the next town, and dealing with any random events along the way (as described later on.) A whole turn is over when every player has gone; a player cannot be on turn 4 when another player hasn’t done turn 3 yet. Turns cannot be divided in any way; once a player’s turn is done, it’s done. Also, a turn cannot be ended without the player traveling to a different town. Turn order is not static; player one will not always go first (except on the first turn.) Turn order is determined by travel time between towns and the speed of the transport (time = distance / speed.) So if two players start their turns at Town A and both go to Town B, the faster player will take their next turn first. Likewise, if both players have the same speed and Player 1 is 10 units away from Town A and Player 2 is 20 units away from Town A, Player 1 will take their next turn first. Why is this important? This is why Towns should not have unlimited goods: players should compete for the best products (and passengers.) If everyone gets to have the best goods at the best prices, why are they competing and how would someone get ahead? If only one player can get the best goods, players will need to factor in distance and speed into their strategies. More tactics mean more variety and more fun. Random Events : Games get monotonous after a while. You will fix this by adding random events. How? Have a few things that may happen to any player as they are traveling to the next town. There should be good things, bad things, and things that could go either way. Players should sometimes get to choose whether or not they participate in the event. Here’s a few of examples of every type:  Pirates take your cargo. (Bad)  You win the lottery. (Good)  Your navigator messes up and you are slowed (Bad)  Someone offers to upgrade your engine for $X. (Good, the player isn’t forced to spend any money if they don’t want to. You could have a 1 in 4 chance the upgrade will fail and cost much more to fix, if that’s more interesting.)  Your crew demands higher wages. (Bad, raising wages is costly, but the fallout

In this case, the strategy would fill the ship with Lava Lamps, but not make good money when selling the Lava Lamps in Town C. The easy-to-see but hard-to-code solution is to fill the transport with Gems and Lava Lamps and go to Town D. You can probably see the complexity when there are more towns, more goods, and a bigger cargo capacity. There are some in between solutions to this problem for you to discover as well. There are other factors to consider. Let’s say the strategy took Lava Lamps to Town D. What good would it buy there? Nothing’s a really good deal there (of course there may be something we’re not seeing, but let’s ignore that possibility for now.) The better long-term idea would be to take the Lava Lamps to Town B so it can purchase Gems the next turn. Let’s say the strategy bought Gems. The best deal is at Town C. But what if Town C is far away and the AI has a slow ship? That means other players could beat it to Town C and get first pick at the commodities. What if Town D is nearby? It may be better in the long run to go there and miss out on a few dollars (maybe the fuel cost to go that far doesn’t even make up for it.) Your game needs at least two strategies. One beginner level and one advanced. The beginning strategy must be able to win when competing against other beginning strategies in a reasonable amount of time. If the strategy make an average of $1 per turn and your game needs $1,000,000 to win, that’s not a reasonable amount of time. If you, as a college-aged human, can win in 30 turns and the strategy can win in 45 turns, that ratio is perfect. If the strategy does better, that’s great. The beginning strategy can actually be advanced, but you probably will not have time to develop two great strategies. You will need an advanced strategy. This should usually beat the beginning strategy. Besides intelligently picking commodities and destinations, the strategy should factor in either distance or purchasing potential at the destination (or both.) Theme : So far, this game has been described in generic terms. Generic means boring. Be creative and pick a theme for your game. This will give uniqueness to your goods, towns, and images. Take the line “You fill your transport with a good and go to Town A. Along the way something bad happens.” Let’s apply some themes: Space: “You fill your freighter with 100 tons of Moon Ferns and travel 10 parsecs to Planet Vexx. Along the way, your ship gets captured by Cylets who steal your hyperdrive – costing you 20,000 credits to have fixed.” Medieval: “You fill your caravan with 100 stones of Mead and travel 100 leagues to Hamburg. Along the way, your caravan gets assaulted by brigands who take your cargo.” Isn’t that more interesting? All that’s required of your game is you remove as much of the generic stuff as you can. Do not stress over the theme. It mostly exists to force you to force your ideas and have consistent images. Balance/Fun : TradingSim is a game. Games are (or should be) fun for everyone playing. Fun is a very subjective term, so exact guidelines cannot be laid out here. An easy way to add fun is to increase the number of things in the game and make each of them distinctive. The required amount of everything is the minimum; feel free to add more commodities, transports, towns, etc. Your game will only get better.

You will know if you game is fun. If you’re unsure, ask your section leader. Better yet, have you friend or sibling play your game. Don’t have your mom tell you if the game is fun; she likes all the work you do. ;-) Balance is more concrete of an idea. Nothing in your game should give a player a distinct advantage over any other player. If one of your transports is vastly superior to the others, that is unbalanced; the same is true if one ship is far worse than the others. There should not be any random events in the game that cause the player to have a guaranteed win or loss. GUI : This game needs a graphical user interface. It must be clean and user-friendly. There should be as little keyboard entry as possible: only numbers for amounts should be typed by the user. This GUI does not need to be overly fancy: a table as shown in the examples that is clickable will be perfect for the marketplace in towns. The map used to show all the towns should be used for players picking their destination for the next turn. Images of each town must be visible and some background should exist. Clicking on the town should have the player travel to that town and end their turn. Since you need to you provide a lot of information, one frame would most likely be cluttered. You may consider having separate frames for the marketplace, the world map, the current-price/supply-percent table, and the town center (from which you can access the other windows, your bank, loan, etc.) Since the game is turn-based, players should be aware of whose turn it is. More over, it should be obvious whose turn it is. There are many approaches to this. The most obvious one is to have a splash screen that shows the player and some other information, such as a picture of their transport and/or some game statistics. You must have some images intermixed with the data. These don’t have to be an integral design element, just enough to break the monotony of text (something like icons for each feature.) Sound : Games are dull without sound. Yours won't be dull. Include at least three sound effects in your game. These can be anything from the sound of a transport flying to the sound of a player victory parade. Other Components : Your game needs all of the above components. In addition, you will need at least three of the following things: Passengers: Every player has to deal with passengers. All transports have some fixed passenger capacity. Every town has some amount of passengers waiting to be picked up. Each passenger has some tolerance level for the price they are willing to pay to get on the transport. Each player will be able to pickup passengers at some price per head and set the price for the next round. To make your job easier, passengers will not have to actually care where they are going, just that they are going somewhere. If you choose to implement this feature, you must provide at least two more transports. There must be some variety in passenger capacity between some of your available transports. This allows for varying strategies about how to deal with passengers and whether they can be valuable to people’s playing styles.

Should you implement this feature, add some random events that globally alter the taxes. These events should raise or lower a specific tax by one percent. They should occur at the beginning of the first player's turn (the first player to go that turn, not the first player to have played) and the message should be repeated to every other player that turn, so they too may be alerted to the tax shift. There should be two * number of tax types new random events. Advertising: Marketing is a big part of any enterprise. Your players should be able to spend money towards promoting their business. The more money a player spends on advertising, the more goods should be available in that town (the prices shouldn’t be affected, just the amount brought to market for traders.) The advertising should affect the next turn. You can either let players choose to advertise in specific towns, or where ever they opt to go at the end of the turn. You may also choose to have all players’ advertising be cumulative: if two players give $1000 to Town A, then Town A will provide how ever many goods $ brings (note this does not mean $2000 worth of goods, otherwise advertising would be pointless.) If you have a passenger system, include a similar mechanism for passenger advertising. Town Specials: Towns are unique. This option will make that feel true. Each town will give the player the choice of doing something there that they could not do elsewhere. Examples include a town with cheap fuel, a vacation town, a gambling town, etc. Town specials should provide interesting results from participating. For example, if you’re in the vacation town, you could give your crew a break. Your game could randomly assign one of three outcomes: the crew is really happy and forget about the money you owe them, the crew is happy but does nothing positive for you, and the crew gets drunk and destroys something, costing you a sum of money. Have fun with these if you choose this option. Insurance: A bad random event can cost a player the game if it comes at the wrong time. Insurance would allow players to protect themselves against bad things for a turn. Before departing a town, players could buy insurance at some cost, which should be randomly determined from a range. Make the pricing such that it is not always smart to buy insurance (if the cost is always insignificantly cheap, why would someone not buy it?) Insurance should not cover player stupidity: running out of fuel or not paying taxes is not covered by insurance. If you choose to implement this feature, you should add at least ten more random events. At least ten of the events in your game must be affected by insurance. Auctions: Include a new type of random event: auctions. All players should be able to bid on the same auction during the turn in which it occurs. The prize of the auction can be one of these three things: a transport upgrade (faster, bigger, more passenger room, more everything, etc.), a factory in some town (more income for the player and possibly more of some commodity there,) or a facility in some town (charges other players money to go there which goes towards the owning player.) AI should respond to auctions with some amount of intelligence: they should bid competitively if they can afford it. They should also not go bankrupt from auctions. Advanced strategies should also consider the time of the game. If someone is close to winning, paying for the auction item doesn’t make sense (generally, games will last a similar

amount of turns, so once you discover that you can use that information here, if you want.) News: Include a news or weather monitoring system. This system should provide the same information across the entire world to every player. The information should do two things: either give light on possible random events or provide theme-based information that may be interesting, yet not important to the game (like most news on the 24-hour news channels.) News about the random events must be valid and helpful to the player. For example, if the news says a hurricane is near Town A, then anyone traveling to Town A should have a high chance of being hit by a hurricane. Make sure the news is consistent across all players, for logical reasons. Not all random events should be reported by the news; some don’t make logic sense to be. Since news needs to be reported every turn, your game will most likely have random events occur more frequently, to keep up with the news. In order to make this more fun, you will have to add at least 10 more random events. Warehouses: Sometimes, you want to buy more than you can carry. In times like that, you need warehouses. This feature tasks you to implement a storage feature for each player in each town. Players can either start with warehouses in every town or buy them from some warehouse dealer on a per town basis. Warehouses should be able to store some commodities for players and keep them safe across multiple turns. There should be no cost to store things in warehouses, as the player owns them. You may wish to implement an upkeep fee, but this is not mandatory. Warehouses are distinct per town and per player, meaning a player can only access their warehouse. More over, they can only access their warehouse in that particular town. If you choose to implement this feature, you must add a few random events involving the warehouses. Have one to two cause harm to a warehouse; some offer warehouse upgrades at a cost or free; and any others you can think of. You need at least three distinct warehouse-related events. Other: Thought of something you want to implement that’s not here? Since this is a new project, try and get it approved; it’s easier than getting a new feature for Risk approved.

Summary:

Since there is a lot of information, here is a concise list of what is required. For details, read the prior sections. What your game will need:  A player range of 2 ≤ min ≤ 8 ≤ max  ≥ 10 different commodities  ≥ 3 pools of money: cash, bank, and loan  ≥ 5 towns  A chart with distances between towns  A chart with current prices or supply percents of commodities in all towns

Additional Strategies (5%) : As the AI section points out, strategies for this game can be complex. Make two more for this bit of extra credit. They should behave differently then the other strategies. These strategies must meet the same criteria as an advanced AI. Stock Market (5%): Add a stock market to the game. Players should be able to buy shares and later sell them. Current stock worth should factor into net worth. You should add small brokerage fees for any market transactions. Stocks can be for either commodities or towns. If your stock market is commodity-based, you should have a stock for every good in the game. If your stock market is town-based, you should have a stock for every town in the game. Town-based stocks should only be purchased in the town they are associated with. Prices should behave in trends, like real markets, and change direction slowly over time. Since these represent a system not directly connected to the players, price changes should be random. Occasional drastic shifts should be included; sometimes a stock plummets or rises quickly (remember earlier this decade?) AI strategies can take the stock market into consideration; intelligent reactions to stocks qualify a strategy as advanced. In addition, your stock market screen will need to display a graph of the stocks' history. This should plot price over time. Use different colors for each stock. Also include options to toggle which stocks are visible and summary data about the player's stocks (stuff like shares owned and average price paid for the stocks.) Full Sound (2%) : Your game needs sound to not be boring. To be really fun, your game needs a lot of sound. Your goal for this extra credit is to make almost everything play a sound. Every action should have a unique sound effect: paying your crew, depositing money in the bank, buying a commodity. If you have a screen that no actions can directly be taken on (some sort of splash screen or main screen) have it play some nice ambient music. If you have any questions about what is sufficient, please ask. Animation (1-5%) : Graphics are supposed to be pretty and flashy. You’ll meet the flashiness requirement if you add at least two animations. Please note, an animated .gif file does not count as an animation for this extra credit. It doesn't matter if you made the gif yourself; the goal is to use Java functionality to draw rapid sequences of pictures. The better and more numerous your animations are, the more points you’ll get for this extra credit feature. You should favor quality over quantity. Modular Theme (5-10%) Your game must be built around one theme or era, but for an extra 10%, design your game in such a way that it can use multiple themes. A user would select this theme at the start of the game. For half credit, include and support at least one other theme. For full credit, include and support 3 themes, or include 2 and support user-made themes. The latter option requires documentation on how to make your own theme.

Helpful Links : http://www.lavamind.com/gaz.html This is the website of Gazillionaire's developers, with a demo for that game. This game influenced this project heavily and is worth checking out. That said, you should not base your game off of this model. Your grader will know. http://en.wikipedia.org/wiki/Supply_and_demand This game is based on this concept, so you should understand this stuff. The detail is way more advanced than what you'll need to worry about, but it's still good to know.