Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Void Blaster

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.


Game Design & Features

  • 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 P to restart or Q to quit.
  • Custom PRNG Engine: An independent linear congruential generator (LCG) is used for generating random numbers without external C library dependency.

Controls

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

Required System Patches (Kernel & C Library)

Void Blaster requires console cursor movement and non-blocking input, which are supported by adding/modifying the following system APIs in BoinkOS:

1. Kernel Changes (boink_os)

  • File: kernel/sys/syscall.h Add the system call ID definition:

    #define SYSCALL_SET_CURSOR 7
  • File: kernel/sys/syscall.c Add the case handler for setting the cursor inside handle_syscall, and update the keyboard handler case to support a non-blocking check when arg1 == 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
        }

2. C Library Changes (boink_libc)

  • File: include/syscall.h Define the matching system call:

    #define SYSCALL_SET_CURSOR 7
  • File: include/stdio.h Declare the API signatures:

    void set_cursor(int x, int y);
    char getchar_nonblock();
  • File: src/stdio.c Implement 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.


Installation & Compilation Guide

Prerequisites

To build and run Void Blaster, you need:

  1. The BoinkOS kernel source tree.
  2. The userland C library (boink_libc).
  3. An i686-elf cross-compilation toolchain (i686-elf-gcc, i686-elf-ld, nasm).
  4. GLFS filesystem tools (glfs-mkfs, glfs-add).
  5. QEMU (qemu-system-i386) to run the emulator.

Build and Package Steps

  1. Compiling the Game Move the source code file void_blaster.c into the src folder 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
  2. Add Build Target to Makefile Make sure your userland Makefile is configured to output void_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
  3. Packaging into GLFS Disk Image Configure the OS disk target inside boink_os/Makefile to copy the generated void_blaster.elf executable into the GLFS disk image as blast.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
  4. Running inside QEMU Boot BoinkOS inside QEMU:

    make run
  5. Launching the Game Once the BoinkOS shell boots successfully, type the following command to execute the binary:

    exec-elf blast.elf

License

Licensed under the MIT License (fully compatible with the BoinkOS Organization licensing model).


Credits

  • Developer: Chirag P Patil (cp099)

About

A real-time, Galaga-style space shooter arcade game built specifically for the custom x86 32-bit protected mode BoinkOS operating system.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages