Cities: Skylines

Cities: Skylines

Traffic++
leftbehind 11 Jun, 2015 @ 11:52pm
June progress update
Hi everyone, just a quick update to let you know how the current development work is going...

Performance tuning

For the past few weeks we've been focussing heavily on performance tuning - making the mod quicker so that the game runs faster (particularly on big cities or if you've got a low-end system). When the next release is published, you'll see a noticeable fps improvement.

As it stands, the version of Traffic++ in development is at least twice as fast as the current (June 2nd) release version, and we hope to improve this even more prior to release.

Before starting the performance tuning it took 4.3 milliseconds average over 10,000 iterations (inclusive of things like vehicle restrictions and lane routing). As of 8 days ago (from time of this post) we had reduced that to just 2.3 milliseconds.

June 2nd (current public release): 4.3ms average over 10,000 iterations

June 4th (dev version): 2.3ms average over 10,000 iterations

For reference, the vanilla game (no mods or customisations) takes 1.9ms average over 10,000 iterations and I guess that's the target we're aiming at ultimately. Will we manage to shave off another 0.4ms, or more? You'll have to wait for the next release to find out!

Code readability

Performance tuning the pathfinder was difficult because it's 'decompiled' code; this resulted in non-descriptive names for variables, and that made it much more difficult to comprehend and improve the code.

Thanks to the work of Nefarion, who's one of the devs that's lending a hand with the performance tuning, the next release will have much improved code readability.

As an example, this...

flag = (lane.m_laneType == NetInfo.LaneType.Pedestrian); flag2 = (lane.m_laneType == NetInfo.LaneType.Vehicle && lane.m_vehicleType == VehicleInfo.VehicleType.Bicycle);

...became this...

isPedestrian = (lane.m_laneType == NetInfo.LaneType.Pedestrian); isBicycle = (lane.m_laneType == NetInfo.LaneType.Vehicle && lane.m_vehicleType == VehicleInfo.VehicleType.Bicycle);

(yes, since C:S 1.1.0 patch there's code in the game or bicycles; the next game patch should be very interesting indeed!)

While that's just a simple change, it makes all the rest of the code much easier to read; compare this line of code before and after for example...

// before: if (flag) ... //after: if (isPedestrian) ...

These changes are making it much easier for current developers - and any other developers who want to get involved - to comprehend what each bit of the pathfinder code is actually doing, and as a result spot where imrpovements can be made much more easily.

Logging improvements

We'd already improved the logging in the last few releases but hope to further improve it for the next release. There's one aspect of this that's of particular interest to me, and that's the information about vehicle AIs...

In recent weeks I've seen an increase in the number of workshop vehicle assets using the wrong vehicle AIs. This is caused when a mod changes a vehicle AI but forgets to reset it afterwards. We're well aware of this issue because Traffic++ had this bug (fixed 1st June) - luckily it only affected one vehicle asset which has since been fixed. However, there are other mods out there (such as No Despawn mod and even an old Lane Changer mod) that are still causing these issues. The author of the asset will be completely unaware of the problem - when they test their vehicle everything will work... because they have the mod that's breaking it installed.

However, when other users subscribe to the asset big problems start... In the best case scenario the vehicle simply won't spawn; even this can have a major impact on services for example. In the worst case scenario, or the "VW Golf scenario" as I've come to call it, players will find their entire citywide transport infrastructure collapsing as it gets clogged up with thousands of abandoned vehicles! I also have a strong suscpicion that a lot of the "Object reference not set to an instance of an object" errors are due to broken vehicle AIs.

Thanks to V10lator, there's now a way to fix broken vehicle assets[forum.paradoxplaza.com] (something the asset author must do), but it's still difficult to determine which assets are broken in the first place... To help solve this we'll be updating the log files in the next release so they clearly show which AIs are assigned to workshop vehicle assets, and I'll let the asset author know if there's a problem with their vehicle and help them fix it.

New release process

As you will probably be aware, we ran in to quite a few issues during the last major update, requiring two hotfixes to solve them. We had the fixes out within 24 hours, but lots of subscribers were affected during that time.

From the next release onwards, we'll be running a small beta test with some of our long-term subscribers (particularly those who've experienced lots of bugs in the past and know how to provide the required information to replicate them). This will mean less frequent updates in future, but we think it's worth adding this delay to improve reliability. It also makes it less likely that I'll get banned from /r/CitiesSkylines for posting about multiple bugfixes! :p

ETA on next release

It's going to be a few weeks before the next release as lots of testing will be required due to the significant number of code changes.

While that's happening, please keep posting your suggestions, bug reports and any other feedback. :)
Last edited by leftbehind; 12 Jun, 2015 @ 9:02am
< >
Showing 1-15 of 23 comments
Ulfgar The Dwarf 12 Jun, 2015 @ 1:31am 
Thank you for the update, I am very happy with the direction Traffic++ is going to :)
FretfulShrimp  [developer] 12 Jun, 2015 @ 3:33am 
Thanks for writing this up @aubergine18.

I have just two things to correct/add in the Performance tuning section:

- It doesn't take 4.3/2.3/1.9 ms to calculate 10,000 routes. That is the average time taken to calculate each route, after calculating 10,000 paths. Which means that calculating the 10k paths actually took 43/23/19 seconds.

- The times shown are times achieved with my (very old) computer, on a city with 65k population and 20k lanes, so it varies a lot from pc to pc, map to map. Also, the vanilla time is still run with my mod - so that I can time it - but without my changes to the pathfinding. Which means that it is the decompiled code that is being run, and not the original.
leftbehind 12 Jun, 2015 @ 8:33am 
I imagine in the original code they've probably used some compiler flags to remove error checking and other stuff to squeeze some additional performance?
FretfulShrimp  [developer] 12 Jun, 2015 @ 9:15am 
I don't know but watever it was, that's what we get with the decompiled code.
Vizxyn 13 Jun, 2015 @ 5:00pm 
Great work. Really appreciate your work with Traffic++
Glowstrontium 14 Jun, 2015 @ 3:50am 
@jfarias: Out of interest, what CPU do you have? This game stresses my i5 4670k, so it's interesting to know.
FretfulShrimp  [developer] 14 Jun, 2015 @ 4:55am 
Originally posted by Glowstrontium:
@jfarias: Out of interest, what CPU do you have? This game stresses my i5 4670k, so it's interesting to know.

http://www.cpu-world.com/Compare/454/Intel_Core_i5_i5-4670K_vs_Intel_Core_i5_i5-760.html
That's a comparison with yours. You can now begin to grasp my suffering... xD
LordBob 14 Jun, 2015 @ 3:55pm 
What a lovely update from literally the best mod going for this game.
DrM 14 Jun, 2015 @ 5:08pm 
Thanks for the update.. very interesting read and great work.
ajcadoo 15 Jun, 2015 @ 1:48am 
This is incredible! Can't wait for the faster performance! I love this mod!
leftbehind 15 Jun, 2015 @ 3:37am 
So, seeing as we hit 100,000++ subscribers yesterday we decided to post a little preview of one of the other features of the next release... The traffic AI just became a whole lot more human-like:

http://www.reddit.com/r/CitiesSkylines/comments/39wex5/soon_single_lane_traffic_jams_yeah_we_fixed_those/
Ulfgar The Dwarf 15 Jun, 2015 @ 3:44am 
Cool, thats awesome!
FeanorKND 15 Jun, 2015 @ 4:34am 
your work is really AWESOME.... this traffic++ is going to be a very important piece of the game.
LordBob 19 Jun, 2015 @ 4:13pm 
Originally posted by aubergine18:
So, seeing as we hit 100,000++ subscribers yesterday we decided to post a little preview of one of the other features of the next release... The traffic AI just became a whole lot more human-like:

http://www.reddit.com/r/CitiesSkylines/comments/39wex5/soon_single_lane_traffic_jams_yeah_we_fixed_those/

Wow, looks wonderful! It is very frustrating to see the default AI just queue like idiots! It's great to see there's some calculations going on for drivers.. I.e, oh.. a traffic jam.. >plans alternative lane routes to skip queue >plans completely different route from that point on, etc.

I really want to play Cities right now... but I want to play it when you guys release the next update... which I'm hoping is reaaaaaaaaaal soon!
leftbehind 19 Jun, 2015 @ 5:37pm 
There is lots of other cool AI stuff coming in this update as well :) JF's had a busy week in RL so not much progress this week, hopefully the update will be ready in a couple of weeks.
< >
Showing 1-15 of 23 comments
Per page: 1530 50