Making of LLem Mings
This is the story that created Llemmings ,
a game created by Large Language Models.
These pages are generated from the commit history, which contain all the prompts
that created the game.
Currently there is only the intro screen and one level. There is a rough level editor if you
want to take a stab at creating levels.
Exploration and findings
What I wanted to explore and now really like about this project is how every commit
comes with a very detailed intention of the code; the prompt. I can definitely see
how a prompt-chain over time will be able to assist in interesting ways when it comes
to the life-cycle of a software project.
Other things this small project was to illustrate:
- How well large language models can generate code
- How to prompt large language models with limited context windows
- Explore ways to organize said prompts
Prompts are very close to specifications -- a technical specification will
be able to create complete software projects in the very near future.
Smaller software projects might become so cheap to make that you do not care about code-quality
or maintainability at all. You will just care about keeping the prompts around and updated.
Prompt notes
If a prompt is prefixed with "Human:", it means that the commit contain all or mostly glue
written by a human.
Prompts in the code are referenced in code comments that looks something like this: >>> Prompt ...
All prompts are found in the folder 'instructions'. For prompts that belong only to the level editor,
you can find them in 'editor/instructions/'.
Some prompts at the very start were sadly lost. They did not generate that much code,
as can be seen if you look at the commits (link at bottom of each page).
Joakim Romland, 17-May-2023
_ username is
. _(9> romland and
==_) mailhost is
-'= gmail . com
Index
Toggle human changes
first
update
update
update
Some basics
Prompt for these changes below
Lemming sprite
Collision detection and other small bits.
Lemming, collisions and game-loop
See prompt below for details
I'm color blind
Basics
Massaging, see below (I also cheated, I see now)
We are making a game like Lemmings
ChatGPT: Details below
They cannot be controlled
ChatGPT: Prompt below
I think this is mostly human cheating :(
ChatGPT: ...
Collisions and movement
ChatGPT: New prompt for collision detection and lemming movement
Collisions and movement
ChatGPT: Prompt tweak
Rendering
ChatGPT: Prompt tweak
Back buffer
ChatGPT: Prompt tweak
Back buffer
ChatGPT: Prompt tweak
Collision fuzziness
ChatGPT: Prompt tweak. And I spot undocumented human cheats!
Buffer
ChatGPT: Prompt tweak
Pause and main loop
ChatGPT:
Movement
ChatGPT:
Movement
ChatGPT:
License
Movement / collision
ChatGPT: It looks like cheating actually, not ChatGPT
Particles, explosion when a lemming dies
ChatGPT: This is a one-shot prompt! Woo!
Make them selectable
ChatGPT: prompt below (there be human cheats in here)
Blockers, actions, buttons
ChatGPT: A lot happened in this commit, sadly
Climbing green-blue blocks (floater was added as a side-gig)
ChatGPT: Climbers... Oh boy. This was a painful one looking back, there will be a series of these commits...
screenshot
Cliff-walls
ChatGPT: In order to be able to test Climbers, we need cliffs
Cliff-walls
ChatGPT: In order to be able to test Climbers, we need cliffs
Cliff-walls
ChatGPT: In order to be able to test Climbers, we need cliffs
A bit of cliff-walls success
ChatGPT: In order to be able to test Climbers, we need cliffs
Make it clear tht it's not done
Cliff-wall tweaks
ChatGPT: In order to be able to test Climbers, we need cliffs
Cliff-wall tweaks
ChatGPT: In order to be able to test Climbers, we need cliffs
Cliff-walls that work-ish
ChatGPT: In order to be able to test Climbers, we need cliffs
screenshot
Seedable pseudo-RNG, debugging
ChatGPT:
Cliff tweaking, forbid cliffs on top
ChatGPT: Prompt tweaking
Cliff tweaking
ChatGPT: Prompt tweaking
Cliff tweaking
ChatGPT: Prompt tweaking
The Climber (!) and more cliffs
ChatGPT: Climber implementation
The Climber (!) and more cliffs
ChatGPT: Climber implementation
Replacing Climber and bounds checks
ChatGPT: Climber implementation
Climber and functionality to helper functions
ChatGPT: New climber implementation and helpers
New climber implementation
ChatGPT: Probably reusing an existing prompt for this
Bug fixing
ChatGPT: Had to intervene and do manual bug-fixing
Bug fixing
ChatGPT: Had to intervene and do manual bug-fixing
Debugging
ChatGPT: Just one prompt below
A passable climber
ChatGPT: No new prompt, just fixing code from the result of an existing one
Bomber!
ChatGPT: A new green-blue block type!
Human: Change title of the page
Link to github
ChatGPT: advanced prompt
Human: 'random' map again
Could not resist
Initial work on Digger/Miner/Basher
ChatGPT: default settings
Work on digger/climber/basher
ChatGPT: default
Ouch
A plausible Basher type
ChatGPT: I am _very_ close to max context length here, may have to switch to GPT-4, but it's so darn slow.
Now we know...
Formatting
No narrow prompts
I thought github would make them short
Passable basher
ChatGPT:
Ouch
Separated code and instructions
Minor clean-up in Lemming.update
ChatGPT: see prompt
Associated code with prompt
Window color
ChatGPT: default settings
Human cheat
Bugfix; height adjustment
ChatGPT: default settings
Cheat
Disable antialiasing, digger fixes, CSS fixes
ChatGPT: default
Make rock undiggable now
Cheat: Handle single color case
Flagged cheat
Fix a collision problem
ChatGPT: This is really just plain debugging and programming
Plausible miner
Human tweaks
Human: Just moved variables around
New terrain generator
ChatGPT: Two prompts
Human: Just moved helper functions
Human: The old noise generator was removed
Refactoring/clean up
ChatGPT
Human: Bombing removed in prev commit
Human: Blocker, like bomber broke at some point
Human: Formatting
ChatGPT: Irritating that it is so consistent in how it indents/formats.
Human: Reverted earlier refactoring
It failed with height adjustment and a number of things
Legs/feet animation
ChatGPT: One prompt, annoyong one.
Seed change
Human: Debugging basher
Human: Bugfixes
Foot was off by one pixel; leg movement speed now depend on velocity;
Human: Moved code
Human: Bugfix
Left-walking bashers broke at some point
Human: Bugfix where digger could get out of its hole
Human: Bugfix
Got rid of velocity inversion in blocker code; and moved the code.
Human: Another movement bugfix
Climber would not be blocked by blockers.
Human: Miner movement hack
Human: Moved legs; only mine dirt
A plausible Builder
ChatGPT: 2 prompts below
Perform pre-programmed actions
ChatGPT (and human)
Human: The builder is particularly dodgy
Added some bandaid to build a platform straight under the feet to see if that fixes building on slopes
Dirt texture
ChatGPT: prompt below
Rock texture
ChatGPT: prompt below
Human: Spawn them at -20 on Y
Clean-up
No new code was added. Moved functions, variables around to preapre for
HUMAN: More clean-up
Variables this time. Previous commit was also HUMAN.
HUMAN: Removed comments
Human: Moved files
Human: Deleted files
Human: Clean-up
Scoped all variables/functions + made it possible to 'export' some
Human: Indentation
Human: Global debug flag
Human: Split html and js into respective files.
Why: Because we'll need part of the .js file for the level editor.
Human: Flagging some code debug
Human: Typo
Human: Pass in DOM element to init()
In preparation of a level editor.
Initial level editor
ChatGPT: ...but a lot of cheating. Prompts below.
Human: Refactoring
Make sure canvas event listeners are only started once, in case init() gets called multiple times.
Human: Cleanup
Literally clean-up. Clean up and reset a level
Human: Shuffled around code
Made seed configurable.
Human: Note about not working on mobile devices yet
Human: Moved file
Human: Moved shape drawing to the game
... to facilitate the level editor to add shapes to maps. There will be
Human: Added default shape for water
Human: Tested rendering texture on shapes
Human: And the tweak to preview level in editor
Background gradients
ChatGPT: Prompt below
Human: Bugfix
Human: Adding utils dir
I can't with good conscience keep adding completely new functionality to
Vegitation for levels (!)
ChatGPT: Prompt below
Human: Bugfix gradients
Human: Oops. Use levelData
Human: Support dynamic decorations
Just boilerplate code
Human: Typo! Vegetation!
Human: Removed unused
Human: Make sure water gets a texture
Human: Respect start position
Passable water texture
ChatGPT: prompt + notes below
Human: Editor fix
Human: Added resources/goals
CRUD for levelData in level editor
GPT-4: Had trouble getting a result in context-length; hence GPT4
Human: Tiny bit of CSS
to make levelData readable
Human: Editor style fixes
Human: Editor bugfix for strings in arrays
Human: Respect a bit more of levelData
Respect num of lemmings to spawn; added all resources and spawnrate.
Resource counter
ChatGPT:
Human: Removed spawn/goal rectangles
Human: More of the same
Human: Moved github link
Human: Added configurable spawn/goal clearing
Human: Random map by default
Morphing text effect
ChatGPT: this took quite a while to get right, but fine!
Human: Fixed editor
...which broke in previous commit
Human: Need more bombers
Human: Consolidating levelData
Added file that hold level data
Reduce hand-drawn points in editor
ChatGPT: Unsurprisingly, it returned Ramer–Douglas–Peucker algorithm.
"Rule engine" for level solutions
ChatGPT: Code-shuffling and a prompt below.
First draft of an tune-player
ChatGPT: prompt below
Audio effects (and samples for a possible tune)
ChatGPT and GPT-4 (where noted)
Human: Moved a prompt away from code
Human: Testing sound effect on spawn
Note that due to browser constraints, you need to have clicked (or some other action) in the document for sounds to play (good thing, but somewhat annoying).
Keeping track of score and level goal checking
ChatGPT: Prompts below
Human: Bugfix. Climbers can be bombers too,
Addtionally: Create lemmings early so that we can use the count to determine level failure/success (coming up)
A better guitar (but well, just better...)
ChatGPT: 3 prompts below
Human: Code comment
Human: Removed debug
A better builder
GPT-4: ChatGPT completely failed at this prompt, but GPT-4 nailed it
Human: Testlevel tweaks
Human: Test with random seeds
Human: Ditched all miners/diggers to simplify
Human: Bugfix for Firefox
There is some timing difference between Firefox and Chrome which made Basher fail in Firefox sometimes. Increasing the number of frames a basher is allowed to be inactive before it is done.
Human: Don't re-create score div
Human: Fixed a TODO
Consume resources when doing pre-programmed actions. Likewise, tweaked test-level to have minimum resources
Human: Bugfix. This could have bitten me.
I had not experienced it being a problem yet, but it could be!
Human: Game over condition
Human: Typo
Human: Added safety check
Persist progress in local storage
ChatGPT: prompt below
Human: Added resource 'time' to level
Split out levelCompleted/levelFailed to separate functions
Fixed framerate to 60
ChatGPT: Prompt below
Human: 120 seconds to solve level 1
Human: Allowed for larger fuzziness & animated to/from outside canvas border
Human: Take time-resource into consideration
also:
Human: Allow cleanUp to be called externally
Human: added getScore()
Fade in/out on level start/end
ChatGPT: prompt below
Human: Bugfix. Never modify levelData
Human: Score for level completion
Human: Show objective BEFORE level-start
Human: Bugfix. Recover if old structure
Human: typo
Human: Getting editor to parity with game
Human: More editor parity
Place level-data in clipboard when saving
ChatGPT:
Human: Font for 'logo'
Human: README updated
Added 'text' tool to level editor
ChatGPT: mostly human glue, but a prompt to get text dimensions below
Human: Beginnings of an intro-screen
Fiddles all over the place here:
Resizable canvas
ChatGPT: prompt below (the rest is all human glue/tweaks)
Style and position "Start game" on intro screen
ChatGPT: prompt below
Human: Tweaked intro looks
Human: Added toggle for autoPlay a level
Human: Unpause intro when starting game
Key-binds and key-bind editor
ChatGPT: 3 prompts below
Implement missing actions used by keybinds
ChatGPT: 2 prompts below
Modal dialog (used for keybinds)
ChatGPT: 2 prompts
Floating Combat Text
ChatGPT: prompt below
Bugfix: restore background proper when blowing them up
ChatGPT: prompt below
Human: Restore gradient for dig/bash too
Human: Editor parity
Human: Get to parity with game
Human: Intro screen tweaks
Human: Positioned settings div
Human: Positioned settings div
Human: New screenshot
Make Llemmings logo consistent between browsers
ChatGPT: Prompt below
Human: Removed some comments
Add the finish zone (house)
ChatGPT: prompts below
Human: Tweaked finish-check
Human: Latest screenshot
Human: Oops
Human: Script to create commit story
Human: Also the CSS for llemmings.com