Code and how to
lighthouse_storm.html
This is the whole game. Change it and press Run.
How to make a game in one HTML file

How this game works

Last Light is one HTML file with no image, model or sound files. It has three parts:

  1. One script tag that loads the Shiny Gen engine from the shinygen npm package.
  2. The game, written in GDScript inside a <script type="text/gdscript"> block. Shaders go in <script type="text/gdshader"> blocks.
  3. One line, ShinyGen.start(...), that starts the engine on the page's canvas.

Everything you see in this game is made by its code when the page loads. Press Code to read all of it.

The engine: Godot 4.6 on WebGPU

The Shiny Gen engine is our fork of the Godot engine, version 4.6, built to run in the browser with a WebGPU renderer (Godot WebGPU) and a WebGL renderer for browsers and phones without WebGPU. The code is real GDScript with Godot's own class names, such as Node3D, MeshInstance3D and Camera3D, so what you or an AI assistant know about Godot 4 applies here.

Make your own with Claude or ChatGPT

Claude, ChatGPT and other AI assistants that write code can make a game like this. Give the assistant a small working page to start from, so it knows how the engine is loaded, and describe your game.

  1. Copy the request below. It includes a complete blank page: a spinning cube.
  2. Paste it into Claude or ChatGPT and replace the last line with the game you want.
  3. Paste the file it gives you into Code here and press Run to play it.
  4. If an error shows under the editor, copy it back to the assistant and ask for a fix. Then ask for one change at a time.
Make me a game as one HTML file that runs on the Shiny Gen engine.

About the engine: it is a fork of Godot 4.6 that runs in the browser, with a WebGPU renderer and a WebGL fallback. One script tag loads it from the shinygen npm package. The game is GDScript inside a script tag of type text/gdscript, using Godot 4 class names. Shaders, if you need them, go in script tags of type text/gdshader with a name, and the GDScript gets one with get_parent().get_shader("name").

Rules: one HTML file, no image, model or sound files (build meshes, materials and sounds in code), keep the engine script tag and the ShinyGen.start line as they are, and give me back the whole file.

Start from this working page, which shows a spinning cube:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My game</title>
<style>
  html, body { margin: 0; height: 100%; background: #111; }
  #canvas { display: block; width: 100vw; height: 100vh; }
</style>
<script src="https://cdn.jsdelivr.net/npm/shinygen@4.6.9/shinygen.js"></script>
</head>
<body>
<canvas id="canvas"></canvas>

<script type="text/gdscript" name="Main">
extends Node3D

var cube: MeshInstance3D

func _ready():
    var cam = Camera3D.new()
    cam.position = Vector3(0, 1.5, 4)
    add_child(cam)
    cam.look_at(Vector3.ZERO)

    var light = DirectionalLight3D.new()
    light.rotation_degrees = Vector3(-45, 30, 0)
    add_child(light)

    cube = MeshInstance3D.new()
    cube.mesh = BoxMesh.new()
    var mat = StandardMaterial3D.new()
    mat.albedo_color = Color(1.0, 0.5, 0.2)
    cube.material_override = mat
    add_child(cube)

func _process(delta):
    cube.rotate_y(delta)
    cube.rotate_x(delta * 0.5)
</script>

<script>
  ShinyGen.start({ canvas: "#canvas", autoFit: false });
</script>
</body>
</html>

The game I want: (describe your game here)

Change this game with an AI

  1. Press Code, then Copy.
  2. Paste the file into Claude or ChatGPT with a request like this one:
This is a complete game in one HTML file. It runs GDScript on the Shiny Gen engine, a fork of Godot 4.6 for the browser, which the script tag loads from the shinygen npm package. Keep it as one file with no asset files, and keep the script tags as they are. Change this: (say what you want). Give me back the whole file.

  1. Paste the answer into Code and press Run.

Edit it yourself

  1. Press Code. The editor holds the whole file.
  2. Change something. A few easy ones to find with your browser's search:
    • Find L A S T L I G H T. Type your own title between the quotes.
    • Find LIGHT_RANGE := 32.0. Make it 60.0 to light a lighthouse from further away.
    • Find st.y * 16.0. Raise 16.0 for a faster boat.
  3. Press Run, or Ctrl + Enter (Cmd + Enter on a Mac). The game restarts with your code.
  4. If your code has an error, it shows under the editor. Reset brings the original back.
  5. Download saves your version as one HTML file.

Put it on your own site

Download the file and upload it to any web host. It has to be opened over http or https, because the engine loads from the npm CDN. The engine shows a Made with Shiny Gen notice while it loads, and the package license asks you to keep it. The embed guide has the details.

Make a game without writing code

In the Shiny Gen app you describe a game and the AI agent writes the GDScript, runs the game and fixes what it finds. Start a new Godot game, or read how this one was made.