Level editor

posted in BitHack
Published September 24, 2019
Advertisement

Since I'm making a ray-casting engine, the world is represented as a large 2d array of cells (values).  There are six such arrays, each containing a different cell attribute, for instance, floor height, ceiling height, floor texture, light value, etc.  Up to this point I have been loading these arrays at level start, from a bunch of bitmaps, created in Aseprite, a pixel drawing program.  Each bitmap would provide one attribute, and the pixels would be greyscale, giving each cell 8bits of information.

This seemed fine at first, but designing a level quickly became a nightmare when you had to juggle 6 bitmap files, update the correct one, and make sure no pixels were misaligned between them.  Below are some of the bitmaps for the example level previously shown:

e1m1_floor.png.e16b891a410cc81a9501aa3b4ff70a94.pnge1m1_ceil.png.ead12dce4d6f4d7871f81186513d2081.pnge1m1_light.png.5b69b659b8bfc97b776a208922ba855c.png

Shown above are the floor height, ceiling height, and light-map in that order.  Not shown are the three other bitmaps, the texture maps for floors, walls and ceilings.
You can start to see how hairy it gets quickly for even a simple level.

To solve this I've been working on a disgustingly bad level editor, which should help me to iterate more quickly on levels when I get to that stage.

editor1.png.61c78f23f6acd10cd2ec109b1128add4.pngeditor2.png.e92ca1d601c792cc82ce4e7fcfe99554.png

It may not look like much but its already a ton faster for making basic levels then using Aseprite.  Above you can see the floor height being edited, with a height selector shown on the side.
To the right is the texture editing mode where a texture can be selected from the right, and drawn onto the level where needed.

Still left to do is adding a way to place entities into the level, which will be addressed at some stage.

 

Previous Entry Weapon Sprites Integrated
Next Entry Hit Scanning!
3 likes 1 comments

Comments

cpfr

I exactly know how you feel. I did the same for my dungeon crawler challenge game "The Fire of Ardor". After days of hex-editing multiple level files, I decided to implement an editor for the raycaster levels. Although my raycaster doesn't have different wall heights, I needed different information about block shapes and wall textures.

Because I allow different textures for different sides of a block, I decided to use the game itself as an editor (i.e. painting the textures on the rendered walls instead of painting on a top-down map).

Long story short; Good job! I'm excited to see the end result.

September 25, 2019 05:50 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Hit Scanning!

2893 views

Level editor

2835 views

Skybox implemented

6825 views

Player weapon

2094 views

Sprite Lighting

1863 views

Arrival on Mars

1836 views
Advertisement