Bitmapfill based tile scrolling

This post shows a more elaborate prototype of a bitmap fill based tile scrolling approach in ActionScript 3 using Tiled and the parser from Pixelpracht to parse the maps. The graphics are from the original Gods game on this page.

Some features demoed:

  • bitmapfill based fluid scrolling without a backing store (saves a lot of time)
  • parallax scrolling with a single tile layer (so the background parallax is only rendered at the spots it has to show)
  • fluid performance on fullscreen / iOs
  • the fact that it’s bitmap fills makes it easy to transform the mesh being painted, meaning that environment transformations (eg blastwaves with rolling ground stones) are fairly easy to implement without the CPU overhead that a displacementmap for example would incur.
  • nice character effects such as flames/ices for powerups

Read more

Hexagon tile grids

A small demo of how you interact with a tilebased grid. Documented source code included and the math behind it is fairly basic. Basically it builds a grid from code, rotates for 5 seconds every 5 seconds and highlights the tile your mouse is over. I couldn’t find a good example online so here it is.

Read more

BSP Dungeon generation

Just a short post to demo a map generation mechanism. Full source included, but no absolutely no support. Feel free to play around with it. The dungeon generator is very crude, I put it together in a couple of hours yesterday, and it has no concept of walls, walkable tiles etc, just pointers to graphic tiles.

Basically what it does is:

  • takes a large rectangle
  • randomly divide it horizontally / vertically
  • keep doing this until each room left is considered small enough
  • convert each room (a rectangle) into a 1 d array containing all rooms, rooms are converted by entering codes for the room into the array, such as TL (top left corner), T (top row), TR (top right etc).
  • now that all the rooms are in the array we process each room, by giving it a door in a random location connecting it to another room (on some occassions we have a secret/magic unconnected room)
  • finally the tile independent map is converted to a specific tileset. We put one together using the LostGarden indoor tileset again, which we manipulated into several large building blocks to make generating rooms much easier 😉

Basically that is all there is to it, on my pc it generates about 20000+ rooms in a second, on the iPad it takes a bit longer, but still manages a nice 50-60 fps without Starling (then again this is still very simple and basic without any interactivity).

Read more