Topic: LLM-backed AIs
carli2
Topic Opener |
Posted at:
2026-02-14, 21:40 UTC+1.0
Hi, I have some experience with local running LLMs. I would like to try a LLM-based widelands AI that gets an overview of all player stats as well as possible actions (e.g. build building X) I worked on previous patches which improved AI capabilities in Widelands but they are all hardcoded algorithms to make decisions. What is missing was a fine-tuning of the weights. Such an AI could also use the chat to tease the enemy What are your ideas?
Top
Quote
|
tothxa
|
Posted at:
2026-02-14, 22:32 UTC+1.0
We should certainly consider creating a fully neural network based AI player if we can. FTR the current AI also uses a very small neural net, but that requires way too much handholding from specialised code. I'm less keen on human language LLM in the chat, both because I'm afraid that it would increase the hardware requirements too much, and because I doubt we can find one with clean, legally obtained training data with cleanly GPL compatible licence. In multiple languages.
Edited:
2026-02-14, 22:47 UTC+1.0
Top
Quote
|
carli2
Topic Opener |
Posted at:
2026-02-15, 00:01 UTC+1.0
My favourite would be to register AI players as separate network clients, so they can run on suitable hardware.
Top
Quote
|
|
Nordfriese |
Posted at:
2026-02-15, 10:43 UTC+1.0
I also think that going all-in on machine learning for the computer players would be great to have. However even the current state involved lots of effort on the code side and lots and lots of contributor time to oversee the human-guided training sessions. We'd have to come up with a concept for a fully autonomous self-supervised AI training mode, in addition to the actual major changes to the 14000+ lines of existing AI code. So an absolutely worthwhile thing in my opinion, but which will also require enormous effort. -1 for making AIs network clients, because we absolutely don't want to force players to connect to some server to play Widelands. Playing offline must never be penalised compared to playing online.
Top
Quote
|
carli2
Topic Opener |
Posted at:
2026-02-15, 14:52 UTC+1.0
So to keep my effort in comparison to merge chances balanced: What's the desired/mergeable way to do it? a) network-AIs (if someone dosen't want to use it, he would just not pick it!, requires either a local AI or a cloud server to connect to) with minimal engine code b) internal pytorch- or tensorflow based fully local implementation on GPU base (runs locally, can train from replays) - both libraries have C++ bindings for executing the model. The training would be based on python code. I would keep the "normal AI" as-is and introduce 1-2 new modes (a and b)
Edited:
2026-02-15, 14:52 UTC+1.0
Top
Quote
|
|
Nordfriese |
Posted at:
2026-02-15, 15:55 UTC+1.0
Just my thoughts: If we use a local AI for Widelands, we would/should not need a very large model. I.e. we could use a small model that can run in realtime on a typical CPU with a runtime performance not worse than the current computer players. That way we would be able to provide this locally to every user without raising our (currently very lenient) hardware requirements1, which is the best possible outcome. We could use pytorch or tensorflow as they also support CPU-based inference2. We'll probably need to train a model from scratch just for Widelands though, unless there's a guaranteed-ethical pretrained model that would fit for our use-case. If this works out, then in the long run it might ideally replace the existing computer players. Our computer player interface is modular so it is trivial to add new modes alongside the existing ones. The real work Widelands-side would be to define and provide an interface that the ML model can use: It will at least need to be able to query game state (map fields, map objects and their details, player statistics, global statistics, …), and have interfaces to send each type of player command, and should be automatically extensible so it won't panic when new features are added or the internal command syntax is changed.
Top
Quote
|
carli2
Topic Opener |
Posted at:
2026-02-16, 01:47 UTC+1.0
In the moment, I am working on a "correct" AI algorithm and dropped the LLM idea for now. The idea: Priority inheritence! Capabilities of the new AI mode ("Planning AI"):
Edited:
2026-02-16, 01:48 UTC+1.0
1
Top
Quote
|


