-- PICO-8 Arcade Shooter: Square vs. Circles
-- Game Logic and Setup
-- Constants
w, h = 128, 128
max_stars = 40
player_speed = 1.5
enemy_speed = 0.5
bullet_speed = 3.5
player_size = 6
enemy_radius = 4
-- Global State
player = {}
bullets = {}
enemies = {}
stars = {}
score = 0
lives = 3
game_over = false
spawn_timer = 0
invuln_timer = 0 -- Player invincibility after being hit
last_move_dir = {x = 0, y = -1} -- Used for bullet direction
-- Initialize Game
function _init()
-- Reset game state
lives = 3
score = 0
game_over = false
bullets = {}
enemies = {}
spawn_timer = 0
invuln_timer = 0
-- Player position (center of screen)
player.x = w / 2
player.y = h / 2
-- Generate starfield
for i=1, max_stars do
add(stars, {
x = rnd(w),
I posted a few days ago about implementing Nuclear Throne style level generation I have been tinkering around with it, current progress so far,
- I got a character
- larger rooms
- An "accidental" flame thrower.
Wrote a custom ECS system that can handle well over 2.5k entities easily(probably can handler much higher but I didn't bother to check :p)
Still need to implement enemies n all, but I am having pretty fun with pico8 :D
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?





0 comments

