often in game development, i read that one has to consider drawing a map.from what i have searched and read over the internet i gather that a game map is an array where the player is expected to move.(the developer already controls where the player moves with an array?)
i know what arrays are but what is map doing in an array?
i have read outsideofsociety.com tutorials on this subject but i still don’t get the point- why does one really need a map? aarggh. what is a map? and why do i need it in my game?
URL’s to sites which explain why one needs a game map VERY CLEARLY to a newbie game developer will very much be appreciated.
there are several ways of using arrays to map a game, its all down to what the developer decides will work best for that game.
my experience of this is in a tile based platform game I (part) made. If you have a look in the development section of the games on my site (click my footer) you’ll see my platformer level editor. This is a tile based level editor, the best way of understanding how a tile based game works is to look at the my example. Basically the platforms in a level are all made up of tiles 15 by 15 pixels big and you place these tiles onto a grid to design the level. This is where the array map comes in…
rather than doing a hitTest for every single tile in the level which would take up an enormous amount of cpu time the position of each tile is mapped to a 2 dimensional array (so the first square of the grid would be array element (0, 0), 3 squares along and 1 square of the grid down would be array element (3, 1) etc.). Placing a tile on a square of the grid sets the corresponding array elemnt to true.
Then when it comes to doing collision detection for your character all you need do is work out which square of the grid he is currently in and check the value of the corresponding array element. Collision detection without the cpu intensive hitTest command.
ok, depending on the game, you’re gonna need some sort of environment to play on. that’s what maps are for. they provide players a place to roam about and do whatever.
Basically, in a lot of games there would be spots that have some kind of an object on them and you can’t access that certain spot… or you might be using a path-finding algorithm for a tile-based world with different terrians… you would store data about tiles in an array (the map), and then use it when your character move or when you’re finding the path between two spots