how can i write a AI for TA3D

Everything related to the code /
Tout ce qui touche au code
Post Reply
xpoy
Posts: 669
Joined: Mon Sep 22, 2008 3:55 am

how can i write a AI for TA3D

Post by xpoy » Fri Jan 23, 2009 1:00 pm

look like title,i want write a AI better than me
infact i want write all my want to AI,how to do that?

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Fri Jan 23, 2009 8:31 pm

Currently, AI is a weight system, very TA-ish thing, and AI API is very poor. The only way to implement an AI at the moment is to add it into the AI module directly in C++, linked against the TA3D binary.

It's planned to add a Lua interface for AI in order to allow easy implementation of various AI and to achieve high portability (scripts are much more portable than plugins). Also since scripts are monitored by the engine, they can be given a CPU quota in order to prevent scripts to slow down things too much. So I believe scripts is the way to go, but for now the Lua interface is TODO work.

So we're listening to you, what would you like to have in the Lua interface ?
=>;-D Penguin Powered

User avatar
Maximum
Posts: 41
Joined: Wed Sep 24, 2008 5:06 pm

Post by Maximum » Fri Jan 23, 2009 11:49 pm

Would it be possible to have it reference the default.txt file in the AI directory like TA does for the weights?

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Sat Jan 24, 2009 1:05 am

the weight system is slightly different, TA3D uses dynamic weights whose evolution is based on several rules (written directly in the code). So this may not be easy to interface with TA static weights (I don't even know exactly how TA system works which makes the thing even harder).

The easiest way to do that would be to use the future Lua interface (we can imagine using the weight system evolving based on rules coded in Lua).

Also, I planned to add several algorithms in the Lua interface that could be useful for AI such as g/kmeans which could be used to identify the different bases/armies of a player and act accordingly :)
=>;-D Penguin Powered

User avatar
Maximum
Posts: 41
Joined: Wed Sep 24, 2008 5:06 pm

Post by Maximum » Sat Jan 24, 2009 4:17 am

Sounds great.

Although Supreme Commander was kind of short lived its LUA AI was pretty neat to mess around with and some pretty good ones did arise.

xpoy
Posts: 669
Joined: Mon Sep 22, 2008 3:55 am

Post by xpoy » Sat Jan 24, 2009 2:48 pm

i can write in C,but not c++,even i can write in ASM but my C++/luo is really poor,may it troublework ?

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Sat Jan 24, 2009 3:45 pm

Lua API is C, so you can perfectly hack this part of the code :) (AI API is nearly C code), also there are several examples of programs using Lua (Lua itself comes with examples).

Also I've made a small project using Lua (in order to understand better the way it works), it contains some useful functions (like functions to use Vector3D objects like native Lua variables). We could use the Lua code loader from this project since it's much better than the one in TA3D script code (and design is thread friendly)
=>;-D Penguin Powered

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests