Development

Daniel Evans edited this page Jun 25, 2018 · 10 revisions

This page is about using development features build into OpenRW and general development tips.

If you want to know how you could help developing OpenRW in general you should check out the contributing page instead.

Debug Features in RWGame

There are many tools within OpenRW geared to helping development of features or fixing issues.

Test Mode

The test mode, accessible from the main menu or using the --test option spawns the player in the map with access to some weapons and vehicles, without running the game script. This can be useful for testing some non-script related functionality such as AI behaviour, vehicle dynamics, collision detection, or world rendering.

Developer Menu

There is a developer menu, accessible in-game via M. This menu provides quick access to useful locations in the world, many vehicles, pedestrian followers and weapons. Pressing F in the menu will enable a free-look camera which is Mouse-Look + WASD with Shift as speed-modifier.

Debugging views

There are debug views accessible via the function keys that will present the game data in-world.

  • F1 General statistics and state
  • F2 Show AI paths, garage bounds, and vehicle spawner locations.
  • F3 Render physics objects.
  • F4 View object state.

Loading Saves

OpenRW can load original game saves. Simply loading a saved created with GTA III with the situation you need to test is a helpful way to speed up debugging or development. The -l/--load switch can be used to provide a file path to a .b save file to load.

Development Tools

There are many tools within OpenRW geared to helping development of features or fixing issues.

Script tracer

When investigating a script issue it is useful to see the opcodes the game executes. Configuring the game with the ENABLE_SCRIPT_DEBUG=1 option will print out each opcode as it is executed, the thread executing it, the program counter, conditional flag and the argument values. Output can be limited to a single thread by setting the environment variable OPENRW_DEBUG_THREAD to the name of the thread.

RWViewer

The RWViewer application is a Qt GUI program for inspecting the game's data files. It currently supports viewing object information, some models, loading and playing animations, as well as viewing map files. More work is needed on this tool to make it usable as a useful tool for both debugging. Missing features include: a file picker for viewing arbitrary files, a texture viewer, more detailed object information.