Improving the Trolly-AI
Moderator: OpenTTD Developers
Improving the Trolly-AI
Hello
We all know that the old (default) AI ist quite bad. And also doesn't
support MP. The new (trolly) supports MP but only buses and trucks.
I spend some time adding the trains feature to the trolly AI. This was
relative easy so far since trolly was already prepared for this step. (my thanks to TrueLight) I have named the improved "MPAI" for
Multiplayer AI.
While this is not finished yet I can say that it performs MUCH better than
the default AI on my testmap and also quite good in general.
I have attached a screenshot where you can see that he likes to build
rail roads.
Raimar
We all know that the old (default) AI ist quite bad. And also doesn't
support MP. The new (trolly) supports MP but only buses and trucks.
I spend some time adding the trains feature to the trolly AI. This was
relative easy so far since trolly was already prepared for this step. (my thanks to TrueLight) I have named the improved "MPAI" for
Multiplayer AI.
While this is not finished yet I can say that it performs MUCH better than
the default AI on my testmap and also quite good in general.
I have attached a screenshot where you can see that he likes to build
rail roads.
Raimar
- Attachments
-
- mpai.png
- (1.25 MiB) Downloaded 830 times
I have a couple of ideas that i have been implementing and they could be useful to you for improve the AI in the areas of helping with the choosing of if its a good idea or not to place a station at a given industry, Amount of Vehicles need to Transport the given goods (i have 3 ways i will be implementing this), and Relay Stations.
If you are interested in any of these please let me know.
If you are interested in any of these please let me know.
Sure I'm interested. This is indeed an area which needs improvements.l_Blue_l wrote:I have a couple of ideas that i have been implementing and they could be useful to you for improve the AI in the areas of helping with the choosing of if its a good idea or not to place a station at a given industry, Amount of Vehicles need to Transport the given goods (i have 3 ways i will be implementing this), and Relay Stations.
If you are interested in any of these please let me know.
I think that there are two input parameters to this: the amount of
cargo to ship and the distance. And from this some code has to
decide how many tracks, trains and wagons.
Raimar
One thing that would help is knowing how many station are collecting stuff from the industry so 5 different station wont pop up at the same industry. 2 or 3 station(?) can work if the industry is producing enough and it is worth to try and steal it from the other companies.
Explaining the different system for the Amount of Vehicles need to Transport the given goods.
One which i am just starting to work on is a system where it auto builds vehicles so a given amount of vehicle are always waiting for full load at the starting station until a vehicle arrives back to the start.
The next one is sort of a monitoring system where it track the time it takes to get there and back and keep a record of it.
And finally one which i have given up on for the time being is an ETA system where it will tell you how long it will take you train to get there and back. (as it will send the vehicle the full journey of the trip all at once (not sure if the devs would like this)) (this system wouldn't be to hard to implement for a network with no trains(or vehicles on it) as i have already done to some extent but it can get very painfully if there are trains or vehicles.
Explaining the different system for the Amount of Vehicles need to Transport the given goods.
One which i am just starting to work on is a system where it auto builds vehicles so a given amount of vehicle are always waiting for full load at the starting station until a vehicle arrives back to the start.
The next one is sort of a monitoring system where it track the time it takes to get there and back and keep a record of it.
And finally one which i have given up on for the time being is an ETA system where it will tell you how long it will take you train to get there and back. (as it will send the vehicle the full journey of the trip all at once (not sure if the devs would like this)) (this system wouldn't be to hard to implement for a network with no trains(or vehicles on it) as i have already done to some extent but it can get very painfully if there are trains or vehicles.
I plan to this. So that max_cargo=production-of-industry/number-of-stationsl_Blue_l wrote:One thing that would help is knowing how many station are collecting stuff from the industry so 5 different station wont pop up at the same industry. 2 or 3 station(?) can work if the industry is producing enough and it is worth to try and steal it from the other companies.
and than depending on max_cargo it id decided if a route is build at all and how big.
I do not understand.l_Blue_l wrote:Explaining the different system for the Amount of Vehicles need to Transport the given goods.
Yes something like this. But it only works good with buses, trucks and a circular rail design. Dedicated tracks without passing loops are easy tol_Blue_l wrote:One which i am just starting to work on is a system where it auto builds vehicles so a given amount of vehicle are always waiting for full load at the starting station until a vehicle arrives back to the start.
construct but will only support one train.
Yes from time to time routes need to be checked. Possible outcomes could be:l_Blue_l wrote:The next one is sort of a monitoring system where it track the time it takes to get there and back and keep a record of it.
And finally one which i have given up on for the time being is an ETA system where it will tell you how long it will take you train to get there and back. (as it will send the vehicle the full journey of the trip all at once (not sure if the devs would like this)) (this system wouldn't be to hard to implement for a network with no trains(or vehicles on it) as i have already done to some extent but it can get very painfully if there are trains or vehicles.
1) vehicles doesn't make profit: the code could try to find the reason (hard) or just sell everything. Possible reasons: destination doesn't accept the cargo any more, producer stoped producing, cargo output too low for the amount of vehicles,...
2) surplus cargo at the producer: add more vehicles
-
- Engineer
- Posts: 123
- Joined: 16 Nov 2006 16:52
Well that looks rather promising.
One thing to keep in mind is that an industry only supplies 2 stations (highest rating) with goods for the time being (might change later on). So the AI should look around an industry and if it finds that there are two reasonably high rating ones, it should not use that industry.
Are you planning to provide us with a diff at some point?
Celestar
One thing to keep in mind is that an industry only supplies 2 stations (highest rating) with goods for the time being (might change later on). So the AI should look around an industry and if it finds that there are two reasonably high rating ones, it should not use that industry.
Are you planning to provide us with a diff at some point?

Celestar
Since for humans players a news message is generated about stations no longer accepting a certain type of cargo, couldn't something similar be done for the AI?rfalke wrote:1) vehicles doesn't make profit: the code could try to find the reason (hard) or just sell everything. Possible reasons: destination doesn't accept the cargo any more, ...
That way maybe it could check if it has a route depending on that station accepting that cargo type, and if so just delete the route.
Wow - rfalke - your patch looks really nice. Finally better rail management from Compu-titors. 
The road AI has been very nice (with exception it didn't renew/upgrade (all of) its vehicles) already but rail really needs a major overhaul...
Perhaps even with 2 track lines (one in each direction).
For better ratings on all those stations you could also include a better station rating-compute patch - now there have been made at least 2 of them so far, but are buried in the past.
You can get the code from the SourceForge's OpenTTD patch list.

The road AI has been very nice (with exception it didn't renew/upgrade (all of) its vehicles) already but rail really needs a major overhaul...
Perhaps even with 2 track lines (one in each direction).
For better ratings on all those stations you could also include a better station rating-compute patch - now there have been made at least 2 of them so far, but are buried in the past.
You can get the code from the SourceForge's OpenTTD patch list.
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
I have attached a snapshot. It is under development. You haveCelestar wrote:Well that looks rather promising.
One thing to keep in mind is that an industry only supplies 2 stations (highest rating) with goods for the time being (might change later on). So the AI should look around an industry and if it finds that there are two reasonably high rating ones, it should not use that industry.
Are you planning to provide us with a diff at some point?
Celestar
to disable road vehicles to make it work. Also currently I'm only
testing with a flat landscape so watch out for problems with
mountains. See the TODO for other things which do not work yet.
EDIT: start with "-d ai=9" to have something to read
Raimar
- Attachments
-
- mpai-snapshot-2007-01-16.diff.gz
- (20.19 KiB) Downloaded 259 times
There is a new snapshot with a lot of improvements:rfalke wrote:I have attached a snapshot. It is under development. You haveCelestar wrote:Well that looks rather promising.
One thing to keep in mind is that an industry only supplies 2 stations (highest rating) with goods for the time being (might change later on). So the AI should look around an industry and if it finds that there are two reasonably high rating ones, it should not use that industry.
Are you planning to provide us with a diff at some point?
Celestar
to disable road vehicles to make it work. Also currently I'm only
testing with a flat landscape so watch out for problems with
mountains. See the TODO for other things which do not work yet.
EDIT: start with "-d ai=9" to have something to read
Raimar
- make buses and trucks work again
- support upgrade rails and trains
- select industry source by amount and number of stations
- much better loan management
- fix handling of crashed vehicles
- better debug methods
- and a lot of other improvements
It now runs on my test map without a problem from 1950 to 2050.
And the top AI player achieves 270mio at the end.
The next things on the todo list are:
- upgrade bridges
- passanger trains
- roro stations
- test multiplayer
Please try the patch and report both success and failure. Run
with "-d ai=2" to get some output.
Raimar
- Attachments
-
- mpai-snapshot-2007-02-08.diff.gz
- (41.65 KiB) Downloaded 249 times
Could you possibly try make the AI try combining stations, so for example one AI player doesn't have 5 unloading stations around a power station, but rather just 1 wich it expands to accommodate new coal routes?
Last edited by Villem on 10 Feb 2007 17:07, edited 1 time in total.
Who is online
Users browsing this forum: Amazon [Bot] and 18 guests