Skip to content

Pjpj42/GridRacer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

25 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

GridRacer

A turn-based vector racing game for iOS

Version Platform Swift License

GridRacer is a strategic racing game inspired by classic pen-and-paper racing games. Navigate a grid-based track using velocity and acceleration vectors. High speed means fast progress but less controlโ€”crash into walls and lose one of your three lives!

Features

  • ๐ŸŽ๏ธ Turn-based vector racing - Position + velocity + acceleration physics
  • ๐ŸŽฎ 2-player local multiplayer - Take turns, see opponent moves
  • ๐Ÿ’ฅ Collision detection - Bresenham algorithm checks entire movement path
  • โค๏ธ Lives system - 3 lives per player with respawn
  • ๐Ÿ Lap counting - First to complete a lap wins
  • โœจ Visual polish - Grid lines, checkerboard finish, animated indicators
  • ๐ŸŽฏ 60 FPS - Smooth SceneKit rendering
  • โœ… 92+ tests - Comprehensive unit test coverage

Screenshots

Gameplay Active Player

How to Play

Movement Physics

Each turn, choose one of 9 acceleration vectors:

(-1,+1)  (0,+1)  (+1,+1)
   โ†–       โ†‘        โ†—

(-1, 0)  (0, 0)  (+1, 0)
   โ†       โ—        โ†’

(-1,-1)  (0,-1)  (+1,-1)
   โ†™       โ†“        โ†˜

Movement Formula:

NewPosition = CurrentPosition + CurrentVelocity + Acceleration
NewVelocity = CurrentVelocity + Acceleration

Objective

  1. Navigate the track without crashing
  2. Build up speed on straightaways
  3. Slow down for corners (or risk crashing!)
  4. Cross the finish line first

Controls

  • Tap green markers - Valid moves (stay on track)
  • Red markers - Would crash into walls
  • Reset button - Start a new race
  • Autoplay button - Watch AI race

Installation

Requirements

  • Xcode 15.0+
  • iOS 18.5+ (or iOS Simulator)
  • macOS 14.0+ (for development)

Build & Run

# Clone the repository
git clone https://github.com/Pjpj42/GridRacer.git
cd GridRacer

# Open in Xcode
open GridRacer.xcodeproj

# Select your simulator/device and press Cmd+R to run

Quick Commands

# Build
xcodebuild -scheme GridRacer -configuration Debug \
  -destination 'generic/platform=iOS Simulator' build

# Run tests
xcodebuild test -scheme GridRacer \
  -destination 'platform=iOS Simulator,name=iPhone 16'

# Launch in simulator
xcrun simctl launch booted trouarat.GridRacer

Architecture

Tech Stack

  • Language: Swift 5.0
  • Graphics: SceneKit (3D rendering of 2D grid)
  • UI: UIKit
  • Testing: Swift Testing + XCTest
  • Platform: iOS 18.5+

Project Structure

GridRacer/
โ”œโ”€โ”€ GridRacer/              # Main app source
โ”‚   โ”œโ”€โ”€ Model/              # Game state (immutable structs)
โ”‚   โ”œโ”€โ”€ Logic/              # Game engine, collision, movement
โ”‚   โ”œโ”€โ”€ Rendering/          # SceneKit renderers
โ”‚   โ””โ”€โ”€ UI/                 # UIKit views and controls
โ”œโ”€โ”€ GridRacerTests/         # Unit tests (Swift Testing)
โ”œโ”€โ”€ GridRacerUITests/       # UI tests (XCTest)
โ”œโ”€โ”€ docs/                   # Design documents
โ””โ”€โ”€ .claude/                # AI-assisted development config

Key Design Patterns

  • Immutable state - All game state uses value types (structs)
  • Functional updates - State transitions return new state
  • Separation of concerns - Model, logic, rendering, UI layers
  • Test-driven - 80%+ coverage on game logic

Development

Using Claude Code

This project includes Claude Code configuration for AI-assisted development:

# See available commands
/help

# Run full development cycle
/iterate

# Create new feature from design doc
/feature "feature-name"

# Analyze and fix bugs
/debug "issue description"

See CLAUDE.md for complete development guide.

Testing

# Run all tests
xcodebuild test -scheme GridRacer

# Run specific test suite
xcodebuild test -scheme GridRacer \
  -only-testing:GridRacerTests/GameEngineTests

# With coverage
xcodebuild test -scheme GridRacer -enableCodeCoverage YES

Documentation

  • CLAUDE.md - Developer guide and AI assistant context
  • docs/GridRacer Concept.md - Game design document
  • [.claude/rules/](. claude/rules/) - Architecture and coding conventions

Roadmap

v0.2 - Enhanced Gameplay

  • Additional tracks (5+ layouts)
  • Track difficulty ratings
  • Sound effects and music
  • 3D racer models

v0.3 - AI Opponents

  • Single-player mode
  • Multiple AI difficulty levels
  • AI racing line optimization

v0.4 - Multiplayer

  • 3-4 player support
  • Online multiplayer
  • Leaderboards

v1.0 - Polish

  • Track editor
  • Particle effects
  • Camera controls
  • Achievements

Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

See .github/CONTRIBUTING.md for detailed guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Contact

PJ - @Pjpj42

Project Link: https://github.com/Pjpj42/GridRacer


Made with โค๏ธ and vector physics

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors