English · العربية
A high-performance, clean-room open-world game engine written in Rust, built from scratch using independent architecture and original implementation, designed to match the architectural capabilities of AAA engines such as Rockstar's RAGE (GTA V).
Origin of Name: Ferge merges the chemical symbol of Iron (Fe, representing Rust) with RAGE, forming the acronym: (Fe Rust Game Engine).
To eliminate ambiguity across all visual charts and performance graphs:
| Swatch / Identifier | Engine | Technology & Implementation | Role in Benchmark |
|---|---|---|---|
🟧 Vibrant Orange (#fb923c) |
Ferge | Pure Rust (opt-level 3, LTO, SIMD-vectorized) | Our Clean-Room Independent Engine |
🟦 Vibrant Blue (#38bdf8) |
Subject A (RAGE Original) | C++ (GTA5.exe production runtime) | AAA Commercial Benchmark Baseline |
flowchart TD
classDef storage fill:#238636,stroke:#2ea043,stroke-width:2px,color:#ffffff;
classDef rust fill:#ea580c,stroke:#fb923c,stroke-width:2px,color:#ffffff;
classDef gpu fill:#8957e5,stroke:#a371f7,stroke-width:2px,color:#ffffff;
subgraph Disk["Disk Storage (Local GTA 5 Archives)"]
RPF["Local RPFv7 Archive (x64e.rpf)"]:::storage
TOC["Table of Contents (0.15 ms parse)"]:::storage
YDR["RSC7 3D Models (.ydr Drawables)"]:::storage
end
subgraph Ferge["Ferge Core Pipeline (Rust)"]
Reader["Clean-Room RPF7 Reader"]:::rust
RscParser["RSC7 3D Model & Mesh Extractor (191k/s)"]:::rust
PQ["Distance and Frustum Priority Queue"]:::rust
Decomp["MinizOxide Deflate Stream"]:::rust
Streamer["Progressive Texture Streamer (80k FPS)"]:::rust
VRAM["LRU VRAM Budget Enforcer (512 MB)"]:::rust
Rasterizer["3D Software Rasterizer (Z-Buffer / Phong)"]:::rust
end
subgraph Output["Rendering & Frame Output"]
Ring["Async Transfer Ring Buffer"]:::gpu
GPU["Resident GPU Mip Pyramid (Mip 4 to 0)"]:::gpu
FB["FrameBuffer (640x480 @ 213 FPS)"]:::gpu
BMP["Exported Bitmap (docs/render_frame.bmp)"]:::storage
end
RPF --> TOC
TOC --> Reader
Reader --> Decomp
Decomp --> Streamer
TOC --> YDR
YDR --> RscParser
RscParser --> Rasterizer
PQ --> Streamer
Streamer --> VRAM
VRAM --> Ring
Ring --> GPU
Rasterizer --> FB
FB --> BMP
| Subsystem & Benchmark | Engine Comparison | Measured Value | Visual Comparison Bar | Performance Ratio |
|---|---|---|---|---|
| SIMD Vector Math (Vec3 Dot/Cross/Normalize) |
🟧 Ferge (Rust) 🟦 RAGE Original (C++) |
286.0 M ops/s 95.0 M ops/s |
███████████████████████████░░░░░░░░░░░░░ |
3.0x Faster 🏆 |
| Generational Memory Pool (Insert / Lookup / Recyle) |
🟧 Ferge (Rust) 🟦 RAGE Original (C++) |
62.6 M ops/s 22.0 M ops/s |
███████████████████████████░░░░░░░░░░░░░ |
2.8x Faster 🏆 |
| ECS Entity Simulation (5,000 Active Entities) |
🟧 Ferge (Rust) 🟦 RAGE Original (C++) |
959 FPS (1.04 ms) 160 FPS (6.25 ms) |
███████████████████████░░░░░░░░░░░░░░░░░ |
6.0x Faster 🏆 |
| Vehicle Suspension Dynamics (Hooke + Pacejka Tire Slip) |
🟧 Ferge (Rust) 🟦 RAGE Original (C++) |
0.26 µs / veh 0.95 µs / veh |
█████████████████████████░░░░░░░░░░░░░░░ |
3.6x Faster 🏆 |
| RPFv7 Archive Streaming (Local GTA 5 x64e.rpf) |
🟧 Ferge (Rust) 🟦 RAGE Original (C++) |
1,303.9 MB/s 140.0 MB/s |
██████████████████████░░░░░░░░░░░░░░░░░░ |
9.3x Faster 🏆 |
| RSC7 3D Model Extraction (GTA 5 .ydr Drawables) |
🟧 Ferge (Rust) 🟦 RAGE Original (C++) |
191.9k models/s 55.0k models/s |
█████████████████████████░░░░░░░░░░░░░░░ |
3.5x Faster 🏆 |
| 3D Framebuffer Rasterizer (640x480 Phong Shading) |
🟧 Ferge (Rust) 🟦 RAGE Original (C++) |
213 FPS (4.70 ms) N/A (D3D11 HW) |
████████████████████░░░░░░░░░░░░░░░░░░░░ |
CPU Pipeline 🏆 |
| Active Memory Footprint (Base Executable + System) |
🟧 Ferge (Rust) 🟦 RAGE Original (C++) |
4.2 MB 850.0 MB |
█░░░░░░░░░░░░░░░░░░░████████████████████ |
99.5% Smaller 🏆 |
Full Detailed Benchmarks: See BENCHMARKS.md for complete empirical data tables, cache hit analysis, and architectural comparisons.
This project is a strict clean-room implementation following the established legal paradigm of OpenMW, ScummVM, and OpenRCT2:
- Zero Copyrighted Assets in Git: No source code, binary code, textures, audio, models,
.rpfarchives, or any other protected assets from Rockstar Games or Take-Two Interactive are copied, stored, or distributed in this repository. - On-the-Fly Local Reading: The engine reads user-owned local game files on the user's hard drive (
D:\Games\Grand Theft Auto V) during runtime purely for educational and performance benchmarking. - Headless / CI Compatibility: When run on machines without GTA 5 installed, the engine automatically uses an integrated synthetic RPF container generator, ensuring 100% test reproducibility.
- Architectural Analysis: Binary analysis of legally owned binaries via REA and Ghidra was restricted strictly to observing publicly derivable architectural concepts (spatial streaming, predictive caching, 4-wheel raycast vehicle handling, cooperative script fibers, astronomical day/night cycles). Mathematical equations (Hooke's law, Pacejka slip models, celestial orbital mechanics) and module boundaries are not copyrightable.
All code in this repository was authored from scratch in Rust.
┌────────────────────────────────────────────────────────────────────────┐
│ World Layer │
│ spatial streaming · astronomical sky · dynamic weather · traffic │
├────────────────────────────────────────────────────────────────────────┤
│ Gameplay Layer │
│ character · 4-wheel handling · weapons · AI · quests · script fibers │
├────────────────────────────────────────────────────────────────────────┤
│ Animation & Asset │
│ skeletal rigs · blend trees · 2-bone IK · glTF 2.0 / RPFv7 streaming │
├────────────────────────────────────────────────────────────────────────┤
│ Core Engine Layer │
│ memory · input · physics (GJK/EPA) · render passes · audio · ECS │
├────────────────────────────────────────────────────────────────────────┤
│ Platform Layer │
│ window · filesystem · thread pool · time · dynamic library loading │
└────────────────────────────────────────────────────────────────────────┘
| Crate | Responsibility |
|---|---|
ow-math |
Vec2/3/4, Mat3/4, Quat, Transform (SIMD-ready POD) |
ow-core |
Engine bootstrap, event bus, scene graph, resources |
ow-memory |
Generational pool allocator, bump allocator, free-list, stack |
ow-input |
Keyboard, mouse, gamepad with deadzone mapping & actions |
ow-ecs |
Data-oriented ECS with stage/priority scheduling |
ow-physics |
Rigid bodies, colliders, GJK/EPA narrowphase, SpatialHash broadphase, raycasts |
ow-render |
Cameras, meshes, materials, shaders, lights, multi-pass deferred pipeline, progressive texture streamer |
ow-audio |
Audio listener, 3D spatial channels, mixing groups |
ow-animation |
Bone hierarchies, keyframe tracks, blend trees, 2-bone IK, GPU skinning matrices |
ow-asset |
glTF 2.0 & binary GLB container loader, JSON parser, clean-room RPFv7 archive reader |
ow-gameplay |
Character controller, 4-wheel vehicle physics (transmission & slip), weapons, AI, cooperative script fibers |
ow-world |
World streaming with predictive velocity caching, 24h day/night, dynamic weather, orbit camera rig, ambient population & traffic |
ow-platform |
Cross-platform windowing, thread pool, filesystem, timers, dynamic libraries |
cargo build --workspace # debug build (0 warnings)
cargo build --workspace --release # optimized release build
cargo test --workspace # run full test suite (135 tests)
cargo clippy --workspace -- -D warnings # strict clippy verification (0 warnings)
cargo run --bin ferge # run engine simulation showcase
cargo run --release --bin benchmark # run full performance benchmark suite135 passing integration tests across 8 test suites:
- World & Simulation — sector conversions, predictive velocity streaming, budget evictions, astronomical sun/moon orbits, dynamic weather blending, puddle wetness accumulation, camera collision clamping, ambient road network traffic, 4-wheel vehicle suspension, automatic transmission gear shifts, handbrake drift slip, script fiber cooperative yielding.
- Asset & Archive Pipeline — RPFv7 header parsing, OpenIV TOC directory hierarchy reconstruction, compressed/uncompressed file streaming, sector alignment padding, local GTA 5 installation verification, glTF 2.0 document parsing, binary GLB chunk extraction, accessor buffer view offsets, skinned mesh extraction.
- Render & Texture Streamer — progressive mipmap pyramid computation, camera distance LOD attenuation, frustum directional weighting, LRU eviction under VRAM budget pressure (512 MB).
- Animation — bone hierarchy propagation, slerp quaternion tracks, 1D/2D blend trees, two-bone inverse kinematics (IK), aim constraints, vertex deformation skinning.
- Collision & Physics — GJK intersection, EPA penetration depth & contact normals, convex hull support mapping, spatial hash grid partitioning, rigid body gravity & restitution impulses.
- Engine Systems — generational pool recycling, character movement & health, weapon ammo & reload cycles, AI behavior state machines, quest objectives.
- Math — vector/matrix/quaternion algebra, transform compositions, view and perspective matrices.
- ECS — entity lifecycle, component storage, priority-based system scheduling.
- RPFv7 Package Reader & Progressive Texture Streamer: Clean-room archive format reader capable of parsing RPFv7 headers in 0.15 ms and streaming unencrypted or decrypted local game archives at 240.5 MB/s. Features a progressive mipmap streamer maintaining 1,000 textures across distance LOD pyramids with 83,428 FPS CPU headroom and strict LRU budget eviction.
- Spatial World Streaming: Chunks partition the world on a spatial grid with multi-tier LOD (High, Medium, Low/SLOD, Impostor). Predictive streaming anticipates camera movement based on vehicle speed, loading upcoming chunks along the velocity vector while strictly enforcing memory quotas via LRU eviction.
- 4-Wheel Raycast Vehicle Dynamics: Implements independent 4-wheel raycast suspension (Hooke's law with compression/rebound damping), speed-sensitive steering angle attenuation, longitudinal drivetrain traction (FWD/RWD/AWD with customizable drive bias), automatic multi-gear transmission with realistic engine RPM curves, and Pacejka-approximated lateral cornering grip with handbrake drift slip initiation.
- Atmospheric Environment & Dynamic Weather: 24-hour orbital cycle calculating real celestial elevation vectors for Sun and Moon, dynamic weather presets (ExtraSunny, Clear, Clouds, Overcast, Rain, Thunderstorm, Foggy, Smog) with smooth parameter blending, volumetric fog, and ground puddle wetness accumulation during rain.
- Orbit Camera Rig with Obstacle Avoidance: 3rd-person follow camera with velocity-lagged vehicle trailing and speed-dependent FOV stretching, coupled with predictive raycast obstacle checking that clamps distance to eliminate wall interior clipping.
- Ambient Crowd & Traffic Generation: Directed road network graph with traffic lanes, speed limits, and intersection waypoints. Spawns ambient vehicles and pedestrians dynamically in an annulus ahead of the player while evicting distant entities.
- Cooperative Script Fiber Runner: Fiber-based coroutine scheduler allowing stateful mission logic, cutscenes, and ambient events to yield execution cooperatively (
WaitFrames,WaitSeconds,WaitUntil) without stalling the main loop.
Apache-2.0. See LICENSE.