Hello, everyone! Let’s go over the last updates and changes to Monster Embassy, shall we?
As I announced last week, during the past few days I’ve week working on porting Monster Embassy to the newest stable version of Godot Engine, Godot 3.0. I can say that I’ve been (mostly) successful: barring a couple of small issues, the game has been now completely ported to the new engine! So, starting tomorrow, I’ll be able to resume regular work on the game and keep adding new features instead of reimplementing old ones.
Regarding Godot 3.0 as a whole, I must say that, besides a couple of bugs (which are understandable, considering this is the first stable version in the 3.0 branch and it’s still very new), the engine has improved a lot since the 2.x branch. I know that most of the improvements are related to the 3D part of the engine, but even speaking from the point of view of a 2D developer, I think that porting my project has been a very good choice. The overall usability and feel of the engine is much better and some really useful functions and objects have been added to the API. It feels smoother, more polished and powerful, and it’s really comfortable to work with (custom editor font size = YES!!). I’ll be looking forward to digging more into it during the following weeks!
It’s so pretty
There’s been only three issues with the port, as far as I’ve been able to test. These are:
The screenshot system. As you may remember, I’d added a script that let you take a screenshot of the game and saved it to a png file. In the Godot 2 version of the script, you could manually set up the “ratio” of the screenshots in a config file : x1, x2, x3… however, for now I haven’t been able to reimplement this resize option in Godot 3.0, so the screenshots will be tiny (160x144 px, the game’s base resolution).
Technical explanation of the issue:
The Viewport function queue_screen_capture() no longer exists in Godot 3. Instead, data from the viewport texture must be manually retrieved by calling get_viewport().get_texture().get_data(). But there’s clearly other differences in how the data is handled, since the Godot 3 resize(width, height, interpolation) function (which was called resized() in Godot 2) no longer works as it should and outputs a blank picture. There’s probably some other step I’m missing here: once I figure it out and/or get some help, I’ll post the results.
Godot 2 (fully-working)
get_viewport().queue_screen_capture() yield(get_tree(), "idle_frame") yield(get_tree(), "idle_frame") var ratio = load_config("screenshot_ratio") var capture_resize = capture.resized(capture.get_width()*ratio,capture.get_height()*ratio,0) capture_resize.save_png("screenshot.png")
Godot 3 (outputs blank image, unless the “resize” function is disabled, in which case the screenshot saves fine)
# get data var img = get_viewport().get_texture().get_data() # wait two frames yield(get_tree(), "idle_frame") yield(get_tree(), "idle_frame") # flip img.flip_y() # get screen ratio + resize capture var ratio = load_config("screenshot_ratio") if ratio == null: ratio = 2 img.resize(img.get_width()*ratio,img.get_height()*ratio,0) # save to file img.save_png("screenshot.png")
The SMRT dialog system. As I’ve explained previously, the game’s dialog system is based on the SMRT addon by brunosxs. This addon was made for Godot 2 and so far it hasn’t been adapted to Godot 3, so there’s been a few issues that I’ve had to solve during the port. The only system I haven’t been able to fix is the “choices” system: that typical choicebox in RPGs and visual novels that lets you pick an option from a branch (“yes” vs “no”, “I’d rather go west” vs “I’d rather go east”, etc.). However, I’ve decided that, for now, this isn’t a bug bug a feature, since I should try to keep the game’s scope as small as possible and the option for branching dialogues goes in the opposite direction. I’ll probably keep branching dialogues out of the game altogether.
Technical explanation of the issue:
SMRT handles choices by creating a VButtonArray object, but VButtonArray no longer exists in Godot 3 and there’s no direct alternative to it. Instead, I guess a blank array should be created, and regular individual Button objects should be added to it.
Window resizing. Previously I had a script that automatically resized the screen to a 160x144px size if you tried to make it smaller than that, and also scaled the screen accordingly to prevent pixel distortion. However, in Godot 3 I’ve had to set the display settings of the game to “Viewport” mode, and this mode doesn’t let me control by script the size of the window. The “2D” display mode does let me resize the window, but it has some issues with pixel and tileset alignment and is graphically buggy. This might be solved in future releases of Godot, though.
As you can see, these issues are pretty minor and aren’t part of the core gameplay of the game, so I won’t worry about them too much for now. I’ll probably find a solution later on.
What I want to work on next
The same as last week + probably trying to fix the screenshot ratio issue.
Things I want to do but will leave for later
The same as last week.
- Thanks to the new is_action_just_pressed function in Godot 3, my issues with input speed have been fixed!
Known bugs to fix
- Sometimes, after entering the element/spell selection menu, you may be unable to exit it. I have found the reason for this bug but I still haven’t gotten around to fixing it.
That’s all, folks. Tune in back next week for more news! I’ll also try to post technical or more detailed info whenever possible, just in case it’s useful to other developers or somebody is interested in reading it.
Best of luck to all.