World Editor

Blitz3D Forums/Blitz3D Beginners Area/World Editor

stayne(Posted 2006) [#1]
I've started work on my world editor, thanks to the wonderful WinBlitz3D lib. A few questions...

At the moment I am loading meshes, placing/moving/scaling/etc them, iterating through the Types to gather up entity placement data for the engine to load and finally exporting the data to a .txt file. Everything is working fine - but I haven't reached the "save/load" functions yet. What's the best way to do this? Just load up the .txt file like the engine does? I know it seems logical but I want to get it right. I suppose saving the current state of all the sliders, checkboxes, etc should be just importing the numbers and setting the gadgets accordingly?

Undo/Redo. *shiver*. We'll leave that one alone for now :).

Final question. If my editor is separate from the game engine, what's the best way to launch the engine from the editor? Is it a good idea to pause the editor during game execution, or just ExecFile() and leave it running?


b32(Posted 2006) [#2]
I think pausing would be best. If you want to use text files, it is a good idea to work with them during the entire process.
However, using ReadInt/WriteInt/ReadFloat/WriteFloat is faster and uses less space than writing strings.
In my editor, I made the undo/redo functions by saving each modification on the design with the same routine I used for (common) saving. It was fast enough.
And yes, store the slider values as integer/floats in the file, I suppose. Read them and set the gadgets like you said.


Danny(Posted 2006) [#3]
Hi Markd,

It sounds like you want to store the values of gadgets(sliders, checkboxes, etc). This doesn't sound very logical to me. Your engine (stand alone) should be able to read your games or 'levels'. So your editor should use your engine's functions to load/save game data. When you have that game data in memory (nicely stored in Types) then you can simply fill any gadgets to be able to edit that data. So you don't ever need to create a seperate 'editor fileformat' or 'save all your gadget values'..

I'm using wb3d as well, and typically I have 3 functions to handle any editors or windows. If I have 'winAnim' as an example, a window to edit some animation, I'd have something like this:

winAnim_build() = builds the gui & initialises static values (this is called only ONCE when the editor starts)
winAnim_show(entity.type) = fills the window's gadget with values from the game entity (stored in the type)
winAnim_update() = checks the gadgets events (buttons pushed, editboxes altered, etc) and alters the values in the game entity's type - with instand real-time results! ;)

I can imagine the undo/redo makes you shiver (makes me vomit!;) - but do realise if you don't do it from the start, chances are you won't be able to simply 'implement' it later - ie. not without starting from scratch ;)

Important is that you keep ALL your editor related functions (and globals and types, etc) SEPERATE from your engine! I stick everything in seperate include files. This way I can 'start my game' from a standalone engine (without editor) AND run my game INSIDE my editor WHILST i'm editing values! Winblitz3D totally ROCKS to do stuff like this!

Hope this helps, good luck!

D.