Topic: AI as a scipt
Ron_of_Nord Topic Opener |
Posted at: 2025-01-18, 04:10
Hi Folks, I read a few posts on the AI and got to wondering wether the inbuilt scripting could handle or improve the current AI, I don't have a constant fast internet connection, I use a dongle, so trying to read through the Lua scripting pages gets a bit frustrating when the connection drops out. Is there a plain text version of the Widelands Lua scripting interface I can get my hands on. I have a love og game AI and some ideas on that front, but I really need either a plain text or pdf version of the inteface to have a look at while I'm testing my ideas. Also, is the sciprt compiled or interpreted, I couldn't figure it out from the source code this morning when the AI idea's I had first blossomed in my mind. After creating my own game AI language ( which is a script language) , I thought maybe I could try rewritting parts of it as a Lua script in widelands. My own AI language is written in Forth with a prolog extention. I don't know the widelands lua interface well enough to attempt anything but some simple code at the moment. The aussies are coming, ya ho! ya ho! Top Quote |
Nordfriese |
Posted at: 2025-01-18, 10:17
You can download the latest documentation as a ZIP archive of HTML files here: I once tried to script an AI for a scenario, but I gave that up because the main problem with Lua is that is is extremely slow compared to C++. Everything in Lua is interpreted at runtime. To get acceptable performance I believe you'd need to compile your code into the Widelands executable, using C++ or some other language that can interface with C++ headers. Top Quote |
hessenfarmer |
Posted at: 2025-01-18, 20:03
Currently there is no direct lua api to influence or control the AI. Our lua interface was originally invented to control the storyline of a scenario. The AI is only influenced by the tribe defin ition files where some vital information is stored that the AI uses to have better knowledge of a tribe. In the c++ functions there are several decision steps implemented which are run according to a scheduler: each of this functions is influenced by a a simple implementation of a genetic algorithm, which mainly influences the weights of game state parameters in decision finding algorithms. Top Quote |
Ron_of_Nord Topic Opener |
Posted at: Yesterday 22:34
Thanks for the information, I've downloaded the latest source so I'll take a look at it as soon as I get the chance The aussies are coming, ya ho! ya ho! Top Quote |
Ron_of_Nord Topic Opener |
Posted at: Yesterday 23:02
thanks also for the link to the lua documentation, I'll have a read through it sometime tonight, even though it's interpreted it may give me some insights along with the widelands source code itself. The local copy will surely help with the scenario/ campaign I'm working on. As to the AI, there isni't much I would change, just a few small things that the AI does that I wonder why. I'll have a look... The aussies are coming, ya ho! ya ho! Top Quote |