Question on how to proceed(Game programming, kinda long).
Hi all,
I'm fairly new to programming in C++, though I've been programming for a while in Java, and am going to begin work on a game(I'm sure you've all heard that quite often). I have a question I'm not certain how to proceed with, and could use some advice.
The game is going to be a 4x TB strategy game set in space, ala Master's of Orion. My problem is this...
I need to have a 2d map upon which I will randomly place Stars and other objects like Nebulas throughout. But I'm not sure how to create the map so that I can place these items. I need to have the method flexible enough so that stars can be placed in a way that does not appear like it's just a regular old grid with every star at the exact center of a block.
The only way I have thought of that I can do this, is by using a 2 dimensional array as the Map. Then designating that a set of 9 entries in the array constitutes another "Block on the grid", so that Items can be placed in varying portions of the "Block on the grid". I.e. the entries on the array corresponding to the numbers below would be one block.
222
111
012
Giving me a center, and "Compass" points in which to place an object, so that it doesn't appear each star is in the exact center of each "Block" it appears in.
My question is this.
Is there an easier way to define a "Grid" based map so that these items could be placed in terms of X,Y coordinates rather than placed in a 2d Array? If so, could someone give me a brief overview on how to do it? I'll also need to be able to save these coordinates to a file.
Not asking for anyone to code it for me, just give me a brief explanation on how it could be done and I'll work it out for myself, as I believe that doing is the better part of learning :)
Thank you all in advance, and thank you for putting up with what's probably the umpteenth "I'm going to make a game" question you've seen this week!