Skip to content

MadhurDixit13/Game-Engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

27 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Advanced Game Engine with Multiplayer & Scripting

Docker SFML C++ JavaScript

A sophisticated Platformer Game Engine developed for the Game-Engine-Foundations course (CSC581) that demonstrates advanced computer science concepts through practical implementation. Features multiplayer networking, JavaScript scripting integration, and multiple deployment options.

๐ŸŽฏ Project Overview

This project showcases a complete game engine implementation featuring:

  • Multi-Platform Support: Windows, macOS, Linux
  • Real-time Multiplayer: Client-server architecture with ZeroMQ
  • JavaScript Scripting: V8 engine integration for runtime scripting
  • Advanced Graphics: SFML-based rendering with custom shapes
  • Docker Containerization: Multiple deployment options
  • Event System: Custom event handling with script callbacks
  • Physics Engine: Collision detection and movement mechanics

โœจ Key Features

๐ŸŽฎ Core Game Engine

  • Object-Oriented Design: Inheritance, polymorphism, and encapsulation
  • Custom Shapes: PentagonShape extending SFML's Shape class
  • Physics Simulation: Collision detection, gravity, and movement
  • Replay System: Record and playback game sessions
  • Pause/Resume: Full game state management
  • Variable Speed: 0.5x, 1x, 2x game speed options

๐ŸŒ Multiplayer Networking

  • Client-Server Architecture: ZeroMQ-based messaging
  • Real-time Synchronization: Character positions and game states
  • Multiple Clients: Support for multiple simultaneous players
  • Network Optimization: Efficient state management and updates

๐Ÿ“œ JavaScript Scripting

  • V8 Engine Integration: Full JavaScript runtime support
  • Hot Reloading: Live script updates during development
  • Event Callbacks: Script-based event handling
  • Native Integration: Seamless C++ to JavaScript communication

๐ŸŽฎ Implemented Games

1. Platformer Game (Base Engine)

  • Character movement and jumping
  • Platform collision detection
  • Color modification through scripts
  • Physics-based movement

2. Space Invaders

  • Enemy spawning and movement patterns
  • Bullet shooting system
  • Collision detection for scoring
  • Event-driven game mechanics

3. Flappy Bird

  • Physics-based bird movement
  • Obstacle generation and collision
  • Score tracking system
  • Boundary detection

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Game Client   โ”‚    โ”‚  Game Server    โ”‚
โ”‚   (Docker)      โ”‚โ—„โ”€โ”€โ–บโ”‚   (Docker)      โ”‚
โ”‚   - SFML GUI    โ”‚    โ”‚   - State Mgmt  โ”‚
โ”‚   - V8 Scripts  โ”‚    โ”‚   - Networking  โ”‚
โ”‚   - Physics     โ”‚    โ”‚   - Multiplayer โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
         โ–ผ
   Display Options:
   - X11 Forwarding
   - VNC Web Interface
   - Headless Mode

๐Ÿš€ Quick Start

Native Build (Requires Build Tools)**

Prerequisites

  • C++17 compiler (GCC/Clang)
  • SFML 2.5+
  • ZeroMQ
  • V8 JavaScript Engine
  • CMake (optional)

Build Instructions

# Server
cd server
g++ -c game_server.cpp -lzmq
g++ game_server.o -o game_server -lsfml-graphics -lsfml-system -lsfml-window -lzmq -pthread
./game_server

# Client
make
./main

๐Ÿ“ฆ Installation Options

Windows

  1. Native Build
    • Install Visual Studio Build Tools
    • Install vcpkg for dependencies
    • Follow build instructions

macOS

  1. Native Build
    • Install Xcode Command Line Tools
    • Install dependencies via Homebrew
    • Follow build instructions

Linux (Ubuntu)

  1. Native Build
    sudo apt install build-essential libsfml-dev libzmq3-dev libv8-dev
    make

๐ŸŽฎ Game Controls

Universal Controls

  • A: Move Left
  • D: Move Right
  • Space: Jump/Shoot
  • P: Pause/Unpause
  • R: Record/Play Replay
  • Q: Change Speed (0.5x, 1x, 2x)
  • E: Resize (with title bar button)

Game-Specific Controls

  • Space Invaders: Space to shoot bullets
  • Flappy Bird: Space to flap wings
  • Platformer: A/D for movement, Space to jump

Script Triggers

  • A + D (Chord): Triggers death script
  • Movement: Triggers color modification script
  • Collisions: Triggers event handling scripts

๐Ÿ”ง Development

Project Structure

Game-Engine-main/
โ”œโ”€โ”€ ๐Ÿ“ assets/              # Game assets (images, videos)
โ”œโ”€โ”€ ๐Ÿ“ scripts/             # JavaScript game scripts
โ”œโ”€โ”€ ๐Ÿ“ server/              # Game server implementation
โ”œโ”€โ”€ ๐Ÿ“ Versions/            # Homework progression (HW1-HW5)
โ”œโ”€โ”€ ๐Ÿ“„ game.cpp             # Main game engine (1199 lines)
โ”œโ”€โ”€ ๐Ÿ“„ ScriptManager.*      # JavaScript integration
โ””โ”€โ”€ ๐Ÿ“„ v8helpers.*          # V8 JavaScript helpers

Scripting System

The engine supports JavaScript scripting through V8:

// Example: modify_color.js
function getRandomColor() {
    return Math.floor(Math.random() * 0xFFFFFF);
}

print("Modifying GameObject Through Script");
platform.color = getRandomColor();

Adding New Games

  1. Create new game logic in game.cpp
  2. Add game-specific controls
  3. Implement collision detection
  4. Add JavaScript event handlers
  5. Update Docker configurations if needed

๐Ÿ“š Learning Progression

This project demonstrates progression through 5 major assignments:

HW1: Object-Oriented Programming

  • Basic C++ classes and inheritance
  • SFML graphics integration
  • Custom shape implementation

HW2: Networking & Multiplayer (5 parts)

  • ZeroMQ integration
  • Client-server communication
  • Real-time state synchronization
  • Multiple client support

HW3: Advanced Networking

  • Multiple server architecture
  • JSON-based communication
  • Enhanced state management

HW4: Game Mechanics (3 parts)

  • Physics simulation
  • Collision detection
  • Game state management
  • Replay system

HW5: Scripting Integration (3 parts)

  • V8 JavaScript engine
  • Script management system
  • Event-driven programming
  • Hot reloading

๐Ÿ› ๏ธ Technical Details

Dependencies

  • SFML 2.5: Graphics, window management, input handling
  • ZeroMQ: High-performance messaging library
  • V8: JavaScript engine for scripting
  • Docker: Containerization and deployment
  • X11/VNC: Display forwarding for GUI

Build System

  • Makefile: Cross-platform build configuration
  • Docker: Multi-stage builds for optimization
  • CMake: Alternative build system support

Performance

  • Multi-threading: SFML Mutex for thread safety
  • Memory Management: RAII and smart pointers
  • Network Optimization: Efficient state updates
  • Graphics: Hardware-accelerated rendering

๐Ÿ“ธ Screenshots & Videos

Game Screenshots

Platformer Game Space Invaders Flappy Bird

Demo Videos

๐Ÿค Contributing

  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

Development Guidelines

  • Follow C++17 standards
  • Use meaningful variable names
  • Add comments for complex logic
  • Test on multiple platforms
  • Update documentation

๐Ÿ“„ License

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

๐Ÿ‘จโ€๐Ÿ’ป Author

Madhur Dixit - Game Engine Foundations Course (CSC581)

๐ŸŽฏ Project Status

โœ… Completed - All features implemented and tested


๐Ÿ†˜ Troubleshooting

Common Issues

X11 Issues

  • Display not found: Check DISPLAY environment variable
  • Connection refused: Restart X11 server
  • Permission denied: Run xhost +local:docker

Network Issues

  • Connection timeout: Check firewall settings
  • Port not accessible: Verify port forwarding
  • Server not responding: Check server logs

๐ŸŽฎ Enjoy your advanced game engine with multiplayer and scripting capabilities!

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages