Monday, September 12, 2011

Anyways...

So I've spent a ton of time playing games instead of making any. I played inFamous, the new Mortal Kombat, Deus Ex: Human Revolution and more. Lots of fun. But I started doing some coding at work for a project and I got the bug.

The coding bug.

I got the urge to start coding more and more, so I did some work on Rustbot. I didn't work on the actual game itself, but rather I worked on some tech that I can apply to it.

I wanted to have the level/map/land load dynamically as the player moves around, so that the entire world is not loaded all at once. So I wrote a program to take a giant 4096x4096 pixel heightmap and split it into 4096 64x64 pixel heightmap tiles. Then I created a new project wherein it only loads/displays the tile the player is in and the adjacent ones.

Figure 1 - The bright green tile contains the player (white dot) and the dark green are the adjacent tiles.

Figure 1 above displays what I mean. So, when the player (the white dot) moves from one tile to another, it needs to ditch the tiles that were adjacent (but aren't anymore) and load the tiles that are.
Figure 2 - Player has moved right by one tile
So the left three light green tiles need to be ditched from memory and the right three tiles need to be loaded in. Currently, the program doesn't do that (because I hit bedtime) but instead just ditches all nine tiles and loads the new ones in. It's not as efficient but it doesn't slow anything down right now. That will presumably change with all other game-type calculations that need to occur (physics and whatnot). As a matter of fact, I have the current grid at a 5x5 (i.e. it loads adjacent tiles two-deep instead of just one) and even that doesn't slow down the framerate with a full reload of all 25 tiles.

This is how we avoid load screens and annoying waits between levels. After this, I'll see about re-writing the object classes and get Rustbot off the ground again.

Speaking of... just how much sense, given what's been established gameplay, does the name "Rustbot" make?

No comments:

Post a Comment