Journaling

From TDN

Contents

Introduction

All flavors of the Torque engine support a feature called the journal. The journal is a system by which all input to the engine is recorded, so that you can play back the exact sequence of events at a later date. It is extremely useful for recording bugs for playback during a debugging session.

One thing to remember is that the journal system is not a general demo recording system that can be stopped, paused, or played back on-the-fly. For recording a gameplay demo for see Demo Recording.

How It Works

The journal system records inputs into the engine for playback later. The input recorded consists of:

  • Posted events
  • Random seeds
  • Network data
  • Some exec()'d scripts


By recording this data into a journal stream, you can accurately playback your session at a later time. The playback stream can be shared to execute your session on other systems, but it is not cross-platform.

Playback can fail if you've made significant changes to the scripts or game code. For example moving a GUI button to another location would cause a recording to miss hitting the button and not playback properly.

Recording

To record a session you must run your executable with the following command line:

  torqueDemo.exe -jSave filename

Where filename is the name of the journal file to create in the root folder of the game. The file name does not need an extension and will be overwritten if a file with the same name already exists. Journal files are very compact as data is only being generated when there are inputs into the system.

Under the hood the command line calls saveJournal which actually starts the recording. The recording ends only when the executable is closed.

Playback

To playback a previously recorded session you do so again via the command line:

  torqueDemo.exe -jPlay filename

Where filename is the name of the journal file to playback. While the playback is occurring you will not be able to interact with the game.

The command line calls playJournal to start playback of your journal file. The playback will show you all mouse movements, gui interactions, and actions taken in gameplay.

Debugging

There is one final command line parameter that comes in useful when debugging:

  torqueDemo.exe -jDebug filename

This command is most useful when playing back a session which causes a crash from the C++ debugger. Before the last event is executed (presumably this is the event that caused the crash) the system executes Platform::debugBreak to dump you into the debugger. You can then start stepping forward to find the offending code.