610 games and counting

Anx - Social Anxiety Simulator V1.0

By jcwilk Published on Jul 11th, 2017 Last updated on Nov 1st, 2018

Anx - A game about social anxiety. Make your way to the safety of your home while avoiding humans and trying not to panic. Explore 3 different somewhat large 3d areas (defined using the 2d pico8 map tool) and get chased down by chatty pathfinding mobs look at you in your eyes and make your poor digital self flip out and lose touch with reality as the pixels of the world tremble and break apart.

up/down - forward/backwards
left/right - turn
A/B - strafe left/right (if using the keyboard, use X and C. If you want to reverse these there's an option in the menu.)

source on github - It's compiled into anx.p8 from a few different files then the whitespace and comments are stripped out into publish.p8. Start with main.lua which will be the easiest to read and which contains all the code and references to the other files.

This is a 3D game I've been working on for awhile which is not really done in that I'd like to put much more art in it (it has room for ~3x the art that's in there so far) but it's basically feature complete and playable so I figured I'd release a first version since the previous WIP was very old. The code is a little rugged and I'm not sure I'd recommend reusing it (although you totally can if you want) but I just thought it was a fun way to explore what Pico-8 was capable of while getting my hands dirty with low level 3D code. It doesn't perform super well and there's some room for further optimization but it's fairly far in the realm of diminishing return at this point when the game already mostly works.

It renders the walls and mobs differently, but what they have in common is that it starts from the left and renders every pixel column individually. If it detects that it's running out of time, it will skip a column by rendering the next column twice as wide. Using this method, it's able to (most of the time) keep up at 30 fps even though the underlying code is not super efficient or mathematically sophisticated. It's a little bit more complicated than this because it actually renders the pixel columns of the objects one at a time and sorts them by depth and figures out how wide each wall/mob pixel is by which rays hit them, but that's the general idea.

When anxiety is accumulated, random vertical offsets are added to each pixel column to make them look sort of like rumbling books on a shelf as well as fisheye, field of view, height adjustments, and a terrible stress inducing music track. Once the panic attack hits... well, the books get torn apart ;P

Walls - Each pixel column is calculated independently and the height is drawn according to distance to the intersection of the wall, which gives the walls the nice even slopes. Because walls are always aligned to x/y axis, the calculations for this are simpler and quicker.

Mobs - Each mob has each pixel column rendered individually, but where the mob will be rendered on the screen is sort of planned/cached once per frame per mob instance on the screen lazily the first time the mob is struck by a ray. The mobs are calculated based on distance to the center of the mob which is why the mob edges are not sloped (unlike the walls) and they are only horizontally skewed. The darkened side edges are somewhat inelegantly hacked in to look 3D but are just sort of "cast" off of the pixels based on basic dot product calculations of 90 degrees off the face. I like the aesthetic though :D