Log In  

DOOMY (overdue Pico-1k jam)

by p01
Cart #doomy-1 | 2021-10-13 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

DOOMY, a tiny first person shooter in 1024 bytes, with collision detection, arbitrary walls, texture w. fog, sound effects, a couple of baddies and a death screen πŸ‘ΉπŸ‘ΊπŸ’₯

Controls & Goal

Move around with the Left, Right and Up arrow keys. Shoot with X or C.
You start with 10 health points, and need to shoot as many baddies until they get you good!


Seeing great and cute entries closing Pico-1k jam was inspiring. That's when I got an idea: "all things SSPR" to balance this cuteness with DOOMY pointless violence and big pixels.

Technical details

In a nutshell DOOMY is a rotozoom (the effect you get when rotating and zooming an image) laid down flat and rendered with scaled sprites.


The textures, sprites, and the base of the level are rendered as a group of rectfill and text in the first 3 lines of code, with first two textures of 8x8 for the walls, then 2 baddies, and finally the base of the level.

In the following 4 lines, the base of the level is expanded and some diagonal walls are added.

Every "thing" in DOOMY goes in the β–₯ object which contains the x,y,t,w properties for the x,y position of the thing, it's texture index t and width w (nil or 1 for walls, 8 for the baddies)

Game loop

In the game loop the things in β–₯ are rotated and moved into another object, 🐱, if they are in the visibility fustrum. The baddies move erratically towards the player.

The things in 🐱 are then sorted and rendered back to front, if one of these thing is large, it means it's a baddy and we render a shadow with an ovalfill

Collisions and baddies hit

For the collision detection, we check the distance of the last thing we drew. Blocking the way forward if it's very close.

We check the color of the pixel under the crosshair to know if it's a baddy. If you shoot we play a noise, increase the score and respawn it at a random location. Otherwise there is a 10% chance it will shoot you with a red flash and some noise.

You know the baddies are bad because they keep shooting you even when you're down!

Source code

u=.2v=1.5a=0p=0h=10β–₯={}r=rectfill f=add
β—†=pget?"β˜…%=  ᢜ8🐱z}",f(β–₯,{x=4,y=5,t=16,w=8}),1,6
memcpy(0,6^13,β§—)for y=0,9,1/8do
for x=0,9,1/8do
function _draw()cls(1)r(0,60,127,68,5)l=rnd
local 🐱,c,s,q,d,w,x,y={},cos(a)*8,sin(a)*8,64
for z in all(β–₯)do
if(z.v<48and abs(z.u)<z.v)f(🐱,z)end
for i=2,#🐱 do for j=1,i do
e=6-2*min(1,h)pal(6,13)for d in all(🐱)do
w=d.w or 1x=q+z*(d.u-w/2)y=q-z*e
if(b&4>0and z<40)u+=c/q v+=s/q
?"♥"..h.."  β˜…"..p,44,119
if(c>7and c<13)then

That's all folks

Hope you enjoy this tiny showdown

P#98580 2021-10-13 14:55 ( Edited 2021-10-13 14:59)

Neat! This works surprisingly well, and the fact that you technically have depth-based lighting and shadows is kind of amazing. If you could find a way to squeeze in backwards movement, that would be cool, but impressive job anyway.

My high score so far is 29.

P#98585 2021-10-13 15:56 ( Edited 2021-10-13 15:57)

Pretty cool how little you really need to make an FPS, but not having a gun is a little bit strange. Great job overall!

P#98586 2021-10-13 15:57

This is such a great 1k game!
Plays really well too, considering the limitations.
Thanks for the technical write-up also, very interesting.
Congrats again on squeezing it all in! πŸ€“πŸ‘

P#98619 2021-10-14 04:13

This is amazing. Do you have the "clean and commented" version anywhere?

P#98670 2021-10-15 01:56

This is awesome

P#98672 2021-10-15 03:26

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2021-10-19 15:40:14 | 0.014s | Q:26