Back to articles

Designing My First Godot Game

In last week’s post, I talked about my first impressions of the Godot game engine. While I still have some reserves about the code generation and support for C# (I can’t put accept the idea of working in GDScript, sorry), I have to say I was very pleasantly dragged into developing in Godot.I will explain what I did last week, but if you are impatient you can play my game here — as promised.Game DesignA demo screenshot from my v-scroll gameThe majority of my game dev hobby projects failed for the same reason: I aimed too high, falling in love with a concept and trying to implement complex game mechanics. This time I decided this shouldn’t be the case: I picked a very simple and well-known game idea, a vertical-scrolling shooter. Is it boring? Of course, but I need to remind myself that I am not building the next big indie hit: I am just learning. Choosing this concept has some considerable advantages:can be conveniently built by looking at the Godot tutorial game, without being a blatant copycat;the game mechanics are easy to understand and implement: move the spaceship, shoot lasers, and avoid damage from impacts with the enemies;it’s easy to create a game loop where you have to survive as long as possible and increase your score. This is a big deal because it allows the game to have a clear beginning and end;does not require a lot of playtesting to be validated;I can stop adding new features whenever I want and still claim I finished the game!Game ArtKenney’s Space Shooter Redux art packOnce the theme and general concept for the game are decided, it’s time to add some art assets to my project. The issue is, I don’t have any yet! Luckily, I can always pay a visit to the almighty Kenney.Kenney is a legendary artist that has released over 30,000 free-to-use assets, that can be used by any aspiring game developer, even in commercial projects. This is very convenient, as I am blatantly lacking in artistic skills. The Space Shooter Redux art pack covers all the assets I need, and more: dozens of sprites, sound effects, UI, text fonts, and background images. Thank you, Kenney.ProgrammingThe game code builds nicely on top of what I learned previously. However, there are still a couple of new patterns that I had to learn on my own.An interesting example is programmatically connecting signals from one scene to another. While Godot allows connecting events from the editor directly, it’s possible to connect only entities that are already defined in the same scene, which is not the case for my procedurally generated enemy ships. This is a problem because, whenever an enemy is destroyed, I want to update the player score in the main game manager. Godot APIs cover this use case with the Connect method:var enemy = (Enemy)EnemyScene.Instance();enemy.Connect("ScoreUp", this, "_on_Enemy_ScoreUpdate"); AddChild(enemy);The _on_Enemy_ScoreUpdate in the Game Manager will be alerted that an enemy was destroyed and that it can increase the score by a specific number.ConclusionI am still not sure what my next project should be: maybe a platformer? Or a puzzle game? However, I have way more confidence about working in Godot and I feel I will continue to have fun with it for a while!ReferencesPlay my game hereGodot Engine API DocsKenney’s websiteOriginally published at https://blog.lorisocchipinti.com on February 22, 2023.Designing My First Godot Game was originally published in Better Programming on Medium, where people are continuing the conversation by highlighting and responding to this story.
#c#
#godot
#redux
29 May 2023
vote
comment0