Setup - ShadowJonathan/ByteCart GitHub Wiki
Step 1: A simple circular line
Let's begin with the most simple system Bytecart can manage.
Build a loop with rails, and put several stations with a booster rail with a block at the end of rail.
Please note that when levers (or buttons) opposite to the stations are powered off, rails are "left-curved" (when the crossing is seen as a 'T', the track turns left). For the purpose of this tutorial, I built a line but you can shape it as you want. On the picture below, Bytecart signs will be under wood blocks to see their location.
You must have something like this example with 4 stations (order of stations in the ring is not meaningful):
Since this network is too simple to use the autoconfiguration command, we will put address manually, but this is the last time we do it.
We will put BC9001 signs.
Under one of the wood block, put a sign with the 2nd line filled with [BC9001] string (with brackets) and the 4th line with the following address: 1.1.1. You should have a Bytecart notification on your screen.
Repeat on the second one (the order is not meaningful) with data: 1.1.2
And so on with other signs: 1.1.3 and 1.1.4.
Time to test it !
Put a storage cart on a station and type command /sendto 1.1.3. Right click on the cart and make it leave the station. It will exit at station 1.1.3.
Lesson to learn
The blue line indicates the main loop. Carts must run clockwise in this loop.
The main loop, in blue, is a ring from where carts will be extracted according to their destination address. This ring is the basic cell of a ByteCart network. We will later use the term ring to designate a loop from where carts can be extracted to go to their destination station.
A ring can hold up to 255 stations, from number 1 to 255.
We designed a basic circular line : any cart entering the ring and turning clockwise will be routed to the right station.
We will see in the next tutorial how to extend this concept to improve our network.
Step 2: Connect rings together
In the previous tutorial we saw how to design a network that can manage up to 255 stations in the same network (namely 1.1.0).
We will see in this tutorial how to connect together up to 3 networks with a router.
Build
Download and paste this schematic (or use this Howto) to build a router next to the ring we built at previous step. Don't put any address on the 4th line of BC8010 sign.
Build 2 rings like at previous step around the router and plug the 3 rings in the router. Do not care of address on the 4th line of signs, and leave it empty. Leave a side of the router free.
Configuration
Put an empty storage cart at the free entry of the router and type command /bcupdater region 1 new
, then right-click the cart. Lauch the cart in the router and wait until all rings have been crossed by the cart. The router is now configured. You can delete the cart or let it run : it will eventually come back to the router and go out by the free side after a 1h timeout.
Note 1 You can run the command /bctracker
while the updater is in the network to see its position.
Note 2 You can run the command /bcupdater remove
to transform the updater into a normal cart and to resume the configuration.
From the same position as earlier, put an empty storage cart and type command /bcupdater local 1
. Right-click the cart and launch it. After all rings have been crossed, stations are configured: You can check that all BC9001 signs were updated with an address. You can destroy it or let it run until timeout is reached.
Test
We have a router with 3 rings connected, each ring with up to 255 stations. Each cart entering the network (clockwise) at any point will go to its destination target even if it is in another ring, going through the router if needed. You can test with a storage cart and the command /sendto
previously used. You need to to pick up address on the BC9001 signs to use them. If the 2 "updater" carts are still in the network, you can see that they never collide.
Lesson
A router can link up to 4 rings. the bcupdater command will setup your network automatically, updating signs with address to use as destination address. bcupdater needs at least one router to operate, that is why we did not use it previously. You can also note that the ring with address 1.1.0 we previously created may have changed of address. This is because bcupdater use information present in router chest to know which rings are already configured. Since the router was new, the chest was empty and bcupdater did not see address 1.1.0 as a valid used ring address, and performed a complete rewriting of signs. Of course, since the router is now configured, bcupdater will preserve address of existing rings if run again.
There is room left for a 4th ring to be plugged in the router. Why don't we use it ? Because this room is left for the ring 0 (check address 1.0.0 on the BC8010 sign on this side) of the region. This special ring must be present somewhere in the region and can't contain a station. Of course we could have use the room for an additional ring and 255 more stations, but the ring 0 must be built somewhere. This tutorial was the opportunity to tell you that you must have a ring 0. We will see this more precisely later.
In this tutorial we saw how to build a network with 1020 stations (in this case, only 765 since on side must be ring 0 and has no station) using 1 central router. We saw that the router and rings can be configured automatically with bcupdater command.
In the next tutorial we will generalize the concept to expand the network to millions of stations.
Step 3: Expand your network
In the previous tutorial we saw how to build a simple network around a central router.
Routers have visibility on the topology of the network, so they can "see" networks that are not attached to them. We will use this feature to add rings.
Build
First check that "updaters" cart are destroyed or stopped. Let's build a new router in the West of the Westerly ring and plug it to the ring. Build some rings around the new router. On each sign, leave 4th line blank.
Configure
We must (re)configure the 2 routers to tell to each other about the new network(s) reachable.
From the ring 0 (the free side of the first router), run /bcupdater region 1 and right-click on a cart and launch it in the network. Wait until all rings have been crossed by the cart. Repeat with /bcupdater local 1 (for this command, you can start from any ring, not necessarily ring 0). It's done.
Test
Now any cart entering the network at any point (driving left) will reach its destination, possibly using a succession of routers to go to right direction until reaching a router directly attached to its destination ring. Routes values are configured in chest to reflect the position of each ring relative to the router holding the chest.
Pick up an a destination address on BC9001 sign and test with a storage cart and the well-known command sendto. Test with command mego for travelling yourself in a cart.
Lesson
Each time we want to add a new ring with up to 255 stations to an existing network we must:
- stop or destroy updaters cart
- build a router (if needed) and attach it to an existing ring
- build and attach some new rings to the new router
- configure all with bcupdater
When building an additional router to a network, we add the possibility to plug up to 3 new rings in it (up to 765 stations). We can expand the network by adding routers at the edge of the network, building 3 rings on each of it, then building 3 routers and 9 rings, etc.
It is important to understand that you can build and plug a router safely on an existing ring : It will not break anything. There are constraints on the creation of rings:
- each router can attach up to 4 rings
- each ring of the network must be attached to one or more routers
- there is a maximum of 2047 rings a router can manage : this limit defines what is called a region in ByteCart terminology. You can't have more than 2047 rings in a single region: to have more rings, you must build another region and connect the 2 regions together through a backbone network.
From this we learn that we are not limited in quantity for routers, but we are limited to 2047 rings, meaning that the last station address we can use is 1.2047.255 (giving 521.985 possible stations in a single region...).
With this principles, we are able to build up to 2047 rings and connect them together with any numbers of routers.
Here is an example of what we can do with several regions containing each several rings:
Routers create connectivity between rings, so you must multiply routers to improve connectivity, optimize pathfinding algorithm and shorten trips.
A little word about the bcupdater command: this command sets a cart as an Updater. An Updater is a special cart that configures permanently a region. It is safe to make it start from ring 0 and let it run until timeout. You can have as many updaters as you want in your network (at the price of small memory usage), but only one in each category (region 1, local 1, region 2, etc.). Updaters loose their property after a timeout depending on the size of the network.
A last thing to do is to build a recycling ring for the region where all garbage carts will go. You already have heard about it: it's ring 0, the spot from where updaters carts are launched. See this Howto to put one or several recycling rings in place.
In this tutorial we learn how to have up to 521.985 stations connected by linking together up to 2047 rings with routers in what is called a region and we set up one or several recycling rings. We learned how to use bcupdater to maintain the configuration of the network.
In the next tutorial we will see how to connect several regions together.
Step 4: Put everything together
We will now create several regions and join them with a backbone.
Build
Build some regions as explained in previous tutorials, but instead of leaving a free ring 0 with a garbage collector, build a backbone router on the ring 0. A backbone router is just a router where BC8010 signs are replaced with BC8020 signs. In each region, we can have as many ring 0 as we wish, and thus connect as many backbone routers we want.
Let say we have 3 regions, we can build 2 or 3 backbone routers at the edge of the regions and link these backbone routers together with some new rings with no stations:
There are no more garbage collectors in regions, they were replaced by a backbone router, the garbage collector is connected to a backbone router now.
Configure
Although the recycling ring, from where we used to start the updaters, are replaced by backbone routers, we will launch our updaters from the same location, i.e with a backbone router in our back and a region router in front of us. If there are several backbone routers connected to a single region, we must choose only one location.
In each region, with a backbone router behind you, execute /bcupdater region n new with n being the number of the region.
When all the regions are configured, take place at the new recycling ring near a backbone router and execute /bcupdater backbone
Test
Now any cart entering the network at any point (driving left) will reach its destination in any region. If another region must be reached, the nearest backbone router will be crossed to enter the backbone network.
Pick up an a destination address on BC9001 sign and test with a storage cart and the well-known command sendto. Test with command mego for travelling yourself in a cart.
Lesson
A backbone network is a simple way to link regions together. Use a backbone in distant parts of the network, or if you can use fast tracks.
You can multiply backbone routers to improve connectivity.
Backbones and ring 0 don't have stations.