Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to understand cellbased maps and how they work, i have googled alot but can't seem to find any explanation for it.

With cell based maps i mean the ones where you do height and everything like walls roof floor in each cell. If possible i would appreciate an explanation from a Javascript perspective, but only a theoretical explanation can do.

So why do we use them? how do they work? Is it just like a normal array with more information?

share|improve this question
Sorry, the internet is a bit dry on the topic, but if you could tell me exactly what a cell based map is I'll tell you how it works, why and how to use it etc. – aaaaaaaaaaaa Mar 4 '12 at 17:04
It wouldn't be just a fancy word for completely plain and ordinary array maps? – aaaaaaaaaaaa Mar 4 '12 at 17:11
Actually, why do you ask? It's just a fancy word after all, it doesn't even matter whether the maps you make fit the description or not, as long as they do the job you want them to. – aaaaaaaaaaaa Mar 4 '12 at 17:15
The cellbased maps as i understand so far is where each "node" is a cell with information about everyting in/on that node such as walls, floor, roof, and items. Seems to be the way to do tilebased maps, but i can't find any good documentation about it. No matter how i formulate the query on google. – justanotherhobbyist Mar 4 '12 at 17:42
Well, just look up tile maps, no reason getting worked up about this specific word. – aaaaaaaaaaaa Mar 4 '12 at 17:55
up vote 6 down vote accepted

Most commonly tile based games mix two types of data to make the game world.

  1. A tile grid with information that every tile needs to have like texturing, accessibility, height, two of the four adjacent possible walls and depending on the game perhaps some other stuff.

  2. All the stuff that can move, or is complex to represent. This is usually made as individual objects containing all their own properties, including position coordinates. You store these objects on one or multiple lists. Often it will be advantageous to have links from the tiles to the objects occupying it.

A small sketch:

        grid[a][b]={} //one object for every tile, stuff in all the info you need
misc=[] //list of case 2 objects
grid[character.x][character.y].occupant=character //backwards reference
share|improve this answer
Nice just what i was looking for. – justanotherhobbyist Mar 4 '12 at 21:10
Remember to mark it as 'answered' – Aralox Mar 5 '12 at 11:00
And do remember, it's just one of many possible setups, needs vary from game to game, it won't fit everything. – aaaaaaaaaaaa Mar 5 '12 at 14:21
Yeah but its a good enough start. :) thx – justanotherhobbyist Mar 5 '12 at 20:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.