The difference between Attackers and Builders

Builders are given the taskqueue behaviour, which follows a list of tasks. Tasks are done from first entry to last, in order. If Shard cannot execute a task (eg. no place to build it was found), it will move on to the next task listed.

Attackers are also assigned an attackerbehaviour. You can do this manually via the behaviours table in behaviours.lua, or via the function underneath that table which is used if no definition for that unit type is found in the table. This is how most attackers are assigned in most peoples lua at the moment.

The default function hands a taskqueuebehaviour (the behaviour that implements task queues) to units if they are capable of building, else it will call IsAttacker to determine wether to hand it an attackerbehaviour or not. The IsAttacker function is simple, all it does is look at the attackers table and see if the unittype is listed, and returns true if it is, and false if it isnt. Refer to attackers.lua for an example, its just a basic list.

You can implement and write your own behaviours, and then tell shard in the behaviours table to use those rather than using the heuristic in the defaultbehaviour function ( I think that’s the name of it ). Refer to the Evo RTS folder for an example of a custom behaviour.

Originally posted on the spring forums here