Re: Project: Economy and Balancing
Posted: 16 Apr 2008 12:20
Now, what do you do when you have something really important to do? Correct - have loads of cool ideas on how to do something completely unrelated. This is my approach to the balancing problem. Well, actually I'm proposing a whole new fantasy economy here. Note, however that all those things can be implemented independently and some might be building blocks for other balancing efforts, too. When they all are implemented we can have an OpenTTD that works completely without money. That is, there will still be an internal cost measure but it will appear as work force or material requirements to the player. Well, that might not be everyone's dream, but it seems funny to me. I'm aware that some of these things need to be supported by specialized GRFs. These are the special industries, stations with capacities and off-road vehicles. Everything else should be compatible with existing GRFs. I sorted the propositions by perceived difficulty to implement.
station capacities:
each station can store only a limited amount of cargo and passengers, depending on its number of tiles. After reaching that amount any means of dumping cargo there is prevented. Optionally also:
- introduce more expensive station tiles that can store more cargo
- introduce specialized station tiles that can store more of a certain cargo but no other.
electric vehicles and power:
Electric vehicles only run, if you have recently provided any power plants with enough fuel.
- Each power plant produces a hypothetical number of power units from each unit of fuel and adds it to a global power pool
- Each electric vehicle uses up a number of power units from the pool (linearly related to maintenance cost) per tile.
- If there is no power left in the pool, electric vehicles slow to a crawl.
- there may be a base amount of power generated every few ticks by hypothetical solar panels or wind turbines.
- the power pool is constantly fading. Every n ticks x% of the power pool dissolves into thin air. After all, storing power is severely limited and long range transmission is lossy.
off-road vehicles:
There are off-road vehicles with limited capacity and speed. They can go everywhere you can theoretically build things plus rails and roads.
- perhaps they should not be able to go over tiles with too many trees (might be configurable)
- Route finding will be similar to ships
- this is needed for the reputation enhancement (see below) and also for growing very small towns that don't have the work force (see below) to build longer roads in feasible time.
industry clusters:
Industries within a certain distance from each other don't need a dedicated transportation service deliver goods to each other. Like that you can build an industry cluster in the scenario editor that will provide you with readily buildable vehicles and fuel (see special industry as depots).
reputation:
- towns are more forgiving concerning construction work. If you bulldoze buildings and thus reduce the work force you're cutting your own flesh anyway.
- The willingness of an industry to give you goods however, is also determined by your rating in the town it belongs to.
- The stupid tree thing is completely removed. With the limited work force it will be impossible to do a huge remodeling of the landscape anyway.
- no bribes and other town actions that cost money, of course
- no additional limiting of station construction. If you can find the work force you can build a station. The most basic bus station costs exactly one man-day and one guy is always there. When station capacities are available and you already have specialized GRFs a special low capacity bus station can be designed for that, otherwise the normal terminal station might do. So, like that you always have a chance to enhance your town reputation by normal means and don't need trees.
- a wider range of configurability concernig town friendliness. Some people may want towns to respond more quickly to your transportation services.
work force:
Instead (or additional to) of money, for construction a certain amount of workers is needed. Workers are found in towns. Each tile on the map belongs to exactly one town. About half of the population can theoretically be mobilized. However:
- industries permanently bind a certain amount of workers each
- People may be unwilling to work for you, depending on your reputation in the town
- After working people need to recover. One worker can do roughly 100$ worth of construction per day. That determines a maximum work force that can be used, and thus the maximum amount of construction that can be done in the proximity of a town per month.
recruiting (add-on to work force and passenger and freight distribution):
You can recruit people from other towns to do work in a certain area. This is done in a recruiting GUI. You determine the station of origin, the destination town and the number of workers you want to use there per month.
- By using the passenger and freight distribution (see below) it can be automatically determined if you're meeting your goal of transporting the recruited workers (which are actually passengers) to their destination.
- The respective work force is then subtracted from the origin town and added to the destination town.
- Of course your ability to recruit in a town is also determined by your reputation there.
special industry as depots:
Instead of having specialized depots for various vehicles, any station in the proximity of a vehicle producing industry acts as a depot where you can build and maintain vehicles. Optionally there may be an industry (coal mine for steam trains for example) where you can only do maintenance.
- Construction may (configurably) not cost money anymore but uses up the cargo stocked at the industry, linearly related to its construction cost. For example building a train engine will use up X steel at a trainworks industry. The industry will only use up its stock for that special purpose and not produce anything on its own.
- When scrapping a vehicle some raw material is added to the industry's or station's stock, depending on the remaining value of the vehicle.
- Maintenance only uses up fuel. A steam engine needs coal, a diesel engine diesel, for example. The amount of fuel is linearly related to the running cost specified for the vehicle and maybe the vehicle type. Planes need huge amounts of fuel. Electric vehicles don't need anything but have to be serviced regardless.
- Breakdowns and automatic maintenance are removed. Instead, you need to explicitly send all vehicles to maintenance in regular intervals, otherwise they'll run out of fuel and slow to a crawl (by being dragged along with a hypothetical emergency engine) or, in the case of airplanes, simply crash (airplanes are overpowered anyway ...).
- Vehicle industries come in different sizes of different capacities. The smallest ones are just one tile and very cheap (for industries). They can be extended by placing other instances directly near them.
- the freight distribution (see below) might come in handy when delivering fuel to maintenance industries.
- Someone needs to figure out how to make vehicles graciously appear and disappear in stations when building/scrapping.
- some bootstrapping process is needed so that you can start building vehicles in the first place. Maybe equip vehicle industries with some initial stock. Or use the industry cluster feature. And perhaps introduce very small vehicles that don't have a maintenance cost.
passenger and freight distribution:
(This is actually a bit off-topic and a refinement of my idea in the passenger destinations thread, but I post it here because it would make delivering the fuel to maintenance industries so much cooler: You just have to load a large train with fuel and send it to all your depot stations in a row.)
A new passenger and freight distribution system takes care of sending everything you don't manually specify to sensible destinations. When the cargo has been delivered the route it has come is recorded and made accessible for a period of time. Like this, after a short convergence period, you can easily spot where everything is going without the need for an expensive precalculation of destinations.
- Towns not only have a limitation for providing passengers, but also one for accepting them. The numbers are equal.
- Each industry is limited in its production capacity and such has a limited capacity for accepting cargo (this is already the case in fact, but the limits are ridiculously high in some cases)
- Each station gets a simple rank metric R_s for each cargo it is involved with. The rank is the number of units of that cargo A_s the station itself can accept per month plus the capacity C_v of all vehicles picking up that cargo at the station, that have visited the station in the last month.
- Each vehicle gets a rank metric R_v for each cargo it can carry which is the sum of the ranks of all stations where it can drop cargo (ie doesn't have a special order to not do so).
- When a cargo packet gets the opportunity to board a train it flips a coin with a probability C_v / R_s of landing vehicle up. If the coin lands vehicle up, the cargo packet boards the vehicle, otherwise it stays at the station.
- When a cargo packet gets the opportunity to leave a vehicle it flips a coin with a probability R_s / R_v of landing station up. If the coin lands station up, the cargo packet leaves the vehicle, otherwise it stays in the vehicle. Note that like this a cargo packet can leave at a station where it is not accepted, if other vehicles can pick it up there.
- At the end of each time period (month? day? maybe configurable) the station consumes the amount of cargo it accepts from its stock. The cargo is then shown in the station window as "delivered" for a time.
- Before entering a vehicle or leaving a vehicle at a station where it is not accepted a cargo packet checks if there is a way from that instance to a station where it is accepted. It does so by depth-first search in the graph spanned by stations as nodes and vehicles' routes as edges. In reasonable networks this search should be finished after very few steps. If no suitable station is found it stays where it is and adds the probability it would have thrown a dice with to the probability for the next such decision. I expect that this happens rarely enough to be insignificant to the overall cargo routing. If not, it needs some further consideration.
- If a cargo packet gets stuck at a station and stays there for some time (because the only route to an accepting station has been removed manually) it is shown as "undeliverable" in the station window for some more time before being deleted.
- Cargo packets are split when entering a vehicle of smaller size or when being larger than a configurable minimum and at the same time comprising more than a configurable percentage of a station's or vehicle's stock. More splitting of cargo packets leads to finer granulation of deliveries, but also to more calculation being done.
- Configurable constraints may be placed on the behaviour of cargo to make things more realistic:
1. A cargo packet must not stay at the same station twice (this will be pretty much standard, I guess)
2. A cargo packet must not enter a vehicle of the same shared order group twice
3. A cargo packet must not visit a station twice regardless of actually leaving the vehicle there (might be hard to determine)
4. If a cargo packet has boarded a vehicle which is slower than the previous one it must never board a faster one than the current one again.
5. If a cargo packet has boarded a vehicle with a smaller capacity than the previous one it must never board one with a higher capacity than the current one again.
These constraints are applied in the depth-search and before boarding/leaving a vehicle.
Now, I got a pretty neat idea on how to prove that this method actually leads to:
a, all cargo being eventually delivered
b, a nice random distribution of cargo among all reachable accepting stations. The farther away and the smaller the stations and trains servicing them the less cargo gets there in expectance.
However, that thing needs some more work.
Also note that all data needing to be saved can easily be identified here. Actually it's only the routes the cargo packets have chosen, some flags and perhaps the ranks as cached values.
station capacities:
each station can store only a limited amount of cargo and passengers, depending on its number of tiles. After reaching that amount any means of dumping cargo there is prevented. Optionally also:
- introduce more expensive station tiles that can store more cargo
- introduce specialized station tiles that can store more of a certain cargo but no other.
electric vehicles and power:
Electric vehicles only run, if you have recently provided any power plants with enough fuel.
- Each power plant produces a hypothetical number of power units from each unit of fuel and adds it to a global power pool
- Each electric vehicle uses up a number of power units from the pool (linearly related to maintenance cost) per tile.
- If there is no power left in the pool, electric vehicles slow to a crawl.
- there may be a base amount of power generated every few ticks by hypothetical solar panels or wind turbines.
- the power pool is constantly fading. Every n ticks x% of the power pool dissolves into thin air. After all, storing power is severely limited and long range transmission is lossy.
off-road vehicles:
There are off-road vehicles with limited capacity and speed. They can go everywhere you can theoretically build things plus rails and roads.
- perhaps they should not be able to go over tiles with too many trees (might be configurable)
- Route finding will be similar to ships
- this is needed for the reputation enhancement (see below) and also for growing very small towns that don't have the work force (see below) to build longer roads in feasible time.
industry clusters:
Industries within a certain distance from each other don't need a dedicated transportation service deliver goods to each other. Like that you can build an industry cluster in the scenario editor that will provide you with readily buildable vehicles and fuel (see special industry as depots).
reputation:
- towns are more forgiving concerning construction work. If you bulldoze buildings and thus reduce the work force you're cutting your own flesh anyway.
- The willingness of an industry to give you goods however, is also determined by your rating in the town it belongs to.
- The stupid tree thing is completely removed. With the limited work force it will be impossible to do a huge remodeling of the landscape anyway.
- no bribes and other town actions that cost money, of course
- no additional limiting of station construction. If you can find the work force you can build a station. The most basic bus station costs exactly one man-day and one guy is always there. When station capacities are available and you already have specialized GRFs a special low capacity bus station can be designed for that, otherwise the normal terminal station might do. So, like that you always have a chance to enhance your town reputation by normal means and don't need trees.
- a wider range of configurability concernig town friendliness. Some people may want towns to respond more quickly to your transportation services.
work force:
Instead (or additional to) of money, for construction a certain amount of workers is needed. Workers are found in towns. Each tile on the map belongs to exactly one town. About half of the population can theoretically be mobilized. However:
- industries permanently bind a certain amount of workers each
- People may be unwilling to work for you, depending on your reputation in the town
- After working people need to recover. One worker can do roughly 100$ worth of construction per day. That determines a maximum work force that can be used, and thus the maximum amount of construction that can be done in the proximity of a town per month.
recruiting (add-on to work force and passenger and freight distribution):
You can recruit people from other towns to do work in a certain area. This is done in a recruiting GUI. You determine the station of origin, the destination town and the number of workers you want to use there per month.
- By using the passenger and freight distribution (see below) it can be automatically determined if you're meeting your goal of transporting the recruited workers (which are actually passengers) to their destination.
- The respective work force is then subtracted from the origin town and added to the destination town.
- Of course your ability to recruit in a town is also determined by your reputation there.
special industry as depots:
Instead of having specialized depots for various vehicles, any station in the proximity of a vehicle producing industry acts as a depot where you can build and maintain vehicles. Optionally there may be an industry (coal mine for steam trains for example) where you can only do maintenance.
- Construction may (configurably) not cost money anymore but uses up the cargo stocked at the industry, linearly related to its construction cost. For example building a train engine will use up X steel at a trainworks industry. The industry will only use up its stock for that special purpose and not produce anything on its own.
- When scrapping a vehicle some raw material is added to the industry's or station's stock, depending on the remaining value of the vehicle.
- Maintenance only uses up fuel. A steam engine needs coal, a diesel engine diesel, for example. The amount of fuel is linearly related to the running cost specified for the vehicle and maybe the vehicle type. Planes need huge amounts of fuel. Electric vehicles don't need anything but have to be serviced regardless.
- Breakdowns and automatic maintenance are removed. Instead, you need to explicitly send all vehicles to maintenance in regular intervals, otherwise they'll run out of fuel and slow to a crawl (by being dragged along with a hypothetical emergency engine) or, in the case of airplanes, simply crash (airplanes are overpowered anyway ...).
- Vehicle industries come in different sizes of different capacities. The smallest ones are just one tile and very cheap (for industries). They can be extended by placing other instances directly near them.
- the freight distribution (see below) might come in handy when delivering fuel to maintenance industries.
- Someone needs to figure out how to make vehicles graciously appear and disappear in stations when building/scrapping.
- some bootstrapping process is needed so that you can start building vehicles in the first place. Maybe equip vehicle industries with some initial stock. Or use the industry cluster feature. And perhaps introduce very small vehicles that don't have a maintenance cost.
passenger and freight distribution:
(This is actually a bit off-topic and a refinement of my idea in the passenger destinations thread, but I post it here because it would make delivering the fuel to maintenance industries so much cooler: You just have to load a large train with fuel and send it to all your depot stations in a row.)
A new passenger and freight distribution system takes care of sending everything you don't manually specify to sensible destinations. When the cargo has been delivered the route it has come is recorded and made accessible for a period of time. Like this, after a short convergence period, you can easily spot where everything is going without the need for an expensive precalculation of destinations.
- Towns not only have a limitation for providing passengers, but also one for accepting them. The numbers are equal.
- Each industry is limited in its production capacity and such has a limited capacity for accepting cargo (this is already the case in fact, but the limits are ridiculously high in some cases)
- Each station gets a simple rank metric R_s for each cargo it is involved with. The rank is the number of units of that cargo A_s the station itself can accept per month plus the capacity C_v of all vehicles picking up that cargo at the station, that have visited the station in the last month.
- Each vehicle gets a rank metric R_v for each cargo it can carry which is the sum of the ranks of all stations where it can drop cargo (ie doesn't have a special order to not do so).
- When a cargo packet gets the opportunity to board a train it flips a coin with a probability C_v / R_s of landing vehicle up. If the coin lands vehicle up, the cargo packet boards the vehicle, otherwise it stays at the station.
- When a cargo packet gets the opportunity to leave a vehicle it flips a coin with a probability R_s / R_v of landing station up. If the coin lands station up, the cargo packet leaves the vehicle, otherwise it stays in the vehicle. Note that like this a cargo packet can leave at a station where it is not accepted, if other vehicles can pick it up there.
- At the end of each time period (month? day? maybe configurable) the station consumes the amount of cargo it accepts from its stock. The cargo is then shown in the station window as "delivered" for a time.
- Before entering a vehicle or leaving a vehicle at a station where it is not accepted a cargo packet checks if there is a way from that instance to a station where it is accepted. It does so by depth-first search in the graph spanned by stations as nodes and vehicles' routes as edges. In reasonable networks this search should be finished after very few steps. If no suitable station is found it stays where it is and adds the probability it would have thrown a dice with to the probability for the next such decision. I expect that this happens rarely enough to be insignificant to the overall cargo routing. If not, it needs some further consideration.
- If a cargo packet gets stuck at a station and stays there for some time (because the only route to an accepting station has been removed manually) it is shown as "undeliverable" in the station window for some more time before being deleted.
- Cargo packets are split when entering a vehicle of smaller size or when being larger than a configurable minimum and at the same time comprising more than a configurable percentage of a station's or vehicle's stock. More splitting of cargo packets leads to finer granulation of deliveries, but also to more calculation being done.
- Configurable constraints may be placed on the behaviour of cargo to make things more realistic:
1. A cargo packet must not stay at the same station twice (this will be pretty much standard, I guess)
2. A cargo packet must not enter a vehicle of the same shared order group twice
3. A cargo packet must not visit a station twice regardless of actually leaving the vehicle there (might be hard to determine)
4. If a cargo packet has boarded a vehicle which is slower than the previous one it must never board a faster one than the current one again.
5. If a cargo packet has boarded a vehicle with a smaller capacity than the previous one it must never board one with a higher capacity than the current one again.
These constraints are applied in the depth-search and before boarding/leaving a vehicle.
Now, I got a pretty neat idea on how to prove that this method actually leads to:
a, all cargo being eventually delivered
b, a nice random distribution of cargo among all reachable accepting stations. The farther away and the smaller the stations and trains servicing them the less cargo gets there in expectance.
However, that thing needs some more work.
Also note that all data needing to be saved can easily be identified here. Actually it's only the routes the cargo packets have chosen, some flags and perhaps the ranks as cached values.