Project
Computer Game: "Colony"


The purpose of this project is to create a fairly simple strategy game in Visual Basic.

The premise is that you are managing an asteroid colony, whose only export is the Iridium ore mined from the asteroid. Every year you get a status report and may sell your ore, spend money on food for your people, or buy or sell Iridium mines. The goal of the game is to survive as administrator until the 10th year, with as much money as possible.

The following should be displayed somewhere on the window:

There should be four text boxes on the window, one for the number of mines to sell, another for the number of mines to buy, another for the amount of money to spend on food, and another for the amount of ore to sell.

At the bottom of the window should be two (command) buttons, one that should advance to the next year, and another that quits the game.

There should be a File drop-down menu, with only one item: Exit.

The initial values of the various variables in the game should be as follows:

A low tax rate is 0.1, a medium tax rate is 0.2, and a high tax rate is 0.3.

On each new turn, the following (listed in pseudocode) should be calculated:

Add "Tax Rate" times "Population" to "Amount of money in bank"
Subtract "Amount of Iridium to sell" from "Iridium in storage"
Add "Amount of Iridium to sell" times "Price of Iridium" to "Amount of money in bank"
Subtract "Number of mines to sell" from "Number of mines"
Add "Number of mines to sell" times "Price of a mine" to "Amount of money in bank"
Add "Number of mines to buy" to "Number of mines"
Subtract "Number of mines to buy" times "Price of a mine" from "Amount of money in bank"
Subtract "Money to spend on food" from "Amount of money in bank"

IF "Money to spend on food" divided by "Number of people" is greater than 12,
  Add 0.1 to "Satisfaction factor"
ELSEIF "Money to spend on food" divided by "Number of people" is less than 8,
  Subtract 0.2 from "Satisfaction factor"
END IF

IF "Satisfaction factor" is less than 0.6,
  Tell the player that the colonists revolted
  End the game
ELSEIF "Satisfaction factor" is greater than 1.1,
  Add a random number between 1 and 20 to "Amount of Iridium produced per mine"
  Add between 1 and 10 people to "Population"
ELSEIF "Satisfaction factor" is less than 0.9,
  Subtract a random number between 1 and 20 from "Amount of Iridium produced per mine"
  Subtract between 1 and 10 people from "Population"
END IF

IF "Population" divided by "Number of mines" is less than 10,
  Tell the player that everyone's overworked
  End the game
ELSEIF "Population" is less than 30,
  Tell the player that there's not enough colonists left
  End the game
END IF

IF "Current year" is 10,
  Congratulate the player
  End the game
END IF

Extra Improvements:

  1. Add two more tax rates: Very High (0.35) and Very Low (0.05).
  2. During the Next Year calculations: If the tax rate is High or Very High, subtract 0.5 from the satisfaction factor. If the tax rate is Low or Very Low, add 0.5 to the satisfaction factor.
  3. Add a button to Restart the game.
  4. If the game is over (either you win or you lose), rather than ending the game, disable the "Next Year" button (Enabled = False), forcing the user to either Quit or Restart. If the user selects Restart, re-enable the Next Year button (Enabled = True).
  5. Include another label on the form, which displays a text message to the user, describing the current satisfaction factor (e.g. "The colonists are satisfied", "The colonists are unhappy with you"...). Use ranges (for each message, test to see if the satisfaction factor is between two values, rather than testing to see if it equals a value). Note that 0.6 is the lowest possible satisfaction factor.
  6. Make the number of years in the game (currently 10) a random value between 10 and 15, set at the beginning of the game.
  7. Add a plague with a 0.2 chance of occurring, which wipes out 1/3 of the population (population = 2 / 3 * population).
  8. Let the user allocate money for research on each turn (another TextBox, like the Money For Food). When 2,000 credits have been allocated in total (over many turns, possibly), the amount of Iridium produced per mine should increase by 10 tons, and research must start over again (another 2,000 credits for another 10 tons).

The Intro to Visual Basic homepage is hosted by GeoCities