Hello friends! I'm attempting to implement replay functionality in PICO-8. (e.g. re-watching your last race in a racing game) I started by changing my update function, so that instead of invoking game actions directly, they are added to a command queue. Imagine something like this:
function move_player(x, y) -- move ZIG for great justice end function update_game() if btnp(➡️) then add_cmd(move_player, {1, 0}) end -- other input handling here process_commands() end |
An entry in the queue is a function, parameters (passed as a table), and the frame that the command was added (e.g. 23). At the end of the update function I execute everything in the queue that is scheduled for the current frame. process_commands
uses an index to track where the next command is, and increments the index whenever it executes one. To replay a game, all I have to do is reset my game state and command queue the index to 1, and run my game engine against the already-populated command queue. So far so good, easy enough to implement and it's working fine.
The next thing I thought was how I could use this to run a demo mode for the game. I play the game, I somehow persist the command queue, and use it to drive the demo mode. So now I need to persist this command queue outside of the Lua runtime. My first thought was looking into serialization of data in Lua, but if I understand Lua correctly I'd be serializing the same functions over and over, and it looks like I don't have access to string.dump anyways.
My best idea now is creating a table that keys the string value of my function names on the various game action functions, and add some code to add_cmd
to actually build a string of Lua code that will re-create my table. Seems kinda derpy but it would work, and does require me to change the name table if I change or add game actions.
Another alternative would be to record the raw input data for every frame and re-write my input handling code so that exactly where the input data is coming from is abstracted. Then my data is just a bunch of booleans that are easily serializable, but I hate this because now I'm tracking way more data than I care about, and it makes handling actual user input while the replay is running less straightforward.
How would you approach implementing replay functionality in PICO-8?
I'm a lifelong programmer but very new to game development, feel free to criticize / correct as you see fit, you won't hurt my feelings! I love learning.
Flight! Finesse! Friendship?!
Kaito is on a mission. He's got a brand-new pair of jetboots. He's snuck himself a pass to the finest spacegate network of 30XX. And if he can reach the other side…
…he might even make a friend.
About
It's been a while, but I'm very pleased to present my second PICO-8 release! This one is very different to Signed by '89, with a whole different genre and set of constraints. It's the first arcade-style game that I've made, and I learned a lot.
How to play
Fly through gates with ← and → arrow keys.
Abysmal Ascent is a platformer with roguelike elements. You play as a desperate mage, trapped deep underground and determined to escape the treacherous depths. Harness your arcane powers, overcome deadly enemies, and face off against formidable foes as you ascend through procedurally generated environments.
Can you make it to the surface?
Controls:
- X: cast spell to fly
- Y: shoot a spell
- Y + arrow up: shoot upwards a more powerful spell able to break ground
Features:
- 2 boss fights
- 3 different environments
- 6 different enemies with unique abilities
- 11 unique powerups
v0.5 Updated 3rd Dec 2023 - 2 players and some more levels
This is my first go at a Pico-8 game. Loving the Pico-8 and have learned a lot over the last couple of weeks.
V0.2 - Updated to include weapon power ups that give you faster firing rates
V0.4 - TANKS!!! cleaned up sounds. Extended music. Refactored map ready for multiple levels.
v0.5 - 2 Player option, 5 levels (then stops rather abruptly!), boats, homing missiles, water level, adjusted difficulty
Shoot the puny humans...
Pick up power ups for faster fire rate...
Save the animals for points and health boost...
How to play
Objective: Destroy the puny humans
Increase health by picking up the animals by flying low to the ground.
Increase fire rate by picking up Crystals
Increase speed by picking up stars
Possibly Endless Golf Demake
This is a demake of Possibly Endless Golf
I've always wanted to write a procedurally generated game and love chilled out golf games. This did actually start as a pico-8 project but I couldn't get the level generation correct so I moved to Monogame as I have more experience with C#. Once I finished my first Steam release. I thought I'd come back and finish what I started, now that I understood how to generate levels.
Aim of the game is to get the ball in the square hole.
Controls:
left/right to move the direction arrow
up/down to modify the power bar
Symptoms: the mouse drifts right on Firefox (only)
How to reproduce:
- export demo cart as an html page
- publish page on itch.io (or equivalent)
- run game on Firefox (MacOS or Windows - Linux is fine)
- notice mouse x-drifting
Note: does not occur when game is run locally
Note: does not occur when game is run fullscreen using the Pico8 button
Wild guess: suspect a Firefox bug regarding mouse coordinates and iframes?
Test cart:
- https://freds72.itch.io/mouse-lock-test
- password: mouse
Code:
function _init() poke(0x5f2d,0x5) end _x,_y=0,0 function _update() _x=mid(_x+stat(38),0,127) _y=mid(_y+stat(39),0,127) end function _draw() cls() print(_x.."/".._y,2,2,7) circfill(_x,_y,4,8) end |
About
Gmlib is a complete general midi version 1 instruments implementation using pico-8 custom instruments.
It consists of 16 carts with 8 instruments in each. Inspired by the midilib project, all the sfx are midilib compatible and will be submitted to the project.
Controls
⬅️, ➡️ cycle through instruments in the current cart
⬆️, ⬇️ navigate between carts
🅾️ play/stop demo
❎ copy current instrument to clipboard
Lights Out
Dear photosensitive players: please show caution when playing this game. it includes minor and medium intensity flashing.
Where is this? Who are you? when am i?
Find yourself in an unknown location with only a LIDAR scanner to your name. we'll see if you can make it out alive. who know's whats just around the corner.
How to play:
The game includes instructions accessible from the title screen.
if you need more info on how certain mechanics work, feel free to ask below.
Special thanks
Thank you to the celeste classic community and the comments here for feedback on sound, gameplay and mechanics
! i really appreciate the help!
All code, sprites, sounds, mechanics, levels were all made by me. if you find any bugs, please let me know via twitter or in the comments below.
Emerald Escapee
Only if you enter the old castle, evade its deadly traps and find all the missing keys, will you be able to touch the Emerald of Power and escape from the Volcanic Shores of Hell.
This is a short Top-Down Adventure Game created with the help of an amazing Programming Tutorial by Dylan Bennett (https://www.youtube.com/@DylanBennett) as well as some tricks and tweaks I borrowed from Nerdy Teachers' awesome Youtube channel (https://www.youtube.com/@NerdyTeachers).
Title Screen
Gameplay Gif
How to Play
Move with ⬆️⬇️⬅️➡️
Hi,
Just bought an RGB30 as the screen looked great for Pico-8 games. It came with just two options showing 'Splore' and 'splore'. Neither would run. OS is JELOS
I then followed some youtube advice and downloaded the raspberry pi version of Pico-8 into the Pico-8 rom folder. This gave me a third option called lexaloffle-pico8. This now loads Pico-8, but finishes with a command prompt error "cannot load lexaloffle-pico-8.png"...oh and I made the mistake somehow of deleting Splore.png and splore.png.
HELP!!
Bubble Boy
Frollick in a field and scare some bugs!
My first Pico 8 game, Yay! I've had a wonderful time making it.
This is a de-make/re-make or homage to an old flash game i played 15+ years ago lost to time and probably old geocities servers. I can't remember more than the gameplay, which i recreated in this game. I made this as much for my own sake as for everyone else that want to run around in a field with some bugs.
Shoutout to Krystman @ Lazy Devs Academy for always having a chill video to watch and get some inspiration and helpful Pico 8 tips!
Early game
"Late" game
Here is Snibbly, my Pico-8 version of Super Nibbly. It was a dos game from 1993.
The aim of the game is to eat all the fruit in time without hitting your own body.
Extra items will appear e.g. puck to shoot, extra live, extra time, drinks to shrink body,....
60 levels
2 game modes:
- original
- level by level
Have fun!