Godot Game created for the TweetTweetJam 9

Uses 495 characters of code to create a pretty sad de-make of Void Stranger.

Use WASD/Arrow Keys to move, Space/Y/Z to pick up and drop white tiles in front of you. Keys are a bit sticky, sorry it feels a bit bad!

If you walk into a black void tile, you die (reload the page to retry). Don't walk out of bounds please.

You can make up your own goal, like "try to connect all islands together without dying".

Source Code

extends Tree
var x:=2
var a
var d=3
var W=1
func _process(E):
    if !a:seed(4);a=range(99);a.shuffle();a.resize(60)
    queue_redraw();var v=Input.get_vector("a","d","w","s").sign();x+=v.x+v.y*9
    if a.find(x)+1:free()
    if v:d=max(0,v.x);if v.y:d=max(0,v.y)+2
    if Input.get_axis("v",""):
        W^=1;var O=x+[-1,1,-9,9][d];if W:a.erase(O)
        else:a.append(O)
func _draw():if a:for i in a:draw_rect(Rect2(i%9*8,i/9*8,8,8),Color());draw_char(ThemeDB.fallback_font,Vector2(x%9*8+2,x/9*8+6),"<>^v"[d],7,Color())

If you use tabs to indent and remove the trailing newline at the end of the file, you end up with 495 bytes for the GDScript.
ProjectSettings and the barebones scene file are not counted towards this limit.

  • The scene tree consists of a singular Tree node (Tree being the shortest CanvasItem node name).
  • The game runs at 5fps so that "holding" a key is similar to just tapping it.
  • Needed to export as debug build since otherwise the game simply didn't want to crash when I told it to. Also the implicit cast to int was broken.
  • Ironically, I could not get a "minified" wasm build going. So you get the full 50MB bundle for an "as-small-as-possible" game :P

Deconstructing the logic a bit:

  • x is the position of the player (reading order). := to implicitly convert to int for Array.find call later
  • a is the tilemap array (also reading order). Values are indices for where pits should be, everything else is tiles.
  • d is facing direction: 0 left 1 right 2 up 3 down
  • W is wand contents.
  • First if-check runs for the first frame only: initialize tilemap
  • Second line handles movement.
  • Third line handles death (by deleting the root node). I tried crashing with type errors here, but even in debug builds they don't halt execution somehow!
  • Fourth line sets facing direction depending on previous input ("if v" ensures that no input means no change in direction).
  • Input.get_axis("v", "") is a shorter syntax for detecting keypress (cost is spamming errors in console).
  • Next two indented lines handle wand usage.
  • Finally rendering is done (only if tilemap is initialized already). Uses ASCII characters for facing direction.

Leave a comment

Log in with itch.io to leave a comment.