sql-space-invaders/README.md
Ari Archer 1588aa4c32
galaga
Signed-off-by: Ari Archer <ari@ari.lt>
2025-02-04 01:56:26 +02:00

41 lines
1.4 KiB
Markdown

# 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>