joaofarias / csl-traffic

A WIP mod for Cities: Skylines to improve traffic.
91 stars 30 forks source link

Balancing maintenance costs for custom roads #44

Closed Archomeda closed 9 years ago

Archomeda commented 9 years ago

Upon seeing the new bus roads, I immediately noticed that the maintenance costs were not really correct (too cheap). I hate to be that guy, but I fixed it in this PR :smile:

By monitoring the costs of 1 road unit in financial stats (empty save), I got the following costs:

Game default Normal Grass Trees Elevated Tunnel
Two-lane 0.32 0.40 0.48 0.80 1.92
Four-lane 0.80 0.96 1.12 1.60 4.80
Six-lane 0.96 1.12 1.28 2.88 5.76
T++ roads Normal Grass Trees Elevated Tunnel
Two-lane bus 0.36 0.36 0.36 0.06 (not a typo) 1.05
Six-lane with bus 1.06 1.06 1.06 3.16 3.16
Pedestrian (gravel) 0.24
Pedestrian (pavement) 0.40 0.40

With some math, you can see that there is some correlation in the default roads (otherwise you can see more info in the comments section I created in the commit). I applied those to the custom roads too, and they are now as follows:

T++ roads (balanced) Normal Grass Trees Elevated Tunnel
Two-lane bus 0.36 0.44 0.52 0.90 2.16
Four-lane with bus
(proposed only in comments, not in code)
0.88 1.04 1.20 1.76 5.28
Six-lane with bus 1.06 1.22 1.38 3.18 6.36
Pedestrian (gravel) 0.24
Pedestrian (pavement) 0.40 1.00

These numbers are not fixed in the source, but rather calculated the same way as the default roads are. Meaning e.g. an elevated road costs you 2.5 times more than a normal road, etc. If four-lane roads with bus lanes are ever going to be added, you have to create a new method that you can base on the others I've created. The numbers that you can use are in the comments.

Anyway, let me know what you think. I based the balancing upon the already existing costs, but I can change it easily if it's not really what you are looking for. Also, I'm really sorry for the reformatting. This happened because the file was mixed with both tabs and spaces as indents. I have an extension installed in Visual Studio that automatically updates the indents to 4 spaces and formats the whole file to be consistent upon saving. I encourage you to do the same, or at least use the built-in command in Edit->Advanced, otherwise this keeps happening. The real changes start around line 950.

joaofarias commented 9 years ago

Hi, thanks for this. I'll merge your code and release it in the next hotfix (today or tomorrow).

I will change it soon because I'm going to make huge changes to how I load new roads to make them more generic and allow for any type of road that I have or might add in the future and even facilitate the addition of new roads by people that don't know how to code. :)

Basically, I want to move the properties of the roads to an xml file where I'd have the name of the prefab it replaces, the name, base costs, lane types and configurations, etc... So, adding roads would be as simple as adding an entry in an xml file.

Still, your code has the basis to calculate road costs, which is very useful. Also, I'll take some time making these changes so with your code, people will already have the correct costs for the current roads. :)

By the way, since you are that guy.... :p What do you think of the costs of the bus roads in relation to the default ones? I've basically maintained the cost and increased maintenance by 10%. I'm thinking it should be more expensive. What do you think?

Archomeda commented 9 years ago

Haha, thanks :smile: I didn't know that's what you were up to, but it sounds really nice. I just wonder if there's a better way to show these roads in the UI. Just having the current T++ roads makes it cluttered already, and manually pressing the left and right buttons is not helping. Why that UI is not scrollable is beyond me, might have to look at it and see if it's something that can be changed. But that's for another time maybe.

About the costs, well, I have to say that 0.36 vs 0.32 is not much of an increase. Seeing that the bus roads do provide a significant advantage in transporting people by bus that otherwise get stuck in traffic (and emergency cars, etc), I'd say a 25% increase should be a minimum. That would give us the following costs:

Road type Normal Grass Trees Elevated Tunnel
Two-lane bus 0.40 0.48 0.56 1.00 2.40
Four-lane with bus 1.00 1.16 1.32 2.00 6.00
Six-lane with bus 1.20 1.36 1.52 3.60 7.20

When looking at this table, it might seem pretty low, but it's just for 1 unit per week. I'm unsure if it should be higher, but I think that 25% is a pretty good start. For the newly implemented hard mode, you can raise it even further to, let's say, 50%? I also suggest asking for feedback of other people before you change it though.

Edit: let me see if I can fix the merge conflicts now that you've pushed a new commit. Edit 2: or not :D

joaofarias commented 9 years ago

Yeah, it's not the most pratical UI. :/

Those values look nice to me. I was afraid of raising them up too much exactly because it is the cost of 1 unit per week. And then there's the base cost that I left unchanged. I'll eventually open a discussion to have feedback regarding all costs of all roads (including default) and change the costs accordingly. Just thought I'd ask for your opinion. :)

Thanks again for the pull and feel free to make some more. :P I'm going to release the hotfix in the next few minutes.

joaofarias commented 9 years ago

By the way, I just gave you credit on the steam page as Archomeda. If you want me to put another name let me know. :)

Archomeda commented 9 years ago

It's no problem for asking my opinion ;) But yeah, since now I'm that guy that fixed the costs for now, I wonder if people will now have less income because of that... hmm... :smirk:

Anyway, I've also looked at the code to see if I could find the formula or method that's used by the game for the default roads, but I couldn't find it (it's really the same with finding a way to draw some text in the environment that's not a GUI and not slow (something I've been trying to work on, but this is really a blocker)). Hence why I created my own, based on the results I got ingame.

I'll come back with issues when I find them :+1:

And oh, that's no problem. On Steam I'm known under the same name (also with the same custom profile URL), although you will probably not find me posting there frequently, if at all.