Why Godot
For a 2D game on phones I wanted three things: an engine that is light, one I could read the source of if something went wrong, and no licence surprises later. Godot is open source under the MIT licence, exports to both iOS and Android, and is very good at 2D. Its own scripting language, GDScript, reads a lot like Python, so the first week was about the engine, not the language.
The mental model, translated
Most of Godot clicked once I mapped it onto the web:
- Scene tree ≈ the DOM. Everything on screen is a node in a tree. A scene is a saved branch of that tree that you can reuse, much like a component.
- Nodes ≈ components. A node has properties, children and a script.
_ready()is your mount effect;_process()runs every frame, which has no real web equivalent and is worth using sparingly. - Signals ≈ events. A child emits a signal, a parent connects to it. It is the same "props down, events up" habit, and it keeps scenes independent.
- Autoloads ≈ global stores. Singletons that live for the whole game: the save state, settings, audio. Useful, and as easy to overuse as a global store.
- Containers ≈ flexbox.
VBoxContainer,HBoxContainerandMarginContainerdo layout for UI. Learn size flags and minimum sizes early; they are yourflex-growandmin-height. - Theme ≈ CSS. One theme resource with type variations styles every button and panel. Tibblo uses a single generated theme, and a test fails if a UI script hard-codes a colour instead of using it.
Every phone size
On the web, responsive layout is the default. In a game it is a decision. Tibblo is designed on a portrait canvas of 720×1280, with the stretch mode set to scale the canvas items and the aspect set to expand: a taller phone gets more room instead of black bars, and the layout has to use it.
Two rules came out of that:
- Respect the safe area. Notches, rounded corners and home indicators eat into the screen. Godot reports the display's safe area; anything tappable stays inside it.
- No sheet runs past the screen. Every pop-up sheet is sized from the viewport, not from where its parent happens to sit. Fixed parts take what they need, the list of choices takes the rest and scrolls, and on a short phone the decoration shrinks before the choices do. Each sheet has a test that checks it fits.
Art from code
I am not an illustrator, so Tibblo's pets are built from layered SVG parts: body, eyes, ears, blush, outfit. Godot imports each part, and a small rig in the scene moves them for poses and growth stages. Parts import at twice their size with mipmaps so they stay sharp on dense screens.
One surprise: semi-transparent parts drawn on top of each other darken at the edges after import, so overlay parts like blush and dirt are drawn opaque. A test checks that every part exists and that its size matches the catalog.
Testing a game like a web app
This is the part I would tell any web developer first: Godot runs headless from the command line. Tibblo has around 40 test suites, each a plain GDScript file run with --script, covering layout, the coin economy, saves, ad pacing and more. Only one snapshot test opens a window to look at real pixels.
- Platform services sit behind interfaces. Ads, purchases and cloud saves each have a real implementation and a fake one, so tests never touch a store or an ad network.
- Tests get their own save folder. Every run writes into a sandbox, so a test can never overwrite real progress.
- Logic takes the clock as an argument. Anything time-based, like when an ad may show, receives "now" from the caller, so a test can jump a whole day in one line.
What did not map
- No page to scroll you out of trouble. Every element has a position, a size and a state. Layout bugs show up as overlaps, not as a slightly longer page.
- State lives on the device. No server holds the truth; the save file does. That changes how carefully you write it (see how I version Tibblo's saves).
- iOS builds need a Mac. I moved development to a Mac partway through so both platforms could be built from one machine.
- Big screens grow big scripts. The main game screen grew to thousands of lines. Splitting it across a chain of scripts kept it workable, but if I started again I would split it into smaller controller nodes from day one.
- Plugins move fast. Mobile plugins for ads and billing change often, which is another reason to keep them behind your own interfaces.
If you are a web developer starting out
- Build one small screen end to end, including an export to your own phone, before designing the whole game.
- Use containers and a theme from the start; do not position UI by hand.
- Set up a headless test run in the first week. It pays for itself the first time a refactor breaks something you were not looking at.
- Decide your save format early and version it from save number one.
Godot's official documentation is excellent and is where I would start: docs.godotengine.org.