OpenRCT2/readme.md

156 lines
13 KiB
Markdown
Raw Normal View History

2014-04-15 01:50:20 +02:00
# OpenRCT2
2016-03-21 13:46:40 +01:00
An open source re-implementation of Roller Coaster Tycoon 2. A construction and management simulation video game that simulates amusement park management.
2014-04-15 01:50:20 +02:00
2016-03-21 13:46:40 +01:00
### Build Status
2016-06-13 20:27:40 +02:00
| | Windows | Linux / Mac | Download |
2016-03-22 18:56:30 +01:00
|-------------|---------|-------------|----------|
2016-04-20 14:17:13 +02:00
| **master** | [![AppVeyor](https://ci.appveyor.com/api/projects/status/7efnemxhon6i5n34/branch/master?svg=true)](https://ci.appveyor.com/project/IntelOrca/openrct2-ject9) | [![Travis CI](https://travis-ci.org/OpenRCT2/OpenRCT2.svg?branch=master)](https://travis-ci.org/OpenRCT2/OpenRCT2) | [![OpenRCT2.org](https://img.shields.io/badge/stable-v0.0.4-green.svg)](https://openrct2.org/downloads/master/latest) |
| **develop** | [![AppVeyor](https://ci.appveyor.com/api/projects/status/7efnemxhon6i5n34/branch/develop?svg=true)](https://ci.appveyor.com/project/IntelOrca/openrct2-ject9) | [![Travis CI](https://travis-ci.org/OpenRCT2/OpenRCT2.svg?branch=develop)](https://travis-ci.org/OpenRCT2/OpenRCT2) | [![OpenRCT2.org](https://img.shields.io/badge/develop-v0.0.5-blue.svg)](https://openrct2.org/downloads/develop/latest) |
2014-08-16 18:05:57 +02:00
2016-03-21 13:46:40 +01:00
### Chat
2016-04-20 14:17:13 +02:00
[![Gitter](https://img.shields.io/badge/gitter-general-blue.svg)](https://gitter.im/OpenRCT2/OpenRCT2/non-dev)<br />
[![Gitter](https://img.shields.io/badge/gitter-development-yellowgreen.svg)](https://gitter.im/OpenRCT2/OpenRCT2)
2014-11-03 19:24:43 +01:00
2014-04-15 01:50:20 +02:00
# Contents
- 1 - [Introduction](#1-introduction)
- 1.1 - [Background](#11-background)
- 1.2 - [Decompiling the game](#12-decompiling-the-game)
- 1.3 - [Progress](#13-progress)
2015-03-21 19:18:45 +01:00
- 1.4 - [Aim](#14-aim)
2015-10-23 09:56:51 +02:00
- 2 - [Downloading the game / Building the source code](#2-downloading-the-game--building-the-source-code)
- 2.1 - [Building Prerequisites](#21-building-prerequisites)
- 2.2 - [Compiling and running](#22-compiling-and-running)
- 3 - [Contributing](#3-contributing)
- 3.1 - [Decompiling](#31-decompiling)
- 3.2 - [Naming of procedures and variables](#32-naming-of-procedures-and-variables)
- 3.3 - [Cleaning and documenting the source code](#33-cleaning-and-documenting-the-source-code)
2014-04-28 18:41:28 +02:00
- 3.4 - [Implementing new features / fixing bugs](#34-implementing-new-features--fixing-bugs)
2015-02-17 19:49:29 +01:00
- 3.5 - [Translation](#35-translation)
- 4 - [Licence](#4-licence)
2014-04-15 01:50:20 +02:00
# 1 Introduction
## 1.1 Background
2015-03-21 19:18:45 +01:00
**OpenRCT2** is an attempt to decompile RollerCoaster Tycoon 2 into C. RollerCoaster Tycoon 2 was originally written in MASM and Visual C++ where functions related to interfacing with the operating system were written in C (supposedly 1%), with the rest of the game being written in pure x86 assembly. For an example of this method, OpenTTD was formed through a similar procedure; the original game, Transport Tycoon Deluxe, was decompiled into C which allowed for the addition of thousands of features to the game. RollerCoaster Tycoon 2 uses the third version of Chris Sawyer's engine, which shares some code with Transport Tycoon. This is reflected in the usage of OpenTTD 0.1 code such as the windowing system and graphics rendering. While the version of the engine used in Chris Sawyer's Locomotion is newer, OpenRCT2 is currently targeting the RollerCoaster Tycoon 2 engine to ease the decompilation process.
2014-04-15 01:50:20 +02:00
## 1.2 Decompiling the game
In order to decompile the game gradually without introducing new bugs, each procedure in RollerCoaster Tycoon 2 is to be re-written in C on an individual basis. To test the accuracy of the re-written procedures, the decompiled C procedures are compiled into a DLL (```openrct2.dll```) which exports an entry procedure mimicking the ```WinMain``` function in RollerCoaster Tycoon 2. The original executable ```rct2.exe``` has been patched so that ```openrct2.dll``` and ```WinMain``` are in the DLL import table and the ```WinMain``` export procedure in ```openrct2.dll``` is called at the start of the ``WinMain`` procedure in ```rct2.exe``` before returning. With this system implemented, starting ```rct2.exe``` calls the new DLL as part of its initialization; the DLL can then run all the decompiled code whilst still being able to read / write to the ```rct2.exe``` memory model and run ```rct2.exe``` procedures.
2014-04-15 01:50:20 +02:00
The project therefore acts as a patch to RollerCoaster Tycoon 2, allowing each procedure to be gradually implemented while simultaneously adding new features where possible. Until all procedures of the original game are re-written in C, the project must remain a DLL which is called from the patched ```rct2.exe```.
2014-04-15 01:50:20 +02:00
## 1.3 Progress
Currently, the windowing system, graphics rendering and basic game loop are being decompiled. Decompiling all of the game's procedures is a convenient way of identifying the game's memory structure. SDL2 has been used as a replacement for the operating system calls, allowing for cross-platform support after the dependency on the original game's executable has been removed.
2014-04-15 01:50:20 +02:00
2015-09-09 19:25:48 +02:00
As of 9th September 2015, a vast set of improvements have been added such as improved UI, tools, cheats, localisation and configuration. The entire window system and UI has been implemented, all file format handling such as loading and saving of parks, graphics and tracks, ride logic, game management (e.g. peep generation, awards, cash out) and a lot of the peep logic. What remains is a lot of code to draw the map, the rest of the peep logic, and the entirety of vehicle logic. The rest are small parts around different areas that aren't particularly significant. More information can be found in [changes to original game](https://github.com/OpenRCT2/OpenRCT2/wiki/Changes-to-original-game).
2014-04-15 01:50:20 +02:00
## 1.4 Aim
2015-03-21 19:18:45 +01:00
The aim is to completely decompile RollerCoaster Tycoon 2 into C so that cross-platform support, new features, and new gameplay can be added in a similar fashion to OpenTTD. With the addition of SDL2, the game can already be run in a resizeable window (which was not possible originally). Once the game has been fully decompiled, additional gameplay features, gameplay tweaks, and improvements can be introduced. The following is only a brief, non-exhaustive list of the possibilities - there are many more:
- Improved peep path-finding
- Increased window / ride / object / map / construction limits
- More sandbox-friendly gameplay
- Editing available objects
- Improved title sequence
2015-03-21 19:18:45 +01:00
- Translation into more languages
- Re-introduction of RollerCoaster Tycoon 1 mechanics:
- Shuttle Loop compatibility
- Have Fun! objective
- Finish building five coasters objective
- Using the mountain tool during the game
2014-04-15 01:50:20 +02:00
# 2 Downloading the game / Building the source code
2014-04-15 01:50:20 +02:00
[OpenRCT2.org](https://openrct2.org/downloads) offers precompiled builds and installers of the latest stable and the develop branch. There is also a Launcher available that will automatically update your build so that you always have the current version as they are released.
## 2.1 Building prerequisites
OpenRCT2 requires original files of Rollercoaster Tycoon 2 to play. It can be bought at either [Steam](http://store.steampowered.com/app/285330/) or [GOG.com](http://www.gog.com/game/rollercoaster_tycoon_2).
2014-05-23 14:29:09 +02:00
### Windows:
2015-12-12 21:06:03 +01:00
- Vista / 7 / 8 / 10
- Visual Studio 2015 Update 2 (Enterprise / Professional / [Community (Free)](https://www.visualstudio.com/products/visual-studio-community-vs))
- [Powershell 4.0](http://social.technet.microsoft.com/wiki/contents/articles/21016.how-to-install-windows-powershell-4-0.aspx).
2014-04-15 01:50:20 +02:00
### Mac:
- [Homebrew](http://brew.sh)
2014-08-17 22:01:05 +02:00
### Mac / Linux:
- sdl2
- sdl2-ttf
- speexdsp
- curl (only if building with network support)
- jansson (only if building with network support)
- iconv (part of glibc on Linux)
- cmake
All libs listed here (bar cmake) required in 32 bit variants.
2014-05-23 14:29:09 +02:00
2014-04-15 01:50:20 +02:00
## 2.2 Compiling and running
2014-05-23 14:29:09 +02:00
### Windows:
1. Check out the repository. This can be done using [GitHub Windows](https://windows.github.com/) or [other tools](https://help.github.com/articles/which-remote-url-should-i-use).
2015-12-12 21:06:03 +01:00
2. Open a new PowerShell window and navigate to the repository.
3. Run the ```setenv.ps1``` script in the repository to setup your PowerShell environment for OpenRCT2 development. This will warn you of any missing applications required to build OpenRCT2.
2015-12-12 21:06:03 +01:00
4. Run ```install``` to download the required dependencies to build OpenRCT2.
5. Run ```build all``` to build all the required components for OpenRCT2.
6. Run ```run``` to run OpenRCT2.
These PowerShell scripts are stored in ```.\scripts\ps``` and have parameters. Once you have use the build script once, further development can be done within Visual Studio by opening ```openrct2.sln```. The build scripts have several commands allowing you to rebuild certain components such ```g2.dat``` or language files.
2014-04-15 01:50:20 +02:00
### Mac:
We support native builds on macOS (limited to i386 only for now).
Make sure that you have [Homebrew](http://brew.sh/) installed and than run the following commands to install all the needed libraries and build OpenRCT2.
2014-08-17 22:01:05 +02:00
```
2015-12-12 13:53:16 +01:00
# Install libraries
./install.sh
# Build OpenRCT2
./build.sh
# Run the game
./openrct2
2014-08-17 22:01:05 +02:00
```
2014-05-23 14:29:09 +02:00
### Linux:
We support native builds for Linux (limited to i386 only for now).
2015-12-11 00:59:49 +01:00
As the easiest approach depends on your distribution, please take a look at the [wiki](https://github.com/OpenRCT2/OpenRCT2/wiki/Building-OpenRCT2-on-Linux).
2014-05-23 14:29:09 +02:00
2014-04-15 01:50:20 +02:00
# 3 Contributing
OpenRCT2 uses the [gitflow workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow). If you are implementing a new feature or logic from the original game, please branch off and perform pull requests to ```develop```. If you are fixing a bug for the next release, please branch off and perform pull requests to the correct release branch. ```master``` only contains tagged releases, you should never branch off this.
2014-04-15 01:50:20 +02:00
2015-09-09 19:25:48 +02:00
Please read our [contributing guidelines](https://github.com/OpenRCT2/OpenRCT2/blob/develop/CONTRIBUTING.md) for information.
2014-04-15 01:50:20 +02:00
## 3.1 Decompiling
Experience with reverse engineering and x86 assembly is necessary to decompile the original game. [IDA 5.0](https://www.hex-rays.com/products/ida/support/download_freeware.shtml) is currently being used to disassemble and analyze the game. You are welcome to contribute to the process by taking an undecompiled procedure, disassembling it, and rewriting it in C. For more information and the latest IDA database, contact IntelOrca.
2014-04-15 01:50:20 +02:00
## 3.2 Naming of procedures and variables
During the development phase, many variables and procedures are referenced by their memory address in OpenRCT2. This is a result of ongoing reverse engineering efforts; the functionality and use of these values has yet to be determined. To help with identification, there are multiple methods you can use.
For variables:
- Modify the variable and see how the game is affected
- Reverse-engineer RCT2 and find where the variable is used or modified
For procedures:
- Remove the call to the procedure in OpenRCT2 and observe the effects
- Reverse-engineer RCT2 and find where the procedure is called
2014-04-15 01:50:20 +02:00
## 3.3 Cleaning and documenting the source code
As the source code is formed from decompilation, it is unorganized and undocumented. Efforts towards cleaning up and documenting code are appreciated; for example, blocks of code can be moved into their own functions, and macros can be created for operations that occur frequently. However, be aware that the overall structure of the code should remain the same to ensure that OpenRCT2 is kept in sync with the original game to ease the integration of additional decompiled code.
In general, small changes that improve code quality and make it easier to reason about the logic are appreciated. More significant changes, such as changing the game's architecture, are to be avoided during the ongoing decompilation of the original game.
2014-04-15 01:50:20 +02:00
2014-04-28 18:41:28 +02:00
## 3.4 Implementing new features / fixing bugs
While decompilation is an ongoing process, this does not prohibit changes being made to the game. New features or bugfixes can be added, with caution, if the underlying code has been decompiled. When implementing these changes, ensure that comments are added to clearly identify where code has been intentionally changed so that it functions differently to the original game; this is essential to ensuring all research from reverse-engineering can still be applied.
2014-04-15 01:50:20 +02:00
2015-02-17 19:49:29 +01:00
## 3.5 Translation
Translations are in progress for German, Dutch, French, Hungarian, Polish, Spanish, Swedish, Italian, and more. You can translate the game into other languages by editing the language files in ```data/language``` directory. Please join discussions and submit pull requests to https://github.com/OpenRCT2/Localisation.
2015-02-17 19:49:29 +01:00
# 4 Licence
2014-04-25 17:07:07 +02:00
**OpenRCT2** is licensed under the GNU General Public License version 3.
2014-12-09 19:31:46 +01:00
# 5 More information
2015-06-24 18:14:07 +02:00
- [GitHub](https://github.com/OpenRCT2/OpenRCT2)
- [OpenRCT2.org](https://openrct2.org)
- [Forums](https://openrct2.org/forums/)
2014-12-09 19:31:46 +01:00
- [Facebook](https://www.facebook.com/OpenRCT2)
- [RCT subreddit](http://www.reddit.com/r/rct/)
- [OpenRCT2 subreddit](http://www.reddit.com/r/openrct2/)