In-game editor questions

Recently I got really inspired by Ron Gilbert releasing the source of Dolores on github (https://github.com/grumpygamer/DeloresDev) and I’ve started playing with a small point and click adventure game myself, working on movement, inventory, cut scenes, walkable areas, triggers, etc.

To help with the workflow I would love to create an editor with a playable version of the game, where I can see what I’m changing and creating on the fly. Most of the data that I need can reside in a json file, but this is where I can’t get my head around how to approach this in Defold.

Where do I store these json data files? How do I structure the game so that it can go into “edit mode”?

This was also of great inspiration:

2 Likes

In-game editors are really cool and they can boost productivity and open up for community contributions and user created content.

This isn’t a Defold specific problem. Will you use the in-game editor while working on your game to create content that you then bake into the final game? Or will you provide an initial version of content when the game is released and then let players modify the content?

There are many different ways to work with files on disk or bundled with the game: https://defold.com/manuals/file-access/

That would be just for me to develop and fine tune the game. The resource will then be baked somehow into the final game and the editor stripped from the build. Are unused collections still bundled in a build?

Working now on implementing a camera so that I can switch from the ingame camera to the editor camera. On the data front I guess I’m going to have to write those json files directly in the Defold project where they are stored right?

Depends on what you mean by unused. If the collection is referenced from a proxy or factory then it will be included. If it’s a collection that has no reference from anywhere then no.

What I’d do is to have a different bootstrap collection which includes the level editor collection and the game bootstrap collection. You use this setup while developing and when releasing you use the game bootstrap collection.

Not necessarily. You can use sys.get_save_file() to get a save path in the user home directory. But you could also use sys.get_application_path() to get the path to where the exe is located.

1 Like

Yep, this is what I was thinking. Thanks!

1 Like

@britzl I’ve picked up this again because I was hitting some limitations at the time that hopefully should be easier to work around now.

I’m at a point where I think I can have most of the functionality inside the in-game editor (layout, polygon collision shapes, triggers, animation synced events, cutscenes) + my scripting framework .

Looking at your boom framework for inspiration because I want to use factories to spawn actors vs rooms vs other bits, I see you’re using a collection with go properties for resource loading essentially.

Am I right that this will load all of those resources as soon as they are referenced and the way to be a bit more mindful (load/unload) is to use a collection proxy?

Yes, currently resource properties are loaded together with the collection they are declared in. We have a feature request to give fine grained control when a resource property is loaded:

1 Like