For my master thesis I'm working on using a technique called dynamic scripting to create an AI capable of playing openttd. Part of the technique is generating AI's and then testing how well they perform against others. To do this I need to run (a lot) of games with just AI players and at as high a speed as possible. Preferably I would be able to use another program that I'll write myself to start openttd and load all the generated AI's and store the gamestate in some way at the end. I was wondering if people here could give me some tips on how to do that.
I've looked around at the documentation and I saw that you can start the game from the command line, is there any way to start a game with several AI's purely from the command line? I saw that this was possible for a dedicated server, but you can't increase the game speed on those, right? And is it possible for gamescripts or AI's to write to files?
Using machinelearning to build an AI question
Moderator: OpenTTD Developers
Re: Using machinelearning to build an AI question
Have a look at the scripts in the scripts folder of an OpenTTD installation. These are not Game Scripts, but an older type of scripts. The name of each script indicate when it run. Inside the script you can put the same commands as you can execute in the in-game console.Arag wrote:I've looked around at the documentation and I saw that you can start the game from the command line, is there any way to start a game with several AI's purely from the command line?
One of these scripts isgame_start.scr. Try insert "start_ai MyAI" in there for the number of rows that you need. It is also possible to assign AI parameters as additional arguments to the start_ai command. My best guess is that if you have an AI parameter that in info.nut is named "my_parameter", then you will pass it as
Code: Select all
start_ai MyAI my_parameter=1
No, not by default. However if OpenTTD run in Linux or if you convert the Windows version to a console program, you can pipe the debug output to a file. If you know some C++ and compile OpenTTD yourself, it is possible to do additional things only limited by the effort you want to spend.Arag wrote:And is it possible for gamescripts or AI's to write to files?
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
-
- Engineer
- Posts: 113
- Joined: 08 Aug 2008 11:35
- Contact:
Re: Using machinelearning to build an AI question
Hi Arag,
I'm a researcher at the Delft University of Technology from the parallel and distributed systems group. Within that group we have a group that focusses on gaming and one of the games we do research with is actually OpenTTD. Our (heavily adapted) version of OpenTTD runs a 10 year game with 15 AIs in roughly 3.5 minute (on my normal desktop machine; we use our DAS-4 supercomputer for running many tests in parallel) and then automatically generates a bunch of graphs. See below for an example:
(The fact that I show a picture in which my own AI has the highest score is purely accidental of course
)
If you happen to live in the Netherlands: come and visit our group and we'll help you get started
If not: drop me an e-mail and we'll go from there. I think I should be able to isolate the parts from our tree that would help you and make a patch out of that. We have made changes for launching games with a selection of AI's directly from the command-line and we have chances (mostly an adapted video driver) to make it run as fast as possible.
I'm a researcher at the Delft University of Technology from the parallel and distributed systems group. Within that group we have a group that focusses on gaming and one of the games we do research with is actually OpenTTD. Our (heavily adapted) version of OpenTTD runs a 10 year game with 15 AIs in roughly 3.5 minute (on my normal desktop machine; we use our DAS-4 supercomputer for running many tests in parallel) and then automatically generates a bunch of graphs. See below for an example:
(The fact that I show a picture in which my own AI has the highest score is purely accidental of course

If you happen to live in the Netherlands: come and visit our group and we'll help you get started

Re: Using machinelearning to build an AI question
Thanks for your replies Zuu and Maninthebox! I think I should be able to go from here.
Re: Using machinelearning to build an AI question
Hi.
You could use the -c flag to load game settings from a config-file. You can start openttd the normal way and set the game settings and the competitors you want. Then you quit the game so the settings are getting written to the config file. Then you better copy it, so you don't change it accidentially.
In Linux you find the default config file in "/homedirectory/.openttd/openttd.cfg".
You could use the -c flag to load game settings from a config-file. You can start openttd the normal way and set the game settings and the competitors you want. Then you quit the game so the settings are getting written to the config file. Then you better copy it, so you don't change it accidentially.
In Linux you find the default config file in "/homedirectory/.openttd/openttd.cfg".
Who is online
Users browsing this forum: Google [Bot] and 7 guests