• entries
743
1924
• views
581091

# Level editor

343 views

Haven't journalled for a bit since the game development has come to a halt while I write a map editor. It is coming along (C++ Builder project since I suck at writing Windows apps).

Only got the actual map view and block selector working so far, although that was the tricky bit. Absolute nightmare getting the scrolling and so on working but all fine now. It only draws the visible blocks so doesn't require a memory bitmap the size of the whole level or anything silly like that. I've tested on a 1000x1000 blocks level and performance is acceptable.

I'm trying to write it as generically as possible so I can use it for any future 2D tile-based games as well but while the map bit is easy to write like that, I'm scratching my head a bit to figure out how to add non-map items via this editor, since their parameters vary from game to game.

At the moment it loads its settings from a scheme.txt file, a bit like:

size 48 48block 00 "blank" rgb 0 0 0block 99 "crate" img "C:\Graphics\Crate.bmp"block 32 "blue"  img "C:\Graphics\BlueBlock.bmp"

I suppose I need to specify the attributes of the various object types in the scheme file along with the blocks, then write a sort of dynamic property editor that can allow me to set up the objects.

I know it seems a bit daft spending this long on a level editor but as I say I'm hoping that I can use the result on future projects as well. I've had a look at mappy and some other tile editors on the net but they don't seem to be quite able to provide what I need.

I really should learn Windows Forms at some point, although I still don't think you can beat Builder for quickly developing tools for personal use. C# scares me a bit.

I said the same thing when I first started with C# and I am glad I switched. It's super easy and even easier with MSC# Express Edition (which is free.)

Level editor is coming along nicely though!

How do you rate Windows Forms for click-dragging visual apps together? I love the ease of use of Builder, and I've invested a lot of years in learning to use it but I get a bit annoyed by its limitations sometimes.

Don't know if you've ever used the VCL but because it was written in Delphi and they just provide C++ headers to interface with the object code, you have some irritating restrictions. For example, you can only create VCL objects via new, not as normal instances, so you end up having to write a lot of boilerplate just to do stuff like storing components in std::vectors and so on.

I was thinking about how to keep the level editor generic and was wondering about the idea of having the editor spit out levels in an intermediate form, possibly in human-readable text format or even maybe XML, then for any given game have a command-line "compiler" that could turn this format into a binary level file. That would mean that the level files could contain information only needed by the level editor that could then be stripped out when making the level files.