Help making a traditional Roguelike editor?

Godot Version

Godot 4.4

Question

I was curious about approaching a concept more than anything. I’m making a level editor with scriptable objects similar to something like gdevelop or bitsy -

my question is what would be some of the best ways to approach giving actions to an object such as inputs, movement, ai behavior and then when saved through the editor what’s the best way to save and output those as grabbable ui to throw into a level?

How can I make “scriptable objects”? With something like graph nodes?

How can I get those as tiles or entities to place into a level?

And does anyone maybe have any resources on a project like this that I can learn from?

Hi!

Complex question, as there’s no right answer here. The right answer would be the one that suits your needs and skills, and depending on the kind of games and its mechanics, it may differ a lot.

How can I make “scriptable objects”?

In Godot, the equivalent of Unity’s ScriptableObjects (I believe that’s what you’re talking about) would be Resources. Here’s the link to the official documentation on how to create your own resources.

You could also store your game data into text files such as Json/XML/YAML files. Every way of storing data has its cons and pros, I’m not digging too deep into that as it’s not the main subject here, just know that those things exist (as in Unity, where ScriptableObjects are not the only way to go).

How can I get those as tiles or entities to place into a level?

Say you’re using Resources; that would mean that somewhere in your project, you have folders and files dedicated to the storage of all your level editor entities.
Knowing the folders paths, what you could do is loading all of the files dynamically on the level editor startup, so that when you create a new resource (tile, enemy, whatever), it’s automatically handled. It may sound like an expensive way of loading things, but for a level editor, I don’t think it matters that much to have some lag on start.

So for instance, if you have a folder res/level_editor/tiles, containing tiles, you could in your script load all the files from that folder (I’ll let you explore how to do that), so you’ll have a list of tiles, that you can then send to some interface.
A basic idea would be to have a menu with a scroll container, in which you instantiate a line for every tile; that way, you’ll now be able to scroll through all the tiles, and when one is clicked/selected, it can be painted onto the level, etc. depending on what you need.

If you’re looking to work on a level editor because you have the time and want to learn how it’s done or you like the technical challenge, go on. However, if you’re in need of a classic roguelike editor to build an actual game, I’d suggest you have a look at existing editors, such as LDTK. I don’t know how this one would fit your needs, but it’s always a good idea to make further enquiries on existing tools.

Hope that helps a bit!

1 Like

This is exactly what I was curious about with storing the information and being able to take it out and use it correctly this at least gives me some direction! I’m looking to do this just to learn and maybe make something for other people to use as a fun tool but mostly to learn how something like this works I really appreciate it :raised_hands: