Page 11 of 42

Re: Shard

Posted: 14 Sep 2010, 07:12
by Forboding Angel
Awesome! Shard Hairy is back to it's usual happy, non-laggy, and kickass self! Thanks AF! :-)

Re: Shard

Posted: 14 Sep 2010, 10:24
by hoijui
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):

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
}
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.

Re: Shard

Posted: 14 Sep 2010, 12:07
by AF
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

Re: Shard

Posted: 14 Sep 2010, 12:12
by hoijui
the most important thing for me there, would be having the (full) list of units (shortName, name & description). i bet a lot of users would not know how to get this, if they are not the mod authors them selfs.

Re: Shard

Posted: 16 Sep 2010, 01:29
by AF
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.

Re: Shard

Posted: 09 Oct 2010, 00:32
by AF
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.

Re: Shard

Posted: 16 Oct 2010, 01:59
by zwzsg
Shard 0.3 Hairy crash Spring 0.82.6.1 at frame 0.

Re: Shard

Posted: 16 Oct 2010, 02:39
by AF
There is no crash information of any kind in that log, or any mention of any AI other than the filenames of KPAI =s Are you sure the script is correct? I dont see any version numbers in there

Re: Shard

Posted: 16 Oct 2010, 02:40
by zwzsg

Code: Select all

	[AI0]
	{
		Name=Bot;
		ShortName=Shard;
		Team=0;
		Host=0;
	}
Or just try it.

I dont see any version numbers in there
Then maybe it is TASClient that is failing to write proper startscript?

Edit: No, SpringLobby write a bigger AI section, but it crashes all the same.

Re: Shard

Posted: 17 Oct 2010, 03:03
by Forboding Angel
Or perhaps spring version changed and shard's dll hasn't been updated? More likely than you think.

Re: Shard

Posted: 17 Oct 2010, 10:02
by hoijui
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:

Code: Select all

git diff 0.82.5.1...0.82.6.1 -- rts/ExternalAI/Interface/

Re: Shard

Posted: 17 Oct 2010, 18:08
by zwzsg
Forboding Angel wrote:Or perhaps spring version changed and shard's dll hasn't been updated? More likely than you think.
Exactly, and that's why I was reminding AF to fix his Shard.

Re: Shard

Posted: 17 Oct 2010, 22:37
by AF
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!

Re: Shard

Posted: 17 Oct 2010, 22:40
by hoijui

Code: Select all

git diff 0.82.5.1...0.82.6.1 -- rts/ExternalAI/Interface/
this code can be adapted to work for feature releases too, i will not tell the secret of how to do it though... its Mr. E!

Re: Shard

Posted: 17 Oct 2010, 22:47
by AF
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?

Re: Shard

Posted: 18 Oct 2010, 13:12
by AF
I've set aside time to put out a release tonight, just a minor rebuild for latest spring.

Thanks for posting the updated C++ Wrapper code Hoijui, perhaps we can have a sticky thread for it?

Re: Shard

Posted: 18 Oct 2010, 23:32
by AF
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.

Re: Shard

Posted: 20 Oct 2010, 14:08
by AF
Has anybody else conducted further tests? I've had no feedback as of yet

Re: Shard

Posted: 20 Oct 2010, 17:56
by oksnoop2
I'm sorry AF, where is the link?

Re: Shard

Posted: 20 Oct 2010, 22:32
by AF
First post in the thread as always. It's the same URL and blogpost as 0.3 hairy, just redownload.