News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

Scripted AI players

Started by Dwachs, September 07, 2015, 03:51:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dwachs

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.
Parsley, sage, rosemary, and maggikraut.

TurfIt

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.

prissi

Yeah, great addition! Thank you so much, that will be really useful. Let's put it into the nightlies.

Dwachs

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.
Parsley, sage, rosemary, and maggikraut.

Dwachs

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.
Parsley, sage, rosemary, and maggikraut.

prissi

That attachment is not there anymore. Is this the file ai_base.nut in the simutrans/script folder?

Dwachs

Here is the file again.  There is also a repository at github:

https://github.com/Dwachs/simutrans-scenarios
Parsley, sage, rosemary, and maggikraut.

prissi

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.

Dwachs

It must be put into program-directory/ai or addon-directory/ai.

How did you manage to crash the program?
Parsley, sage, rosemary, and maggikraut.

prissi

#9
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 ...

Dwachs

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.
Parsley, sage, rosemary, and maggikraut.

NuubNuub

Got an error occured today by your scripted AI, but dont have any clue how to fix it...

Dwachs

Thanks for reporting. Some debug routine failed :/

You can comment out this line (line 325 in roadconnector.nut, starts with label_x.create..)
Parsley, sage, rosemary, and maggikraut.

Andarix

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 for Simutrans r9112+