This repo is has been replaced by: https://codeberg.org/Taffer/godot-experiments
Everything in this repo should be considered out of date.
Some experiments using the Godot game engine.
These are ports of my PyGame experiments (which started as ports of my Löve experiments for now), we'll see where this goes.
- Experiment 01 - Scrolling Texture
- Experiment 02 - Monospaced Text
- Experiment 03 - Variable Text
- Experiment 04 - Text Entry
- Experiment 05 - Image Fade
- Experiment 06 - UI Dialog
- Experiment 07 - Animiated Icon
- Experiment 08 - Styled Text
- Experiment 09 - UI Button
- Experiment 10 - UI Spinbox
- Experiment 11 - Tilemap
- Experiment 12 - Tilemap Minimap
- Experiment 13 - Fade
- Experiment 14 - Animated Sprite
- Experiment 15 - Drop shadow text
- Experiment 16 - Joystick
- Experiment 17 - Sprite Joystick
- Experiment 18 - Tilemap Layers
- Experiment 19 - Lighting
- Experiment 20 - LPC Sprite
- Experiment 21 - Blocked Sprite
Want to bribe me to work on more experiments, faster? Want to suggest an experiment?
Always willing to entertain suggestions, but if you're asking me to do some
work, you have the option of fuelling it with coffee. ;-)
These use the Godot Engine.
Stuff I wrote is released under the MIT license, and any resources are covered by their respective licenses (please see individual experiment write up for details). I'm only using open source and freely usable third-party bits, but they might not be using MIT's license.
Old games used a technique to animate textures where they shifted the sprite one row or column per frame. An easy/cheesy way to do this is to just produce a set of sprites that are shifted already and treat them as individual frames.
I want to see if there's a way to do it without duplicating and modifying the sprite. I'm thinking that ancient platforms (think Commodore C=64 or Apple ][) wouldn't have the memory to waste for this sort of thing.
The goal is to do this with one draw call, by adjusting the texture.
This is actually more complex in Godot than in PyGame or Löve2D; we have to write a shader! Thank you Internet for answering this question.
This variant of Experiment 1 accomplishes the same thing with two major differences:
- almost no code (literally one line to set the animation when the scrolling sprite is ready)
- scrolling the texture using the texture Region rather than a shader; when I first did Experiment 1 I didn't know about Region
character_robot_jump.png
- From Kenney.nl's freely usable Toon Characters 1 collection.
This is an attempt to create a simple text/console type of window. Print text to it, render it, and scroll up when you reach the bottom. Think of the text area in the bottom-right of the Ultima V, for example.
We'll make an area that can display five lines of 20 characters each. It automatically wraps lines that are too long, and there's a rectangle around the text area so you can be sure it's not over-drawing.
LiberationMono-Bold.ttf
- An open source font from the liberationfonts repo; this is licensed under the SIL Open Font License.
This is the same as Experiment 2, but with a variable-width font. This is trivial in Godot.
LiberationSerif-Bold.ttf
- An open source font from the liberationfonts repo; this is licensed under the SIL Open Font License.
This is an attempt to turn Experiment 2 into a simple text entry box. Whatever you type will be printed in the text area.
We'll make an area that can display five lines of 20 characters each. There's a rectangle around the text area so you can be sure it's not over-drawing.
This is trivial with Godot, just use a TextEntry
object.
LiberationMono-Bold.ttf
- An open source font from the liberationfonts repo; this is licensed under the SIL Open Font License.
In this experiment, we'll fade an image from black to fully-drawn.
character_robot_jump.png
- From Kenney.nl's freely usable Toon Characters 1 collection.
In this experiment, we'll draw a dialog box with some text in it and a character portrait.
HONK.png
- The Goose from House House's amazing Untitled Goose Game, used without permission. I'm not affiliated with House House in any way, other than as a happy customer. You should buy Untitled Goose Game, it's amazingly fun. I have it on my Switch!rpg_gui_v1
- RPG GUI construction kit v1.0 by Lamoot on OpenGameArt.org. I had to create a 9-patch image of the parts I wanted to use because I couldn't figure out how to use arbitrary texture hunks for it in Godot.
Font:
LiberationSerif-Bold.ttf
- An open source font from the liberationfonts repo; this is licensed under the SIL Open Font License.
In this experiment, we'll draw an animated icon.
This is trivial in Godot thanks to the AnimiatedSprite
object.
character_robot_sheet.png
- From Kenney.nl's freely usable Toon Characters 1 collection.
This is an attempt to create a simple text window that supports some text styling (multiple fonts and colours). Print text to it, render it, and scroll up when you reach the bottom.
LiberationMono-Bold.ttf
andLiberationSerif-Bold.ttf
- Open source fonts from the liberationfonts repo; this is licensed under the SIL Open Font License.
In this experiment, we'll draw a button with some text in it. It'll respond to the mouse hovering over it, and clicks.
rpg_gui_v1
- RPG GUI construction kit v1.0 by Lamoot on OpenGameArt.org.
Font:
LiberationSerif-Bold.ttf
- An open source font from the liberationfonts repo; this is licensed under the SIL Open Font License.
In this experiment, we'll draw a spinbox with some text in it. It'll respond to the mouse hovering over it, and clicks, switching between a set of values.
uipack
- Kenney.nl's UI Pack.
Font:
LiberationSerif-Bold.ttf
- An open source font from the liberationfonts repo; this is licensed under the SIL Open Font License.
In this experiment, we'll draw a viewport onto a tilemap that was created in Tiled. Use the arrow keys or WASD to move the viewport around the map.
LiberationSerif-Bold.ttf
- An open source font from the liberationfonts repo; this is licensed under the SIL Open Font License.terrain-map-v7.png
- LPC Terrains from OpenGameArt:
"[LPC] Terrains" by bluecarrot16, Lanea Zimmerman (Sharm), Daniel Eddeland (Daneeklu), Richard Kettering (Jetrel), Zachariah Husiar (Zabin), Hyptosis, Casper Nilsson, Buko Studios, Nushio, ZaPaper, billknye, William Thompson, caeles, Redshrike, Bertram, and Rayane Félix (RayaneFLX). See
CREDITS-terrain.txt
. You MUST credit all authors with the information in this file, and you must link back to this page on OpenGameArt.
In this experiment, we'll draw a viewport onto a tilemap that was created in Tiled. Use the arrow keys or WASD to move the viewport around the map. This version adds a minimap that follows the viewport.
LiberationSerif-Bold.ttf
- An open source font from the liberationfonts repo; this is licensed under the SIL Open Font License.terrain-map-v7.png
- LPC Terrains from OpenGameArt:
"[LPC] Terrains" by bluecarrot16, Lanea Zimmerman (Sharm), Daniel Eddeland (Daneeklu), Richard Kettering (Jetrel), Zachariah Husiar (Zabin), Hyptosis, Casper Nilsson, Buko Studios, Nushio, ZaPaper, billknye, William Thompson, caeles, Redshrike, Bertram, and Rayane Félix (RayaneFLX). See
CREDITS-terrain.txt
. You MUST credit all authors with the information in this file, and you must link back to this page on OpenGameArt.
In this experiment, we'll try to fade in/out on an image by drawing over it with masking rectangles.
fox n girl shadows.png
by zonked on OpenGameArt; resized and cropped to fit the window I'm using.
In this experiment, we'll animate one of the Liberated Pixel Cup sprites (OpenGameArt's mascot, Sara). Use WASD or arrow keys to walk around.
grass.png
- A grass tile, by Invincible.LiberationMono-Bold.ttf
- An open source font from the liberationfonts repo; this is licensed under the SIL Open Font License.LPC_Sara
- Stephen "Redshrike" Challener as graphic artist and William.Thompsonj as contributor. Mandi Paugh is the original artist of Sara and creator of the OGA mascot.
LPC sprite sheet documentation:
- Each row is a complete animation cycle.
- Rows are mostly in groups of four based on facing: away, left, forward, right.
- Animation rows are: Spellcast, Thrust, Walk, Slash, Shoot, Hurt (only one facing for Hurt).
- Are 64x64 on the sprite sheet.
This experiment draws text with different dropshadows, so we can see how to make our white text more readable on a light coloured background.
grass.png
- A grass tile, by Invincible.LiberationMono-Bold.ttf
andLiberationSerif-Bold.ttf
- An open source font from the liberationfonts repo; this is licensed under the SIL Open Font License.
I'm skipping implementing this one because Godot handles joysticks transparently through the input mapping support. Both Löve2D and PyGame provide extremely low-level access to the gamepad data and it's up to you to map the raw numbers into something useful.
Similarly, I'm skipping Experiment 17, because it's just Experiment 14 with joystick support for movement. Through the magic of Godot's input mapping, Experiment 14 already supports gamepad control.
In this experiment, we'll draw a viewport onto a tilemap that was created in Tiled. Use the arrow keys or WASD to move the viewport around the map. This expands on Experiment 11 by working with a map that has several layers.
LiberationSerif-Bold.ttf
- An open source font from the liberationfonts repo; this is licensed under the SIL Open Font License.terrain-map-v7.png
- LPC Terrains from OpenGameArt:
"[LPC] Terrains" by bluecarrot16, Lanea Zimmerman (Sharm), Daniel Eddeland (Daneeklu), Richard Kettering (Jetrel), Zachariah Husiar (Zabin), Hyptosis, Casper Nilsson, Buko Studios, Nushio, ZaPaper, billknye, William Thompson, caeles, Redshrike, Bertram, and Rayane Félix (RayaneFLX). See
CREDITS-terrain.txt
. You MUST credit all authors with the information in this file, and you must link back to this page on OpenGameArt.
In this experiment, we'll take experiment 14 - Animated Sprite and add some simple lighting.
This uses Godot's 2D lighting rather than the blocky shadows of the original demo.
grass.png
- A grass tile, by Invincible.LiberationMono-Bold.ttf
- An open source font from the liberationfonts repo; this is licensed under the SIL Open Font License.light.png
is from Godot's 2D Lights and Shadows demo.LPC_Sara
- Stephen "Redshrike" Challener as graphic artist and William.Thompsonj as contributor. Mandi Paugh is the original artist of Sara and creator of the OGA mascot.
In this experiment, we'll take the LPC Sara animation from experiment 14 and let you cycle through the different animations in the spritesheet. Use WASD or arrow keys to walk around and Space to cycle to the next animation.
grass.png
- A grass tile, by Invincible.LiberationMono-Bold.ttf
- An open source font from the liberationfonts repo; this is licensed under the SIL Open Font License.LPC_Sara
- Stephen "Redshrike" Challener as graphic artist and William.Thompsonj as contributor. Mandi Paugh is the original artist of Sara and creator of the OGA mascot.
LPC sprite sheet documentation:
- Each row is a complete animation cycle.
- Rows are mostly in groups of four based on facing: away, left, forward, right.
- Animation rows are: Spellcast, Thrust, Walk, Slash, Shoot, Hurt (only one facing for Hurt).
- Are 64x64 on the sprite sheet.
In this experiment, we'll take experiment 14 - Animated Sprite and add some blocks that restrict movement. I was trying to do this as part of a new lighting Experiment, but it wasn't working, so I decided to simplify a little.
col.png
- A column, by mold, resized and cropped to 32x32.grass.png
- A grass tile, by Invincible.LiberationMono-Bold.ttf
- An open source font from the liberationfonts repo; this is licensed under the SIL Open Font License.LPC_Sara
- Stephen "Redshrike" Challener as graphic artist and William.Thompsonj as contributor. Mandi Paugh is the original artist of Sara and creator of the OGA mascot.