Creating a small puzzle RPG to experiment with godot-rust
These 2-3 last weeks, I have been using what I could of my free time to experiment with godot-rust.
My experience using the library
Using godot-rust has been a nice experience for me, although I got blocked with some things at first. I got blocked on issues like these:
- Realizing I had to call
.bind()or.bind_mut()whenever I wanted to access to some node attributes. I also had to make those attributes public. - Realizing that the docs are for the
masterversion so I had to update the library just to understand how to make avarwith a default getter and custom setter.
But thankfully, the library is well documented. There is a section about how to start with a blank project, and then you can simply go iterating through there. Then you can catch up with the issues I commented above easily, if you know how to search and read.
Something that works totally different from GDScript or C#, is that nodes don't get a script attached. Instead, in your Rust code, you declare a struct with some annotations and behaviour, and then a completely new node type is created in the Godot editor! This felt a bit weird to me at first, but then I thought it's more or less the same as a node that has a script attached. You write your own nodes with their own behaviour, instead of Godot nodes having scripts attached to extend their behaviour.
Once I got more comfortable with the library, I felt I could do things almost as fast as if I was using GDScript. Having a proper type system to work with feels so nice. With GDScript, I got so disgusted every time I had to use the language.
The game
I wanted to do a small project with the library, so I got inspiration by the game Tower of the Sorcerer. This is a game that at first glance seems like a traditional roguelike. But the difference is that it's all deterministic, and you need to careful use your resources and optimize your HP to get as far as you can in your adventure!
This is a really simplified version of the game, with less things to have in account, and a single floor. Your objective is to kill the devil... and make a soup with them 🤭. No, really, this last part is just funny because for the assets pack that I used for the sprites, it happened to be a character that looks so similar to Marcille, from Dungeon Meshi, so I used it for the game.
I warn you that the game is really difficult! The steps I took to do a good level design were basically, place things a bit randomly (at my own criteria), and then balance:
- "The game is too easy, let's improve the stats of this monster".
- "Now the game is unbeatable because there aren't enough sword items so I can't hit the serpent, let's add another sword item to the level".
- ...
And just iterating like this is how I get a more-or-less balanced experience! But I made it difficult enough so I think there is only one way to beat it. If I get inspired I could do another post with the solution, for those who want to play the game but can't beat it.
The link to the game is here, is only playable in browser!