Welcome to this post We are going to tell you everything there is to know about Cities: Skylines – Usage and Debug Output in this guide.
With the mod installed and the game re-started you can open the debug window (hit F7 to indicate that ModTools is installed) and you’ll get debug messages (one per minute) informing you about the specific road segments you added to the map:
How it works
The way the traffic detector works is that every N frames (in the code this is called “COUNT_FRAME_INTERVAL” and is set to 10 by default) it scans for all the instances of the custom road segments (“HighwayCountIn” and “HighwayCountOut”) and sees what vehicles are in every segment and makes a list, the next time it scans (10 frames later), it makes a new list and sees how many of the vehicles were in the first list and not the new one, these are the vehicles it counts as having left the watched segment. Every minute (this time frame is also adjustable if you edit the code, it’s in a variable referred to as “DIVISOR” for reasons) it will report the total of the vehicles that have left the segment. This happens for every segment, i.e. every minute there is a report on how many vehicles have left each segment. I wanted to be aware of the number of vehicles that entered and left a particular intersection. I came up with two distinct segments of roads with an “in” and an “out”. In addition to reporting on the individual segments there is a report available that sums up all segments.
This is an example of the output of the debugging process:
[Log] MyFirstMod.MyBehaviour.Update(): TICK:
Seg 0,2800 = 6
SEQ 1,9981 = 2
Seg 2,16498 = 50
SEQ 3,19693 70
IN TOTAL = 72, OUT TOTAL = 56
This debug text has four road segments, two of which are “in” and two are “out”.
- The first segment that is “out” has the segment_id “2800”. (every road segment is unique) We can see that six vehicles left the segment within the last minute.
- The first segment “in” is number “1” with segment_id “9981”, we can see two vehicles leaving this segment in the last few minutes.
- The second segment “out” is numbered “2”, has an ID of “16498” and we are able to see 50 vehicles left this segment in the last few minutes.
- The second “in” segment is identified as “3” and has a segment_id of “19693” and we can see that 70 vehicles left that segment in the last minute
- the total for all vehicles that left all of the “in” segments is 2 + 70 = 72 vehicles
- the total for all vehicles that quit all “out” segments is 6 + 50 = 56 vehicles
Remember to keep this in your mind
- Bicycles do not count.
- All output is sent directly to debug-output. I believe that this is, or can be, transferred to an external file. If so it’s easy to parse the output text to extract the raw traffic data, which could be useful for those who plan to observe numerous roads.
- The game may be negatively affected by the CPU’s activity. You’ll notice a change in your game’s performance when background processes that are CPU-intensive are running.
The mod does not have an UI, so it begins running after a game is loaded. I utilize the “pause on load” mod to load games while in a paused mode. The mod will show zero totals for each segment as long as the game is in a pause. To set up a simulation run or counting you must clear the debug window and when you see a see an output from the debug window that is displaying the latest minutes totals stop the game so that it will get a full minutes worth of data in the first minute, so if you are slow unpausing the game, you’re in danger of getting less than a minutes worth of data. This is a clever way to get around the lack of an “start recording” button.
This Cities: Skylines – Usage and Debug Output guide has come to an end. Please contact us and let us know if you have any concerns, questions, or suggestions about how we can improve this topic. Thank you very much for your thoughtfulness, and I hope you have a lovely day! The author and creator of RichAntDav inspired this post. Also, if you like the post, don’t forget to add us to your bookmarks; we publish new posts every day with additional material, so be sure to check back with us frequently for more posts.
- All Cities: Skylines Posts List
Leave a Reply