Archived

This topic is now archived and is closed to further replies.

Programming map

This topic is 6033 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m new to game programming and I have current mission to code a map section for our little project which is kind of a strategy game. You should be able to move units in this map view among other things..So I''m left out with nothing, I have no idea where to begin. Pleeze, gimme some basic help about programming a map into a game! Thanks in advance!

Share this post


Link to post
Share on other sites
You need an internal representation of the map in memory defined as some data structure. If the map is dense like a chessboard, then it should be defined as a 2 dimensional array. If the map is a set of connected rooms or some other more abstract concept, then you likely need a set of nodes with pointers from each node to the connected areas.

You then need a function which can draw this map given its data description. And you also need some function which can take a poition on the drawn map (a screen cooridnate) and translate that back to whatever location on the map that screen cooridnate represents.

Once you have translated the screen cooridnates to positions on the map in the map data structure, you need a function which determines if going from A to B is possible given the constraints of the game. These could be related to distance, obstructions, enemy units, etc.

Share this post


Link to post
Share on other sites