Hey all,
I am hoping someone might have programmed something like this before. Basically it is the same as any rts, where the screen is only focused on one part of the map, but can be scrolled, and actions still take place offscreen. HTMS Education Links:: Shodor Activities - scroll to Box Plot, Box Plot 2, Measures, Plop It Eagle Eye Cam - Hancock Wildlife in Hornby Island, British Columbia, Canada http://htms.springdaleschools.org/links.htmlHOME |
I'm still pretty new to c++, but I am wondering if you could use an 2D array to store data for the map, and then call data from that array based on the position of the screen relative to the map?
The map I have in mind will be somewhat big, so I was hoping to create something that has no lag and doesn't hog memory/cpu time. Any ideas would be appreciated.
Thank you,
Cedwyn
Thank you for your help, that is what I had in mind. I was thinking of using a tiled array system, where a single array cell counts as a tiny tile, but wasn't sure if a huge array of many small tiles would create any processing problems :)
As for the coding, I'm thinking of making each cell in the array (if it has a unit on the tile) be a pointer to an unit object. I figure this is better for the system as I can delete pointers when a unit dies, as well as allow selecting multiple units. Ie. An array called 'selection' holds the pointer data for all units selected. The Inform Designer's Manual:: File Format: PDF/Adobe Acrobat - View as HTMLand for many games design begins with, and is periodically interrupted by,. research. If constructing geography, maps of real mountain ranges, river valleys http://www.inform-fiction.org/manual/Chapter8.pdfHOME | Transformers Movie News:: The Eagle Eye premiere red carpet event featured more than a few people involved with .. Scroll down to "Trailer 4" and press the right arrow key on your http://www.seibertron.com/news/index.php?f_cat=4&f_keyword=trailerHOME |
If anyone has anymore thoughts or ideas, please share :)
^with C++ your not going to be killing your CPU that much for simple array modifications ect. But for this type of thing I would make a multidimensional array for.
Array: [[id(type), #(relative to number onscreen), hp(health), x, y]]
Basically then when you have Type soldier attack type soldier (of the enemies multidimensional array) you can use basic math to find if they are on the screen if thats true then use simple math to simulate a bullet firing between the units sub from their hp in each array.
Note that the types would have to be defined with properties such as Total HP and damage range (x1 to x2). Game design takes a lot of time so make sure your spending more time thinking than you are coding or you will end up wasting dev time.
I hope this give a brief example and design logic to go from.
/edit, additional information.
Tiled world with free from movement. Tiles will give you a very clear estimate on hit regions and path finding while allowing for a more realistic unit movement style (remember RTS tiles are usually larger around 100x100pixels to 150x15pixels.
Scratch what i said.
Units: [[id(type), #(relative to number onscreen), hp(health), x, y]]
-Where X, Y are true pixel cords on the map.
Buildings: [[id(type), #(relative to number onscreen), hp(health), x, y]]
-Where X, Y are tile locations on the map.
This will allow tiles hit detection to be altered when a building is created above the tile or if it is destroyed. And units movements along the nodes (nodes are in the center of every passable tile.
Also if your doing the tiles as ISO (such as starcraft), then these ideas may not work.
Where was the last debate on wednesday with Mccain and Obama?
INSTANCE / WAITING FOR SPRING
|