The International Simutrans Forum

Development => Scripting Scenarios and AI => Topic started by: Dwachs on September 07, 2015, 03:51:54 PM

Title: Scripted AI players
Post by: Dwachs on September 07, 2015, 03:51:54 PM
Here is a patch to enable scripted AI players. The patch is against r7582.

There is also an example AI in sqai.zip. You have to put this in the program directory (or under addons/)

Enjoy! any feedback appreciated.

Attached files:
-- sqai.zip - the test AI
-- scripted-ai.zip - the patch
-- Windows GDI executable can be downloaded here: http://simutrans-germany.com/files/upload/sim-wingdi.zip

To start an AI player: open player list window, select 'Scripted AIs', activate player, click 'Load Scripted AI', then select the AI to play.

This is work in progress. No load & save support.
Title: Re: Scripted AI players
Post by: TurfIt on September 07, 2015, 06:21:10 PM
Someone needs to teach your AI the concept of 'net wealth'.  Of course doesn't matter much since they just keep on playing when bankrupt.  ;D

The title of the AI Selector dialog is strangely corrupted - first two characters... They keep changing, and sometimes only those first two are shown.
Title: Re: Scripted AI players
Post by: prissi on September 07, 2015, 08:10:40 PM
Yeah, great addition! Thank you so much, that will be really useful. Let's put it into the nightlies.
Title: Re: Scripted AI players
Post by: Dwachs on November 14, 2015, 03:00:36 PM
Here is an update. Please test.

This file contains windows executable and sample scripted AI player:

http://simutrans-germany.com/files/upload/scripted-ai-wingdi.zip

Patch (apply with -p3) and source of scripted AI player attached.
Title: Re: Scripted AI players
Post by: Dwachs on July 02, 2016, 03:37:42 PM
I did it. Committed all my work on AI players. Please try r7847, when it is compiled by the nightly build site.

Attached is a sample AI player that concentrates on truck transport. Unzip the archive in your simutrans program or user directory.
Title: Re: Scripted AI players
Post by: prissi on October 08, 2016, 02:08:12 PM
That attachment is not there anymore. Is this the file ai_base.nut in the simutrans/script folder?
Title: Re: Scripted AI players
Post by: Dwachs on October 08, 2016, 02:53:57 PM
Here is the file again.  There is also a repository at github:

https://github.com/Dwachs/simutrans-scenarios
Title: Re: Scripted AI players
Post by: prissi on October 08, 2016, 04:41:12 PM
When I try to activate the AI it say load AI in an empty filelist. I unzipped the files into the program directory scrpts/ai/sqai
Upon quitting it crashed.
Title: Re: Scripted AI players
Post by: Dwachs on October 08, 2016, 04:47:03 PM
It must be put into program-directory/ai or addon-directory/ai.

How did you manage to crash the program?
Title: Re: Scripted AI players
Post by: prissi on October 08, 2016, 04:57:13 PM
Activate the AI but do not loading anything. When trying to save it will crash.

Ok, put it into main directory and it works. Thanks.

EDIT: Sollte evt. horses-AI heißen, zumindest im pak64 ...
Title: Re: Scripted AI players
Post by: Dwachs on June 13, 2018, 06:34:03 PM
Here is a new version of my AI players. They will now build combined road and water connections. Please test

Unzip the attached file in the program directory.
Title: Re: Scripted AI players
Post by: NuubNuub on April 21, 2019, 08:05:37 PM
Got an error occured today by your scripted AI, but dont have any clue how to fix it...
Title: Re: Scripted AI players
Post by: Dwachs on April 26, 2019, 02:13:28 PM
Thanks for reporting. Some debug routine failed :/

You can comment out this line (line 325 in roadconnector.nut, starts with label_x.create..)
Title: Re: Scripted AI players
Post by: Andarix on June 14, 2020, 09:43:07 AM
For those interested, here is an extension of the Script AI to find the railroad used.

It is still under development.

Script AI for Rail (https://github.com/Andarix/simutrans-scenarios/tree/master/ai/sqai) for Simutrans r9112+