Programming map
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!
- Just another sad bastard
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.
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.
_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in Think Harmony With Horses
ALU - SHRDLU - WORDNET - CYC - SWALE - AM - CD - J.M. - K.S. | CAA - BCHA - AQHA - APHA - R.H. - T.D. | 395 - SPS - GORDIE - SCMA - R.M. - G.R. - V.C. - C.F.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement