
Shard 0.4/dev
Moderators: hoijui, Moderators
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Shard
Awesome! Shard Hairy is back to it's usual happy, non-laggy, and kickass self! Thanks AF! 

Re: Shard
for a 5 year old, it would probably be even better, if you could write a sample config file for a mod that does not yet have one. it could consist of a single task list for one unit, containing all the other units, including (human-)name and description of the units:
_BA.lua (user has to remove the '_' for it to work):
i am sure this could be enhanced, eg. by having one list per side/faction instead. but in general, this allows to make a config file with just the template.
_BA.lua (user has to remove the '_' for it to work):
Code: Select all
allUnits_list = {
"corsolar", -- Solar - Produces energy
"cormex", -- Metal Extractor - Produces metal
...
}
taskqueues = {
corcom = allUnits_list, -- the unit will try to build the units from that list
}
Re: Shard
Technically there is already a sample in the form of the default taskqueues.lua which is being overridden. It contains a primitive BA taskqueue that serves as an example.
However I can see that it could nethertheless be improved by creating the overrides subfolder if it doesn't already exist and copying taskqueues.lua into it along with a readme.txt or howto.txt
I'll look into that for the .31 Ballsey release
However I can see that it could nethertheless be improved by creating the overrides subfolder if it doesn't already exist and copying taskqueues.lua into it along with a readme.txt or howto.txt
I'll look into that for the .31 Ballsey release
Re: Shard
Im considering another update, no functional changes, just documentation changes. I've noticed some people have gone about things a slightly harder way based on the default examples, and some comments here and there, and slight redefinition of taskqueues.lua to guide people down the easier route would help.
That and one or two bits of sanity checking, as misspelt unit names can causes crashes when they're fed into the engine APIs, which can leave people getting puzzled when they're modifying Shards files and spring starts crashing.
So ,unless your developing with Shard, it would have no impact.
That and one or two bits of sanity checking, as misspelt unit names can causes crashes when they're fed into the engine APIs, which can leave people getting puzzled when they're modifying Shards files and spring starts crashing.
So ,unless your developing with Shard, it would have no impact.
Re: Shard
Notes on Tasks and Attackers that will be of use to anybody just starting with Shard:
Tasks are done from first entry to last, in order. If Shard cannot execute a task (eg no place to build it 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.
Also of note.
The Taskqueues are defined in a lua table named 'taskqueues' in taskqueues.lua, and take the form of "unittype" = tableOfTasks, where the table of tasks is a lua array of strings, aka unit type names to build, starting in order from the beginning to the end.
If however the taskqueue behaviour finds a function not a table, it will call that function and expect a table in return. This way you can implement custom logic, and return different task queues each time, depending on who what or when it is called.
This is also true of the tasks themselves. Shard expects a string, e.g. "corsolar" for a core solar plant unit, however if it finds a function, it will call the function like above expecting a string as a return value.
I would suggest looking at evolutionRTS' shard support, and especially using the way the taskqueues.lua is formatted there, rather than how its formatted in conflict terra, as it is much more flexible and easier to read/understand.
Tasks are done from first entry to last, in order. If Shard cannot execute a task (eg no place to build it 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.
Also of note.
The Taskqueues are defined in a lua table named 'taskqueues' in taskqueues.lua, and take the form of "unittype" = tableOfTasks, where the table of tasks is a lua array of strings, aka unit type names to build, starting in order from the beginning to the end.
If however the taskqueue behaviour finds a function not a table, it will call that function and expect a table in return. This way you can implement custom logic, and return different task queues each time, depending on who what or when it is called.
This is also true of the tasks themselves. Shard expects a string, e.g. "corsolar" for a core solar plant unit, however if it finds a function, it will call the function like above expecting a string as a return value.
I would suggest looking at evolutionRTS' shard support, and especially using the way the taskqueues.lua is formatted there, rather than how its formatted in conflict terra, as it is much more flexible and easier to read/understand.
Re: Shard
Shard 0.3 Hairy crash Spring 0.82.6.1 at frame 0.
- Attachments
-
- script.txt
- The startscript used.
- (1.22 KiB) Downloaded 129 times
-
- infolog.txt
- The infolog registered nothing.
- (12.63 KiB) Downloaded 119 times
Re: Shard
Code: Select all
[AI0]
{
Name=Bot;
ShortName=Shard;
Team=0;
Host=0;
}
Then maybe it is TASClient that is failing to write proper startscript?I dont see any version numbers in there
Edit: No, SpringLobby write a bigger AI section, but it crashes all the same.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Shard
Or perhaps spring version changed and shard's dll hasn't been updated? More likely than you think.
Re: Shard
the callback changed indeed. here are the generated sources of the Cpp Wrapper for 0.82.6(.1); see attachment.
for details of what changed, see:
for details of what changed, see:
Code: Select all
git diff 0.82.5.1...0.82.6.1 -- rts/ExternalAI/Interface/
- Attachments
-
- spring_0.82.6.1_AIWrapper_Cpp_srcGenerated.zip
- (96.32 KiB) Downloaded 23 times
Re: Shard
grr, in the past it was a simple error message from the engine saying the AI interface version was different. Crashing with no error log, message or warning is horrendous usability, nevermind graceful crashing.
If I'd had known this was going to be an issue I'd have set aside time this weekend to sort it out so nobody would be any the wiser, I need prior warning of these things!
If I'd had known this was going to be an issue I'd have set aside time this weekend to sort it out so nobody would be any the wiser, I need prior warning of these things!
Re: Shard
Code: Select all
git diff 0.82.5.1...0.82.6.1 -- rts/ExternalAI/Interface/
Re: Shard
We shouldn't have to or need to, some AI developers are not familiar with git or even have it installed, and use the source releases on the downloads page. In the past we have always been told outright when the interface has changed enough to need us to recompile our AIs, and while the majority of openly available public AIs are being built on buildbot and bundled with, Shard is not alone, and there are other developers with various other intentions who are not active on these forums or in any community forum.
How are they to know that they need to rebuild when there are no error messages, stack traces, warnings, instructions, or notifications on the download?
Moreover how am I to know to rebuild if I'm on a machine where I cant freely browse the spring forums and load visual studio? If Im in work I can get into trouble by loading up the spring forums, release threads usually come in the form of emails to my phone, I dont even have visual studio on that machine. So given that in the past some releases have required no intervention to fix Shard, how do I know whether to go out and socialize, or go home and do a rebuild an re-release?
How are they to know that they need to rebuild when there are no error messages, stack traces, warnings, instructions, or notifications on the download?
Moreover how am I to know to rebuild if I'm on a machine where I cant freely browse the spring forums and load visual studio? If Im in work I can get into trouble by loading up the spring forums, release threads usually come in the form of emails to my phone, I dont even have visual studio on that machine. So given that in the past some releases have required no intervention to fix Shard, how do I know whether to go out and socialize, or go home and do a rebuild an re-release?
Re: Shard
Ive rebuilt and made one or two changes, performance should be higher, but please test it out, my drivers have made things awkward to test here and I havent got enough time left this evening to sort that out. Same blogpost, same download url.