Best practice for designing a risk-style board game
- by jyanks
I'm just trying to figure out how to set up the code for a game like risk...
I would like it to be extensible, so that I can have multiple maps (ie- World, North America, Eurasia, Africa) so hardcoding in the map doesn't seem to make a whole lot of sense
I'm a bit confused on how/where items should be stored/accessed.
Here are the objects I see the game theoretically using:
-Countries/Territories
-Cities (Can be contained within territories)
-Capitols
-Connections
-Continents
-Map
-Troops
At the moment, I feel like:
-A map should have a list of continents and countries. The continents would be more of a 'logical' thing where the continents would just be lists of countries that are checked for bonuses at the start of turns
-Countries should have a list of countries that they're connected to for the connections
What I can't figure out is: Where do I store the troops? Do I have an object for every single troop or do I just store the number of troops on a country object as an integer?
What about capitols and cities? Do those just have a reference to the country they reside in?
Is there anything I'm not seeing here that's going to screw me over in the long run with the way that I'm thinking about things now?
Any advice would be appreciated.