Reclaiming wreckages/feautures

Reclaiming wreckages/feautures

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Reclaiming wreckages/feautures

Post by submarine »

reclaiming keeps drinving me nuts :(

what am i doing wrong?

Code: Select all

Command c;
c.id = CMD_RECLAIM;
c.params.resize(4);
c.params[0] = pos.x;
c.params[1] = cb->GetElevation(pos.x, pos.z);
c.params[2] = pos.z;
c.params[3] = radius;
i tried values between 10 - 2000 for radius - but it never works :(
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

Must be the weird way you set up the vector, i dont get why the getelevation either. I do this, see if it works:

Code: Select all

	
		float3 pos = cb->GetFeaturePos(feature);
			Command c;
			c.id = CMD_RECLAIM;
			c.params.push_back(pos.x);
			c.params.push_back(pos.y);
			c.params.push_back(pos.z);
			c.params.push_back(50);
			cb->GiveOrder(unit, &c);
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Post by submarine »

no sorry i havent been precisely enough:

i dont want to recliam a certain feature but give this "area reclaim" order
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

I just increase the radius, using the builder's pos as the position float3.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

hmm, I have several scenarios in NTAI where I push_back items into the params then feed it into spring and sprign crashes and the debugger says there's nothign in the container, which si verified when I add checks in the code to only issue commands if c.params.empty() == false, and yet it still manages tog et through soemtimes for some reason.

try it:

Code: Select all


Command c;
c.id = CMD_ATTACK;
cb->giveorder(unit,&c);
in 0.67b3 it wont crash it just wont do anything, hwoever in 0.7 it will crash, which is annoying, sicne sometimes the commadns I send in seem to have contents before going in but they dotn afterwards....

Also submarine you may want to check the return on that giveorder()
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Post by submarine »

radius 2000 should be a few screens no?

@af: what kind of return values are there?


has nobody ever given an area reclaim order?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I have, look at the Factor::UnitIdle() routine in NTAI to see examples of area reclaim and area resurect.

GiveOrder returns an integer, usually zero, but if the order fails it returns -1 and the unit turns idle (without calling unitIdle()). I take it you've dealt with this by checking a units commands against the commands you agve ti like JCAI does. QAI issues a CMD_STOP command to kcikstart a untiIdle() call, and NTAI directly calls UnitIdle()
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

2000 is large, cant say it in screens since theres zoom. And yes ive used area reclaim, even if i think its a pig dirty solution for the problem, reason why i use individual features now. If what i said doesnt work it must be the spring version, since its an exact paste from KAI and as i said Ive tried it with the builder's pos and it worked in the past.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

JCAI uses area reclaiming when builders get stuck... So it works, but I have no idea what you're doing wrong. I checked the BuilderCAI code and according to that you're doing it ok. Height shouldn't even matter because it uses distance on X & Z to find features.
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Post by submarine »

ok thx very much guys, must be my fault then, i'll go on experimenting with it
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

hmm someone should chekc the BuilderAI code to se eif comamnds are being used properly too, I'm sure an if(c.params.empty() == false) check is needed somewhere.
Post Reply

Return to “AI”