Jump to content
Sign in to follow this  
killzone_kid

"Keep the rabbit in a cage!" challenge (AI related)

Recommended Posts

This challenge is for BIS and anyone who is willing to try their luck with it.

The idea is this: You have 10 rabbit agents and a 10 x 10 virtual cage. The challenge is to convince the rabbits to stay within the virtual area with all available AI commands. Sounds simple?

Here is my take:

[color="#FF8040"]tr [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]createTrigger[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"EmptyDetector"[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]player[/color] [color="#191970"][b]modelToWorld[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]10[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
tr [color="#191970"][b]setTriggerArea[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#FF0000"]5[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]5[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
tr [color="#191970"][b]setTriggerActivation[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"CIV"[/color][color="#8B3E2F"][b],[/b][/color] [color="#7A7A7A"]"PRESENT"[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
rabbits [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]for[/b][/color] [color="#7A7A7A"]"_i"[/color] [color="#191970"][b]from[/b][/color] [color="#FF0000"]1[/color] [color="#191970"][b]to[/b][/color] [color="#FF0000"]10[/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color]
rabbits [color="#191970"][b]pushBack[/b][/color] [color="#191970"][b]createAgent[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Rabbit_F"[/color][color="#8B3E2F"][b],[/b][/color] [color="#191970"][b]position[/b][/color] tr[color="#8B3E2F"][b],[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color] [color="#7A7A7A"]"NONE"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]
tr [color="#191970"][b]setTriggerStatements[/b][/color] [color="#8B3E2F"][b][[/b][/color]
[color="#7A7A7A"]"if (rabbits isEqualTo thisList) exitWith {};
_esc = rabbits - thisList;
doStop _esc;
{_x moveTo position thisTrigger} forEach _esc;
systemChat str [time, _esc];
false"[/color][color="#8B3E2F"][b],[/b][/color]
[color="#7A7A7A"]""[/color][color="#8B3E2F"][b],[/b][/color]
[color="#7A7A7A"]""[/color]
[color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color][/color]

Rabbits leaving the virtual trigger area are ordered to stop and then move to the centre of the area. You can see from the video below that some rabbits do exactly that, while others do exactly what they want.

I am not going to make another FT ticket because there are enough tickets about AI already. I just want BIS to get in the shoes of a mission maker and feel the frustration for themselves.

Edited by Killzone_Kid

Share this post


Link to post
Share on other sites

You can see from the video below that some rabbits do exactly that, while others do exactly what they want.

Are you sure it's not an impression? From what I can see on my end, agents don't respond to any "move" commands at all.

I just tried with a "b_survivor_b" unit spawned with createAgent - no way I could get him to move...

Share this post


Link to post
Share on other sites

Yes, I know very well, what you mean talking about frustration. Today again I was unable to script some nice idea, because necessary command is malfunctioning (reported on the tracker long time ago). Maybe only an impression, but seems, lately I'm noticing more and more various irritating AI bugs, mostly around vehicles/crew.

Yours code seems work to me. Roughly. I mean - rabbits at least seem to be bounded somehow to the area instead of spreading far away.

What worked very well instead:

{
_x disableAI "MOVE"
} 
foreach rabbits;

{
_x limitSpeed 0
} 
foreach rabbits;

{
_x disableAI "ANIM"
} 
foreach rabbits;

{
_x enableSimulation false
} 
foreach rabbits;

and my favourite:

{
_x setDamage 1
} 
foreach rabbits;

You could even try to calibrate some centripetal setVelocity "pushes" if you like something more dynamic. :)

BTW, I would prefer to see solved a challenge based on 100% safe and flawless AI driving in a convoy through populated city.

Edited by Rydygier

Share this post


Link to post
Share on other sites
Are you sure it's not an impression? From what I can see on my end, agents don't respond to any "move" commands at all.

I just tried with a "b_survivor_b" unit spawned with createAgent - no way I could get him to move...

doMove doesn't work at all on rabbits, while moveTo works OK, but this is tested on DEV branch, and this is exactly where I posted this thread initially, on DEV branch forums.

Share this post


Link to post
Share on other sites

Yup, but it requires to create a group, wich - unless I'm wrong - is not the case with createAgent.

You really shouldn't have to do that for stuff such as rabbits games. ;)

Share this post


Link to post
Share on other sites
Yup, but it requires to create a group, wich - unless I'm wrong - is not the case with createAgent.

You really shouldn't have to do that for stuff such as rabbits games. ;)

You can put agents in teams, and there is a tonne of commands to do with teams. doStop works on rabbits though, single or group, against any common sense :)

Share this post


Link to post
Share on other sites

This competition is now closed, and the winner is.... Borivoj Hlava, a.k.a. DarkDruid with his awesome override! To disable animal behaviour routine, one can now simply

[color="#FF8040"][color="#1874CD"]_agent[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"BIS_fnc_animalBehaviour_disable"[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color][/color]

right after agent creation. I've adjusted my original script to make rabbits look alive while disabling the default behaviour, if anyone interested:

[color="#FF8040"]tr [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]createTrigger[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"EmptyDetector"[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]player[/color] [color="#191970"][b]modelToWorld[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]10[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
tr [color="#191970"][b]setTriggerArea[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#FF0000"]5[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]5[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
tr [color="#191970"][b]setTriggerActivation[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"CIV"[/color][color="#8B3E2F"][b],[/b][/color] [color="#7A7A7A"]"PRESENT"[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
rabbits [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]private[/b][/color] [color="#7A7A7A"]"_r"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]for[/b][/color] [color="#7A7A7A"]"_i"[/color] [color="#191970"][b]from[/b][/color] [color="#FF0000"]1[/color] [color="#191970"][b]to[/b][/color] [color="#FF0000"]10[/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color]
[color="#1874CD"]_r[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]createAgent[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Rabbit_F"[/color][color="#8B3E2F"][b],[/b][/color] [color="#191970"][b]position[/b][/color] tr[color="#8B3E2F"][b],[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color] [color="#7A7A7A"]"NONE"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_r[/color] [color="#191970"][b]setVariable[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"BIS_fnc_animalBehaviour_disable"[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
rabbits [color="#191970"][b]pushBack[/b][/color] [color="#1874CD"]_r[/color][color="#8B3E2F"][b];[/b][/color] 
[color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]
tr [color="#191970"][b]setTriggerStatements[/b][/color] [color="#8B3E2F"][b][[/b][/color]
[color="#7A7A7A"]"if (rabbits isEqualTo thisList) exitWith {
	_r = thisList select floor random count thisList;
	_r moveTo (_r modelToWorld [2.5 - random 5,2.5 - random 5,0]);
};
_esc = rabbits - thisList;
doStop _esc;
{_x moveTo position thisTrigger} forEach _esc;
systemChat str [time, _esc];
false"[/color][color="#8B3E2F"][b],[/b][/color]
[color="#7A7A7A"]""[/color][color="#8B3E2F"][b],[/b][/color]
[color="#7A7A7A"]""[/color]
[color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
[/color]

Share this post


Link to post
Share on other sites

Maybe I'm stupid and doing something wrong, but how do I use this on an editor placed animal?

I tried some different stuff as sh9 setVariable ["BIS_fnc_animalBehaviour_disable", true]; dostop this; in the init field, sadly to no avail :(

Share this post


Link to post
Share on other sites
Maybe I'm stupid and doing something wrong, but how do I use this on an editor placed animal?

I tried some different stuff as sh9 setVariable ["BIS_fnc_animalBehaviour_disable", true]; dostop this; in the init field, sadly to no avail :(

Are you trying this on DEV branch?

Share this post


Link to post
Share on other sites

Yes, and I saw the override comment in the function viewer. I wouldn't even mind the sheep moving and going about their way, if that wouldn't include grazing under water...

I guess I'll try your script. The hoops we jump for something so simple ;)

Share this post


Link to post
Share on other sites
Yes, and I saw the override comment in the function viewer. I wouldn't even mind the sheep moving and going about their way, if that wouldn't include grazing under water...

I guess I'll try your script. The hoops we jump for something so simple ;)

animalBehaviour script determines how animal should behave depending on surrounding. Disabling it has different effect on different animals, if it has effect at all. Take a hen for example, it cannot be stopped, because all it does is walk and peck continuously. Some hardcoded routine. You can order it to walk towards specified position, but that's about it. Ideally it would be great to be able to affect hardcoded behaviour, but I doubt it would be easy.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×