A space adventure game where players pilot spacecraft through gravitational fields created by black holes to reach portals at the end of each level.
Singularity is an original arcade-style game that challenges players to navigate through 10 increasingly difficult levels filled with black holes, asteroids, and gravitational forces. Players can choose from four different spacecraft, each with unique characteristics, and must use skill and physics to surf gravitational waves to victory.
- Responsive Design: Locked 1280x720 aspect ratio that scales perfectly to any screen size
- 4 Unique Spacecraft: Each with different speed and mass characteristics
- 10 Challenging Levels: Progressively difficult scenarios with moving black holes
- Physics-Based Gameplay: Realistic gravitational forces affect both player and asteroids
- JSON Level System: Easy-to-edit level configurations
- Clean Architecture: Modular code structure for maintainability
- Superbug - Balanced craft with good speed and moderate mass
- Psych Bike - High speed, low mass - fast but easily affected by gravity
- The Compiler - Maximum speed, high mass - powerful but harder to control
- Voidwalker - Lower speed, moderate mass - stable and predictable
- A modern web browser (Chrome, Firefox, Safari, Edge)
- A local web server (optional but recommended)
- Clone or Download the repository
- Navigate to the project directory
- Serve the files using one of these methods:
# Install dependencies
npm install
# Start the development server
npm startThe game will be available at http://localhost:3000
# Python 3
python -m http.server 8000
# Python 2
python -m SimpleHTTPServer 8000Then open http://localhost:8000/public/ in your browser
- Install the "Live Server" extension in VS Code
- Right-click on
public/index.html - Select "Open with Live Server"
You can open public/index.html directly in your browser, but level loading may not work due to CORS restrictions.
Singularity-Arcade-Game/
├── public/
│ ├── index.html # Main HTML file
│ ├── sketch.js # Main P5.js entry point
│ ├── game.js # Core game logic and state management
│ ├── classes.js # Game object classes
│ ├── style.css # Styles
│ ├── volt.ttf # Game font
│ └── p5.js # P5.js library
├── levels/
│ ├── level1.json # Level configurations
│ ├── level2.json
│ └── ... (level1-10.json)
├── package.json # Node.js dependencies
└── README.md # This file
- Mouse: Move your spacecraft by moving the mouse cursor
- Click: Navigate through menus and select spacecraft
- Objective: Reach the glowing finish line at the right side of each level
Levels are stored as JSON files in the levels/ directory. Each level defines:
- Black holes with positions, sizes, and movement patterns
- Asteroid spawn configurations
- Special items like extra lives
- Finish line position and dimensions
{
"levelNumber": 1,
"name": "Training Course",
"blackHoles": [
{
"x": 0.5, // X position (0-1 normalized)
"y": 0.5, // Y position (0-1 normalized)
"size": 0.278, // Size (normalized to screen height)
"isMoving": false,
"moveAngle": 0,
"moveRadius": 0
}
],
"asteroids": {
"count": 13,
"spawnSides": ["right", "top", "bottom"]
}
}The game uses a normalized coordinate system (1280x720) that automatically scales to fit any screen size while maintaining the correct aspect ratio. All positions and sizes are calculated relative to these base dimensions.
- Black holes exert gravitational force on both the player and asteroids
- Force calculations use realistic physics equations
- Moving black holes create dynamic gravitational fields
- game.js: Main game state management and rendering coordination
- classes.js: Individual game object definitions (BlackHole, Star, Asteroid, Player)
- sketch.js: P5.js integration and event handling
- Create a new JSON file in the
levels/directory (e.g.,level11.json) - Follow the existing level structure
- Update the victory condition in
game.jsto handle additional levels
Edit the getCraftData() method in the Player class in classes.js to adjust speed, mass, or add new craft types.
Modify the gConstant value in the updateGravity() method to change the strength of gravitational effects.
- Chrome/Chromium: Full support
- Firefox: Full support
- Safari: Full support
- Edge: Full support
- Mobile browsers: Supported with responsive scaling
The game is optimized for smooth 60fps gameplay on modern devices. The responsive scaling system ensures consistent performance across different screen sizes and resolutions.
- 2025: Complete refactor with responsive design, JSON levels, and clean architecture
- 2019-2024: Original development and iterations
Copyright © 2019 Tom Wesley
This original novelty arcade game allows users to pilot a spacecraft which surfs on the gravitational waves of black holes to explore various galaxies.