This post is the latest in a series that covers our migration from Godot 3 to Godot 4.
Last time, we converted our Tile Sets through a big export/import script. Let’s try the same thing for Tile Maps:
This tool is designed so you can just press a button and the listed Tile Map will be imported based on the json file. If you’re wondering how this works behind the scenes, the process is similar to the one described in the last blog post: we load and edit Godot resources directly in Godot, then persist our changes to disk.
How well does it work in practice? Well, here’s what we started with:
Yikes. Nearly every tile layer has some problem with it. Some have the wrong tiles, and some are even at the wrong (x,y) position. After improving the logic a bit, here’s the next iteration of the script:
It’s much better –you can see more of the brown dirt, as well as the “sandy creek bed” (under the water) and more of the dark border of the room. But many tiles are still just plain wrong. Here are some specific problems that we needed to fix:
● The brown “dirt” tiles that are missing (i.e., the one directly above the Player) had inconsistent Tile Sizes: both 64×64 and 48×48 were listed! Godot 3 is more lenient here, which is why it appeared to work before.
● Some tiles were not listed in the right place because of a bug whereby (0,0) is not saved properly for a Tile Map’s position… which only matters if its “template” is saved to a different position (say, (144, 255)).
● Sometimes the “template” Tile Set is not updated in the Tile Map that uses it. In that case, we created a complicated “duplicate properties” function in our import script that fixes this.
Well, let’s see how the final product looks:
That’s just about perfect. It’s worth keeping in mind, however, that the three problems we just listed must all be fixed manually. This only takes a few minutes, though, so the script is still saving us dozens of hours.
Well, now that we’ve got this looking good, we’re ready to walk around this map in-game, right?
There’s still a ton of script-related work to do. Godot 4 is so different from Godot 3 under the hood that it’s almost better to think of it as an entirely new engine, rather than a tiny upgrade.
In fact, the work we just described is only about 60% of the work required to get these screenshots. Just trying to load a simple scene like the Title Screen would cause Godot 4 to spit out dozens to hundreds of warnings and errors. We’ve fixed a great deal of these, but there are many more. And once those are fixed, we’ll still have “logical errors” –things that don’t crash the game but cause it to behave in a way that’s not what we want Last Dream 2 to look like. And all of these errors are new in Godot 4.
In short, after a few months of work it is finally starting to seem like we have a decent workflow for (automatically) converting the bulk of our Tile Sets and Tile Maps to Godot 4. We’ve got a long road ahead of us, but we’ve managed to reduce the scope of the upgrade work from unknown to finite. More posts to come!
Share