How big can a game board be? I have currently two limiting factors:
- Memory. I crash my iTouch with a Board bigger than 750×750
- Loading/Generation Time. Currently, with a 750×750 Board, this takes seconds.
Surely we can make a much larger board. It all depends how we store the data. For now I use a flat 2 dimensional array, with each cell including the following information:
- terrain (NSString*)
- prop (NSString*)
- solid state (BOOL, prevents player & NPCs from occupying a cell)
- height (float, allows offsetting tiles and props vertically)
Since each cell is also an object, I use 4*3+1+4 = 17 bytes per cell (assuming an atomic ‘BOOL’ actually occupies a single byte and counting the cell object reference). I could:
- encode terrain and prop as byte values (2)
- encode height as a short (2)
- use C arrays (I’ll probably need to do this anyway to reduce the time spent allocating memory for the board), saving the cost of a cell object reference
- Do away with the solid state (that could be implicit to terrain)
The resulting allocation would be 4 bytes per cell, for times less than the current allocation. Let’s not sweat it, that’s just a board twice as large.
I consider that a ‘board size’ factor between 5 and 100 will potentially impact design opportunities – in other words, the board has to be vastly wider to change the way I think about my design.
RLE compressing terrains and storing props as a list (versus allocating space for a single prop within each cell) may be much more effective in some cases. It’s worth noting that both methods somehow imply reduced variety in the game board. If larger means emptier, is it really worth it?
Let’s keep in mind that, to create a massive game board, we need either to slice it (can’t hold a complete board into memory) or… …approach the problem in a quite different way.
What’s in it for a game?
The speed of my player character was originally 5 pix / frame. I’m not sure about the frame rate – just OK actually. At 5 pix per frame with 32×16 tiles, it takes 15 seconds to cross a 25×25 board. That’s a really small board. I’d like a board big enough for exploring. Granted a game isn’t all about hanging around and visiting places.
A 500×500 board is 20 times wider, So it takes a round 20×15 = 300 seconds to cross it. Just about 5 minutes. But I feel 5pix/frame is too stately, so make it 8 pix per frame. Now we can cross the board in about 3 minutes.
OK then, going ‘around the world’ is one thing. How long would it take to explore all of the board’s corners? 9 minutes? I don’t think so. If we do it ‘screen by screen’, With 30 tiles on the height of a single screen, we have 50/3 ~ 15 rows to check, making about 15×3 = 45 minutes.
Ideally, I’d like to have a much larger board. But for now, I’ll worry more about how I populate the board, and less about how big it can be.