Code Monkey home page Code Monkey logo

opentomb's Introduction

Build Status

OpenTomb — an open-source Tomb Raider 1-5 engine remake

Table of contents

What is this?

OpenTomb is an open-source re-implementation of the classic Tomb Raider engine, intended to play levels from all classic-era Tomb Raider games (1—5), as well as custom TRLE levels. The project does not use any of the original Tomb Raider code, as all attempts to retrieve source files from Eidos/Core were in vain.

Instead, everything is being re-developed completely from scratch. It should be noted, however, that OpenTomb uses certain legacy routines from unfinished open-source projects, such as OpenRaider and VT project (found at icculus.org), plus some code from Quake Tenebrae.

OpenTomb tries to recreate the original Tomb Raider series experience, although with contemporary updates, features and additions, being able to fully benefit from running on modern PCs with powerful CPUs and graphic cards.

Links to forums and info:

Why create a new engine?

It's true that we have fully working Windows builds of TR2-5, and TR1 works perfectly through DosBox. However, as time progresses the situation will only worsen, with newer Operating Systems becoming increasingly unlikely to support the games. OpenTomb will always be able to be ported to any platform you wish.

It is also true that there are patchers for the original engine, aiming to improve and update it: TREP, TRNG, etc. The advantage with OpenTomb is that we are not limited by the original Binary, a huge limitation when it comes to new features, graphical enhancements, code modification and more. An open-source engine removes these limitations.

Features

  • OpenTomb has a completely different collision approach to the original engine, circumventing many of the limitations present. We use a terrain generator to make an optimized collision mesh for each room from so-called "floordata".
  • OpenTomb is capable of a variable frame rate, not limited to 30fps like the original engine.
  • OpenTomb uses common and flexible libraries, such as OpenGL, OpenAL, SDL and Bullet Physics.
  • OpenTomb implements a Lua scripting engine to define all entity functionality. This means that, again, unlike the original, much less is hardcoded into the engine itself, so functionality can be extended or modified without having to modify and recompile the engine itself.
  • Many abandoned and unused features from the original engine have been enabled in OpenTomb. New animation, unused items, hidden PSX-specific structures inside level files, and so on!

Supported platforms

OpenTomb is a cross-platform engine: currently it can be ran on Windows, Mac or Linux. No mobile implementations are in development yet, but they are indeed possible.

Setup

To run any of the levels from the original games, you will need the assets from that respective game. These resources often tend to be in cryptic formats, with variations across games. Because of this, you'll need to convert some game resources to usable formats yourself, or get them from somewhere on the Net.

Here is the list of all needed assets and where to get them:

  • Data folders from each game. Get them from your retail game CDs or Steam/GOG bundles. Just take data folder from each game's folder, and put it into corresponding /data/tr*/ folder. For instance, for TR3, the path would be OpenTomb/data/tr3/data/. Tomb Raider "Gold" versions go to data/tr*_gold/ directories.

  • CD audio tracks. OpenTomb only supports OGG audiotracks for a moment, so you should convert original soundtracks by yourself, or just download whole TR1-5 music package here: https://opentomb.earvillage.net PLEASE NOTE: Files may need to be renamed for this to work, please see #447

  • Loading screens for TR1-3 and TR5. For TR3, get them from pix directory of your installed official game. Just put this pix directory into /data/tr3/ folder. As for other games, it's a bit tricky to get loading screens, as there were no loading screens for PC versions TR1-2, TR4 used level screenshots as loading screens, and TR5 used an encrypted format to store all loading graphics. So, to ease your life, you can simply download loading screen package here: http://trep.trlevel.de/temp/loading_screens.zip Just put it right into OpenTomb directory, and that should do the trick. Note: the engine supports png and pcx format of screen images.

Compiling

There is a CMakeLists.txt file provided with source code, so you can compile OpenTomb using CMake. On Windows, you can also compile it from Code::Blocks or Netbeans IDE. Alternatively, you can manually compile it in Code::Blocks or Netbeans by recursively adding all source files from /src directory, and adding these libraries in Linker Settings under Project Build options:

  • libmingw32.a
  • libSDL2main.a
  • libSDL2.dll.a
  • libpng.a
  • libz.a
  • libpthread.a

On Linux, just download the source code and run in terminal:

cmake . && make

The required dependencies are the development headers for SDL2, png, ZLIB. You can install them in an Ubuntu-based distro with this command:

sudo apt-get install libopenal-dev libsdl2-dev libpng12-dev libglu1-mesa-dev zlib1g-dev

On Mac, use XCode project, which is also available in source code.

NB: Please note that OpenTomb requires C++11 (-std=c++11) flag to compile properly! You may use CPU-specific optimization flags (-march=prescott, -march=i486, -march=core2), as well as general optimization flags (-O1, -O2 and -O3), but -O3 flag on old GCC versions may prevent to engine crash as Bullet tends to crash with this optimization level (GCC 5.1+ may compile it without errors).

Running and Configuration

To run OpenTomb, simply run the executable generated by the build. By default, no command line options are needed. Access the console by pressing `. This allows you to enter commands to select levels, change settings, and more. Enter 'help' to get a list of commands. Enter 'exit' to quit the engine.

Currently, all settings in OpenTomb are managed through config.lua and autoexec.lua. Config.lua contains persistent engine and game settings, while autoexec.lua contains any commands which should be executed on engine start-up.

Config.lua is divided into different sections: screen, audio, render, controls, console and system. In each of these sections, you can change numerous parameters, the names of which are usually fairly intuitive.

Autoexec.lua is a simple list of commands which are ran at startup. Modifying existing commands may cause the engine to function incorrectly.

To select a level, enter 'setgamef(game, level) into either autoexec.lua or in the console, where game is 1-5. Mansion levels are generally 0, and games which do not have a mansion begin from level 1. For example, to load level 2 of TR3, you would enter setgamef(3, 2).

Licensing

OpenTomb is an open-source engine distributed under LGPLv3 license, which means that ANY part of the source code must be open-source as well. Hence, all used libraries and bundled resources must be open-source with GPL-compatible licenses. Here is the list of used libraries and resources and their licenses:

  • OpenGL — does not need licensing (https://www.opengl.org/about/#11)

  • OpenAL Soft — LGPL

  • SDL / SDL Image — zlib

  • Bullet — zlib

  • Freetype2 — GPL

  • Lua — MIT

  • ffmpeg rpl format and codecs (http://git.videolan.org/)

  • Droid Sans Mono, Roboto Condensed Regular and Roboto Regular fonts — Apache

Credits

NB: Please note that authors and contributors list is constantly extending, as there is more and more people involved in project development, so someone may be missing from this list!

  • TeslaRus: main developer.
  • Cochrane: renderer rewrites and optimizing, Mac OS X support.
  • Gh0stBlade: renderer add-ons, shader port, gameflow implementation, state control fix-ups, camera and AI programming.
  • Lwmte: state and scripting fix-ups, controls, GUI and audio modules, trigger and entity system rewrites.
  • Nickotte: interface programming, ring inventory implementation, camera fix-ups.
  • pmatulka: Linux port and testing.
  • richardba: Github migration, Github repo maintenance, website design.
  • Saracen: room and static mesh lighting.
  • Stohrendorf: code review, original game logic information, auto build system.
  • T4Larson: general stability patches and bugfixing.
  • vobject: nightly builds, maintaining general compiler compatibility.
  • vvs-: testing, feedback, bug report.
  • xproger: documentation updates.
  • Banderi: documentation, bugfixing.
  • gabrielmtzcarrillo: entity shader work.
  • filfreire: documentation.
  • TokyoSU: misc fixes, weapon inventory.

Additional contributions from: Ado Croft (extensive testing), E. Popov (TRN caustics shader port), godmodder (general help), jack9267 (vt loader optimization), meta2tr (testing and bugtracking), shabtronic (renderer fix-ups), Tonttu (console patch) and xythobuz (additional Mac compatibility patches).

Translations by: Joey79100 (French), Nickotte (Italian), Lwmte (Russian), SuiKaze Raider (Spanish), filfreire (Portuguese - Portugal).

opentomb's People

Contributors

agentzero1 avatar banderi avatar carlo-bramini avatar cochrane avatar cyyy1998 avatar devnexen avatar filfreire avatar gabrielmtzcarrillo avatar gh0stblade avatar mdeguzis avatar nunojesus avatar per1234 avatar pritchy96 avatar rffontenelle avatar ricciardi-adrien avatar richardba avatar stohrendorf avatar teslarus avatar tokyosu avatar vobject avatar vvs- avatar xproger avatar zdimension avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opentomb's Issues

TR3 Thames Wharf: Lara disappears, leaves behind trail of white polygons.

As described by Lwmte:

There are some bugs, however - for example, in TR3 Thames Wharf, try to get to a sector with death slide, and you will notice that Lara will disappear on certain sectors on her way, and instead, some garbage white polygons will appear in bottom left corner.

Almost certainly caused by new shader code.

Lara is getting teleported on collision

The new collision system is rough at present, but that isn't a point. For some strange reason the coordinates fluctuate wildly. Try this test at the console setgamef(4,3) setEntityPos(player,42787,39352,-6131,177,0,0) then return to game play and tap down once. I've got Lara on top of a crate, on top of it at the back wall, inside the crate, out of the level geometry and even at the opposite front wall of the room at one point!

Issue in height calculation

There is currently an issue which prevents Lara from correctly using a climbable wall.

And if the wall goes up from one room to another a weird bug happens, instead of looped animation, the climbing animation stops and she performs another climb.

Lara jumps too far

In Caves when Lara prepares to make a standing forward jump to the last secret from the ledge, she can only grab the opposite ledge to climb. But in OpenTomb she safely land behind the gap. This also makes jumping around on the blocks in a switch room in Palace Midas unnecessary.

Genuine Tomb Raider bugs

There are just too many. I'm starting this issue to document all of these. Script overrides could use this information to patch them on the fly.

  • wrong geometry
    • in Caves setEntityPos(player,17503,48134,-6401,129,0,0)
    • in Palace Midas setEntityPos(player,34010,57306,3548,144,0,0)
    • in Palace Midas setEntityPos(player,75946,37669,4065,122,0,0)
  • transparent back-face
    • in Tomb of Qualopec setEntityPos(player,52714,62133,-6656,267,0,0)
  • wrong trigger
    • entity 66 in St. Francis' Folly (described in #33)
  • wrong static location
    • static 40 in Old Mill (described in #49)
  • inaccessible items
    • entity 87 in Palace Midas.
  • wrong collisions
    • when Lara got hit by a door and there is no portal she ends up in a limbo.

Bleeding mipmap transparency

In original TRs, texture info had three types of transparency attributes - OPAQUE (0x00), TRANSPARENT (0x01, magenta-colored zones) and TRANSLUCENT (0x02, alpha-blended). Current version of OpenTomb renderer ignores OPAQUE flag, setting all opaque texinfos to transparent. While it may look normal on a close range, getting farther from these textures may result in "transparency bleeding" on mipmaps from adjacent textures in atlas. This should be fixable by making OPAQUE attribute working again.

Highly-penetrative underwater collision

A month or two ago, some changes to physics engine were made, which resulted in extremely poor collision detection underwater - Lara can literally swim into any wall, floor or ceiling.

Overlapping rooms geometry produces visual artefacts

This is visible over certain angles only, e.g. setgamef(1,7) setEntityPos(player,38335,45407,4352,275,0,0) or setgamef(5,1) setEntityPos(player,52875,42308,3584,65,0,0). By rotating the camera the artifacts disappear. It may be related to #40.

Here's a link to screen shots.

Incorrect walking animation

When the walk button is tapped once, Lara makes two steps most of the time. But in TR1 she makes just one.

Hair has no skinning

Lara's ponytail in TR4 has gaps instead of being continuous and smooth, because skinning of hair meshes is not yet implemented. (This also applies to TR2 and TR3, but there that was original)

I'm currently working on changes to the skinning code in general (they already work, but broke animated textures again; I'll push them once that's fixed), so I'd like to claim this one. It will probably end up with TR2 and TR3 getting skinning, as well.

Environmental mapping missing

The specular lighting effect ("shiny") in TR4 and TRC is missing and should be added back in.

Note: This bug was not introduced by the shaders. The old code didn't implement it either. Still needs to be fixed, though.

Fallback state implementation and unused speeds

Copied from Tomb Raider forums (post by Joey79100):

When there's a pit behind you, and you press Backwards, Lara will start hoping backwards. Once she's above the empty, she starts falling, playing animation 34 and then 35 (that have StateID 3, that is used for jumping forwards), but it's wrong. She should play animation 93 that has StateID 29 (and without animation 34 before).
This animation and its StateID were considered as unused by Fluen when creating his animation list (and consequently, StateID29 wasn't referenced in the StateID list), because visually it looks the same as animation 35, but actually it is used, and there's a reason.
The problem that exists now is that if you are already pressing the Action key when jumping backwards (to grab the ledge), Lara gets stuck on the edge, switching continuously between animation 22 (starts falling while jumping forward when she hasn't finished the "jump cycle" (when there was a ceiling)), and animation 82 (falls on the ground).
Animation 93 lets you grab a ledge only after 7 frames (not a hardcoded thing, the StateID change is written this way in the animation), while animation 35 lets you do this during the whole animation. So using animation 93 will prevent her from being stuck like she currently does.

Proof that the StateID exists: in TOMB.MAP that was leaked with the May TR1's demo, it's referenced this way:

0001:00013da0 lara_as_fallback_

(StateID 30 is used when shimmying left, and is just after 29 which has a rather clear name)
I don't know if you've written code for this StateID though, but there shouldn't be a lot of differences.
By the way it seems that the speed for animation 95 (ready to grab) is ignored. She's meant to go forward, but in OpenTomb she has no horizontal speed.
The speed she has when she hits a wall while jumping are ignored too.

Broken lighting in TR5

But the lighting problems are inconsistent. I get them in the same places but not every time. Seems that they depend on previous actions. Every time I load the level I get different distribution. They appear as very bright white, yellow or totally black colors on Lara and some textures. Here's one place where it sometimes can be seen: setgamef(5,1) setEntityPos(player,46970,42791,-256,270,0,0). And here's another: setEntityPos(player,51278,38426,-256,90,0,0).

I'm not able to attach screenshots for some reason, so here's the link to them.

Crash when leaving level with hair

When leaving a level with hair (for example by ending the program), an assertion gets triggered because bodies are destroyed while there are still constraints between them.

Frustums are broken

Happens in many places, e.g. Caves (see #49), Area 51, Old Mill, Streets of Rome. That's after VAO changes.

Strange HEAVYTRIGGER behaviour in LEVEL3B.PHD

In Tomb of Qualopec, there is a grated door in the main passage to Scion, which is opened on level start-up (activation mask is set). For some reason, it's not affected by HEAVYTRIGGER which should be triggered by boulder. Most likely, additional reverse-engineering of original TR trigger behaviour is needed.

Classic camera broken

Classic camera will rotate in front on the first collision and stays there indefinitely. This was broken by 8f1992a.

Wrong textures in Lara' home

In TR2 Lara' home there are wrong textures in some of the windows. In particular, in the kitchen when you look at the windows from outside.

Wrong lever behavior

In St. Francis' folly lever 66 can be operated only once, while in the original it's unlimited. That leads to possible deadlock if player didn't trigger closing a door when entered the room first time.

Jagged lighting on longer multi-mesh entities

As described and shown in video by Lwmte; good examples are TR3 T-Rex, TR4 Crocodile.

This is almost definitely caused by the renormalization stage of mesh loading, which needs to be improved here.

Lara vertical misalignment on ladder

There are some really critical bugs with ladder states, as Lara can't climb up properly from ladder to horizontal surface (it takes few "iterations" for her to finally align correctly), and also she doesn't stop climbing up when she's right under the ceiling, which results in her awkward repositioning.

Fix for the first problem is to finally align Lara's vertical position to multiples of 256 when grabbing.
Fix for the second problem is to perform additional collision checks right above and next to her.

Partial texture clipping

In some areas objects may share the space between its' polygons and surrounding room geometry. Thus it may occlude textures of such objects. One example can be seen in Caves setEntityPos(player,16791,87115,-8960,214,0,0). On a sufficient distance takes place visible flickering apparently caused by Z-fighting. This wasn't so obvious in the original game where camera didn't move during breath animation.

Aburpt crashes in various parts of different levels

Most likely, it is related to Lua script stack trashing - possibly, in trigger functions section. Good example to check is the end of Temple Ruins with last key in underwater room (sector with two sinks, which also produces short lock-up before crashing).

Broken animated textures in TR4+

Possibly, something was broken either with changing UVRotate algorithm, with implementing room shader or with recent renderer/BTA optimizations.

Incorrect detection of DEATH trigger

Currently, no additional collision checks are performed on DEATH sectors, only Lara move type is checked. This results in false DEATH triggers, for ex., when Lara is stepping onto trapdoor above lava. This should be fixable by checking if Lara has hit room collisional mesh OR static/entity mesh. Then we ignore DEATH trigger in latter case.

Early frustum clipping

It seems that clipping happens too early. See for example setgamef(4,6) setEntityPos(player,27242,29836,0,16,0,0), then try to rotate camera to the left. Also, try to jump straight up.

Missing double-sided polygons

As a result of merging polygons with single-sided and double-sided attribute into the same vertex buffer object (with single-sided attribute), double-sided polygons are missing. Most obvious example are trees in TR3 Jungle.

Can't pass through

In TR4 Race For The Iris entity 26 has collision flag set. Requires the same override as in Sacred Lake.

Wrong dive behaviour

Copied from TRF (post by Joey79100):

When Lara is floating and you want her to dive, she will start going forward (animation 118 then 116) and dive using animation 115. It's good that she can dive when swimming forward as she couldn't in the originals, but now she can't even dive when she's not moving.
In the original games, she didn't start swimming, but dived directly with animation 119. When the animation is triggered, she's rotated at 45° and the animations continue normally. <...> Actually, the animation is forced only when Lara has StateID 33 (floating but not moving). The diving animation never plays during the animation 116 (floating forward), but as soon as animation 117 (stopping animation, with StateID 33) is triggered. So Lara has to be stopped first, and only then she can dive if the Jump key is pressed.
The fact that she stops is certainly hardcoded when the Jump key is pressed though, but it doesn't force the stop animation to play. I think it simulates the releasing of the Up key, or it forces next StateID 33, so when the animation encounters a StateID change with StateID 33, she starts stopping... and as her animation will now be animation 117 which has StateID 33, she will dive at this precise moment.
Fun fact: animation 115, that makes Lara dive while floating forward, wasn't ever played in-game, but there's a StateID change in animation 116 that could trigger it. But it checks for StateID 17 (swimming underwater) instead of StateID 35 (diving)... so either it can't even work, or it works, but as the "stop" behavior has the priority (as it is on the same key), it will not be triggered as she will already be stopping.

Incorrect sound flags parsing in TR2

Most likely, flag order was changed in TR2 for rewound and wait samples, which results in wrong sound behaviour (e.g., T-Rex steps, Lara sliding, pistols shooting, etc.). Must check original flag meaning in TR2.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.