File I/O from Squirrel

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

Post Reply
wilco_moerman
Engineer
Engineer
Posts: 70
Joined: 05 Jun 2008 15:51

File I/O from Squirrel

Post by wilco_moerman »

Hi, I am trying to create an AI for the TJIP contest, and I was wondering whether the NOAI framework allows writing to/reading from files? And if so, if someone could give me a short example?
Nunc dimittis servum tuum Domine secundum verbum tuum in pace
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: NoAI Branch - An AI Framework

Post by Yexo »

It doesn't allow that. The only thing you can write text to is de console (and the ingame ai debug panel). You can do that by using AILog.Info/Warning/Error.
wilco_moerman
Engineer
Engineer
Posts: 70
Joined: 05 Jun 2008 15:51

Re: NoAI Branch - An AI Framework

Post by wilco_moerman »

Yexo wrote:It doesn't allow that. The only thing you can write text to is de console (and the ingame ai debug panel). You can do that by using AILog.Info/Warning/Error.
thanks for the reply. I guess I'll just have to use the script mechanism to output the console to a file, and copy-paste from there to my code.

In case you were wondering: I want to tune my AI by learning values for some of the decisions, and it would have been nice if I could just write them to some file and load them when needed.
Nunc dimittis servum tuum Domine secundum verbum tuum in pace
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoAI Branch - An AI Framework

Post by TrueBrain »

wilco_moerman wrote: (..)

OK, any idea when it will apear on http://nightly.openttd.org/noai/scoreboard.php? Because that is still r13442 instead of r13454
Nightlies run every night at 1800 CEST ... and the commits are made after that ;) So check back in ... 10 minutes :p
wilco_moerman wrote:
Thanks for reporting and please keep posting any bugs here or on flyspray. If you want a fast reaction or follow latest development, irc is a good place (#openttd.noai @OFTC).
maybe I'll do that.
Avoid FlySpray, I don't read that :p I hope to have a subforum soon, then this will get a bit more organized ;)
wilco_moerman wrote: I wanted to start a server with restart_game_year = 2007 and starting in 1998 (for the TJIP challenge) and just let it run all night for testing. But if the game crashes after each "newgame" that won't work.

I am trying to implement an AI using a neural network, but networks need a lot of runs to train. That is why I need to start new games and save and load data. The network needs to be stored and loaded between each run. The saving works by using the console to output a script. I'll try to do the loading by modifying the .nut-files automatically using some Java-programming. I'll just get the parts I need from the console-output and substitute them into the .nut-file.

It might be ugly, but as far as I can see it's the only way to transfer information between successive AI's.
It most likely is :) Good luck with using a NN for this problem ... I wonder if it ever leads to anything :) Can't wait to see if it does :)
The only thing necessary for the triumph of evil is for good men to do nothing.
wilco_moerman
Engineer
Engineer
Posts: 70
Joined: 05 Jun 2008 15:51

Re: NoAI Branch - An AI Framework

Post by wilco_moerman »

TrueLight wrote:
wilco_moerman wrote: (..)

OK, any idea when it will apear on http://nightly.openttd.org/noai/scoreboard.php? Because that is still r13442 instead of r13454
Nightlies run every night at 1800 CEST ... and the commits are made after that ;) So check back in ... 10 minutes :p
I'm counting the seconds :)

TrueLight wrote: Avoid FlySpray, I don't read that :p I hope to have a subforum soon, then this will get a bit more organized ;)
yeah I read the topic on that. Seems only logical.

TrueLight wrote: It most likely is :)
at least as long as NOAI doesn't implement any file IO :?
TrueLight wrote: Good luck with using a NN for this problem ... I wonder if it ever leads to anything :) Can't wait to see if it does :)
I'll let you know. I have successfully used a NN together with reinforcement learning for my master's thesis, so I thought I would give it a try.
Nunc dimittis servum tuum Domine secundum verbum tuum in pace
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 15 guests