Advanced Statistics

If you liked this item, please rate it up on Steam Workshop page.

Author: VacuumTube

Last revision: 19 Jan at 14:21 UTC (3)

File size: 1.08 MB

On Steam Workshop

Description:

This mod will show you additional statistics and extensive information in the game.
It can be added/removed every time.

[Description also available in game]

Did you ever wanted to know…

  • How long you played on a savegame (real/game time)?
  • More summarized information about towns (Reachability, Cargo Supply)?
  • More summarized information about industries (Levels, Production)?
  • How many persons there are really simulated?
  • Which people are walking, driving or using lines?
  • For how long people have been waiting at a station?
  • How much cargo is on its way or waiting at stations?
  • The employment rate of town buildings?
  • How many person capacities there are at a certain area (incl. person magnets)?
  • How many vehicles are waiting or stopped?
  • How long the (player owned) street network is?
  • What percentage of the tracks are electrified?
  • Which track types you used and where?
  • Information about street/track speed, curve radius and slope?
  • How many traffic lights there are in a town?
  • How many trees there are on the map?
  • How many additional street/track/bridge types, models, etc. there are with mods?
  • Financial total statistics?

If you like statistics, this mod is right for you.

Also useful as tool to find out filenames of objects and for modders.

Structure

The statistics are contained in a window that is displayed at startup.
They are read from the game sorted by entity types, evaluated and displayed in a tabwidget. Additionally there is general information about the game and application.

For each tab/datatype, a short info can be displayed in the game bar. A click opens the corresponding tab directly. In addition, there is a button in the game bar on the far right to open the window.

Eventually, the mass of information may seem overwhelming at first. I tried to present all relevant and interesting data as compactly and clearly as possible. Nevertheless, you have to deal with it a bit and try it out to understand the different values.
Some elements have tooltips (hold cursor on them) with additional explanations.
For experienced users there is a setting for even more data.

Selection

There are 3 ways to specify which items are included in the statistics (for most types):

  • Global – All objects of this type on the whole map
  • View – All objects in the current view (white circle)
  • Radius – All objects in the white circle (radius changeable)

Calculations

Because of the numerous calculations and iteration over all objects in the game, the calculation time is significant. Therefore, the runtimes are displayed to keep track of them.
Normally the statistics are only updated when the corresponding tab is selected/visible.
To keep the values in the gamebar up to date, you can also activate the permanent background execution in the settings. However, this is only possible to a limited extent, depending on data type and savegame progress.
If the total runtime exceeds 200ms, this leads to lagging in the simulation. This can also be controlled with the debug window (debug mode on, 2x AltGr+i, the lower one).

Problems/Bugs

I have tested the mod extensively, but I can’t exclude possible bugs. That’s why I included an error handler to prevent the game from crashing. In such a case, a window will be displayed. But all information is also written into the stdout txt[www.transportfever2.com].
If an error occurs, please do the following:

  1. In the mod settings, set Log Level to 2
  2. Reproduce the error
  3. Send me stdout file

Background

This project is by far the biggest and most elaborate mod I have created for Transport Fever 2.
The first ideas started already a year ago. The statistics available in the game were just not sufficient enough for me. So it started with graphically displaying single values like game time, total population and other data about towns and industries.
With the time the project became bigger and bigger, because I also wanted to include information of the other entity types (vehicles, assets, people, tracks…). Also, with the modding update last summer, even more possibilities were available.
With time I learned a lot about the game, the (gui) modding interface and programming with Lua. So the next step always remained small and made it possible to add even more information in a compact and flexible way. The finished result always seemed close, but due to the volume (to extract everything interesting from the game what’s possible) and many details, the project dragged on very long, which I underestimated in the beginning.
To get an impression of the size of the project: It consists of 87 script files.

Acknowledgements

Although I encountered some technical issues during development, I would like to thank Urban Games for the support and the modding possibilities.
A big thanks goes to eis_os and CommonAPI2, whose console and inspector tools were very useful during development.
Furthermore, I would like to thank the beta testers for the useful comments.

Code and future development

The source code of this mod is available on GitHub: https://github.com/Vacuum-Tube/Advanced_Statistics_1
I have some ideas for the future. Anyway, I need a break from programming now.

If you like to support my mod development, you can donate here:

[paypal.me] Thank You!

If you have feedback, suggestions, bugs, crashes or questions about the stats itself, please use the appropriate subforum below.

Download
Revisions:

Old revisions of this mod are available below. Click the link to download.