#Level editor design

1 messages · Page 1 of 1 (latest)

coarse walrus
#

Hello folks, I have been tinkering with the idea of making an in-game level editor for my game. So far most approaches I have looked at have a menu with textures representing the game objects, and then they instance these objects when the mouse is clicked using those menu tools.

My question is, why is this texture only approach used? Can I just have the actual scenes as children of the UI nodes, and then clone them when the user wants to place them in the level?
Additionally, what would be a good approach to prevent the scenes from executing their behaviour inside the level editor?

Thanks in advance

barren ingot
#

No idea why this texture only approach is used? Maybe because it's easier? Especially in engines that don't have such a flexible node system...

Anyway, as for implementing your own: you can absolutely use scenes and instance them. For example your could preload() your scenes, and whenever the user clicks somewhere you do instance() and set the position to the mouse position.

As for preventing the added scenes from running I see two options. Either have the whole application paused, and only set the custom level editing stuff to always process. Or have a globally accessible object (for example an Autoload) that has a flag for "level editing active". That way any object can check by itself if it should do something or if it shouldn't.

Also make sure to read up on the owner property. If you later want to save the level then it will come in handy. If all added objects have the level node as their owner, then you can simply save that level node using the built in resources saver. It will save all child nodes that have it set as owner too.

coarse walrus
#

Yeah the texture approach is weird for me when it could just be the actual scenes! But the weird thing is that I have seen godot tutorials that do this, not other engine's ones. It's actually really cool when you want to generate the level from an image, but I want an actual in game editor.

I will try both approaches when it comes to preventing the scenes from running. I'm not a fan of global state, but I can see a case for autoloads in this context.

Thank you!

barren ingot