Skip to content
juanputrerasmPublic

Latest commit

 

History

97 Commits

Folders and files

Repository files navigation

OpenMTM2

JavaScript Three.js Platform GitHub Pages License

A clean-room, open-source implementation of Monster Truck Madness 2 for the web.

OpenMTM2 recreates the original game in a modern browser using your own Monster Truck Madness 2 installation, or Microsoft's free MTM2 trial without one. It supports game data from Beta 10, retail 2.00.41, the official patched 2.00.42, and community patches through Community Patch 3. Everything runs locally and nothing is uploaded. The only game files in this repository are the unmodified trial and its license (assets/trial/), which the license allows to be passed on free of charge.

More than Monster Truck Madness 2. OpenMTM2 also plays the tracks and vehicles of CART Precision Racing and 4x4 Evolution 1 and 2, plus Monster Truck Madness 1. Add those games' folders or PODs and race CART cars and Evo trucks on any track, each on its own game's physics. See CART Precision Racing and 4x4 Evolution.

Live application: Play OpenMTM2 on GitHub Pages

OpenMTM2 running an eight-truck race with the enhanced renderer


Features

  • Complete single-player racing: Circuit, Rally, Summit Rumble, drag racing, tournaments, driver profiles, results and a Hall of Fame, with up to eight trucks.
  • Multiplayer: online rooms through a server browser, up to 16 players, and classic TCP/IP play with the original game (retail and Community Patch 3).
  • Party modes: Hockey, Soccer, Tag, Cops & Robbers, Race & Rumble, Combat and Deathmatch, with teams, roles and rules set in Options, and Freestyle, a solo show run judged out of 10.
  • Faithful simulation: clean-room truck physics, collisions and CPU drivers running in a Web Worker.
  • Four Terminal Reality games in one: MTM2 Beta 10 through Community Patch 3, plus the tracks and vehicles of CART Precision Racing, 4x4 Evolution 1 and 2, and MTM1, each vehicle on its own game's physics.
  • Classic or enhanced presentation: ten cameras, the original-style HUD, dynamic weather, water, shadows, lighting, particles and optional modern scenery effects.
  • Sound and replay: engines, impacts, ambience, music and instant replays that can read and write the game's .rpl format.
  • Gamepad from start to finish: menus, the install screen, an on-screen keyboard and racing all work with a controller alone, with the game's force feedback felt as rumble.
  • Phones: installable to the Home Screen or as an app, fullscreen and clear of the notch.
  • Player choice: truck tuning, rebindable controls, graphics presets, cheats, free roam and an in-game console.
  • WebXR: menus and races work in supported standalone and PC-connected VR headsets.

Each area is described under Feature details.

Supported game data

OpenMTM2 contains no Microsoft or Terminal Reality game data. Supply your own installation from any of these releases:

Release Support
Beta 10 Supported, with the classic menus by default
Retail 2.00.41 Supported, with the classic menus by default
Official patch 2.00.42 Supported, with the classic menus by default
Community Patch 1, 2 and 3 Supported, with the modern menus by default

The installer reads POD.INI and the archives it lists. It inspects MONSTER.EXE only to identify the version; the executable is never run. At minimum the installation must provide STARTUP.POD, MUSIC.POD, SOUND.POD, COCKPIT.POD, TRUCK2.POD and UI.POD. Every other archive is optional.

Community Patch 3 content includes .SI2 tracks, HD PNG and TGA art, normal and occlusion maps, enhanced materials and glass, track lights and moving objects.

Sounds and music can be replaced the same way the HD art replaces textures: a POD holding SOUND\<name>.OGG or SOUND\<name>.MP3 is played in place of the game's SOUND\<name>.WAV (OGG first, then MP3, then the WAV), for a truck's horn as for a track's music (SOUND\FARM.OGG for the farm tracks' farm.wav). The WAV's .KLP loop points still apply, counted at the replacement's own sample rate. MP3 encoders add a little silence at the start, which shifts loop points, so OGG is the better choice for anything that loops. A browser that cannot decode the replacement plays the WAV.

CART Precision Racing and 4x4 Evolution

OpenMTM2 reads the other Terminal Reality racing games of the time from your own copies:

Game Tracks Vehicles
CART Precision Racing (1997) Road courses with their road layer, walls and catch fences CART cars on the CPR car model: six gears, Garage springs, dampers and wings, and CPR's own computer drivers
4x4 Evolution (2000) Terrain, models, trees, grass, AI life (flocks of birds) and checkpoints; mission tracks in Free Roam Evo vehicles on the 4x4 Evolution model, with Garage tuning
4x4 Evolution 2 (2001) All of the above, plus object paths and track scripts Evo 2 vehicles on the 4x4 Evolution 2 model, with Garage tuning
Monster Truck Madness (1996) Its tracks, skies and stadium drag strips MTM1 trucks on the 1996 physics and drag rules

Add a game with Options > Data > Add POD.INI (pick its folder) or single PODs with the POD manager. Any vehicle races on any track. Options > Game > Physics picks the model: by default each vehicle drives on its own game's physics; it can also follow the track's game, or use one model for all. A 4x4 Evolution track always runs its own game's physics on its own smoothed ground, as in Evo. One of them is CommPatch4, Community Patch 4's physics: MTM2's trucks on CP4's fixed tick, with props that collide by their own triangles (docs/CP4_EXE_ANALYSIS.md 10 and 11). Another is OpenMTM2, the default for an MTM2 truck on an MTM2 track: MTM2's physics with drivable meshes, so a track made of models (Carmageddon II's Beaver City as converted for CP4) is driven on its streets, decks and tunnels, with the computer trucks and the cameras on the meshes too.

Requirements

  • A modern Chrome, Edge, Firefox or Safari with JavaScript modules, Web Workers, WebGL and Origin Private File System support
  • Your own Monster Truck Madness 2 installation, as described above
  • An HTTP or HTTPS origin; the application does not run directly from file://
  • WebXR and a compatible browser only when using VR

Getting started

Use the hosted application

  1. Open OpenMTM2 on GitHub Pages.
  2. Pick a language and the graphics (Enhanced or Standard), then get the game's files:
    • Choose MTM2 folder: the folder containing POD.INI;
    • Choose ISO or ZIP file: a disc image or a zip made from your own copy;
    • Play the free trial: Microsoft's 1998 trial (Farm Road 29 and four trucks), installed with one click after you accept its license.
  3. Check in, choose a track and truck, and race.

The archives are copied once to the browser's private storage and remain there until you use Change base install or Clear browser game data in Options. They never leave your device.

Run locally

Clone the repository and serve its root with any static HTTP server:

git clone https://github.com/juanputrerasm/OpenMTM2.git
cd OpenMTM2
python3 -m http.server 8080

Then open http://localhost:8080/. There is no build step and no package installation.

Note

A service worker keeps a local copy of the application after the first visit, so an installed game can continue to work offline. A reachable server always takes precedence; Options also has a Start without the server switch.

Controls

These are the defaults; every driving key can be rebound in Options.

Action Keys
Accelerate, brake and steer Arrow keys or W, S, A, D
Shift up / down Q / Z or Page Up / Page Down
Change camera; go back one camera V; Shift+V
Turn the chase camera; tilt it Insert / Delete; keypad - / + (or - / =)
In the cockpit: look left, right, behind; rear-view mirror Insert, Delete, keypad + (held); keypad -
Course map; names on the map Tab or M; N
Dashboard gauges; finder ring G; F
Horn; YeeHaw; helicopter recovery Space; Y; H
Timing display O
Console The key left of 1
Pause Esc or P

Gamepad

A standard gamepad (Xbox, PlayStation and the like) plays the whole game, menus included, with no mouse or keyboard:

Racing Button
Steer Left stick
Throttle; brake and reverse RT; LT
Shift up; shift down RB; LB
Helicopter; camera Y; X
Dashboard gauges; overlay map A; B
Pause Start
Evo: drive mode; handbrake (held) D-pad up; D-pad down
Menus Button
Move (lists such as the tracks included) D-pad or left stick
Press or pick; back A; B
Change a dropdown or slider A, then the D-pad; A keeps it, B puts it back
Options tabs LB; RB
Type in a text box A opens an on-screen keyboard; Done keeps the text, B puts it back

Options, Keys has Gamepad pedals (the triggers, the left stick, or both) and Steering response (10 is the game's own steep curve; lower makes the stick steer more evenly), plus Gamepad rumble, Rumble strength and Rumble effects: the game's force feedback felt as the pad's rumble. Hits (crashes, landings, wheels hitting things), the ground under the wheels, and a soft engine rumble; fewer effects save a wireless pad's battery. Rumble readout shows in a race what the pad is doing and why (Chrome, Edge and Safari; not Firefox). A pad without the standard mapping drives with its left stick. Choosing a game folder or an ISO needs a mouse, keyboard or touch once, since browsers open their file window only for those; the free trial installs with the pad alone. VR controllers follow the WebXR xr-standard layout.

Phones and fullscreen

On a desktop or Android browser, the Start screen and the foot of Options, Game have a Fullscreen button. Browsers allow it only from a click or tap, not from a gamepad. OpenMTM2 can also be installed: Android's Install app, or on an iPhone Share, Add to Home Screen (from Safari, or Chrome on iOS 16.4 and later). Installed, it opens with no browser bars, in landscape on Android. An iPhone puts only videos fullscreen in its browser tabs, so the Home Screen is the way there; its copy keeps its own storage, so the game files are installed once more inside it. A phone shows a tip about this once.

Feature details

Racing and game modes

  • Race Circuit, Rally and Summit Rumble events against CPU trucks, with laps, checkpoints, timing, results, persistent driver profiles and a Hall of Fame. Professional difficulty uses a track's second course when it has one.
  • Run MTM1 drag strips with auto-staging, a working Christmas tree, red lights, lane and reversing disqualifications, timing slips and drag weekends based on Community Patch 3's documented rules.
  • Explore any non-race track in Free Roam. This is also how mission tracks without checkpoints from 4x4 Evolution are driven.
  • Play the party modes, OpenMTM2 additions that were never in the game: Hockey on Breakneck Ridge's frozen lake and Soccer on Highlands Rally (time limit and sudden death), Tag (proximity points), Cops & Robbers, and Race & Rumble (classic racer and blocker teams, a timed block, or a Chase). Tag and the Chase can also follow Monster Truck Madness 64's rules. Pick each truck's team colour and role in the Computer Opponents dialog. Party modes also run on free roam tracks. See the extensions guide.
  • Race Combat on any circuit or rally: the trucks wreck each other, wearing down the engine, the gearbox and each wheel until wheels come off. Earn credits at checkpoints and for damage dealt, and press X to repair. The first truck home, or the last one running, wins. A wrecked player watches the rest of the race.
  • Play Deathmatch on any track: Combat's damage with no race. Wreck as many trucks as you can before the time runs out; the most wrecks wins, and wrecking yourself costs one. Wrecked trucks come back after a few seconds at a spot away from the fight, briefly protected. Credits come only from attacking and buy repairs with X when repairs are on (off by default). Trucks spawn on the drivable surface: a mesh street or deck, a bridge, a road, never the terrain under it.
  • Drive a Freestyle run on any track, alone against the clock, as at a Monster Jam show: big air, wheelies, donuts, flips, hits and saves are judged out of 10, with the score building live on the HUD and its breakdown in the Winner's Circle. Use all the time and keep moving; reversing without a reason and crashes cost points. Its trick physics works under every physics model.
  • The Computer Opponents dialog filters the available trucks by name, and in a single-player race or tournament you can pick your start position on the grid (also in Options, Game), or leave it at Random as the game does.
  • CPU trucks keep control better, get themselves unstuck, and on Professional drive back through a missed checkpoint instead of calling the helicopter.
  • CPU trucks contest the zone in Rumble events, while tire tracks, dust, sparks, splashes and moving scenery bring the race to life.

Multiplayer

  • Online rooms: choose Multiplayer, then Online rooms. The default server is multiplayer.openmtm2.workers.dev. Browse, create or join rooms (public, password or code), share an invite link, and race with up to 16 players and computer opponents. The room owner can also pick a party mode. Combat and Deathmatch online need a server with OpenMTM2 Server's modeTruck event.
  • Classic TCP/IP: host or join games with the original MTM2 (retail 2.00.42 or Community Patch 3) by IP address, through a small desktop helper from the OpenMTM2 Server project.
  • Each machine simulates its own truck; remote trucks are smoothed, and results are shared at the end.
  • Instant Replay works online too: it plays over the race, which keeps running underneath with your truck still in it.

See the multiplayer guide for the protocols, ports and server setup.

Simulation, cameras and HUD

  • The truck simulation is a clean-room implementation of the original game's documented behaviour: suspension, tires, drivetrain, collisions and AI all advance at a fixed 60 Hz in a worker.
  • Ten camera views include chase, cockpit and track cameras. The cockpit has its dashboard, steering wheel, shifter and mirror, and its side and rear windows when you look round; Z mode adds the game's zoom, while Inertia pulls back with speed. The mouse looks round the exterior views, and the wheel's zoom on each view is kept between games.
  • The HUD recreates the game's timing board, Lead and Back gaps, speedometer, tachometer, gear strip, finder ring, course map and message bar. Speed can be shown in MPH or KPH.

Tracks and community content

  • Add another game's POD.INI or individual POD files through Options > Data. The POD manager shows every mounted archive, its detected game, and the tracks and trucks it supplies.
  • MTM1 tracks retain their skies and stadium drag strips. CART Precision Racing tracks include their road layer, walls and catch fences. 4x4 Evolution 1 and 2 tracks include terrain, models, AI life, object paths, trees and checkpoints. Every track takes every vehicle: MTM2 trucks, CART cars and Evo vehicles, each on its own game's physics or on the model picked in Options.
  • Community Patch 3 support covers HD model, truck, sky and terrain art; normal and occlusion maps; enhanced materials and glass; track lights; moving objects; four-tire sets; and .SI2 tracks.
  • Community Patch 4 tracks (betas 0.52 and 0.53, up to hotfix 3) bring their 16-bit, Spline and Full Map terrain, lakes, vegetation, wispy fog volumes, drivable surface meshes, 3D cockpits and waterfalls: sheets of water poured over a crest by the game's own rules, with flow tubes, whitewater, droplets, mist per stream and their roar. Hotfix 3's Normal-Water and Normal-Terrain detail maps (_WDTL, _WMSK, _DTL, from MaskArt too) load with their Always On and Strength options. Roofed arenas can be lit as outdoors, as in CP4 0.53 (Options > Advanced > CP4).

Graphics, weather and water

  • Choose the classic 1998 presentation or the enhanced OpenMTM2 renderer. The enhanced path adds sun and terrain shadows, smooth shading, terrain detail, glossy sky-reflecting paint, lens flare, light beams and glowing lamps.
  • Weather includes Clear, Cloudy, Fog, Rain, Snow, Dusk, Night and Pitch Black. Rain and snow are blocked by bridges; fog can settle into valleys; snow accumulates with depth and is cleared or ploughed by trucks.
  • Water supports depth, reflections, shores and underwater views, with spray, wakes and ripples from trucks. Snow can freeze it into ice that cracks under hard landings.
  • Optional scenery effects add rounded terrain facets, cliff relief, puddles, persistent tire ruts, lit particles, detailed ground and the game's original backdrops through atmospheric haze. Each feature has its own switch under Options > Scenery.

See the visuals guide for the rendering choices and their controls.

Audio, replay and customization

  • Web Audio plays engine loops, skids, impacts, splashes, ambience, moving-object sounds, menu audio and MOD music from the player's installation.
  • Instant Replay records the race, plays it back with engine sound, gear changes, ambience and music, switches among any truck and camera, and provides VCR-style play, pause, rewind, fast-forward, slow-motion, frame-step and scrub controls. Replays can be saved to or opened from the game's .rpl format, crushed cars included.
  • Options, Data imports the game's own drivers (player.pro) and Hall of Fame (MTM2 High Scores) and saves OpenMTM2's in the same files. The Start screen's Monster Manual is OpenMTM2's own guide to the game.
  • The Garage provides truck tuning. Options include rebindable keys, graphics presets, V-sync, a frame-rate limit, anti-aliasing (Auto picks the cheapest that suits the preset), a picture size for slower graphics chips, skipping scenery hidden behind other scenery, and GOLD mode cheats. The FPS counter shows draw calls and triangles, and a click copies its figures with the track and settings for a report. The drop-down console controls opponents, laps, track, weather, skill and truck selection.

In a headset

OpenMTM2 runs in VR wherever the browser provides WebXR. Menus and races show an Enter VR button; you can drive from the cab or a seat behind the truck, use the controllers as a joystick, and set up races on a board without removing the headset.

A standalone headset cannot select a folder on your computer, so serve the game data to it:

node tools/serve.mjs --game "/path/to/Monster Truck Madness 2"
adb reverse tcp:8080 tcp:8080

With a USB-connected headset, open http://localhost:8080/ in its browser. For Wi-Fi, use node tools/serve.mjs --lan --game ...; the helper serves HTTPS with a locally generated certificate. See the VR guide for setup, controls and implementation details.

Architecture

Component Role
ES modules Application flow, menus, race rules, input, audio and rendering
Module Web Workers Archive loading, asset conversion and the fixed-step vehicle simulation
OPFS Private local storage for the player's game installation and user data
Three.js r169 Terrain, vehicles, scenery, weather, effects and WebXR rendering
Web Audio Engines, effects, ambience, interface sounds and music
OpenPhotex Terminal Reality formats and the MTM2 simulation, vendored as plain ES modules

The application has no build step. The vendored OpenPhotex copy in src/vendor/openphotex/ is generated from the upstream project and should not be edited directly. See the architecture guide for the full module layout and data flow.

Development

Serve the repository as described under Run locally, then run the test suite with:

node --test tests/

Tests require Node.js 22.18 or newer. Tests that use original game files are opt-in: run OPENMTM2_STOCK=1 node --test tests/ to include them. They look in ~/games or $OPENMTM2_GAMES and skip when the files are absent.

Before contributing, read AGENTS.md. In particular: do not add game data or decompiled code; implement Terminal Reality formats and simulation changes in OpenPhotex; and cover behaviour derived from the original game with tests.

The project is under active development. The current state and the remaining work are in the project plan, and what was built, milestone by milestone, in the changelog.

Documentation

Document Contents
Project plan Where the project stands and the open work
Changelog What was built, milestone by milestone
Architecture Modules, workers, storage and application data flow
Multiplayer Online rooms, classic TCP/IP play and the server
Extensions The party modes and how to add one
VR Headset setup, controls and implementation
Visuals Enhanced terrain, water, weather, lighting and scenery
Standalone asset inventory Original MTM2 asset dependencies that need replacement for a self-contained release
MTM2 executable analysis Original game behaviour, rules, HUD, cameras, weather and cheats
MTM2 physics The original simulation specified for reimplementation
Reverse-engineering tools Helpers used to document original behaviour

Related projects

  • OpenPhotex: Terminal Reality file formats and the MTM2 simulation used by OpenMTM2.
  • JSTrackViewer: browser-based 3D viewer from which much of OpenMTM2's rendering work developed.

Credits and license

Developed by Juan Pablo Utreras and released under the Apache License 2.0.

Monster Truck Madness 2 is a trademark of Microsoft Corporation and was developed by Terminal Reality Inc. OpenMTM2 is an independent clean-room project and is not affiliated with or endorsed by Microsoft or Terminal Reality. It contains none of their code or data; you must provide your own copy of the game.

Third-party assets retain their own licenses: