• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
Trolleybuses!

Greetings fellow city-builders and welcome to another Sunset Harbor Dev Diary!

Ever since Cities: Skylines was released, we have received hundreds of requests for one specific feature: Trolleybuses! And to go along with every one of those requests, vivid debates took place within the community about whether or not trolleybuses are too hard to implement, if the feature is “too niche” or if “they” actually ever even read the suggestions posted on the forums.

Let us assure you that we are indeed constantly listening, and every single idea is considered when we are deciding what to do next! Also, we are just as enthusiastic about public transport as you are, and you would have to be very creative to suggest something that we would consider to be “too niche”

The reason trolleybuses have never been added is their technical complexity. Trolleybuses are basically “trackless trams”: electrical buses that draw their power from overhead wires. Unlike trams, they utilize two wires and two trolley poles to complete the electrical circuit. And like a normal bus, a trolleybus is able to change lanes and stop on the side of the road. As the bus is moving, its poles rotate and tilt to stay attached to the wires. In the game as well as in reality, the trolley poles are the most tricky part of the whole system.

We are glad to inform you that we have managed to overcome the technical challenges, so Trolleybuses will finally be available in Cities: Skylines – Sunset Harbor!

DevDiary_Trolleybus1.png

They are finally here!

The trolleybus system in Cities: Skylines – Sunset Harbor consists of four components:
  • Trolleybus Depot
  • Trolleybus Roads
  • Trolleybus Stops
  • Trolleybus Vehicle
To get started with trolleybuses, you first place a Trolleybus Depot. After that, you can place Trolleybus Roads and create Trolleybus Lines with roadside stops. Your depot will then send out trolleybuses to operate the lines. It is important to remember that the trolley poles must be attached to the wires at all times, so your Trolleybus Depot and your Trolleybus Lines must be connected by Trolleybus Roads as well!

DevDiary_TrolleybusDepot.png

Trolleybus Depot sending out new trolleybuses.

DevDiary_Trolleybus2.png

Taking passengers over the river.

That’s the easy part! In the second part of this Dev Diary, we would like to shed light on what we did to make the trolley poles behave realistically. Unlike other diary entries, this one will be slightly more technical. Even if you are not that math and geometry savvy, we still hope you enjoy this inside look!

trolleybus1.jpg


The Wire

Let’s take a closer look at the roads! On every road segment, you will find three catenary masts: One at the start, one in the middle and one at the end. The electrical wires span the masts, and with some mathematical calculations we can find out the start and end coordinate of each wire section. Let’s call them
image2019-9-24_12-6-9.png
and
image2019-9-24_12-6-21.png
(using a small arrow to mark them as 3D vectors).

A mathematical formula to define the line of the wire would be
image2019-9-24_12-6-37.png
with
image2019-9-24_12-6-45.png
and
image2019-9-24_12-6-50.png
.

When the bus is on the road segment, we want its pole to connect to the overhead wire defined by the mathematical formula above.
image2019-9-24_12-7-39.png
is the coordinate where the pole is attached to the wire.

The Trolleybus

The game knows how the bus is positioned and rotated in the world, and from that it is possible to calculate the coordinate where the trolley pole is attached to the bus. Let’s call it
image2019-9-24_12-12-56.png
!

The trolley pole is made of sturdy metal, so it cannot stretch. That means the distance between the coordinate where the pole is attached to the bus (
image2019-9-24_12-12-56.png
) and the coordinate where the pole is attached to the wire (
image2019-9-24_12-7-39.png
) must always be equal to the length of the pole. Let’s call it
image2019-9-24_12-7-48.png
and define this formula to take that into account:
image2019-9-24_12-7-54.png


The Equation System

By inserting the first formula into the second one, we end up with a single equation with a single unknown variable
image2019-9-24_12-9-46.png
:

image2019-9-24_12-8-12.png


With a few tricks we can transform it into a quadratic equation:

Screenshot_1.png


We can use the quadratic formula to solve the equation.
We will get zero, one or two values for
image2019-9-24_12-9-46.png
:

image2019-9-24_12-9-30.png


Note that there will be no solutions if the part in the square root is negative (which happens if the wire is too far away from the bus). Note that the solutions for
image2019-9-24_12-9-46.png
calculated by this formula could also be out of range (
image2019-9-24_12-9-51.png
), so we have to check that as well.

Choosing the Right Position

By inserting
image2019-9-24_12-10-3.png
and
image2019-9-24_12-10-8.png
into our wire formula
image2019-9-24_12-10-17.png
, we can calculate two theoretical pole-wire-attachment coordinates
image2019-9-24_12-13-1.png
and
image2019-9-24_12-13-8.png
. One will be above the front part and the other above the back of the bus:

image2019-9-24_12-10-37.png

As the pole of a trolleybus is typically facing backwards, we need to find out which of the two positions is the correct one.

Haven’t had enough of vectors yet? Let’s define a few more:

Screenshot_2.png


Rendering the Trolley Poles

Uh, that was a lot of math! Now that we know where the pole is attached on the bus (
image2019-9-24_12-12-56.png
) and where the pole is attached to the wire (either
image2019-9-24_12-13-1.png
or
image2019-9-24_12-13-8.png
), it is possible to render the pole in the correct position and rotation.

As we learned, a trolleybus has two poles (otherwise the electrical circuit would be incomplete), so we will just repeat the same steps to draw the second pole.

And now you know what kind of stuff goes on behind the scenes to render the poles! Of course, in order to make trolleybuses realistic, this was just one small portion of the overall work that was needed!

DevDiary_TrolleybusNight4.png

The last shift of the evening.

Once again, we've reached the end of a Dev Diary. We hope that you liked this insight into the development of Cities: Skylines and that we didn’t scare you with all the formulas! Gotta say, the end result is really mesmerizing. We could just watch the buses circle around for hours! What do you guys think about the trolleybuses?

Until next time, city-builders!

Your Colossal Order dev team
 

Attachments

  • image2019-9-24_12-10-32.png
    image2019-9-24_12-10-32.png
    309 bytes · Views: 94
  • image2019-9-24_12-10-27.png
    image2019-9-24_12-10-27.png
    286 bytes · Views: 42
  • image2019-9-24_12-9-19.png
    image2019-9-24_12-9-19.png
    208 bytes · Views: 32
  • image2019-9-24_12-8-8.png
    image2019-9-24_12-8-8.png
    208 bytes · Views: 28
  • image2019-9-24_12-7-34.png
    image2019-9-24_12-7-34.png
    349 bytes · Views: 32
  • image2019-9-24_12-7-19.png
    image2019-9-24_12-7-19.png
    349 bytes · Views: 30
  • image2019-9-24_12-7-0.png
    image2019-9-24_12-7-0.png
    246 bytes · Views: 51
Last edited:
My cities are like that as well. There are some areas that are really, really beautiful but like all real cities there are those areas that, well, need a bit of sprucing up.
 
For the first time I was very upset by purchase of this new dlc. There is no way to combine a tram and a trolley in the city. Such a problem was in the first part of Cities in motion a hundred years ago ... guys, are you serious? Even tram and trolley bus intersections are not allowed. Many players create projects of real cities and tram-trolleybus streets exist, add to this addition. Fix it...
 
Yeah, I am a bit sad over some aspects too, most of which I consider bugs. But have found out you can cross trams and trolleybuses just fine when anarchy mode is enabled :).
As for the hubs and other buildings that come bundled with a road (I wish they didn't) you can use e.g. https://steamcommunity.com/sharedfiles/filedetails/?id=427258853 mod to build a crossing over such road and then it gets detached and can be upgraded to any type. And I am sure there are other methods that work too and I don't know of. Anyway, now I have the train metro hub with a trolleybus road in between.

One thing that I would very appreciate though is if buses and trolleybuses could have combined stops just as in Cities in Motion. This makes the trolleybuses much less useful if you want to have both transport types in your city. Combining all transport types including trams as well would have also been nice though. All these things were so much more flexible in Cities in Motion but I am afraid all the roads in Cities: Skylines are just fixed and for that type of flexibility it would require a lot of changes (albeit not being able to cross tram and trolleybus roads or having combined stops is most likely just an artificial limitation).

Well, I wish at least some of the things will get fixed with an update...
 
One thing that I would very appreciate though is if buses and trolleybuses could have combined stops

And they indeed can have combined stops. I've just found out that there is an easy, a bit unreliable and a bit hacky trick to it.
Just build nearby segments of a road, put a bus or a trolleybus stop on it while having the other transport type stops on the main segment, delete the temporary branches and enjoy. Hope that CO won't fix this "bug" as it is certainly a feature for me :).

1-build-nearby-roads.jpg 2-delete-nearby-roads.jpg 3-watch-the-miracle.jpg 4-alignes-itself-after-a-while.jpg 5-both-transport-types-use-the-same-stop.jpg
 
  • 3Like
  • 1
Reactions: