Hello and welcome, we will give you information about Cities: Skylines – Traffic counting mod setup tutorial, we hope this post will be useful to you.
Step 1: Get the code
The first thing you should do is to get a copy. This shouldn’t be difficult as the source code is just a text c#.
The code is currently located at:
https://gitlab.com/richantdav/cs-traffic-counting-mod/-/tree/master – [gitlab.com]
You could clone or copy the repo, but you only need “MyFirstMod.cs”.
Step 2: Installing the mod
The game searches for mod source folders in the directory C:\Users\\AppData\Local\Colossal Order\Cities_Skylines\Addons\Mods.
Create a new directory called “FirstMod” in this directory. Create a new directory called “Source” inside the new directory. This is where you will put the “MyFirstMod.cs”.
- ModTools: Debugging Toolkit for Modders, Version 3.3.0. (It should work for similar numbered versions). Hit F7 to open the debug window
- Pause on Load
Create new road types
The mod first searches for all road segments with a specific name. These names are:
“HighwayCountOut”, “HighwayCountIn”, “Highway4CountOut”, and “Highway4CountIn”.
You must create 1,2,3, or 4 new rroads and give them these names.
Note that the names must be exact matches.
To create new road types that have these names, you’ll need the Asset Editor. I created new road types based off the normal 3 and 4-lane highways. You can see in the screenshots that I have modified the roads to make them more distinguishable from the standard version. I increased the “Half Width”, property of each new type of road to 18 for “In” roads, and “23” (for the out roads). The custom roads are marked with a blue line. The mod should work on any road type, not just highways or one way roads.
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 – it scans the custom road segments and sees what vehicles are in the segment and makes a list, the next time it scans (10 frames later by default), 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. The traffic detector reports the number of vehicles that have left the segment every minute. This value can be changed if you edit your code. It’s stored in a variable named “DIVISOR”. This is done for each segment. Every minute, a report is generated on how many vehicles have left each segment. For my purposes, I wanted to know the number of vehicles that entered and left a specific intersection. I created two groups of road segments: an “in” and an “out”. In addition to reporting the individual segments, a report is also available that sums up all the segments.
This Cities: Skylines – Traffic counting mod setup tutorial Guide is now complete. We would appreciate hearing from you if you have any questions or suggestions on how we may improve this post. Thank you very much; I hope you have a fantastic day! The writings of creator and author RichAntDav served as inspiration for this entry. Also, if you like the post, don’t forget to add this website to your bookmarks; we publish new posts every day with additional material, so be sure to check back with this website on a regular basis for more posts.
- All Cities: Skylines Posts List
Leave a Reply