Game thing progress #8, actually mostly about editor stuff

Hello, Hello, all two (three?) of you reading. It's good to see you again. Once again it has been some time since the last post.

Many things have happened, mostly me also helping out on some other game, which also takes time (actually, I will get paid for it when I sort out paypal stuff so I'm not just wasting time, hopefully). But really, who cares about that, right?

You're probably here to read the progress on THE game, not some other game. It's been pretty slow. The current part will have more walking-mode content than all the previous ones together, and drawing and programming that stuff takes a lot of time, although I haven't touched it in a.. while. Mostly have been procrastinating or doing something else, after drawing three rooms and implementing two.

Since the release, I've implemented modding for the terminal-mode of the game. Mods can basically do everything normal lines can, but are loaded from the instance menu (you'll have to play the game if you want to know where the menu is). I've written an elaborate instruction on how to make them here, although this will only be relevant whenever the next release comes out. Nevertheless, I think it came out pretty well. When mods are loaded, they are provided a separate line environment than can only access its own lines and can't touch the main-story lines or other mods' lines. Mods can also load scripts, these are not vetted like the lines are, as I couldn't figure out a good way to do so. However, they're always available in namespace mod.<script name here>, that mod is literal, so you don't have to know the name of the mod. In general, the name of the mod never needs to be used in the API, so it's only for the players. When organized as such, mods can't interfere with each other.

For terminal mode, more smooth scrolling was implemented, which, unlike previously, actually looks pretty good and is better on the eyes than the text just jumping. Here's how it looks:

Some other improvements have been have been made to the room loading stuff, such as making passages fallback to previous days room files if one wasn't find in the current day, so rooms don't need to be repeated if they don't change. As part of work on the next day's walking part, touch-activated interactables were added, both always-working and one-time working (based on the activatable callback). These are used for main character commentary on some things, for example, and room transitions in some places.

A fade-in/out has been implemented and used whenever logically needed, like in transitioning from terminal to walking and transitions between rooms. It looks pretty good, and makes the player unable to walk in walking-mode while transitioning.

A way for coroutines to wait on something has been added, by making coroutines return special values from yield (in a way, this is similiar to how Unity Engine does it). This also has been used for providing coroutines with delta time. Previously it was wrongly passed as an argument, now when the coroutine resumes yield returns delta time for it.

A generic look-closer-at-thing system has been implemented, as there are now several things to look at that only show picture and text.

And now.. for the actually intersting part: editing TOML assets while in-game. For this, the pretty bad lua TOML parser has been replaced with a better C++ one and passed to lua. Additionally, all information on the position of the TOML node is saved, in C++ the whole parsed TOML file is saved for later, and for lua only the file and the path to the node is passed. When a component wants to have things saved, it provides a file and a path to the node and the toml-node-in-file is looked up and replaced.

A read-only editors are implemented for Transformable and Name, and for Collider an editor that actually does things is implemented (it also updates transformable in TOML source when needed).

As of now, new components can't be added, and neither can new entities, but the existing components can be edited. This includes checks for defaults, which are not written to the file if they are not overriden in the editor. Otherwise, if the default value is changed the key-value pair will be added to the TOML code.

The serialization-back system itself is implemented by finding the relevant place in the TOML file and replacing just this place with manual string manipulation on the C++ side. This is done so as to save the formatting and such of the original file, as it seems that no TOML libraries are able to do so and always re-format and re-arrange the file (very rude of them). As such, a system to only modify the data in relevant parts was made.

As for prefabs, currently editing anything using non-overriden prefab value will modify the prefab itself. This will probably have to be changed in the future somehow.

The editing will hopefully be expanded in the future and help with making new rooms, as it becomes quite tideous to maintain by hand. The hardest parts may be adding new entities and components, in particular figuring out where to put them in the file. Hopefully, I'll be able to work on that.

Here's how all of that looks:

Shown is the Collider editor. Currently editor clicks are only recognized for objects with colliders, other objects will probably have to somehow be made available otherwise as there isn't really an easy way of finding them in the world, although I do have some ideas for the future. Otherwise, objects with colliders can be dragged with mouse with CTRL+Click and clicking on an object selects it for editing, while double-clicking anywhere where there is no object deselects it.

Also, after my friend played the game (someone actually played it, crazy, huh?), he found out that it may so happen that non-english layout broke the game sometimes. That is because lua has string.char and utf8.char and the first one can't handle anything that is not ASCII. So I've replaced all mentions of string.char with utf8.char to hopefully fix the problem. That same friend found some typos and suggested changing the "description" color in the terminal part, as it didn't look well on black background and was hard-ish to read. So now the color is a bit more soft, as you may have noticed in the first video in the post. Another thing he noticed is an inconsistency where you didn't see something but it was mentioned later, that was fixed too, with the new text not mentioning the thing if you haven't seen it.

That was quite a lot of text now, wasn't it? Two videos, too! That's a record. I'm going back to making the editors better for now, probably. This seems to be promising. And also helping with that other game I mentioned. Happy new year, and thank you for reading my blog post!

Comments