[AI] SuperSimpleAI v55 (Stable) and v58 (Testing)

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

User avatar
3iff
Tycoon
Tycoon
Posts: 1105
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: SuperSimpleAI v25 (Old Stable), v41 (Stable) and v45 (Testing)

Post by 3iff »

Absolutely my pleasure...

I really like the way V45 uses double road stations. Somehow I never quite thought of doing that (in that way).
It also makes upgrading the stations to through stations a lot easier.
Wanabe
Engineer
Engineer
Posts: 1
Joined: 07 Jul 2023 10:34

Re: SuperSimpleAI v25 (Old Stable), v41 (Stable) and v45 (Testing)

Post by Wanabe »

Hello, it seems I have managed to find a combination of settings/newGRF to get V45 of Super Simple AI to crash in JGR 0.54.2 (https://github.com/JGRennison/OpenTTD-patches/releases). If I had to geuss based on the name of the Function in the stack trace it's due to Mail being removed from the game via viewtopic.php?t=87332 ( Improved Town Industries 2).

I've played other games close to vanilla settings with Super Simple running in the background and it seems rather stable in those configurations, even after long sessions or many years and multi-session plays. I like the simplicity of this AI overall. While it can certainly struggle or otherwise get itself into serious trouble it can also be surprisingly effective with what it does.

While I'm posting I'll add that I've noticed that sometimes it has trouble with train lines with 90 degree turns turned off and can get the trains stuck going in and out of a depot. The trains I've seen stuck did technically have an indirect route if it just turned and went to the nearest train station first but the pathfinder couldn't figure that out for the AI.

Other than the above occuring here and there my only real gripe with SuperSimpleAI is probably how slow it takes to calculate/pathfind its new routes it's building. It could understandably be intentional, of course. Sometimes though it can take so long building a train route for example that I've seen it trying to build one for multiple years and then eventually demolish it.

Cheers and thanks for developing this AI for the community.
Attachments
Wanabe&Fenix.sav
(953.55 KiB) Downloaded 345 times
Error1.png
(222.62 KiB) Not downloaded yet
Error2.png
(112.86 KiB) Not downloaded yet
Jaume
Engineer
Engineer
Posts: 68
Joined: 24 Aug 2007 15:43

Re: SuperSimpleAI v25 (Old Stable), v41 (Stable) and v46 (Testing)

Post by Jaume »

Thank you for your report Wanabe :-)

I don't have time these days, this new version 46 only fixes the crash reported at last reply by Wanabe, and a little protection for the problem reported by 3iff recently: now this AI don't try to use roadveh/train/aircraft if they are disallowed in GameSettings. But, I think, pathfinding may hang the AI if these configuration changes when it is pathfinding.

And, since v44, replacing road vehicles doesn't work well. Some road vehicles are stopped in depots for months, until they are removed.

This version is poorly tested!
Jaume
Engineer
Engineer
Posts: 68
Joined: 24 Aug 2007 15:43

Re: SuperSimpleAI v25 (Old Stable), v41 (Stable) and v47 (Testing)

Post by Jaume »

Hi all,

Version 47 is here. It fixes another (and unusual) crash.
User avatar
3iff
Tycoon
Tycoon
Posts: 1105
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: SuperSimpleAI v25 (Old Stable), v41 (Stable) and v47 (Testing)

Post by 3iff »

Not sure if this is fixed in V47, but I finally grabbed an issue with V45...but I've left the screenshot at home (Sorry)

Anyway, the details are in MAIN.NUT line 537 (of version 45).
The AI tries to add a wagon...and on rare occasions, WAGON = NULL but there's no check for this possibility.
It then tries to check the minspeed (or maxspeed?) of a non-existant item and it crashes the AI.
It's a very rare event which is why I've had trouble tracking it.
I'll try and get the screenshot here next time I'm on but maybe that's enough info to be going on with?
(Ah, is that the bugfix in V46??)

Meanwhile, I'll try V47.
User avatar
3iff
Tycoon
Tycoon
Posts: 1105
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: SuperSimpleAI v25 (Old Stable), v41 (Stable) and v47 (Testing)

Post by 3iff »

Sorry about the misinformation above. I had the wrong file and wrong line number...

Anyway, it looks like the problem may have been investigated by you in V46 (the code had been changed) and using V47 I haven't seen the issue again.
Jaume
Engineer
Engineer
Posts: 68
Joined: 24 Aug 2007 15:43

Re: SuperSimpleAI v25 (Old Stable), v47 (Stable) and v48 (Testing)

Post by Jaume »

Hi all! I'm back!

New version 48 is here. Tons of code, a few changes in rail building, and some fixes:

Fixed malfunction in train engine cache.
Fixed some trash (isolated depots) when building a rail route and source or destination industry closes.
Rail stations that accepts or provides two cargos looks for the two cargos (using NewGRF, of course).
Faster railbuilding, using fake passing lanes (like checkpoints) between passing lanes. This changes how passenger rail routes are made.
Save data when replacing small airport by big one.
Station tile now is far as possible from the other station. This improves incoming, especially in short routes with long trains.

You can download this version of SuperSimpleAI from first post. Enjoy it!
Jaume
Engineer
Engineer
Posts: 68
Joined: 24 Aug 2007 15:43

Re: SuperSimpleAI v25 (Old Stable), v41 (Stable) and v45 (Testing)

Post by Jaume »

3iff wrote: 16 May 2023 13:19
AI building a rail service, every 6-7 days it buys/sells an engine (maybe checking it can do so).
It is because a malfunction in the engine cache. It is fixed in v48.
3iff wrote: 16 May 2023 13:19 However, I disabled AI from building trains during this process (while it was pathfinding). The script complained that it couldn't build the engine and then seemed to stop doing anything.
I think that is a problem with PathFinder Lib. Simply it hangs. I don't know how to fix it.
3iff wrote: 16 May 2023 13:19 There is also the issue with making a vehicle class (trains or RVs) unavailable during the AI process of trying to build that type of service. (Does that make sense??)
Currently it seems to just stop (perhaps waiting for that vehicle class to become available).
Well, before building something this AI makes all checks. But it doesn't make this check while building. Maybe it can be done...

Thank you 3iff
Jaume
Engineer
Engineer
Posts: 68
Joined: 24 Aug 2007 15:43

Re: SuperSimpleAI v25 (Old Stable), v41 (Stable) and v45 (Testing)

Post by Jaume »

Wanabe wrote: 07 Jul 2023 10:59
Other than the above occuring here and there my only real gripe with SuperSimpleAI is probably how slow it takes to calculate/pathfind its new routes it's building. It could understandably be intentional, of course. Sometimes though it can take so long building a train route for example that I've seen it trying to build one for multiple years and then eventually demolish it.
Try v48 with FastPathFinder enabled (it's enabled by default). It has the effect of dividing the distance of two points to build rails by two, using 1/4 of time to calculate it. But it can do some strange turns in the route.

Thank you Wanabe!
User avatar
3iff
Tycoon
Tycoon
Posts: 1105
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: SuperSimpleAI v25 (Old Stable), v47 (Stable) and v48 (Testing)

Post by 3iff »

Jaume,

Thanks for the continued support. I've very glad to help detect any bugs that sneak through.
I'll try the new version when I get a chance and hopefully I won't be reporting any problems!
Jaume
Engineer
Engineer
Posts: 68
Joined: 24 Aug 2007 15:43

Re: SuperSimpleAI v25 (Old Stable) and v49 (Stable)

Post by Jaume »

Hi all, hi 3iff

This new version fixes the crash described in viewtopic.php?p=1270429#p1270429

v49:
Fixed crash when removing road stations at loading game stage.

:)
Jaume
Engineer
Engineer
Posts: 68
Joined: 24 Aug 2007 15:43

Re: SuperSimpleAI v25 (Old Stable), v49 (Stable) and v50 (Testing)

Post by Jaume »

Good afternoon!

Version 50 is out. There are some changes placing stations, now destination station can be linked to two industries, when dual cargo routes. And some faster functions placing passinglanes too. This version is Testing, I don't has too time to test it too much. You can download this latest version from first post.

v50:
Link two industries to destination rail station, if it is possible (of course, with dual cargo routes).
Better and faster placing stations and passing lane functions.
Fixed bad direction of passing lanes in two destination rail lines.
Don't send dual cargo trains to depot (because are too old, or to attach more wagons) if isn't empty.

Please, write here if you found a bug!
Jaume
Engineer
Engineer
Posts: 68
Joined: 24 Aug 2007 15:43

Re: SuperSimpleAI v25 (Old Stable), v50 (Stable) and v51 (Testing)

Post by Jaume »

Happy new year! Four years since SuperSimpleAI was published... :D

Version 51 is available from download in first post.

v51:
Added single passing station for some dual cargo routes.
Shorter stations for non-primary industries.
Less CPU consuming in Load() and Save() functions.
Jaume
Engineer
Engineer
Posts: 68
Joined: 24 Aug 2007 15:43

Re: [AI] SuperSimpleAI v25 (Old Stable), v50 (Stable) and v52 (Testing)

Post by Jaume »

New version 52 is available to download in the first post.

v52:
Fixed crash when saving a game while it's replacing airports.
When building dual cargo routes, don't remove the route if only closes one of two of destination industries, but transform it to single cargo route.
Jaume
Engineer
Engineer
Posts: 68
Joined: 24 Aug 2007 15:43

Re: [AI] SuperSimpleAI v25 (Old Stable), v50 (Stable) and v53 (Testing)

Post by Jaume »

Yep! Version 53 is out!

Finally, SuperSimpleAI can build thousands of routes without crashes when saving the game. I tested it with 5000 aircrafts, 1600 trains and 4300 road vehicles! Over 2500 routes :-)

v53:
Changed the limit of maximum routes to 3600.
Some issues fixed and some tunning in Manager functions.
Fixed some air issues.
Renew vehicles even if the limit is reached.
Check for vehicles with wrong number of orders.

Enjoy it!
Jaume
Engineer
Engineer
Posts: 68
Joined: 24 Aug 2007 15:43

Re: [AI] SuperSimpleAI v25 (Old Stable), v50 (Stable) and v54 (Testing)

Post by Jaume »

Another testing version is out!

v54:
Now is possible to load games from version 25 or older without crash (poorly tested).
Don't build new routes if we have already reached the aircraft/road vehicle/train limit.

With this version we can load old games, with a SuperSimpleAI from BaNaNaS. I tested it with an old game with version 22 of this AI. If you found a crash loading old games, please write me.

Enjoy!
xarick
Transport Coordinator
Transport Coordinator
Posts: 351
Joined: 26 Feb 2015 00:52

Re: [AI] SuperSimpleAI v25 (Old Stable), v50 (Stable) and v54 (Testing)

Post by xarick »

Got a crash.
I'm using a custom openttd build, but the savegame should be loadable on the latest openttd nightly versions from 20250328 and up.
These are the parameters I used on the 15 AIs:

Code: Select all

SuperSimpleAI = aircraft_style=0,build_statue=1,close_unprofitable_routes=1,electrify_old=0,fast_rail_pf=1,max_pass_train_length=0,max_transported=10,min_pass_train_length=0,min_train_length=0,rename_airports=1,rename_stations=1,road_line_type=0,slowdown=0,subsidy_chance=0,train_length=0,train_line_type=0,train_pass_line_type=1,use_aircraft=1,use_localbuses=1,use_regionalbuses=1,use_roadvehs=1,use_trains=1,use_trucks=1,waiting_time=0
SuperSimpleAI = aircraft_style=1,build_statue=1,close_unprofitable_routes=1,electrify_old=1,fast_rail_pf=1,max_pass_train_length=1,max_transported=10,min_pass_train_length=1,min_train_length=1,rename_airports=1,rename_stations=1,road_line_type=1,slowdown=0,subsidy_chance=0,train_length=1,train_line_type=1,train_pass_line_type=2,use_aircraft=1,use_localbuses=1,use_regionalbuses=1,use_roadvehs=1,use_trains=1,use_trucks=1,waiting_time=0
SuperSimpleAI = aircraft_style=2,build_statue=1,close_unprofitable_routes=1,electrify_old=0,fast_rail_pf=1,max_pass_train_length=2,max_transported=10,min_pass_train_length=2,min_train_length=2,rename_airports=1,rename_stations=1,road_line_type=2,slowdown=0,subsidy_chance=0,train_length=2,train_line_type=2,train_pass_line_type=3,use_aircraft=1,use_localbuses=1,use_regionalbuses=1,use_roadvehs=1,use_trains=1,use_trucks=1,waiting_time=0
SuperSimpleAI = aircraft_style=3,build_statue=1,close_unprofitable_routes=1,electrify_old=0,fast_rail_pf=1,max_pass_train_length=3,max_transported=10,min_pass_train_length=2,min_train_length=3,rename_airports=1,rename_stations=1,road_line_type=3,slowdown=0,subsidy_chance=0,train_length=3,train_line_type=3,train_pass_line_type=4,use_aircraft=1,use_localbuses=1,use_regionalbuses=1,use_roadvehs=1,use_trains=1,use_trucks=1,waiting_time=0
SuperSimpleAI = aircraft_style=3,build_statue=1,close_unprofitable_routes=1,electrify_old=0,fast_rail_pf=1,max_pass_train_length=3,max_transported=10,min_pass_train_length=2,min_train_length=4,rename_airports=1,rename_stations=1,road_line_type=4,slowdown=0,subsidy_chance=0,train_length=4,train_line_type=5,train_pass_line_type=5,use_aircraft=1,use_localbuses=1,use_regionalbuses=1,use_roadvehs=1,use_trains=1,use_trucks=1,waiting_time=0
SuperSimpleAI = aircraft_style=3,build_statue=1,close_unprofitable_routes=1,electrify_old=0,fast_rail_pf=1,max_pass_train_length=3,max_transported=10,min_pass_train_length=2,min_train_length=5,rename_airports=1,rename_stations=1,road_line_type=4,slowdown=0,subsidy_chance=0,train_length=5,train_line_type=6,train_pass_line_type=6,use_aircraft=1,use_localbuses=1,use_regionalbuses=1,use_roadvehs=1,use_trains=1,use_trucks=1,waiting_time=0
SuperSimpleAI = aircraft_style=3,build_statue=1,close_unprofitable_routes=1,electrify_old=0,fast_rail_pf=1,max_pass_train_length=3,max_transported=10,min_pass_train_length=2,min_train_length=6,rename_airports=1,rename_stations=1,road_line_type=4,slowdown=0,subsidy_chance=0,train_length=6,train_line_type=7,train_pass_line_type=7,use_aircraft=1,use_localbuses=1,use_regionalbuses=1,use_roadvehs=1,use_trains=1,use_trucks=1,waiting_time=0
SuperSimpleAI = aircraft_style=3,build_statue=1,close_unprofitable_routes=1,electrify_old=0,fast_rail_pf=1,max_pass_train_length=3,max_transported=10,min_pass_train_length=2,min_train_length=7,rename_airports=1,rename_stations=1,road_line_type=4,slowdown=0,subsidy_chance=0,train_length=7,train_line_type=7,train_pass_line_type=7,use_aircraft=1,use_localbuses=1,use_regionalbuses=1,use_roadvehs=1,use_trains=1,use_trucks=1,waiting_time=0
SuperSimpleAI = aircraft_style=3,build_statue=1,close_unprofitable_routes=1,electrify_old=0,fast_rail_pf=1,max_pass_train_length=3,max_transported=10,min_pass_train_length=2,min_train_length=8,rename_airports=1,rename_stations=1,road_line_type=4,slowdown=0,subsidy_chance=0,train_length=8,train_line_type=7,train_pass_line_type=7,use_aircraft=1,use_localbuses=1,use_regionalbuses=1,use_roadvehs=1,use_trains=1,use_trucks=1,waiting_time=0
SuperSimpleAI = aircraft_style=3,build_statue=1,close_unprofitable_routes=1,electrify_old=0,fast_rail_pf=1,max_pass_train_length=3,max_transported=10,min_pass_train_length=2,min_train_length=9,rename_airports=1,rename_stations=1,road_line_type=4,slowdown=0,subsidy_chance=0,train_length=9,train_line_type=7,train_pass_line_type=7,use_aircraft=1,use_localbuses=1,use_regionalbuses=1,use_roadvehs=1,use_trains=1,use_trucks=1,waiting_time=0
SuperSimpleAI = aircraft_style=3,build_statue=1,close_unprofitable_routes=1,electrify_old=0,fast_rail_pf=1,max_pass_train_length=3,max_transported=10,min_pass_train_length=2,min_train_length=10,rename_airports=1,rename_stations=1,road_line_type=4,slowdown=0,subsidy_chance=0,train_length=10,train_line_type=7,train_pass_line_type=7,use_aircraft=1,use_localbuses=1,use_regionalbuses=1,use_roadvehs=1,use_trains=1,use_trucks=1,waiting_time=0
SuperSimpleAI = aircraft_style=3,build_statue=1,close_unprofitable_routes=1,electrify_old=0,fast_rail_pf=1,max_pass_train_length=3,max_transported=10,min_pass_train_length=2,min_train_length=10,rename_airports=1,rename_stations=1,road_line_type=4,slowdown=0,subsidy_chance=0,train_length=11,train_line_type=7,train_pass_line_type=7,use_aircraft=1,use_localbuses=1,use_regionalbuses=1,use_roadvehs=1,use_trains=1,use_trucks=1,waiting_time=0
SuperSimpleAI = aircraft_style=3,build_statue=1,close_unprofitable_routes=1,electrify_old=0,fast_rail_pf=1,max_pass_train_length=3,max_transported=10,min_pass_train_length=2,min_train_length=10,rename_airports=1,rename_stations=1,road_line_type=4,slowdown=0,subsidy_chance=0,train_length=12,train_line_type=7,train_pass_line_type=7,use_aircraft=1,use_localbuses=1,use_regionalbuses=1,use_roadvehs=1,use_trains=1,use_trucks=1,waiting_time=0
SuperSimpleAI = aircraft_style=3,build_statue=1,close_unprofitable_routes=1,electrify_old=0,fast_rail_pf=1,max_pass_train_length=3,max_transported=10,min_pass_train_length=2,min_train_length=10,rename_airports=1,rename_stations=1,road_line_type=4,slowdown=0,subsidy_chance=0,train_length=13,train_line_type=7,train_pass_line_type=7,use_aircraft=1,use_localbuses=1,use_regionalbuses=1,use_roadvehs=1,use_trains=1,use_trucks=1,waiting_time=0
SuperSimpleAI = aircraft_style=3,build_statue=1,close_unprofitable_routes=1,electrify_old=0,fast_rail_pf=1,max_pass_train_length=3,max_transported=10,min_pass_train_length=2,min_train_length=10,rename_airports=1,rename_stations=1,road_line_type=4,slowdown=0,subsidy_chance=0,train_length=14,train_line_type=7,train_pass_line_type=7,use_aircraft=1,use_localbuses=1,use_regionalbuses=1,use_roadvehs=1,use_trains=1,use_trucks=1,waiting_time=0
Attachments
screenshot#73.png
(123.34 KiB) Not downloaded yet
Choice Enterprises, 1950-10-04.sav
(21.96 MiB) Downloaded 31 times
Formerly known as Samu
xarick
Transport Coordinator
Transport Coordinator
Posts: 351
Joined: 26 Feb 2015 00:52

Re: [AI] SuperSimpleAI v25 (Old Stable), v50 (Stable) and v54 (Testing)

Post by xarick »

I have another crash. Savegame is too large for the forum. I uploaded here: https://1drv.ms/u/c/23b29f3de45f6f1f/Ee ... g?e=ewswcm
Attachments
screenshot#75.png
(141.34 KiB) Not downloaded yet
screenshot#74.png
(113.1 KiB) Not downloaded yet
Formerly known as Samu
Jaume
Engineer
Engineer
Posts: 68
Joined: 24 Aug 2007 15:43

Re: [AI] SuperSimpleAI v25 (Old Stable), v50 (Stable) and v55 (Testing)

Post by Jaume »

Thank you so much xarick!

Version 55 prevents this crashes, but I don't know why some variables has null value into this functions.
Jaume
Engineer
Engineer
Posts: 68
Joined: 24 Aug 2007 15:43

Re: [AI] SuperSimpleAI v55 (Stable) and v56 (Testing)

Post by Jaume »

Hi all!

There is a new release with some new features and bugfixes:

v56:
Check events while electrifying or removing a rail line.
Check events and routes while searching a place to build a rail station.
Don't electrify or remove rail lines if we are building a route, this will put wrong data in saved games.
Fixed missing extra destination industry in saved data.
Show route's last year profit (only Cargo trains and trucks, and when "Close unprofiteable industries" setting is on).
Fixed bad size of passenger trains.
Don't flood the console with the "We have reached the aircraft/road vehicle/trains limit" warning.
Prevent Manager to spend too much time checking routes witout using some time building something.
Renamed settings.nut file to aisettings.nut.
Renamed manager.nut file to cmanager.nut, ans some function improvements.
Moved all cBuilder files to new "cbuilder" directory.
Prevent to use unnecessary depots while pathfinding from or to fake passinglanes.
Transform dual cargo lines to single cargo line if the industry near passing station closes.

Since Stable version can load games started with BaNaNaS version of SuperSimpleAI, OldStable version is no longer available.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests