Implementing nuclear throne's level generation on pico8
I have been tinkering around with procedural level generation and Pico-8 for a few days which lead me to reimplementing a portion of Vlambeer 's iconic game Nuclear Throne's level generation.
I decided to not exactly follow their algorithm but a pretty close implementation of it. Mainly because the 1:1 implementation didn't create a very good looking map on pico8 imo.
Using a combination of
- Random walk and
- Weighted directional bias (a.k.a a random % that I hand tweaked to look satisfactory, no maths involved :p)
The algorithm was able to carve out organic levels that were pretty similar to Nuclear Throne.
So I found an interesting approximation algorithm for converting to and from floating point data (bitwise not in a supported variable) but the issue is its based on the assumption one has u32 to work with.
I got some of the base code working in theory but the big int library doesn't work with byte anding and oring totally in a way I'm wrapping my head around entirely yet.
The problem is while I could do it one by one with a string, that would not be efficient.
Splitting bytes and relocating to just a high byte set on two variables should work but is melting my brain. Anyone else fall down this rabbit hole before?
My latest game, Spooky Stylin' uses this "bitplaning" technique to store two 2-bit spritesheets instead of a single 4-bit spritesheet. I took a shot at animating the process to show how it works.
Read more about it on my neocities blog!
Acknowledgements
I owe a lot of my understanding to Two Owls and 8-bit Caaz. Check out these posts for more
So the Pico-8 supports GPIO on the Raspberry Pi and Pocket Chip, but I don't want to have to use Raspberry Pi or the pocket chip just for GPIO! The Pi Pico does have GPIO that could be used, but I don't know if it connects with the Pico-8, I really want to make something interactive and it would be really helpful. Does anyone know any alternatives?
I just want to make some LED's light up, nothing to fancy, just want to send stuff in and outside of the Pico-8!
It would also be extremely helpful if I could at least do the same on Picotron, because that has WAYYY more room to put microcontroller GPIO entries in
I took the retro space game aspect in a different direction by looking towards space invaders but simplified the concept to having the enemies coming at you, like Galaga. The game uses a few states, the title, the game, and the game over state. It will cycle through all three, with the game over state triggering if the player reaches zero health, and the title retriggering after the game over state while also showing your high score so far. I tried to emulate the drift-esque movement of a space ship, by having the values of one direction go up as you push one direction and then go down as time goes on or goes faster if the opposite direction is pushed. It didn’t quite work the way I wanted and is the thing that I think needs the most revision.
If anyone else is reading this and is getting started with Pico 8, I would definitely try something like this or any simple top down game first. Platformers have a lot more physics elements to balance when making them, and something like pong will have some intimidating math for the ball bouncing (as silly as that sounds). I also would say to not use rectfill for your sprites, I was coming off p5js and that was the easier option for me there. It was also easier to focus on the game that way, but it actually strains the engine more and can cause flickering. I would definitely just make super simple sprites to start off with, or just get some online as there are a lot of free packs to choose from.
pico8 debugprint cartridge
to use:
n main cart:
#include debugprint.p8
in _draw function after cls():
x is topleft x , y is topleft y
drawprint(x,y)
at lines to add and update variables of:
name is display label of value, value is the value displayed
addprint(name,value)
[github page](https://github.com/willWallace-RIT/pico-8_debugprint
example
tab displays debug info
left key adds to x0
Thought of this today while I was on a hike
I thought it might be cool to teach a class on making games with PICO-8
The first theme I thought of was "making games with math" and this was the result
My record is 5.9667
It started off fun and what I think could be accessible to even newbie programmers, but things got a little too complicated when I needed the "aimer" to "shoot"
The bullet (yes, singular bullet, that never despawns, just hides) and the targets might be a bit too advanced. I tried using simple syntax but that ended up being confusing (and I kept getting way too many syntax errors grrrr). If I were to stuff this into an intro course, I would probably just do it the advanced way or dumb the game down





0 comments
