Skip to content

TheJulianAlva/project-rxj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

77 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฐ The Mansion Riddle (Project RXJ)

Main Banner

A retro 3D survival horror engine built from scratch with Python and OpenGL.

Python PyGame OpenGL Status

๐Ÿ“– About the Project

The Mansion Riddle is not just a game; it is a deep technical exploration of how classic survival horror games (like Resident Evil or Silent Hill) worked. This project implements a custom 3D engine that combines the versatility of PyGame for window and input management, with the low-level power of PyOpenGL for rendering.

โœจ Key Features

  • Native 3D Rendering: Graphics pipeline implemented manually using OpenGL in Immediate Mode.
  • Fixed Camera System: Mathematical implementation of cinematic perspective changes based on invisible triggers.
  • Tank Controls: Faithful recreation of the classic control scheme that defines the genre.
  • Scalable Architecture: Modular design based on State Machines and Design Patterns.

๐Ÿ› ๏ธ Tech Stack

This project demonstrates proficiency in software engineering and computer graphics:

  • Language: Python 3
  • Core Loop & I/O: PyGame (Window handling, delta time, keyboard/mouse inputs).
  • 3D Graphics: PyOpenGL (Primitive rendering, projection and model-view matrix management).
  • Mathematics: Extensive use of linear algebra for 3D transformations and camera calculations.

๐Ÿ›๏ธ Software Architecture

The code follows SOLID principles and design patterns to ensure maintainability:

Simplified Class Diagram (Mermaid)

classDiagram
    class GameEngine {
        +state_stack
        +push_state()
        +pop_state()
        +update()
        +draw()
    }
    class BaseState {
        <<Abstract>>
        +update()
        +draw()
    }
    class PlayState {
        +player
        +camera_manager
    }
    class MenuState
    
    GameEngine o-- BaseState : Manages
    BaseState <|-- PlayState
    BaseState <|-- MenuState
Loading

Patterns Used

  1. State Pattern: GameEngine manages a stack of states (PlayState, MenuState, PauseState), allowing fluid transitions and encapsulated logic.
  2. Singleton: Used in InputManager and DataManager to provide controlled global access to shared resources.
  3. Observer (Event System): Decouples game trigger logic (like puzzles) from their effects (opening doors), allowing a flexible reactive system.
  4. Component/Object: Game entities (Player, Puzzle) encapsulate their own logic and data.

๐ŸŽฎ Game Guide

Controls (Tank Style)

Key Action
W Move Forward
S Move Backward
A Turn Left
D Turn Right
E Interact (Examine/Open)
ESC Pause / Menu

๐Ÿš€ Installation and Execution

Follow these steps to run the project locally.

Prerequisites

  • Python 3.8 or higher installed.
  • Git to clone the repository.

Step by Step

  1. Clone the repository

    git clone https://github.com/TheJulianAlva/project-rxj.git
    cd project-rxj
  2. Create virtual environment (Recommended)

    python -m venv venv
    # On Windows:
    .\venv\Scripts\activate
    # On Mac/Linux:
    source venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Run the game

    python main.py

๐Ÿ“‚ Project Structure

project-rxj/
โ”œโ”€โ”€ main.py                 # Entry Point
โ”œโ”€โ”€ engine.py               # Engine Core (State Machines)
โ”œโ”€โ”€ assets/                 # Resources (Models, Textures, Sounds)
โ”œโ”€โ”€ data/                   # Configuration and levels (JSON)
โ”œโ”€โ”€ game_objects/           # Entities (Player, Puzzles, Cameras)
โ”œโ”€โ”€ state/                  # Game State Logic
โ”œโ”€โ”€ systems/                # Global Systems (Audio, Input, Triggers)
โ””โ”€โ”€ utilities/              # Math tools and helpers

๐Ÿค Contribution

Contributions are welcome under the Feature Branch workflow!

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

๐Ÿ‘ฅ Contributors

This project was developed by a team:


๐Ÿ“„ License

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


Developed as a final project for the Computer Graphics course.

About

๐Ÿฐ A retro 3D survival horror engine built from scratch with Python and OpenGL. Features tank controls, fixed cameras, and modular state-driven architecture.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages