Anyone know how to make Shard AI work with Conflict Terra?
Moderators: hoijui, Moderators
Anyone know how to make Shard AI work with Conflict Terra?
I installed Shard AI on Linux as AF, the creator of Shard, showed on his "Shard" thread. I then tried playing Conflict Terra against it, but the AI just sat there, and my first scout blasted it's com (commanders have no guns in Conflict Terra), and it didn't do anything. Anyone know how to make Shard work with CT?
Re: Anyone know how to make Shard AI work with Conflict Terra?
Shard only worked with an old version of CT (CT 1.02 or something) which is outdated since a year or so.
I am afraid it was not (yet?) updated to work with some of the new features like the new economics and cruiser morphing:
http://code.google.com/p/conflictterra/ ... ding_an_AI
I am afraid it was not (yet?) updated to work with some of the new features like the new economics and cruiser morphing:
http://code.google.com/p/conflictterra/ ... ding_an_AI
NO AI CURRENTLY WORKS FOR CONFLICT TERRA
Re: Anyone know how to make Shard AI work with Conflict Terra?
yah, it barely works... do you know how I could fix it?
Re: Anyone know how to make Shard AI work with Conflict Terra?
You would need to use the game:SendToContent("message") call in shards lua, and then modify CT so that a gadget responds with the necessary information ( or executes the desired action ).
No modification o the C++ portion of Shard or recompilation should be necessary, and the entire affair can be conducted with a copy of 7zip and a text editor
No modification o the C++ portion of Shard or recompilation should be necessary, and the entire affair can be conducted with a copy of 7zip and a text editor
Re: Anyone know how to make Shard AI work with Conflict Terra?
Thats like saying all you need to build a space shuttle is metal, some wires and a screwdriver...the entire affair can be conducted with a copy of 7zip and a text editor
Not much modifying required, if any at all.modify CT so that a gadget responds with the necessary information ( or executes the desired action ).
(At least I don't remember anybody saying "this needs to be added.", imo CT is ai-playable if somebody bothers to try)
The two main problems to make CT playable by AI
are: 1) morphing cruisers & 2) mining.
1) The morph gadget is already useable by AIs. (at least there is some AICallin() thing and afaik its some custom command which AIs can already send anyway.)
Would need logic as when and where to use cruisers as factories and when to use them as fighting units.
There are some other units that can morph between two forms (ie flak truck) but thats not necessarily needed.
2) Mining is just building miners and then doing nothing or giving them a command once to start mining. (vs sending them back to the rocks when they want to go to the dropoff, like shard/other AIs currently seem to do)
Next stop would be a logic where to mine, where to place new dropoff depots, when to momentary move miners out of the way of attacks etc.
Not so easy imo, surely not as trivial as "make mex on all free spots."
The only other Lua thing are jumpjets but only ~3 units have them.
The drones faction would probally be simpler to make an AI with btw.
tl;dr:
yanom: to avoid confusion...are you even interessted in AI making or do you just want to play?

AF: if anybody was to ever to make shard play ct, it would most likely be you.
Re: Anyone know how to make Shard AI work with Conflict Terra?
People still try to play ct? Hmm.
I'll help out if someone would hold my hand through the process. I'll do just about anything game side to get working AI.
I'll help out if someone would hold my hand through the process. I'll do just about anything game side to get working AI.
Re: Anyone know how to make Shard AI work with Conflict Terra?
from what I can garner from looking at CT, it looks like each faction is very different, so maybe it'd be best to make the AI work on one specific faction first. The Drones seem like the best choice, because they're super simple (and it's somewhat appropriate to have a bot play the robot faction)
Re: Anyone know how to make Shard AI work with Conflict Terra?
now I don't know a bit about AI... but it would be nice to have a working AI for CT. It seems like a great game, and I don't always have time for multiplayer matches.
Re: Anyone know how to make Shard AI work with Conflict Terra?
Here's the crushing news. I don't either..
Need someone to save the day.

Re: Anyone know how to make Shard AI work with Conflict Terra?
MAYBE i can make Shard work with Drone faction. Can you point me in the right direction? Like how to make the starting engineer at first make a land factory or something?
Re: Anyone know how to make Shard AI work with Conflict Terra?
Look to the taskques.lua here is an example:
http://code.google.com/p/conflictterra/ ... queues.lua
Basically something like this:
taskqueues = {
kdroneengineer = {
"kdronestructure",
"kairdronefactory",
{ action="wait",frames=30},
The problem here is getting mining towers to morph near rocks and unmorph when that space runs dry.
http://code.google.com/p/conflictterra/ ... queues.lua
Basically something like this:
taskqueues = {
kdroneengineer = {
"kdronestructure",
"kairdronefactory",
{ action="wait",frames=30},
The problem here is getting mining towers to morph near rocks and unmorph when that space runs dry.
Re: Anyone know how to make Shard AI work with Conflict Terra?
tp_KTAI.lua in CT has a (bad&ugly) function to find the nearest rocks from a unit:oksnoop2 wrote:The problem here is getting mining towers to morph near rocks and unmorph when that space runs dry.
Code: Select all
local resid, tx, ty,tz,distance = nearest_res_from_unit (unitID)
You could check every few seconds if all towers are still in range of rocks and if not then do something like:
Code: Select all
function deployAt (unitID, tx,tz)
Spring.GiveOrderToUnit(unitID, CMD.MOVE , {tx, Spring.GetGroundHeight (tx,tz), tz }, {}) --moves the unit
Spring.GiveOrderToUnit(unitID, 31210,{UnitDefNames["kdroneminingtower"].id},{"shift"}) --deploys
end
Code: Select all
Spring.GiveOrderToUnit(unitID, 31210,{UnitDefNames["kdroneengineer"].id},{})
Re: Anyone know how to make Shard AI work with Conflict Terra?
AF has told me like a million times, but i can't remember. behaviours.lua maybe? AF where would this code be shoe horned into?
Re: Anyone know how to make Shard AI work with Conflict Terra?
You could make the drone faction more ai-agreeable, like remove the mining towers and have engineers just reclaim the rocks (but slow, so that i'd be balanced vs the other faction).oksnoop2 wrote:I'll do just about anything game side to get working AI.
Re: Anyone know how to make Shard AI work with Conflict Terra?
everything in taskqueues.lua is prefixed with a "b", not a "k" as shown here. is the k the drone faction and b the flying cruiser faction (NKG i belive)?oksnoop2 wrote:Look to the taskques.lua here is an example:
http://code.google.com/p/conflictterra/ ... queues.lua
Basically something like this:
taskqueues = {
kdroneengineer = {
"kdronestructure",
"kairdronefactory",
{ action="wait",frames=30},
Re: Anyone know how to make Shard AI work with Conflict Terra?
The mining does not work by reclaim. The rocks are actually neutral units that the miners and towers attck. The k prefix indicates in his case kevin's units which would be drone. Here is a list of the internal unit names used by shard and the engine:
http://code.google.com/p/conflictterra/ ... units?fp=2
http://code.google.com/p/conflictterra/ ... units?fp=2
Re: Anyone know how to make Shard AI work with Conflict Terra?
knorke wrote:Thats like saying all you need to build a space shuttle is metal, some wires and a screwdriver...the entire affair can be conducted with a copy of 7zip and a text editor
Not much modifying required, if any at all.modify CT so that a gadget responds with the necessary information ( or executes the desired action ).
(At least I don't remember anybody saying "this needs to be added.", imo CT is ai-playable if somebody bothers to try)
The two main problems to make CT playable by AI
are: 1) morphing cruisers & 2) mining.
1) The morph gadget is already useable by AIs. (at least there is some AICallin() thing and afaik its some custom command which AIs can already send anyway.)
Would need logic as when and where to use cruisers as factories and when to use them as fighting units.
There are some other units that can morph between two forms (ie flak truck) but thats not necessarily needed.
2) Mining is just building miners and then doing nothing or giving them a command once to start mining. (vs sending them back to the rocks when they want to go to the dropoff, like shard/other AIs currently seem to do)
Next stop would be a logic where to mine, where to place new dropoff depots, when to momentary move miners out of the way of attacks etc.
Not so easy imo, surely not as trivial as "make mex on all free spots."
The only other Lua thing are jumpjets but only ~3 units have them.
The drones faction would probally be simpler to make an AI with btw.
tl;dr:
yanom: to avoid confusion...are you even interessted in AI making or do you just want to play?
AF: if anybody was to ever to make shard play ct, it would most likely be you.
Building Miners and making them do nothing
I have explained on these forums more than once how to do that.
- Make a new behaviour that does absolutely nothing.
- Assign it to the miners
- Tell builders to build miners
- Load game
Your implementation of morphing isnt th eonly one out there, nor does it provide a way of telling the AI if A can morph or not, and if it will morph into B C or D.
But having said that, if one off morphing of a single unit is all that's needed then:
Code: Select all
game:sendtocontent("ok morph that command cruiser now please")
Tools
7Zip is to extract the game files and repackage them. A tetx editor is to modify the lua code.
You do not need anything more, and fi what you have told me about the AI Callin is correct, then you don't even need 7zip.
I'm not going to be able to hold your hand, and while I can help on the Shard side, I don't know the intimate details of your game, and to expect me to is unrealistic. The days of an AI programmer knowing the full scope of the domain is over unless you want hefty specialisation.
It doesn't matter if the AI is C++/Java/lua/Python/Lua widget, game developer involvement is necessary.
What strikes me is that your willing to have a go at me for saying a text editor is all that's needed, when your admitting there's an AICallin that I was not aware of. As far as I knew, I and oksnoop looked into it but he didn't know what to do and I didn't have enough time to investigate myself.
So as the core developer, I am telling you:
- This is not a complicated thing to do
- Shard was designed for this to be easy
- Shards entire goal was to be easy to extend
- Since Shards release I have made this even easier
- Shard itself is small and light, and is probably dwarfed by the code you've written in gadgets
I went to great lengths to make sure that the worst case scenario was my C++ portion failing to compile, and if that happened, it would be very easy to fix as its merely a wrapper, something that any C++ developer here of novice ability could fix easily, and something the engine developers do already for the old AIs.
There is no AI logic of any kind in the C++ portion, and the logic in the lua portion is not dependant on it for structure, and can be ported to a completely different engine if needs be with no changes. I know I'm not going to be here forever, and I know that no single AI developer could ever fulfill the demands of an entire community as it stands today.
Put quite simply, you expect me to do all the work given a nod int eh right direction, when you could have had it all done months ago if a barely competent lua coder had spent 30 minutes.
Re: Anyone know how to make Shard AI work with Conflict Terra?
morphing gadget is this one: http://code.google.com/p/conflictterra/ ... _morph.luaYour implementation of morphing isnt th eonly one out there, nor does it provide a way of telling the AI if A can morph or not, and if it will morph into B C or D.
I believe it is the same as used in zeroK, S44 etc. though it might be outdated.
About the AICallin I didnt know myself until this thread (http://springrts.com/phpbb/viewtopic.php?f=15&t=26105) but it seems to go like:
-- Exemple of AI messages:
-- "aiShortName|morph|762" -- morph the unit of unitId 762
At top there is some more example stuff like
-- Print all the morphing possibilities:
Though I have never tested that much, its not my gadget, its from CA or whereever oksnoop2 found it.
And the cruiser morphs right in the construction bay, blocking it.Make a behaviour, assign it to the cruisers, and make it send a message in the first frame, hey presto.
Also where would one even look to figure out the gameframe. In Spring its Spring.GetGameFrame() but in Shard?
I dont expect you to do it at all, its not even my gamePut quite simply, you expect me to do all the work given a nod int eh right direction, when you could have had it all done months ago if a barely competent lua coder had spent 30 minutes.

Just saying that you are the most likely person to make Shard play something because
1) you know Shard & Lua
2) others do not. Those who could maybe figure it out cba and would rather make a complete Lua AI.
Well, now there is enough info about CT's Lua and Shard's working, lets see what happens.
Seems we both are just pointing out problems/possible solutions but cba to put it together for several reasons.
Re: Anyone know how to make Shard AI work with Conflict Terra?
ok, I'm clearly in way over my head here, with all this lua stuff... I am kinda interested in how the AI works though.