aqZ5

In this post I will reminisce about this game I just completed. For anyone interested in playing it before reading the spoilers below point your browser to https://sordidaugust.itch.io/aqz5 and download the game NOW.

As mentioned in the previous post, there was a ten day game jam starting on April 20th, where participants had to make any game of their choice in lisp. I had just completed a foreign function interface to OpenGL as a first project in Common Lisp and decided to join the fray. Two days before the jam started I had nothing more then a few functions from SDL2 to open windows, a OpenGL 3.3 foreign function interface, a function to load PGM2 images (a simple ASCII format for greyscale images) and a few routines I made to uv map a 512×512 PGM2 atlas of letters to render text. Here is all of this in action minus text rendering: 2018-04-18-220444_1909x870_scrot

My idea for the jam, given the time constraints, was a 3rd person shooter where you take control of a mighty blue circle you need to bring safely from one end of a white room to another taking cover behind boulders while getting shot at by NPCs (also circles). Stepping on a checkpoint at the end of the room would trigger an alarm with flashing red light permeating the room bringing upon you a final wave of NPCs you need to take out. Because it wouldn’t be possible to add sound effects the idea was to have onomatopoeia in text bubbles replace the sound of gun shots.

In the first two days I made some utilities so I could write gpu kernels in lisp syntax rather then glsl strings. For example writing this:

2018-04-21-202927_642x94_scrot2

would automatically be expanded into this:

2018-04-21-202943_534x126_scrot1

for OpenGL. I also made it so that any recompilation of the lisp shader while the game is running could be seen on the screen. This turned out to be useful to develop light shaders faster.

2018-04-22-115527_844x631_scrot

On the 22nd and 23rd I wrote some functions to draw the room and characters. When I decided to go with a tiled floor the lack of antialiasing was unbearable. Using multi-sample render buffers worked out great:

2018-04-22

The next three days were entirely dedicated to the collision response system. I ported the implementation I had made in C of the method explained by Erin Catto in his famous paper Iterative Dynamics with Temporal Coherence.

collision

By the 27 at the end of the day I had bullets flying and an awesome macro to make levels. Here is what a level definition looks like in the final game:

2018-05-03-223214_437x491_scrot

The first two elements are the width and height of the map with origin at the centre. Boulders are defined as either convex polygon vertices or rectangles with the position of either its top left corner or its centre, its width and its height. Then you define the spawn points of the player and any amount of NPCs you want and finally the checkpoint. The macro initializes everything needed for the game from collision geometry to vertices for a 3D rendering of the level and player/NPCs. The next day I would redefine the macros of this very good raw SDL2 bindings for Common Lisp written by Zulu-Inuoe https://github.com/Zulu-Inuoe/raw-bindings-sdl2 so as to work with the SBCL’s foreign function interface rather then CFFI. At the moment my translation is garbage but it was good enough to process keyboard and mouse input.

2018-04-28-004033_1920x1080_scrot

The last two days were spent on implementing the camera, gameplay state machine (respawn, timers, checkpoint, …), adding the onomatopoeia’s (didn’t have time to add action bubbles around them), flashing red alarm and some final tweaks to make everything feel better.

2018-05-03-225513_1920x1080_scrot 2018-05-03-225613_1920x1080_scrot