bobn

module
v0.0.0-...-2ee3bae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2025 License: Apache-2.0

README ยถ

    โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ•—
    โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•‘
    โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘
    โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘
    โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘ โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ•‘
    โ•šโ•โ•โ•โ•โ•โ•  โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•  โ•šโ•โ•โ•โ•
     S P A C E   D E F E N D E R   โ–  โ–ฒ โ—
       .  *  .   โ–ฒ    .  *   .    *    .
    *    .   /   \   .    *   .   *   .
  .   *    /  O O  \    .   *   โ–    .   *
    .    /___________\  *   .  / \  .
  *   .    |  โ– โ– โ–   |    .   * |___| *  .
    .  *   |_______|  .    *    .   *
  .    *    .    โ—    *   .    โ–ฒ    .  *

Go Version WASM License

A retro arcade space shooter controlled by your head movements!

Play Now โ€ข Features โ€ข Controls โ€ข Development


๐Ÿš€ About BOBN

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  โ–ฒ                              โ”‚
    โ”‚ /_\  INCOMING INVADERS!         โ”‚
    โ”‚  |                              โ”‚
    โ”‚      โ–  โ–  โ–  โ–  โ–  โ–  โ–  โ–  โ–  โ–         โ”‚
    โ”‚      โ–  โ–  โ–  โ–  โ–  โ–  โ–  โ–  โ–  โ–         โ”‚
    โ”‚      โ–  โ–  โ–  โ–  โ–  โ–  โ–  โ–  โ–  โ–         โ”‚
    โ”‚                                 โ”‚
    โ”‚            โ–ฒ                    โ”‚
    โ”‚         โ”€โ”€โ•โ–ผโ•โ”€โ”€                 โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

BOBN is a browser-based Space Invaders game written in Go and compiled to WebAssembly. What makes it special? You control your ship using head movements tracked by your webcam!

๐ŸŽฎ Key Features
     โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™
    โˆ™  โ”Œโ”€โ”€โ”€โ”  FEATURES  โ”Œโ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”   โˆ™
    โˆ™  โ”‚ โ–ฒ โ”‚            โ”‚ โ–  โ”‚  โ”‚ โ— โ”‚   โˆ™
    โˆ™  โ””โ”€โ”€โ”€โ”˜            โ””โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”˜   โˆ™
     โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™
  • ๐ŸŽฅ Camera-Based Control - Move your head left/right to control your ship
  • ๐Ÿ•น๏ธ Classic Arcade Gameplay - Authentic Space Invaders experience
  • ๐ŸŒ Pure Browser-Based - No downloads or plugins required
  • โšก Go + WebAssembly - Fast, efficient performance
  • ๐ŸŽจ Retro CRT Effects - Scanlines, phosphor glow, and arcade aesthetics
  • ๐Ÿ“Š Live Head Tracking Display - ASCII art visualization of camera feed
  • ๐Ÿ† High Score Tracking - Compete for the top score

๐ŸŽฏ Quick Start

    โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
    โ•‘  > INITIALIZING SYSTEM...     โ•‘
    โ•‘  > LOADING WASM MODULE...     โ•‘
    โ•‘  > READY PLAYER ONE           โ•‘
    โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
Prerequisites
  • Go 1.21 or higher
  • Modern web browser with WebAssembly support
  • Webcam (for head tracking control)
Installation & Running
# Clone the repository
git clone https://github.com/jonasrmichel/bobn.git
cd bobn

# Build and run
make run

# Open in browser
# Navigate to http://localhost:8080

๐ŸŽฎ How to Play

      CONTROLS           MOVEMENT
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ [SPACE]  โ”‚       โ”‚  โ†   โ†’  โ”‚
    โ”‚  FIRE    โ”‚       โ”‚  HEAD   โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ [ENTER]  โ”‚       โ”‚  [ESC]  โ”‚
    โ”‚  START   โ”‚       โ”‚  PAUSE  โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Game Modes
  1. Attract Mode - Press ENTER or click START to begin
  2. Playing - Destroy all invaders before they reach you
  3. Game Over - Your final score is displayed
Scoring
    โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
    โ•‘  ENEMY POINT VALUES  โ•‘
    โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ
    โ•‘  โ–  = 10 POINTS       โ•‘
    โ•‘  โ–ฒ = 20 POINTS       โ•‘
    โ•‘  โ— = 30 POINTS       โ•‘
    โ•‘  โ—† = ???  MYSTERY    โ•‘
    โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

๐Ÿ› ๏ธ Development

     โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™
    โˆ™    < CODE STRUCTURE >     โˆ™
    โˆ™      /    |    \          โˆ™
    โˆ™    cmd  internal  web     โˆ™
     โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™โˆ™
Project Structure
bobn/
โ”œโ”€โ”€ cmd/
โ”‚   โ”œโ”€โ”€ server/          # HTTP server
โ”‚   โ””โ”€โ”€ wasm/            # WASM entry point
โ”œโ”€โ”€ internal/
โ”‚   โ”œโ”€โ”€ game/            # Game engine & logic
โ”‚   โ”‚   โ”œโ”€โ”€ engine.go    # Core game loop
โ”‚   โ”‚   โ”œโ”€โ”€ entities.go  # Game objects
โ”‚   โ”‚   โ””โ”€โ”€ state.go     # Game state management
โ”‚   โ””โ”€โ”€ wasm/            # WASM-specific code
โ”‚       โ”œโ”€โ”€ bridge.go    # JS interop
โ”‚       โ”œโ”€โ”€ camera.go    # Head tracking
โ”‚       โ””โ”€โ”€ renderer.go  # Canvas rendering
โ”œโ”€โ”€ web/
โ”‚   โ”œโ”€โ”€ index.html       # Game UI
โ”‚   โ”œโ”€โ”€ arcade.css       # Retro styling
โ”‚   โ””โ”€โ”€ wasm_exec.js     # Go WASM support
โ””โ”€โ”€ Makefile            # Build automation
Build Commands
# Build everything
make all

# Build WASM only
make wasm

# Build server only
make server

# Run development server
make run

# Clean build artifacts
make clean
Development Tips
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  ๐Ÿ’ก PRO TIPS:               โ”‚
    โ”‚                             โ”‚
    โ”‚  โ€ข Use Chrome DevTools      โ”‚
    โ”‚  โ€ข Check console for logs   โ”‚
    โ”‚  โ€ข Test with good lighting  โ”‚
    โ”‚  โ€ข Adjust camera threshold  โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŽจ Customization

Adjusting Head Tracking Sensitivity

Edit internal/wasm/camera.go:

// Increase/decrease sensitivity
gameX := -((c.smoothedX - 0.5) * 4.0) // Change multiplier

// Adjust detection threshold
if brightness > 80 { // Lower = more sensitive
Modifying Game Difficulty

Edit internal/game/engine.go:

// Invader speed
baseInvaderSpeed: 1.0  // Increase for harder

// Invader drop distance
invaderDropDistance: 20.0  // Pixels per drop

๐Ÿš Architecture

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚          BROWSER                 โ”‚
    โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
    โ”‚  โ”‚      HTML/CSS UI          โ”‚  โ”‚
    โ”‚  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค  โ”‚
    โ”‚  โ”‚    WASM Game Engine       โ”‚  โ”‚
    โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚  โ”‚
    โ”‚  โ”‚  โ”‚ Camera   โ”‚  Game     โ”‚ โ”‚  โ”‚
    โ”‚  โ”‚  โ”‚ Tracking โ”‚  Logic    โ”‚ โ”‚  โ”‚
    โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚  โ”‚
    โ”‚  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค  โ”‚
    โ”‚  โ”‚    Canvas Rendering       โ”‚  โ”‚
    โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Key Components
  • Game Engine: Fixed timestep loop at 20Hz
  • Rendering: 60 FPS canvas updates
  • Camera Processing: 30 FPS head tracking
  • Input System: Keyboard and camera hybrid control

๐ŸŽฎ Game Features

     WAVES              ENEMIES
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  1  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€> โ”‚ โ–  โ–  โ–  โ–  โ”‚
    โ”‚  2  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€> โ”‚ โ–  โ–  โ–  โ–  โ”‚
    โ”‚  3  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€> โ”‚ โ–ฒ โ–ฒ โ–ฒ โ–ฒ โ”‚
    โ”‚  4+ โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€> โ”‚ โ— โ— โ— โ— โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”˜           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • Progressive difficulty increase
  • Wave-based gameplay
  • UFO bonus targets
  • Life system
  • Score tracking

๐Ÿ› Troubleshooting

    โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
    โ•‘     COMMON ISSUES & FIXES      โ•‘
    โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
Issue Solution
Camera not working Allow camera permissions in browser
Black game screen Refresh page, check console for errors
Laggy controls Ensure good lighting for camera
Ship not responding Press ENTER to start game first

๐Ÿ“œ License

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚   Apache License 2.0       โ”‚
    โ”‚   Copyright 2025           โ”‚
    โ”‚   Jonas Michel             โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

This project is licensed under the Apache License, Version 2.0 - see the LICENSE file for details.

You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0


๐Ÿค Contributing

      โ–ฒ
     /_\    CONTRIBUTORS WELCOME!
    [___]
     | |    Fork โ†’ Code โ†’ PR
     |_|
  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐ŸŽฏ Roadmap

    [ ] Multiplayer support
    [ ] Power-ups & bonuses
    [ ] More enemy types
    [ ] Sound effects
    [ ] Mobile touch controls
    [ ] Leaderboard system

๐Ÿ‘พ Credits

     โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
     โ•‘  CREATED BY              โ•‘
     โ•‘  Jonas Michel            โ•‘
     โ•‘                          โ•‘
     โ•‘  INSPIRED BY             โ•‘
     โ•‘  Space Invaders (1978)   โ•‘
     โ•‘  By Tomohiro Nishikado   โ•‘
     โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

    GAME OVER

    โ–ฒ โ–  โ— โ–ฒ โ–  โ— โ–ฒ โ–  โ— โ–ฒ โ–  โ—

    INSERT COIN TO CONTINUE

    [ PRESS START ]

Made with โค๏ธ and Go

โฌ† Back to Top

Directories ยถ

Path Synopsis
cmd
server command
wasm command
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL