What is TexAI? How do I play with it?

Do you want to help out with Freeciv development? Then check out this forum.
Sanguivorant
Posts: 31
Joined: Mon Apr 25, 2022 12:54 am

What is TexAI? How do I play with it?

Post by Sanguivorant »

I have been reading the AI documentation and I'm wondering if this is a separate AI that you can play with versus "classic" AI. If so, how can I play against it? I have tried to use the command /create "AI" "tex", but it tells me that there is no AI type of that name.

There is also a section in the documentation that says that the game supports "AI Modules", in the sense that you can create your own AI script and somehow load it into the game for testing. Is freeciv normally installed with dynamic modules support enabled?
cazfi
Elite
Posts: 3447
Joined: Tue Jan 29, 2013 6:54 pm

Re: What is TexAI? How do I play with it?

Post by cazfi »

Sanguivorant wrote: Sun Dec 28, 2025 4:23 pm I have tried to use the command /create "AI" "tex", but it tells me that there is no AI type of that name.
Sounds like your freeciv has not been built with tex enabled. It should be enabled by default, though. At least in recent freeciv versions. What is your freeciv version?
Sanguivorant wrote: Sun Dec 28, 2025 4:23 pmThere is also a section in the documentation that says that the game supports "AI Modules", in the sense that you can create your own AI script and somehow load it into the game for testing. Is freeciv normally installed with dynamic modules support enabled?
It's not a "script" support, but a dynamic module (quite similar to a shared/dynamic library) which you would typically implement in C. Implementing your own AI module would be a major undertaking.
Meson based build system does not yet support building dynamic modules support at all. In autotools based build system it's not enabled by default (in the ~15 years that we've had this dynamic modules support, nobody has shown interest in creating a single module)
Sanguivorant
Posts: 31
Joined: Mon Apr 25, 2022 12:54 am

Re: What is TexAI? How do I play with it?

Post by Sanguivorant »

cazfi wrote: Sun Dec 28, 2025 6:34 pm
Sanguivorant wrote: Sun Dec 28, 2025 4:23 pm I have tried to use the command /create "AI" "tex", but it tells me that there is no AI type of that name.
Sounds like your freeciv has not been built with tex enabled. It should be enabled by default, though. At least in recent freeciv versions. What is your freeciv version?
Sanguivorant wrote: Sun Dec 28, 2025 4:23 pmThere is also a section in the documentation that says that the game supports "AI Modules", in the sense that you can create your own AI script and somehow load it into the game for testing. Is freeciv normally installed with dynamic modules support enabled?
It's not a "script" support, but a dynamic module (quite similar to a shared/dynamic library) which you would typically implement in C. Implementing your own AI module would be a major undertaking.
Meson based build system does not yet support building dynamic modules support at all. In autotools based build system it's not enabled by default (in the ~15 years that we've had this dynamic modules support, nobody has shown interest in creating a single module)
I built it from source, however, it is not Freeciv, but freeciv21, a different launcher So maybe in the configuration I forgot to support it. I will building it from source on the latest version and see if I can play with Tex.

When you say dynamic module, does this mean that I would have to rebuild my game to get these AI scripts to show if I were to make one?


Edit: So I built from source the latest version and tex does work. What makes it different exactly? Does it do air combat?
cazfi
Elite
Posts: 3447
Joined: Tue Jan 29, 2013 6:54 pm

Re: What is TexAI? How do I play with it?

Post by cazfi »

Sanguivorant wrote: Sun Dec 28, 2025 7:47 pm
cazfi wrote: Sun Dec 28, 2025 6:34 pm
Sanguivorant wrote: Sun Dec 28, 2025 4:23 pmThere is also a section in the documentation that says that the game supports "AI Modules", in the sense that you can create your own AI script and somehow load it into the game for testing. Is freeciv normally installed with dynamic modules support enabled?
It's not a "script" support, but a dynamic module (quite similar to a shared/dynamic library) which you would typically implement in C. Implementing your own AI module would be a major undertaking.
Meson based build system does not yet support building dynamic modules support at all. In autotools based build system it's not enabled by default (in the ~15 years that we've had this dynamic modules support, nobody has shown interest in creating a single module)
When you say dynamic module, does this mean that I would have to rebuild my game to get these AI scripts to show if I were to make one?
It's dynamic in the sense that it's not statically compiled in to freeciv, but freeciv is able to dynamically load it. So, using a dynamic module does not require rebuilding freeciv as long as it has originally been built with dynamic modules support.
Dino the Dinosore
Hardened
Posts: 215
Joined: Sun Dec 31, 2017 3:41 am

Re: What is TexAI? How do I play with it?

Post by Dino the Dinosore »

Is it possible to set some players to one aitype and others to a different one? This script of server commands seems to do that -
hard
set aifill 5
set aitype tex
hard
set aifill 9
The "set aitype tex" seems to reset the difficulty level back to the default "easy".
cazfi
Elite
Posts: 3447
Joined: Tue Jan 29, 2013 6:54 pm

Re: What is TexAI? How do I play with it?

Post by cazfi »

Dino the Dinosore wrote: Mon Dec 29, 2025 1:21 amIs it possible to set some players to one aitype and others to a different one?
Yes. The typical case is that wanted number of tex players is created with the "/create <name> tex" -commands, and rest up to "aifill" players get the default AI type (classic).
Dino the Dinosore
Hardened
Posts: 215
Joined: Sun Dec 31, 2017 3:41 am

Re: What is TexAI? How do I play with it?

Post by Dino the Dinosore »

Now I'd like to see 2 aitypes compete to see which is better. Is it possible to set up a game similar to my example server script, with no human player and run it and see the end game screen?
cazfi
Elite
Posts: 3447
Joined: Tue Jan 29, 2013 6:54 pm

Re: What is TexAI? How do I play with it?

Post by cazfi »

Dino the Dinosore wrote: Wed Dec 31, 2025 4:11 am Now I'd like to see 2 aitypes compete to see which is better. Is it possible to set up a game similar to my example server script, with no human player and run it and see the end game screen?
Since the point of tex (originally "t)hreaded ex)perimental") is that it tries to reduce turn-change time by doing some calculations during the turn, be sure not to use timeout of -1 like in traditional autogames. Instead set it to a couple of seconds. Otherwise tex won't have opportunity to do its calculations.

Otherwise classic and tex are almost identical. They both use "default AI" code.
Sanguivorant
Posts: 31
Joined: Mon Apr 25, 2022 12:54 am

Re: What is TexAI? How do I play with it?

Post by Sanguivorant »

Dino the Dinosore wrote: Wed Dec 31, 2025 4:11 am Now I'd like to see 2 aitypes compete to see which is better. Is it possible to set up a game similar to my example server script, with no human player and run it and see the end game screen?
If you look at the code itself, texAI pretty much uses classicAI scripts for deciding what to build, how to move, what to research, how to fight, etc.

Only way to change behaviour is to change the code, or at least how wants are calculated.
Dino the Dinosore
Hardened
Posts: 215
Joined: Sun Dec 31, 2017 3:41 am

Re: What is TexAI? How do I play with it?

Post by Dino the Dinosore »

I've never run an autogame - how do you do that? Or is there anything on the wiki that explains it?

This functionality would be quite useful if I ever get up the nerve to try and improve the ai code.
Post Reply