Categories
Nesus

Devlog #1 – Level Editor

Hello everyone!
Here’s the first devlog of 2021. I hope to make this a biweekly thing, but I don’t know if I’ll be able to keep that up. I’ll say monthly, just to be safe. Anyway, enjoy the video!

In the beginning of 2020, my friend Nate and I went up to Yosemite for New Years – and it was on this trip that I weighed my options for Nesus. There were only really two options – to use a different game engine that could accommodate my needs for parallax and lighting, or to create a custom, in-game level editor.

I decided to create a custom, in-game level editor, because I did not want to take the time to recreate the game in a different engine. It was the perfect solution – I wouldn’t have to recompile the game every time I wanted to make a change, and I could automate everything about the creation of levels so that I wouldn’t have to do repetitive tasks that disrupt my workflow. Oh, and I could add literally anything to the editor.

UI was difficult in the beginning, but early-on I found IMGuiGML, a port of the popular Dear ImGui development UI framework, perfect for creating editors. For months I worked with more drive than I have ever had in game development – and despite being in school I managed to spend 5-8 hours daily working on the editor. (2)

First, I incorporated the basic necessities first – systems for placing tiles/objects, and a layer system of object/tile layers, with saving specifically in mind. I incorporated tile brush sizes, in addition to making it so that you can place tiles from different tilesets on the same layer. This was something you could not do in GameMaker’s native editor – it required you to use a different tile layer for different tilesets. Internally, tiles are represented by ds_grids – and there are two ds_grids per layer. One grid holds the tile index, while the other holds the tileset index. (3)

After tile/object editing was possible, I had to make it possible to “run” levels. It was not yet possible to play the levels being created. To do so, I created a system called the “editor runtime” – this system deactivates all of the helper objects of the editor (including the object placeholders) and creates all of the instances based on the locations of the placeholders. Tiles did not need to be loaded, as they were already loaded by the editor.

Now that I had the editor runtime, I had to find a way to run a level separate from the editor. As of now, the game needed the editor to run, as it stored many of the data structures and information necessary to “run” a level. I created a new system, dubbed just the “runtime”, which was a little more work, and it runs in a separate room than the editor. The runtime must wipe itself of any old level content, load the tiles, and finally load the instance data, keeping saved variables and save information in mind. I had to recreate the data structures and systems provided by the editor, but in a standalone manner. (4)

Several days later, I completed the runtime, and the foundations for the level editor were complete. Afterward, I sought to solve the issues that plagued me in the first place – first, the parallax editor. I could now adjust the values of the file in real time, and readjust the values based on what I was seeing. I then added the lighting system into the editor – allowing me to view the effects of the lighting in real time and adjust the lighting values accordingly. The work on the level editor was finally starting to pay off! (5)

Following these features, I added the instance variable editor – allowing for the setting and saving of specific instance variables, the variable channel system – allowing for triggers to “trigger” a specific channel and instance variables to listen to specific channels, and generic instance variable saving – which allowed me to specify specific variables that would always be saved in an object, in addition to remembering that object was created/destroyed during the runtime. With the recent addition of the dialogue editor, the editor has become much more powerful than I originally thought, and now I can finally start working on what matters – the content.

TLDR; watch the video! Thanks for reading and stopping by – see you in a few days!

Leave a Reply

Your email address will not be published. Required fields are marked *