Space invaders in SQLite3 with a C rendering engine. Or Galaga, I guess, I mixed it up :( https://www.youtube.com/watch?v=y8twLGfE210
Find a file
Ari Archer 1588aa4c32
galaga
Signed-off-by: Ari Archer <ari@ari.lt>
2025-02-04 01:56:26 +02:00
scripts Implement the C renderer. 2025-02-04 00:10:56 +02:00
src Include conf.h in game_switch.h 2025-02-04 01:42:33 +02:00
.clang-format Init 2025-02-03 18:20:38 +02:00
.editorconfig Init 2025-02-03 18:20:38 +02:00
.gitignore Add SQL logic 2025-02-03 20:09:33 +02:00
LICENSE Init 2025-02-03 18:20:38 +02:00
Makefile Add SQL logic 2025-02-03 20:09:33 +02:00
README.md galaga 2025-02-04 01:56:26 +02:00

SQL Space Invaders

Space invaders in SQLite3 with a C rendering engine.

note: Turns out I got the gameplay wrong, and I just verified it. I mixed it up with another game and I can't put my finger on it now. Oh well, had fun with this anyway. Close enough. Galaga?

Recently I watched this video: https://youtu.be/Ly9dtWwqqwY?t=183 and it talked about functional and object oriented programming. In that video, a statement was said that piqued my interest:

For example, SQL is a good example of a DSL, and it's great in finding a collection of records in a set, but it'd be a rather poor choice for writing space invaders

And I thought to myself - would this be even possible? Especially in SQLite? Turns out it is :D

Of course, rendering in SQLite is near impossible, however, combined with a C front-end this was more than possible.

Requirements

  • A C compiler
  • Libsqlite3
  • Make
  • Linux, probably

Compiling and Running

make game.db && make
./sql-space-invaders game.db
  • Press h to move left
  • Press l to move right
  • Press k to shoot a bullet

Configuring

You can configure stuff in src/sql/init.sql where the initial parameters are stored.

Scoring

The game is scored in how many ticks you manage to survive, however, you can change it to being how many invaders you kill by removing the score logic in state.sql and moving it to kill logic in invaders.sql.

Live Demo

https://www.youtube.com/watch?v=y8twLGfE210