A real-time, Galaga-style space shooter arcade game built specifically for BoinkOS—a custom 32-bit x86 protected mode operating system.
Void Blaster features real-time, non-blocking rendering, custom pseudorandom alien movement and bomb patterns, active dive-bombing swoop physics, dynamic difficulty scaling across multiple waves, a score/wave header, a Play Again menu, and smooth, flicker-free terminal rendering using VESA console cursor control.
- Classic Arcade Gameplay: Swaying alien formations, random swoop dive-bombs, and real-time projectiles.
- Flicker-Free Rendering: Uses a "Dirty Rects" clearing algorithm to update only the moving screen characters, avoiding costly full-screen VESA page redraws.
- Non-Blocking Control: Extended OS console interrupts allow smooth keyboard checks without halting game logic.
- Gradual Difficulty Scaling: Wave 1 starts slow with half-speed dive bombers, low bomb frequency, and larger delay frames. Subsequent waves dynamically speed up the game loop and make the aliens more aggressive.
- Play Again Loop: When the game ends, the Game Over screen displays your score and allows you to press
Pto restart orQto quit. - Custom PRNG Engine: An independent linear congruential generator (LCG) is used for generating random numbers without external C library dependency.
| Key | Action |
|---|---|
A |
Slide Ship Left |
D |
Slide Ship Right |
Space |
Fire Laser Cannon |
Q |
Quit Game (Triggers Game Over) |
P |
(At Game Over Screen) Play Again |
Q |
(At Game Over Screen) Quit to Shell |
Void Blaster requires console cursor movement and non-blocking input, which are supported by adding/modifying the following system APIs in BoinkOS:
-
File:
kernel/sys/syscall.hAdd the system call ID definition:#define SYSCALL_SET_CURSOR 7
-
File:
kernel/sys/syscall.cAdd the case handler for setting the cursor insidehandle_syscall, and update the keyboard handler case to support a non-blocking check whenarg1 == 1:case SYSCALL_SET_CURSOR: console_set_cursor(arg1, arg2); return 1; case SYSCALL_GETCHAR: __asm__ __volatile__("sti"); if (arg1 == 1) { if (kbd_has_char()) { return (int)kbd_read_char(); } return 0; // Return immediately if no key is pressed } else { char c = read_key(); return (int)c; // Standard blocking read }
-
File:
include/syscall.hDefine the matching system call:#define SYSCALL_SET_CURSOR 7
-
File:
include/stdio.hDeclare the API signatures:void set_cursor(int x, int y); char getchar_nonblock();
-
File:
src/stdio.cImplement the userland wrapper calls:void set_cursor(int x, int y) { syscall(SYSCALL_SET_CURSOR, x, y, 0, 0, 0); } char getchar_nonblock() { return (char)syscall(SYSCALL_GETCHAR, 1, 0, 0, 0, 0); }
Note: Make sure to clean and rebuild the C library (make -C libc clean && make -C libc inside boink-userland-template) so that the updated libc.a exposes these headers and functions before compiling.
To build and run Void Blaster, you need:
- The BoinkOS kernel source tree.
- The userland C library (
boink_libc). - An
i686-elfcross-compilation toolchain (i686-elf-gcc,i686-elf-ld,nasm). - GLFS filesystem tools (
glfs-mkfs,glfs-add). - QEMU (
qemu-system-i386) to run the emulator.
-
Compiling the Game Move the source code file
void_blaster.cinto thesrcfolder of your BoinkOS userland template repository:# Move void_blaster.c to boink-userland-template/src/ cp src/void_blaster.c ../boink-userland-template/src/void_blaster.c -
Add Build Target to Makefile Make sure your userland
Makefileis configured to outputvoid_blaster.elf:GAME_OBJS = src/void_blaster.o build/crt0.o LIBC = libc/build/libc.a game: $(GAME_OBJS) $(LIBC) $(LD) $(LDFLAGS) -o build/void_blaster.elf $(GAME_OBJS) $(LIBC)
Compile the userland target:
make game
-
Packaging into GLFS Disk Image Configure the OS disk target inside
boink_os/Makefileto copy the generatedvoid_blaster.elfexecutable into the GLFS disk image asblast.elf:disk: $(KERNEL_BIN) glfs-mkfs boinkos.glfs glfs-add boinkos.glfs $(KERNEL_BIN) boink.bin # Add the compiled game executable glfs-add boinkos.glfs ../boink-userland-template/build/void_blaster.elf blast.elf
Generate the updated disk image:
make disk
-
Running inside QEMU Boot BoinkOS inside QEMU:
make run
-
Launching the Game Once the BoinkOS shell boots successfully, type the following command to execute the binary:
exec-elf blast.elf
Licensed under the MIT License (fully compatible with the BoinkOS Organization licensing model).
- Developer: Chirag P Patil (cp099)