← Back to team overview

logame team mailing list archive

Re: New Level loading and Tiling engine

 

Hi, sorry for the delay.

2009/9/17 Paul Elms <paul@xxxxxxxxxxxxxx>

> Hi all,
> I have recently committed large changes to the way levels are loaded and
> introduced a tile engine which draws tiles to the background, so I
> thought I had better explain how it works.
>
> The information for each level is taken from two files; a single game
> wide tiles.yaml file that lists each type of tile's characteristics and
> its image file, and a specific level.yaml file.  All tiles used in the
> game must be listed in tiles.yaml so the game knows about them.  At
>

What about a tile.yaml per level? So we could create different themes (per
level), say one level takes place outside in the winter, one in a cellar. In
each case it would be good to have different tile sets.


> present there are only 3 test tiles (red,green and blue).  Each tile has
> a .png image which needs to be in media/images/tiles/ and can be any
> size.  Each tile also has some characteristics listed in tiles.yaml,
> such as whether it is solid (can be walked on, but not through) or not
> (background decoration tiles or things like water) and if it is safe or
> deadly (like water or spikes).  If anyone has any more ideas for other
> characteristics, please shout:)
>

That's a good idea, so they could be also be animated. I first thought of a
having all tiles in one file, your attempt is much better. :-)


> Collision detection between the tiles and player_1 is detected, but I
> still need to write the code that will use it together with the tile's
> characteristics, to act on the player.
>
We got to think of a good way to introduce gravity, so that the player is
falling when he's not walking on solid ground.

>
> The level.yaml file (only testlevel.yaml at present) holds all data
> about a level, its name, the path to the background image, the tile
> types used in the level with their positions on the background image,
> and the enemies and collectable types, positions and other data.  This
> file is hand editable, but listing the locations of all tiles, enemies
> and collectables by hand would be nearly impossible for a complex level,
> so my next task is to write a level editor that will create/modify
> level.yaml files.
>

Yes, maybe we could also generate the enemies/collectables randomly,
depending on some settings.

I will also add some more documentation to these files so they can be
> more easily understood.
>
> A new Tiler class handles all the loading of the tile data and the
> creation of Tile instances.  The images of each tile are then blitted
> onto the background surface once only, during the creation of the level.
>
:-) I really like the class' name.


> Any comments, bugs etc.. :)
>
> Paul
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~logame<https://launchpad.net/%7Elogame>
> Post to     : logame@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~logame<https://launchpad.net/%7Elogame>
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References