Thursday, February 2, 2012

A Quick Q&A for the Map and Tile System

In the Ponychan thread for Spikes Quest, Sind!.noTamoDY2 wrote:
This is getting more and more epic by the update :3

But since there is a level editor, do you think there is a possibility for allowing custom graphics?
I'm looking forward to seeing what everypony makes :3

Also, I'd really like to know how the level format works, and how you set it up. Currently, for my own game, I've planned to put all the level date for each level on a separate XML file. But I'm wondering how you made it ^-^

My response:

the level editor is made entirely from scratch code in Blitz Max (everything from memory from several years of personal experience)

the level reads a .tdat file which returns the tile image file and then the data of each individual tile for that image.

and then the level reads a .prlx file which tells the game which parallax background to use (first reading back the flag that tells the game if the background is a 3D mesh, or a set of images)

After that the level (a .gmap file) reads back the map width and height (measured by screens), creates the tiles accordingly (applying the tdat tile data to each individual tile) and then the data for the tile's shading and misc in-game entities (enemies, npc's, items, etc)

If I do publish these editors alongside (or after) the final game is published, then yes, you will be able to load your own customizable tilesets. In fact, that's one of the major improvements that the new map editor has! (in the recent demos, I've kept myself limited to just the one tileset)

In order to use your own custom tiles, you would first separate the tiles into the three groups (main layer, background layer, foreground layer.) The main layer is the tile layer that Spike interacts with and it has two sublayers (background and foreground) for a more manageable effect. Once you have your tiles sorted on a simple image template you would then have to run it through the tile data editor, where you'd set each of the main layer's tile attributes (type of obstacle, surface and then the tile's sub layer)

Once you've done that, then you would have to run a prlx editor to create your own customizable parallax background (unless you just want a blank background in your level)

when your done creating both the tdat and prlx files you can then run them through the map editor where you'd build your own map. You set the map's width and height (again, measured by screens) and select your tdat file. the prlx file is selected in the main editor.

So while your in the editor you can draw out your map with all three tile layers, the parallax background, misc entities such as enemies, NPCs, items, etc and set the shade properties of each tile.

Also for things like signs and doors you would have to manually set their properties. For signs, you would have to select a dlg file which gives each sign their dialog text. and as for the doors you'd have to tell the program which map each door leads to (currently I'm debating about whether I should just stick to setting that property manually in the code)

Once finished, you simply just save the gmap file and load it into the game!

currently I have to load the gmap files through the code. But maybe eventually I'll figure out a more advance and easier way of doing it.

I have been considering making a special map editor for the community and a map player to go along with it which would enable you to make your maps and run them through the player, like a mini game where you could challenge other players to get from point a to point b on your map :)

that's all I can tell you for the moment. the rest will be revealed in future updates.

So stick around!

No comments:

Post a Comment