[Edited - thanks to Tekillaa I took some more time for more detailed description at the end. Not perfect but it will help to understand the different parts little bit better. For now it would need to much time for a deeper look at every logic-block ... It took already several weeks to set this up and test it ^^]

I build a car on belt logistic system with a car-routing logic.

Its the first time I worked with cars on belts and also the first time working with circuite networks, using logistic bots (i like belts!) and posting in the forum (wow ), so you will find something for sure to improve and maybe there are some bugs, but in my opinion its nice enough to present it as a draft.

First of all: Thanks to the autor of: http://www.rengels.de/computer/factorio/cars.html

I took his work and combinated/extended it with my car-routing-idea. It was a big help!

There are some very intresting topics (lets not talk about the errors done by using the circuite network the first time ...):

- You need to be VERY carefully with the car alignment. If its not perfect the car can hang or take the wrong way. I hope I did it well ...

- With car on belts there isn´t a crossing possible. Means to set up a crossing was little bit of fun and takes some space, but its possible.

- How to create a routing?

- I like the cars on belts idea

- In my configuration I have one car every 27 red belts (max possible density) which means a minimum (max 7 slots of the cars are reserved for the coordinates) of 73 slots every 27 red belts = 3.650 ores or a equivalent of a train with one loc and (nearly) 2 wagons.

- no need for fuel which would be needed by trains (maybe put one coal into the car to stop the blinking )

- some kind of self healing (as long as the cars will not hang somewhere). if it misses the correct exit (for example in my save during the tests there was a timer which wasn´t resetted, I removed the car to early ...) the car will be looped and routed correctly the second try. You will see it in the blueprint .

- I did not test it but I am pretty sure that a train setup will be faster than this design.

- Try to avoid passing many crosses with the cars. It will need some time to pass the routing-process

- I build this for cars with each only one type of input, I am not mixing up different items in one car. If the factory in the city block needs 4 different items equaly there are 2 inputs wasted. Also the output is designed for a 1:1 in and output ratio (because of 6 loader and 6 unloader stations). Maybe with some adaptions its possible to improve this design.

I am using a coordinate system for that which are represented via items within the cars. If you need to transport the items below just change it for you. I took this items because I will not transport them under other conditions, they are cheap and I need items with stacks higher or equal 12 because of the stack inserters.

- X1-coordinate: green wire

- X2-coordinate: red wire

- Y1-coordinate: stone furnance

- Y2-coordinate: Boiler

- Z1-coordinate: wooden chest

- Z2-coordinate: iron chest

- coordinate-desider if *1 or *2 is used: pistoles

The first 6 Z coordinates (item count of 0 to 5) I am using for the Input of the city block on the upper side, the last 6 Z coordinates (item count 6 to 12) I am using for the output on the bottom of the city block.

I have 2 different mainparts there.

- The "crossing" which is like a big X-cross for trains. The cars can go in from all 4 directions and also go out.

- The (un-)loaders stations which are along the top and bottom of the city blocks to get the items in and out.

Above and below the screenshot there is space for a city block.

In short how it works:

First of all, I need to know if X1:Y1:Z1 needs to be used or X2:Y2:Z2. For that I am using the "coordinate-desider". If there is one pistol in the car I am using X1:Y1:Z1, if there are two pistols I am checking X2:Y2:Z2.

So there is an inserter to check (via counting the pistols) which items the other inserters needs to take. This items are counted and there is a decider which of the both lines out the car should take. This logic is used 4 times for the crossing and one time for the stations.

As soon as the car got to the right coordinate there is a small decider which checks which of the 6 stations should be used to (un-)load the car. During this the coordinate-desider will changed from 1 to 2 or 2 to 1. There I will need logistic bots (also first time using it because I like to work with belts ...)

In my example I am using 3 inserter for X and Y coordinates which means I can use it for a 36*36 city block design. But its easy expandable just by adding additional X and Y inserters and adapting the belts. I started with 2 inserters for each X/Y coordinate, and it was a very easy task to change it to 3 for both (but do not change it in production if you do not have the time to move anything).

Using 4 inserters for X and Y means that I am able to use a 48*48 city block grid and the space between the cars will be 2 more belts. I think its ok for scaling, because even 36*36 are 1.296 blocks ...

How to create a network:

Just place the blueprint and adapt the Constant combinator in the middle of each cross (marked with two other constand combinatores showing "TOTO"; copy and paste and to lazy to change it to "TODO" in the blueprint ...) to set the coordinate used for this cross and also which items the unloader should unload by changing the constant combinator near the unloaders.

Now add the cars and define between which coordinates they should "drive" by putting in the right items, for example moving between X=1, Y=2, Z=3 and X=10, Y=12, Z=7 put in 1x pistol, 1x green wire, 2x stone furnance, 3x wooden chest, 10x red wire, 12x boiler and 7x iron chests.

I recommend to define the first block as the middle of available coordinates, for example when using a max of 36*36 city blocks define the first block as X=18 and Y=18 so that you can extend the city in all directions.

How many cars are needed for maximum throughput needs to be analyzed in each world (changing the city-blocksize and the distance will be the factors how many cars should be used)

The details:

**routing**

- In the brown area at the left corner there is the logic which coordinates each outgoing line has. You define the coordinate of the right output with the constand combinator (for example 0=10 and 1=11 for X=10 and Y=11) and the other coordinates for the outputs are calculated via just via +/-1. So the line outgoing on the right will have X=10, Y=11, left will have X=9, Y=11, down is X=10 and Y=12 and up X=10 and Y=10

- The red area is just the waiting-area

- The orange area ensure that there is the correct distance between two cars and activate/deactivate the belt in the red area

- The yellow area is checking first which coordinates should be used (*1 or *2) and than just grap the right items and count them.

- The green area gets the input of the yellow area and there is a timer combinated with a memory cell. As soon as the timer == L the memory cell is written and holds the information if the wall needs to be opened. The logic there is done with the two decider at the bottom of the green area. The car is routed to the right if The X-items are >= the X-coordinate defined in var 0 and Y<= the Y coordinate defined in var 1, routed down if X>=1 and Y>=1, left if X<=0 and Y>=1 and up if X<=0 and Y<=0.

- The blue area is just resetting the timer so that everything is clear for the next car.

**the (un-)loader**

- First there is such the routing as shown before but a little bit addapted. If the car is for exactly this city block than it will be routed to the (un-)loaders, if it should be routed even further it goes down to the next crossing

- The orange area checks again if Z1 or Z2 should be checked and which "station" the car should go.

- The yellow area gets the info from orange one and opens. Z=5 means going down to the (first) iron-loader, Z=4 is the copper, Z=3 is coal and Z0-2 go further to the right

- The red areas for each line have two functions. First switching the pistoles (1 pistol => 2, 2 pistols => 1) and second reset the memory cell from the orange and (the two red ones on the right side) green area.

- If Z<=2 than it passes the red area on the top which gives the impulse to set the memory cell for the green one. This is needed because in the meanwhile the next car is going through the orange area.

- The loaders just load the car until there isn´t any inserter working for more than a few ticks.

**the unloader-configuration**

- Its a must to set the items to grap because without the filter they would also grab the items for the coordinates. Just set the constant combinator.

**rotated**

most of the parts are just rotated (the left routing is just the roteded right one) and the unloaders are just roteded loaders. Of course both with little changes but in generall just rotated.

All togheter: For now I do not know how usefull this is in a real play but I love it!

Blueprints (the first one is from the screenshot, the second blueprint is my testenviroment):