Lisp vs Blub Empire
Lisp is the best language. But the Blub Empire is taking over the world!
Fight for your favorite programming language in this Medieval Strategy Game.
This game is an entry for the Lisp Game Jam 2018.
Sorry for the dumb AI, it is definitely bad, but I didn't got the time to make it fun to play against.
Don't hesitate to zoom the page to better see the game.
How to play:
I - move the cursor up
K - move the cursor down
J - move the cursor left
L - move the cursor right
H - action
G - cancel
When a unit is selected:
Action(H) on an empty tile - Move
Action(H) on an opponent next to the unit - Attack
Action(H) with cursor on the unit - Use one coin to level up the unit
The game is written in a custom Lisp language called wasm-adventure (written in Racket) that transpiles directly to WebAssembly.
This means the game does not use any framework nor graphics engine. I had to build everything from the ground up byte by byte in assembly, then write utility functions to draw to the screen (which basically consists in writing bytes to a specific location in memory).
I wanted to try that because WebAssembly in its text format actually uses s-expressions. If I can write a lisp language that generates s-expressions, I can generate WebAssembly.
Under the hood example:
A simple wasm-adventure function I wrote:
(func move-cursor-up () (locals pos) (set-local pos (load-byte (mem 'game 'cursor-pos))) (store-byte (mem 'game 'cursor-pos) (call 'row-up pos)))
Then Racket transforms the code into a WebAssembly function:
(func $move-cursor-up (local $pos i32) (set_local $pos (i32.load8_u (i32.const 7878))) (i32.store8 (i32.const 7878) (call $row-up (get_local $pos))))
Then the web assembly toolkit resolves the code into this 1-to-1 equivalent WebAssembly binary:
(func $func18 (local $var0 i32) i32.const 7878 i32.load8_u set_local $var0 i32.const 7878 get_local $var0 call $func12 i32.store8)
As you can see, this looks fairly close to actual CPU assembly, except it runs in the browser!
Leave a comment
Log in with itch.io to leave a comment.