Performance

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
(Created page with "This document discusses performance from a content creation perspective. It seeks to enumerate the major factors which reduce game frame rate and reference the major strategie...")
 
m
Line 12: Line 12:
 
=The Low Level=
 
=The Low Level=
 
In order to render a single frame, Trainz must perform the following steps in order:
 
In order to render a single frame, Trainz must perform the following steps in order:
 +
 
1. Perform a single frame update for all frame-locked game threads. The important threads from a content creation perspective are the Game Main Thread and the PhysX Thread. Most other threads are not frame-locked, or are not likely to hurt frame performance.
 
1. Perform a single frame update for all frame-locked game threads. The important threads from a content creation perspective are the Game Main Thread and the PhysX Thread. Most other threads are not frame-locked, or are not likely to hurt frame performance.
 +
 
2. Process GPU buffer uploads, culling, and sorting.
 
2. Process GPU buffer uploads, culling, and sorting.
 +
 
3. Render the shadow buffer (if enabled).
 
3. Render the shadow buffer (if enabled).
 +
 
4. Render the reflection buffer (if enabled).
 
4. Render the reflection buffer (if enabled).
 +
 
5. Render the main scene.
 
5. Render the main scene.
 +
 
6. Vsync and display the result.
 
6. Vsync and display the result.
 +
  
 
Several of these steps are overlapped between frames; for example once the game threads have completed one frame and passed the frame to the renderer, they may start on the next frame. This overlap reduces frame time but does not reduce simple input latency.
 
Several of these steps are overlapped between frames; for example once the game threads have completed one frame and passed the frame to the renderer, they may start on the next frame. This overlap reduces frame time but does not reduce simple input latency.

Revision as of 20:06, 16 October 2017

This document discusses performance from a content creation perspective. It seeks to enumerate the major factors which reduce game frame rate and reference the major strategies in avoiding problems.


Contents

Performance Concerns

There are a number of discreet metrics which should be considered when evaluating performance:

  • The time taken to render each frame. This is inversely proportional to frame rate, and is a more useful metric.
  • Timing variations between frames. Longer frames may cause visible hitches. Both longer and shorter frames can cause mis-predictions which are nearly as bad.
  • Latency between basic user input (such as a camera movement) and the result appearing on-screen.
  • Latency between complex user input (such as a database search, moving a spline, or placing a new locomotive) and the result being finalized.
  • Loading time when entering a session, or when teleporting from place to place in a session.

The Low Level

In order to render a single frame, Trainz must perform the following steps in order:

1. Perform a single frame update for all frame-locked game threads. The important threads from a content creation perspective are the Game Main Thread and the PhysX Thread. Most other threads are not frame-locked, or are not likely to hurt frame performance.

2. Process GPU buffer uploads, culling, and sorting.

3. Render the shadow buffer (if enabled).

4. Render the reflection buffer (if enabled).

5. Render the main scene.

6. Vsync and display the result.


Several of these steps are overlapped between frames; for example once the game threads have completed one frame and passed the frame to the renderer, they may start on the next frame. This overlap reduces frame time but does not reduce simple input latency.

Because these steps are performed sequentially, a stall at any stage will delay the entire frame. To reach a steady 60fps, the entire process must complete within 16ms with no exceptions.

Game Main Thread

Per-frame Costs

TBD.

One-off Costs

TBD.

Loading

TBD.

PhysX Thread

TBD.

GPU

TBD.

Settings

TBD.

Profiling

TBD.

Personal tools