ChooChoo, a train network AI
Moderator: OpenTTD Developers
Re: ChooChoo, a train network AI
I know that it wont flood an area with bus stops if you disallow building on town owned roads, but I want to still be able to do that!
please can you give an option in the AI config settings to turn this off?
please can you give an option in the AI config settings to turn this off?
Re: ChooChoo, a train network AI
You mean an option to not build those bus stops, even if the game settings allow it? Yes, that's a good idea (maybe I'll just let it build one little bus stop, so it's not too badly gimping itself). Unfortunately, now that I just got both Civ 5 AND Minecraft... this may take a while
Oh, and I gotta release the tram fix... mmmmmaybe this weekend
Oh, and I gotta release the tram fix... mmmmmaybe this weekend
Re: ChooChoo, a train network AI
crash immediately after start
- Attachments
-
- Przechwytywanie.PNG (104.34 KiB) Viewed 2452 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: ChooChoo, a train network AI
Thanks, I'll check it out!
That's weird - it checks (earlier) whether it found an engine, or at least it should. Ah - looks like it didn't find a suitable wagon. Any kinky game settings or GRFs you're using?local trainCost = AIEngine.GetPrice(engine) + AIEngine.GetPrice(wagon) * (trainLength-1) * 2;
Re: ChooChoo, a train network AI
A lot of newgrfs (so I reported only crash not all weird behaviours)Michiel wrote:Thanks, I'll check it out!
That's weird - it checks (earlier) whether it found an engine, or at least it should. Ah - looks like it didn't find a suitable wagon. Any kinky game settings or GRFs you're using?local trainCost = AIEngine.GetPrice(engine) + AIEngine.GetPrice(wagon) * (trainLength-1) * 2;
riversw.grf =
egrvts.1.0\egrvts.grf =
av8_aviators_aircraft_set-1.7\pb_av8w.grf =
usstatsw.grf =
ukwaypointsw.grf =
TranspEngShowRunw.GRF =
total_bridges.grf =
swedish_houses-1.1\swehouses.grf =
ae_subuw.GRF =
stolen_trees-1\stolentreesw_162.grf =
smoothsnoww.grf =
shipdepotw.grf =
tramtrkw.grf =
transmitter.grf =
newwaterw.grf =
newshipsw.grf =
nhdepw.grf =
germanrvw.grf = 1
"BRBV v0.4w.GRF" =
dutchcatw.grf =
fish_ship_set-0.6.1\fish.grf =
buffers.grf =
foundw.grf =
heliport.grf =
indstatrw.grf =
modernsuburbanw.GRF =
mauvetoblackw.grf =
testw.grf =
harbourw_456.grf =
climate_dependant_airports-0.1.0\airportsplus.grf =
heqs_heavy_equipment_set-0.7.1\heqs.grf =
shanghaimaglev3.grf =
shanghaitransrapid.grf =
lrvs-testw.GRF =
VAST.grf =
uk_railway_set_tracks-1\pb_trax.grf =
firs-nightly-r1494\firs-nightly\firs.grf =
ukrs2__the_uk_railway_set-0.6\proj1000.grf = 0 4 0 0 0
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: ChooChoo, a train network AI
It is game with vanilia settngs and it is visible thac CC is not upgrading its engines what results in disappearing vehicles - probably because autorenew sold old vehicle and is unable to build new.
In first attached savegame CC have 3 cargo trains, later only 1.
In first attached savegame CC have 3 cargo trains, later only 1.
- Attachments
-
- autosave14.sav
- (451.84 KiB) Downloaded 129 times
-
- autosave15.sav
- (414.23 KiB) Downloaded 130 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: ChooChoo, a train network AI
Ah, thanks. I'll add a check so it at least doesn't crash.Kogut wrote:A lot of newgrfs (so I reported only crash not all weird behaviours)
That, or they became unprofitable due to breakdowns. It only does autorenew currently, it doesn't replace engines with newer types. I'm currently improving the startup code, making it a bit more aggressive and less random in selecting good starting cargo routes. Maybe after that, I'll look at long term issues, like vehicle management.Kogut wrote:It is game with vanilia settngs and it is visible thac CC is not upgrading its engines what results in disappearing vehicles - probably because autorenew sold old vehicle and is unable to build new.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: ChooChoo, a train network AI
ChooChoo was having trouble in the later years of my Tournament game:
Code: Select all
dbg: [ai] [3] [S]
dbg: [ai] [3] [S] *FUNCTION [FindPath()] ChooChoo-361.tar/choochoo-361/builder_track.nut line [107]
dbg: [ai] [3] [S] *FUNCTION [Run()] ChooChoo-361.tar/choochoo-361/builder_track.nut line [53]
dbg: [ai] [3] [S] *FUNCTION [RunSubtasks()] ChooChoo-361.tar/choochoo-361/task.nut line [115]
dbg: [ai] [3] [S] *FUNCTION [Run()] ChooChoo-361.tar/choochoo-361/builder_network.nut line [233]
dbg: [ai] [3] [S] *FUNCTION [RunSubtasks()] ChooChoo-361.tar/choochoo-361/task.nut line [115]
dbg: [ai] [3] [S] *FUNCTION [Run()] ChooChoo-361.tar/choochoo-361/builder_network.nut line [636]
dbg: [ai] [3] [S] *FUNCTION [Start()] ChooChoo-361.tar/choochoo-361/main.nut line [70]
dbg: [ai] [3] [S]
dbg: [ai] [3] [S] [maxBridgeCost] 15389
dbg: [ai] [3] [S] [u] 100
dbg: [ai] [3] [S] [bridgeLength] 20
dbg: [ai] [3] [S] [pathfinder] INSTANCE
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [ai] [3] [S] [crossing] INSTANCE
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [ai] [3] [S] [exit] ARRAY
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [ai] [3] [S] [task] INSTANCE
dbg: [ai] [3] [S] [minMoney] 0
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [misc] TILE: 0x2c568 (360,354)
dbg: [misc] type_height = 0x11
dbg: [misc] m1 = 0x8
dbg: [misc] m2 = 0
dbg: [misc] m3 = 0
dbg: [misc] m4 = 0x7
dbg: [misc] m5 = 0x2
dbg: [misc] m6 = 0
dbg: [misc] m7 = 0
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: ChooChoo, a train network AI
Update!
I've improved the startup to make it a bit more competitive. It now tries to select the most profitable cargo routes and builds more of those than before (at the same difficulty setting).
The pathfinder can now optionally follow another track, penalizing a route if it is not adjacent to the first. This results in slightly better double track layout. Usually...
Also, I've widened the area in which crossings may be placed, so hopefully it'll grow some bigger networks on rougher maps now. The new tar is in the first post, and will be on Banananananas in a minute.
I've improved the startup to make it a bit more competitive. It now tries to select the most profitable cargo routes and builds more of those than before (at the same difficulty setting).
The pathfinder can now optionally follow another track, penalizing a route if it is not adjacent to the first. This results in slightly better double track layout. Usually...
Also, I've widened the area in which crossings may be placed, so hopefully it'll grow some bigger networks on rougher maps now. The new tar is in the first post, and will be on Banananananas in a minute.
Re: ChooChoo, a train network AI
platnetmaker: thanks for the bug report, I'll look into it!
Edit: interesting... was inflation on in that game? It might be that the cost of bridges has become so high that it never starts to pathfind because it can't get the money to build the longest possible bridge.
Edit: interesting... was inflation on in that game? It might be that the cost of bridges has become so high that it never starts to pathfind because it can't get the money to build the longest possible bridge.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: ChooChoo, a train network AI
I didn't play with inflation. You can get the whole game with all its settings (start and final savegame ) in this thread.Michiel wrote:platnetmaker: thanks for the bug report, I'll look into it!
Edit: interesting... was inflation on in that game? It might be that the cost of bridges has become so high that it never starts to pathfind because it can't get the money to build the longest possible bridge.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: ChooChoo, a train network AI
Quick fix: while testing planetmaker's savegame, I kept getting ERR_PRECONDITION_FAILED trying to build newgrf cargo stations, so I've changed it to fall back to normal stations in that case.
Re: ChooChoo, a train network AI
I like your AI a lot!
I played around with it for a bit and I have some suggestions for future updates.
Maybe they have been suggested before, but I thought I would post any way.
First is that I noticed that the busses don’t transfer passengers to the stations but just service the station and some bus stations in the towns. This way they actually compete with the trains for passengers at the stations.
I think the AI would do better if you would give the busses a ‘transfer and leave empty’ order for the train stations, this way they transfer additional passengers to the stations for your trains to transport.
Second is that your AI seems to build its train routes somewhat at random. It for instance build a track to the map edge with no towns around in my last game.
I think it would be really cool if you could implement something like the mapping routine PathZilla uses (or used) for its busses.
Maybe you can do something with this.
Any way, thanks a lot for programming an AI for us to play around with!
I played around with it for a bit and I have some suggestions for future updates.
Maybe they have been suggested before, but I thought I would post any way.
First is that I noticed that the busses don’t transfer passengers to the stations but just service the station and some bus stations in the towns. This way they actually compete with the trains for passengers at the stations.
I think the AI would do better if you would give the busses a ‘transfer and leave empty’ order for the train stations, this way they transfer additional passengers to the stations for your trains to transport.
Second is that your AI seems to build its train routes somewhat at random. It for instance build a track to the map edge with no towns around in my last game.
I think it would be really cool if you could implement something like the mapping routine PathZilla uses (or used) for its busses.
Maybe you can do something with this.
Any way, thanks a lot for programming an AI for us to play around with!
Re: ChooChoo, a train network AI
That error usually means that one of the parameters is the wrong type, like an engine id instead of a station id or somethingMichiel wrote:Quick fix: while testing planetmaker's savegame, I kept getting ERR_PRECONDITION_FAILED trying to build newgrf cargo stations, so I've changed it to fall back to normal stations in that case.
AroAI - A really feeble attempt at an AI
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
Re: ChooChoo, a train network AI
Thank youX_stream wrote:I like your AI a lot!
I played around with it for a bit and I have some suggestions for future updates.
Maybe they have been suggested before, but I thought I would post any way.
I did get that question before - so I'm gonna copy/paste the answerX_stream wrote: First is that I noticed that the busses don’t transfer passengers to the stations but just service the station and some bus stations in the towns. This way they actually compete with the trains for passengers at the stations.
I think the AI would do better if you would give the busses a ‘transfer and leave empty’ order for the train stations, this way they transfer additional passengers to the stations for your trains to transport.
I've actually considered both, since there's a tradeoff: if I have the bus pick up passengers at the train station, that really increases the cargo rating, so the train station gets/keeps more cargo (passengers) from the town. However, as long as a town is small, most passengers are taken away by the bus instead of the trains. On the other hand, if I set the bus to transfer and leave empty, it brings people in from town, but it doesn't help the ratings at all. Another option is to use transfer orders on both sides: then, the bus will pick (the same people) up at each end, so you get the ratings bonus without "losing" passengers, but you run the bus service at a loss.
It's more than "somewhat" It picks a random spot for a crossing, estimates if it's likely to connect at least 3 towns, and then starts building. Sometimes, it'll connect a huge network, while sometimes, it only manages to connect a single town, making the whole exercise useless... I quite like the randomness, it's not so focussed on the large towns like most AIs. However, it could use a bit of optimization.X_stream wrote: Second is that your AI seems to build its train routes somewhat at random. It for instance build a track to the map edge with no towns around in my last game.
I think it would be really cool if you could implement something like the mapping routine PathZilla uses (or used) for its busses.
You're welcome, I'm only doing it for funX_stream wrote: Maybe you can do something with this.
Any way, thanks a lot for programming an AI for us to play around with!
Re: ChooChoo, a train network AI
Big bug fixed! Now with much nicer double track, because I told the pathfinder to follow another track and then didn't give it one, so it was going all over with all the wrong costs.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: ChooChoo, a train network AI
With the updated version on Bananas, I noticed that ChooChoo is competing heavily with itself: one mine with three stations which connect to a different power plant each. Vice versa would make sense, but this way round - I guess it should not do that
- Attachments
-
- Gamla Österboda Transport, 2020-11-13.png (288.86 KiB) Viewed 2452 times
-
- Gamla Österboda Transport, 2020-10-30.png (152.89 KiB) Viewed 2452 times
-
- Another game
- Unnamed, 2021-02-25.png (44.08 KiB) Viewed 6550 times
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: ChooChoo, a train network AI
Thanks! I think I removed the check on whether an industry is already being served. I'll put that (back) in!
Re: ChooChoo, a train network AI
Fixed! And I've increased performance a bit by using shorter trains.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: ChooChoo, a train network AI
Also the current bananas version still creates continuously errors (though not fatal, it's annoying as it spams the console, which is nothing I like when doing casual testing, of also other stuff concurrently):
Code: Select all
dbg: [ai] [3] [S]
dbg: [ai] [3] [S] *FUNCTION [Run()] ChooChoo-394.tar/choochoo-394/builder_cargo.nut line [51]
dbg: [ai] [3] [S] *FUNCTION [Start()] ChooChoo-394.tar/choochoo-394/main.nut line [75]
dbg: [ai] [3] [S]
dbg: [ai] [3] [S] [railType] 0
dbg: [ai] [3] [S] [maxDistance] 75
dbg: [ai] [3] [S] [b] 4
dbg: [ai] [3] [S] [a] 5
dbg: [ai] [3] [S] [cargo] 3
dbg: [ai] [3] [S] [route] INSTANCE
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [ai] [3] [S] [task] INSTANCE
dbg: [ai] [3] [S] [minMoney] 0
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [ai] [3] [S] Your script made an error: unknown error
dbg: [ai] [3] [S]
dbg: [ai] [3] [S] *FUNCTION [Run()] ChooChoo-394.tar/choochoo-394/builder_cargo.nut line [51]
dbg: [ai] [3] [S] *FUNCTION [Start()] ChooChoo-394.tar/choochoo-394/main.nut line [75]
dbg: [ai] [3] [S]
dbg: [ai] [3] [S] [railType] 0
dbg: [ai] [3] [S] [maxDistance] 75
dbg: [ai] [3] [S] [b] 4
dbg: [ai] [3] [S] [a] 296
dbg: [ai] [3] [S] [cargo] 3
dbg: [ai] [3] [S] [route] INSTANCE
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [ai] [3] [S] [task] INSTANCE
dbg: [ai] [3] [S] [minMoney] 0
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [ai] [3] [S] Your script made an error: unknown error
dbg: [ai] [3] [S]
dbg: [ai] [3] [S] *FUNCTION [Run()] ChooChoo-394.tar/choochoo-394/builder_cargo.nut line [51]
dbg: [ai] [3] [S] *FUNCTION [Start()] ChooChoo-394.tar/choochoo-394/main.nut line [75]
dbg: [ai] [3] [S]
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Who is online
Users browsing this forum: No registered users and 19 guests