Something that I have been giving some thought to lately is a detailed level editor. In the past I have deliberately crafted games that offer the same structure but with only slight variances.
In Invaders from Mars the aliens offered slightly different patterns, for example. In Hoth Strike the number of rebel soldiers increased. Essentially the core game mechanics remained the same. That is, the puzzles didn’t vary in style or complexity.
But I want to move beyond that. I want to offer games that have been designed with a more immersive level of play. The only way to achieve this is to create a tool that allows me to position obstacles, challenges, rewards, monsters and power-ups. Furthermore I want to be able to literally paint the screen with decorations (platforms, walls, tiles) independently of the game’s consideration for what should and shouldn’t be a collision.
So I’ve been putting together some ideas based on applying layers to my games.
Here’s how it works.
Since I am working on a Gauntlet style top-down game just now I figured it best to illustrate my thoughts with that style in mind. As you can see in the illustration above the level starts out with a simple floor covering. This is a general carpet effect most probably achieved using the CSS backgroundImage style set to repeat; In my editor I select the floor tile to paint the scene with.
Then I move up a layer to the decoration. I intend to work with a minimum of 16 x 16 scaled tiles here.
When the two layers are combined you can see that I get a satisfactory amount of detail. The game code will handle any scrolling through the viewing window where the level is larger than the canvas dimensions and literally stitch the two levels together.
The final part of the puzzle is the collision layer. Here I need to instruct the game code where in the level cannot be crossed. Walls, doors, tables etc all need to be “painted” with the collision mask.
Something like this
The red area forms the collision area.
Additional attributes in the level editor will inform the game code just how to handle collision with the region.
For example I may wish to make a wall electric or red hot. I can assign a pain value to the wall.
In the game I will be returned something like this
col.damage = 10;
Either way I have some information to work with in the game code.
Future developments may see additional detail such as ambient sound effects or spawn effects.
Of course I need to consider such things as output format such that the level data can actually be used. I’m pretty sure that JSON formatted text files are the way to do it.
All just thoughts at the moment. As a rule I enjoy writing web based tools more than most projects so I’m going to enjoy this. Half the battle is knowing when to stop ! :-)
Interested in feedback from anyone with similar experience.