Blog

Captain’s diary #20: Improved balancers, ship docking, and chickens

Welcome everyone, Captain Marek reporting! Thanks for joining me for our 20th Captain’s diary! Today I will tell you how we revamped transport balancers including their UI to make them more intuitive and useful. I will also describe how we dealt with land sharks (ships passing through terrain) and finally a little about food production.


New and improved balancers

Balancers are a critical component of the transport network (conveyors and pipes) because they allow the merging and splitting of transports with priorities. In the beta, the implementation of balancers had two main issues.


The first issue was “leaky” priorities. When an input or output was set to be prioritized, in some circumstances (depending on when exactly each product arrived) these priorities were not followed and products from non-prioritized ports sneaked through. Unfortunately, in many cases these product “leaks” could cause cascading issues such as stuck production or power outage and this could be very frustrating


The solution was to rewrite the prioritization code and thoroughly test it. And when I say thoroughly, I mean that we wrote 94 unit tests testing balancers in 15 different connection scenarios. This gives us confidence that the new code is working as intended.

Screenshot from our testing framework showing names of passed tests. Note that “Zipper” is just the internal name for “Balancer”.

The second issue was confusing UI. The balancer entity evolved over time, but its UI was lagging behind. In the beta, the priority of ports was set using toggles and the player could choose between prioritizing ports marked as “X” or “O”. These marks were on the 3D model.


Old balancer UI. Can you tell which ports are prioritized?

Many players were confused about the priority toggles and sometimes switched them the other way around. It was hard to see “X” vs “O” from further away, and when the balancer was being built, you could not even see the marks!


The UI was completely reworked and instead of port markings on the 3D model we decided to place the 3D model in the UI and display priority toggles right next to the ports. No more confusion with what ports are prioritized! And since the orientation is important, the preview in the UI matches the main camera rotation and even shows connected transports. You can not only set priorities when the balancer is being constructed but also when ports are not yet connected.


New balancer UI with clear prioritization toggles.

Additionally, as you may have noticed from the new UI screenshot above, the balancer now has 8 I/O ports! This is 2x the number of ports compared to the old one that had only 4 ports.


Next, balancers can be now directly connected to buildings like storages or machines. This was not possible before due to technical reasons. With the new implementation in place, direct connection is supported and tested.


And that’s not all, new balancers also support enforcement of even inputs/outputs counts! This means that you can split outputs evenly across connected outputs, or merge products evenly across connected inputs. Note that priorities and even counts enforcement are currently not compatible, you can choose only one.


New balancer that splits two tier 2 conveyor belts to five tier 1 belts evenly.

Improved ship docking

In beta, arrival and departure animations of ships were “fixed”, meaning ships did not consider the surrounding terrain or other buildings. We were assuming that the players would most likely build docks facing the open ocean. However, some of our beta players put a lot of work into making much more complex harbors and ships ended up just plowing through the island. Some players called them “land sharks”.


A “land shark” roaming through the factory. Watch out trucks!

Initially, we planned to implement path-finding for ships, similarly to trucks, so they could navigate freely, but this would be a big project (our estimate was 4-6 weeks of work). To limit the scope of the Early Access release, we decided to simplify this task and stick with the “fixed” animation approach but check that the area used by the animation is obstacle-free.


To minimize limitations of dock placement with regard to docking animation clearance, we have added two new docking animations and the ship will automatically pick the one that is obstacle-free. The reserved areas are visualized during construction and anytime a dock is selected so you will be able to plan around it.


Example of different docking animations. You can also see the reserved areas when docks are selected.

While working on ships, we have also fixed and improved smoke particle effects on all ships. Take a look at the difference below.


Chickens!

As we complete more tasks around the new food industry, we can finally start presenting parts of the new processing chains.


We have a new model and full implementation of the chicken farm! The building can host up to 500 chickens (we estimated the real one would hold 5k chickens, so your chickens will have quite a room!). You get chickens by purchasing them from the world map. However, they are costly, so you want to let them reproduce to fill your entire farm.


Chicken farms which house ... chickens

You can feed chickens with all the regular crops or leftovers from food production (e.g. tofu production gives you animal food as waste output). Chickens also need water, and if something is missing, they start to perish.


New UI for chicken farm management

Chickens give you eggs, but you can also slaughter them for meat in an automated fashion. However, you get a chicken carcass instead of meat. To get meat, you need to process the carcass into it. That also gives you useless meat trimmings that you can later reuse once you learn how to make sausages.


Sneak peek into some of the new recipes

There are 4 categories in our food industry - carbs, protein, vitamins, treats. The first three affect the health of your pops, the more categories you provide, the better health of your citizens gets. As you might have guessed, eggs, meat, and sausages belong to the protein category. However, if you prefer to avoid chicken farming, you can produce soybeans to make tofu for protein. Tofu production requires limestone and sulfur.


And that’s all for now. If you have any comments, questions, or suggestions, feel free to get in touch on our Discord server.