Tutorial :Tile based game theory



Question:

I'm looking for articles on tile based games, like the old ultima 6&7, or even puzzle pirates. Specifically:

  1. How they keep track of objects on the map. Objects such as other characters, or trees, or things the character can move.
  2. AI behind the characters. How the game handles character behavior for characters on the map that are off screen. Especially with very large maps and numerous characters.


Solution:1

I remember checking out Amit's Game Development page back when I wrote some games. He has a great sub-section on tiles that has most of what you want.


Solution:2

You could look through back issues of Game Developer magazine to see if something addresses what you're asking in detail.

For (1) the easiest way of dealing with a tile-based map where each tile can contain multiple objects is to just have a big multidimensional array of structs representing each tile. The struct contains a pointer to the head of a linked list representing all the objects in that tile. This is very memory efficient and lets you quickly find everything in a certain tile while also enumerating them along some other axis (eg, owner, allocation arena, etc).


Solution:3

RogueBasin is devoted to Rogue-like games (e.g. Rogue, NetHack, ). All of those games were based on a simple square grid. The site has an extensive section on developing games like that: http://roguebasin.roguelikedevelopment.org/index.php?title=Articles

You will find both suggestions and code there which could be used to build a game like you describe. After all, the only real difference between Rogue/Larn/NetHack/etc. and Diablo or the Ultima series is using simple text characters to depict the map and gameplay vs. isometric sprites.

In particular you will find information about calculating the area illuminated by a torch or lantern the user is carrying, data structures for storing maps, algorithms for automatic generation of maps, and lots of notes for how different games which have already been written chose to address these problems.


Solution:4

Check out Gamasutra. They have loads of articles for all kinds of game development.


Solution:5

The map would be an array of values. It could be divided into discrete parts. Only parts in range of the player would be loaded and the objects & npc in these parts active.

Since the old hardware had very limited memory and cpu, those games would only be able to load and process parts of the maps.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »