Design - ShadowJonathan/ByteCart GitHub Wiki
To design a transit system that will fit your need you must follow a design process. This article will try to give keys for a good design.
Identify distribution points
I intentionnally use the word distribution point, since it is what ByteCart is. You must think of it like an internet access and not like a transport system. ByteCart is clearly user-oriented and the philosophy is that every player can have his own stations, with an s because each player may have different access points: house, mine, farm, etc.
Of course you will have some more classic stations to transport players. You can make big stations for events or small stations.
You can also plan distribution points for "online" services such as a common warehouse, a sorting machine, a bank, etc.
Once you have identified the distribution points, you must locate them on a map.
It is also valuable to identify locations of portals to connect to other world or other servers. ByteCart is transparent to such elements, providing that the portal implementation provides the copy of the entire inventory of players or storage carts, including the content of the books.
Visualize traffic
You must analyze the map and the distribution points to evaluate the traffic:
- Where are the areas where there will be a high local traffic with many distributuion points ?
- Where are the biggest flow ?
- Where are the isolated points ?
These elements will scale the network.
Draw the lines
You must apply the following principles:
Areas where there is a high local traffic will have deterministic circuit, i.e. there will be no choice for the path. Think about a metropolitan transit system with a circular line: To go from one point to another of the city, you have only one circuit possible even it is not the shortest path. People tolerate this situation if the trip is not long. Routers will be at the edge of such areas.
In situations where deterministic circuit is not tolerable and a choice must be made to optimize the path, you need a router. Think about a national transit network: people who want to go to the South will not understand why they first go to the North on a long distance. Routers are the only device that can optimize the path and send people to the right direction. These areas will concentrate 1 or more routers.
You must place the routers while asking this:
where is it unavoidable to make a decision about the best route to take ?
Once the routers are placed, draw the main rings to link them together. Rings must be the shortest possible, but should be close from the areas where there are many distribution points.
All the distribution points will placed on subrings of 128, 64, 32, 16, 8, 4 or 2 stations, or will be directly on the ring if they are close to it.
Extending regions or creating new ones ?
There are some cases where a new region must be created instead of extending an existing one.
Extending a region has some drawbacks: It extends the perimeter covered by the updaters and can make the discovery of the region uneasy. Remember that there is a timeout on the updaters.
Extending a region is like extending a suburban transit system: there is a point where suburban transit system is not relevant. This is the case if the distance between 2 routers becomes huge. It is difficult to give a rule, just look at the shape of the region: it must not be stretched or distorted.
Backbone network
We will now change of scale and look at the design of a backbone network.
Reconsider the comparison of the region with a suburban transit system area. In this model, the backbone would be a national or international airline transport system. It covers longer distance than in a region and makes connection between several cities or countries.
In such a network, the location of airports is important. In ByteCart, airports are the ring 0, where each region has its current garbage collector. You can have several airports around a region (several rings 0).
Routers in a backbone network are places where a decision about the best path to a region is made. You must put routers in places where taking such a decision is unavoidable. For example, to go to Rio de Janeiro from Paris, it is better to go there directly than have a transit in Miami. Adding a router near Paris allows direct connection. Sometimes shortening path does not worth it, you can spare a router and players will have to make longer trips.
A good practice is to have a backbone router next to each region router where it will be attached.
Additional routers will be added to avoid multiplication of lines, as airline transit hubs prevent opening a regular line in each destination for everywhere in the world. For example, if you want to go from NYC to Windhoek in Namibia, since there is no direct flight(in ByteCart model you would say:there is no track), you will take a flight to Cape Town and a second flight from Cape Town to Windhoek. In ByteCart model, it means that you will build a backbone router in Cape Town to avoid to build a direct track between NYC and Windhoek. Instead, you will use the track that goes to Cape Town where the router will make you take the track to windhoek.