Skip to content

Taffer/godot-experiments

Repository files navigation

Moved

This repo is has been replaced by: https://codeberg.org/Taffer/godot-experiments

Logo of the GiveUpGitHub campaign

Everything in this repo should be considered out of date.

Godot Experiments

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.

Bribe me

Want to bribe me to work on more experiments, faster? Want to suggest an experiment?

ko-fi

Always willing to entertain suggestions, but if you're asking me to do some work, you have the option of fuelling it with coffee. ;-)

Credits

These use the Godot Engine.

License

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.

Experiment 1 - Scrolling 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

Graphics

  • 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.

Experiment 2 - Monospaced Text

Graphics

This is the same as Experiment 2, but with a variable-width font. This is trivial in Godot.

Experiment 3 - Variable Text

Graphics

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.

Experiment 4 - Text Entry

This is trivial with Godot, just use a TextEntry object.

Graphics

In this experiment, we'll fade an image from black to fully-drawn.

Experiment 5 - Image Fade

Graphics

  • 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.

Experiment 6 - UI Dialog

Graphics

  • 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:

In this experiment, we'll draw an animated icon.

Experiment 7 - Animated Icon

This is trivial in Godot thanks to the AnimiatedSprite object.

Graphics

  • 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.

Experiment 8 - Styled Text

Graphics

In this experiment, we'll draw a button with some text in it. It'll respond to the mouse hovering over it, and clicks.

Experiment 9 - UI Button

Graphics

Font:

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.

Experiment 10 - UI Spinbox

Graphics

Font:

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.

Experiment 11 - Tilemap

Graphics

"[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.

Experiment 12 - Tilemap

Graphics

"[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.

Experiment 13 - Rect Fades

Graphics

  • 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.

Experiment 14 - Animated Sprite

Graphics

  • 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.

Experiment 15 - Text Dropshadows

Graphics

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.

Experiment 18 - Tilemap Layers

Graphics

"[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.

Experiment 19 - Simple Lights

Graphics

  • 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.

Experiment 20 - Animated Sprite

Graphics

  • 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.

Experiment 21 - Sprite Joystick

Graphics

  • 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.

About

Some experiments using the Godot game engine.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published