Author Topic: Scripted AI players  (Read 2180 times)

0 Members and 1 Guest are viewing this topic.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4205
  • Total likes: 161
  • Helpful: 148
  • Languages: EN, DE, AT
Scripted AI players
« 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.
« Last Edit: September 07, 2015, 04:08:45 PM by Dwachs »
Parsley, sage, rosemary, and maggikraut.

Offline TurfIt

Re: Scripted AI players
« Reply #1 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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8725
  • Total likes: 304
  • Helpful: 229
  • Languages: De,EN,JP
Re: Scripted AI players
« Reply #2 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.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4205
  • Total likes: 161
  • Helpful: 148
  • Languages: EN, DE, AT
Re: Scripted AI players
« Reply #3 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.
Parsley, sage, rosemary, and maggikraut.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4205
  • Total likes: 161
  • Helpful: 148
  • Languages: EN, DE, AT
Re: Scripted AI players
« Reply #4 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.
Parsley, sage, rosemary, and maggikraut.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8725
  • Total likes: 304
  • Helpful: 229
  • Languages: De,EN,JP
Re: Scripted AI players
« Reply #5 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?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4205
  • Total likes: 161
  • Helpful: 148
  • Languages: EN, DE, AT
Re: Scripted AI players
« Reply #6 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
Parsley, sage, rosemary, and maggikraut.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8725
  • Total likes: 304
  • Helpful: 229
  • Languages: De,EN,JP
Re: Scripted AI players
« Reply #7 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.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4205
  • Total likes: 161
  • Helpful: 148
  • Languages: EN, DE, AT
Re: Scripted AI players
« Reply #8 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?
Parsley, sage, rosemary, and maggikraut.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8725
  • Total likes: 304
  • Helpful: 229
  • Languages: De,EN,JP
Re: Scripted AI players
« Reply #9 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 ...
« Last Edit: October 08, 2016, 05:14:09 PM by prissi »