View Single Post
Old 05-26-2009, 08:37 PM   #1
ADHDeveloper
Junior Member

Activity Longevity
0/20 15/20
Today Posts
0/11 ssssssss2
Red face Datastructures for turn based strategy game.....

Hey Folks,

I am sorta new to development and .net and currently working on creating a turn based strategy game using Silverlight and C# as a hobby project.

So far I have a a hex map up and running, internally its an array of Hex objects, which render to the canvas as individual polygons. I have now started thinking about implementing players and units into the game and I am having some trouble figuring out what data structures to use for this.

Each game will have a hex map composed of individual hexagons (polygon object in silverlight) that serve as the game tiles. Each game will have 2 or more players that align themselves with one of the two races in game, and then have 1 or more units when they start. During the game they can capture bases and earn credits, which in turn allows them to produce more / different units.

My thinking is that I need to maintain an in memory list of all players and all the units that belong to them as well as the location of that unit (in terms of grid location so I can easily look it up in the array of hex's).

Should i maintain one master list of it all? Or just have a player object which has a list of units and the units themselves have information on their grid location? That would seem to be the logical way, but then when the player clicks a hexagon (to select his unit) I would need to some how relate that hex with the player and the particular unit on it....

I am taking this slow right now. My first step is to get some basic functionality prototyping done on the client side using silverlight before I dive into the server end of things and the multiplayer coding.

Sorry if this sounds a bit noobish, I am new to all this so go easy on me
ADHDeveloper is offline   Reply With Quote