Page 1 of 1
Improving the Trolly-AI
Posted: 13 Jan 2007 23:04
by rfalke
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
Posted: 13 Jan 2007 23:14
by Brianetta
Still no junctions, though. Not even passing loops. Are these things to come to pass?
Posted: 13 Jan 2007 23:22
by rfalke
Brianetta wrote:Still no junctions, though. Not even passing loops. Are these things to come to pass?
I disabled junctions for now because adding signals is something
for a later stage.
Well I'm not a big fan of passing loops. But I plan to implement
RoRo stations.
Raimar
Posted: 14 Jan 2007 07:45
by l_Blue_l
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.
Posted: 14 Jan 2007 08:07
by rfalke
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.
Sure I'm interested. This is indeed an area which needs improvements.
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
Posted: 14 Jan 2007 10:44
by l_Blue_l
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.
Posted: 14 Jan 2007 12:02
by rfalke
l_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.
I plan to this. So that max_cargo=production-of-industry/number-of-stations
and than depending on max_cargo it id decided if a route is build at all and how big.
l_Blue_l wrote:Explaining the different system for the Amount of Vehicles need to Transport the given goods.
I do not understand.
l_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.
Yes something like this. But it only works good with buses, trucks and a circular rail design. Dedicated tracks without passing loops are easy to
construct but will only support one train.
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.
Yes from time to time routes need to be checked. Possible outcomes could be:
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
Posted: 15 Jan 2007 13:51
by Tomsomethingcon
is there any where we can download this "mod" so we can also try it ?
Posted: 15 Jan 2007 16:23
by Celestar
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
Posted: 15 Jan 2007 20:14
by oVRoM
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, ...
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?
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.
Posted: 16 Jan 2007 17:08
by SirkoZ
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.
Posted: 16 Jan 2007 18:20
by rfalke
Celestar 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
I have attached a snapshot. It is under development. You have
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
Posted: 08 Feb 2007 21:02
by rfalke
rfalke wrote:Celestar 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
I have attached a snapshot. It is under development. You have
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
There is a new snapshot with a lot of improvements:
- 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
Posted: 10 Feb 2007 10:27
by Celestar
I'll try this out in the next few days...
Celestar
Posted: 10 Feb 2007 13:19
by Villem
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?
Posted: 10 Feb 2007 16:17
by rfalke
Akalamanaia wrote: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 accomodate new coal routes?
Yes I can put it on the todo list.
Raimar
Posted: 11 Feb 2007 09:35
by Celestar
The pathfinding appears to work rather nicely.
I noticed something about depots: Trains should have a "Service At" order instead of "Go To" for depots.
Celestar