Jump to content
Sign in to follow this  
arjay

ARJayLIB Agent System - Populate the world!

Recommended Posts

ARJay Agent System 0.1 ALPHA

---------------------------

The ARJay agents system is a dynamic AI generator for locations - villages, towns, cities and military installations (at the moment).

Bringing dynamic life to Stratis, the agent system will populate all locations on the island.

Generated agents don't just stand around, the system runs a number of AI subroutines to give agents the illusion of intelligence (up to a point.. their driving skills leave a lot to be desired!).

Civilians will congregate for meetings, walk around their locations, turn on house lights in the evening, turn on music in their houses, sleep, go for drives to other locations..

Military agents will patrol their bases, patrol using vehicles (land and air currently) to other locations, man static weapons, garison strong points..

The system uses a distance based garbage collection system to remove agents and vehicles from locations depending on how close any players are. If players return to locations the system

remembers agents who have been killed when recreating them, giving the illusion of a whole island of activity but keeping performance as the main focus.

The system is entirely script based, you can configure the world of Stratis to be however you want it, have all locations occupied by OPFOR, or BLUFOR, or a mixture.

Locations can be setup to be occupied by multiple groups, so a firefight may be in progress when you arrive.. There are a host of configurable options to tailor the system to you mission.

Locations can be captured by eliminating all agents within it, map markers can be created to display current location occupation.

The system works with single player, multiplayer, client server, and dedicated server setups.

This is a alpha release of the system, I would appreciate some help with testing the system. If you want to help test please let me know.

Ideas for next releases

------------------------------------------------------

Faction command / intelligence, a commander for each faction that reacts to changes on the battlefield, directing re-inforcements etc.

Ambient traffic / non location based agents

I have a lot of ideas for new extended features, if you do as well, let me know.

The test mission

------------------------------------------------------

The agent system comes with a co-op test mission, the mission has no tasks just displays the system running in a multiplayer environment.

Media

------------------------------------------------------

qgjgTy6h.jpg

Some house lights on in Agia Marina

JGAEXwkh.jpg

Some civilian agents gather to talk

0OJnAFyh.jpg

BLUFOR agents occupying LZ Connor

OsoaRjZh.jpg

An agent garisons a hard point while a squad of agents makes an air patrol

Download

------------------------------------------------------

Dropbox

(WITH AUDIO 14mb)

https://www.dropbox.com/s/ac0bidgqrfhkd1h/ARJay_Agents.Stratis.zip

(WITHOUT AUDIO 400kb)

https://www.dropbox.com/s/fe51lzhqkfpk8oj/ARJay_Agents_No_Audio.Stratis.zip

Github

https://github.com/ARJayDEV/ARJayLIB_agents/

Images

http://imgur.com/a/rOUSc

Video

Changelog

------------------------------------------------------

2013-05-19

Moved shared base classes back to description.ext (thanks to godfather for making it obvious that was a bad idea in the first place)

Added no audio version for download

Edited by ARJay

Share this post


Link to post
Share on other sites

Hey ARJay,

Very nice mate. Have you thought about mixed zones too? So an area populated with Civs, but under the control of BLUFOR/OPFOR?

Share this post


Link to post
Share on other sites

very nice, only comment would be to reduce the file size as 14MB is a little to big if you add this to a mission say 3mb it would be a Big file for MP.

How about an option to remove Audio as that is the Big file ?

Edited by 1PARA{God-Father}

Share this post


Link to post
Share on other sites
Very nice mate. Have you thought about mixed zones too? So an area populated with Civs, but under the control of BLUFOR/OPFOR?

Hi Kremator, yep you can assign any amount of factions to a location, the example in the video shows a EAST / WEST occupation of Agios Ioannis but that could be changed to WEST / CIV like so:

[arjay_missionLocations, "Agios Ioannis", [["CIV", "WEST"],[[0.5, 0.5, objNull, 0, []],[0.5, 0.5, objNull, 1, ["FIRETEAM", "SQUAD"]]]]] call Dictionary_fnc_set;

Which would set a 50% occupation of buildings to civilians and blufor. I would like to have all buildings occupied by civilians, but with a faction presense (road block etc) but that is a dream for the future :)

very nice, only comment would be to reduce the file size as 14MB is a little to big if you add this to a mission say 3mb it would be a Big file for MP.

How about an option to remove Audio as that is the Big file ?

Yep I hear you, I might release a no audio version for download. You can do this yourself by removing the ogg files from the arjay/audio folder, clearing the arjay/audio config.hpp and setting

// create ambient music for civilian houses (pv broadcast)
arjay_agentCreateHouseMusic = false;

in the file arjay/agent/arjay_agent_presets.sqf

Edited by ARJay

Share this post


Link to post
Share on other sites

Well that i enough if we can do it or-self if needed then , will test on Dedi over the weekend and report any issues

A quick question if i wanted to add a Killed EH to all Civilians where would i do this ?

this addEventHandler ["Killed", {_this execVM "civilians\civdeath.sqf";} ];

Edited by 1PARA{God-Father}

Share this post


Link to post
Share on other sites

Hi 1PARA

A quick question if i wanted to add a Killed EH to all Civilians where would i do this ?

There is already a killed event handler defined on line 962 of the arjay/agent/arjay_agent.sqf:

/*
Agent killed event handler
*/
arjay_agentKilled =
{
private ["_agent", "_killer", "_agentId", "_profile", "_side", "_killedByPlayer", "_timeOfDeath", "_groupCount"];

_agent = _this select 0;
_killer = _this select 1;

_agent switchMove "";

_agentId = vehicleVarName _agent;
_profile = _agent getVariable "arjay_agentProfile";
_side = [_profile, "side"] call Dictionary_fnc_get;

_killedByPlayer = isPlayer _killer;
_timeOfDeath = diag_tickTime;

// store death
[arjay_agentsKIA, _agentId, [_agent, _agentId, _side, _killedByPlayer, _killer, _timeOfDeath]] call Dictionary_fnc_set;

// if agent is a group leader promote group member from grunt to agent status
if(_agent getVariable "arjay_agentIsGroupLeader") then
{
	_groupCount = [group _agent] call arjay_countGroupAlive;
	if(_groupCount > 0) then
	{
		[_agent, _agentId] call arjay_agentPromoteGrunt;
	}
	else
	{
		// cleanup
		[_agentId] call arjay_cleanupAgent;
	};
}
else
{
	// cleanup
	[_agentId] call arjay_cleanupAgent;
};	
};

you could run your script:

/*
Agent killed event handler
*/
arjay_agentKilled =
{
private ["_agent", "_killer", "_agentId", "_profile", "_side", "_killedByPlayer", "_timeOfDeath", "_groupCount"];

_agent = _this select 0;
_killer = _this select 1;

_agent switchMove "";

_agentId = vehicleVarName _agent;
_profile = _agent getVariable "arjay_agentProfile";
_side = [_profile, "side"] call Dictionary_fnc_get;

if(_side == "CIV") then
{
	this execVM "civilians\civdeath.sqf";
}

_killedByPlayer = isPlayer _killer;
_timeOfDeath = diag_tickTime;

// store death
[arjay_agentsKIA, _agentId, [_agent, _agentId, _side, _killedByPlayer, _killer, _timeOfDeath]] call Dictionary_fnc_set;

// if agent is a group leader promote group member from grunt to agent status
if(_agent getVariable "arjay_agentIsGroupLeader") then
{
	_groupCount = [group _agent] call arjay_countGroupAlive;
	if(_groupCount > 0) then
	{
		[_agent, _agentId] call arjay_agentPromoteGrunt;
	}
	else
	{
		// cleanup
		[_agentId] call arjay_cleanupAgent;
	};
}
else
{
	// cleanup
	[_agentId] call arjay_cleanupAgent;
};	
};

Untested should work..

Edited by ARJay

Share this post


Link to post
Share on other sites

Yep worked :) Nice 1

Just had a quick test on Dedi all worked , Will grab some players tonight for a proper test with a lot of players so see how performance is , but looking very good so far !.

Any way to adjust / make more civilian travel in car's or will that be in your update ?

Share this post


Link to post
Share on other sites

You could adjust the task part of the civilian controller

arjay/agent/arjay_agent_controller_civilian.sqf

line 114

// task
arjay_agentCivilianCommand = call Dictionary_fnc_new;
[arjay_agentCivilianCommand, "DAY", [0.01, 30]] call Dictionary_fnc_set;
[arjay_agentCivilianCommand, "EVENING", [0.1, 30]] call Dictionary_fnc_set;
[arjay_agentCivilianCommand, "NIGHT", [0, 30]] call Dictionary_fnc_set;
[arjay_agentCivilianCommands, "TASK", arjay_agentCivilianCommand] call Dictionary_fnc_set;

you could adjust the probability of task (usually involves driving)

// task
arjay_agentCivilianCommand = call Dictionary_fnc_new;
[arjay_agentCivilianCommand, "DAY", [0.1, 30]] call Dictionary_fnc_set;
[arjay_agentCivilianCommand, "EVENING", [0.1, 30]] call Dictionary_fnc_set;
[arjay_agentCivilianCommand, "NIGHT", [0, 30]] call Dictionary_fnc_set;
[arjay_agentCivilianCommands, "TASK", arjay_agentCivilianCommand] call Dictionary_fnc_set;

Share this post


Link to post
Share on other sites

Sorry another Q !

where do i find class RscTitles ?

As it conflicts with something i have so ill add it to your one to test

Cheers

class RscTitles
{
///////////////////////
}

;

Share this post


Link to post
Share on other sites
where do i find class RscTitles ?

RscTitles is defined in arjay/dialog/config.hpp line 10

class RscTitles {
#include "capture_dialog.hpp"
};

Share this post


Link to post
Share on other sites
RscTitles is defined in arjay/dialog/config.hpp line 10

class RscTitles {
#include "capture_dialog.hpp"
};

Ahh ta :)

Hmm having a little issue i need to put in

#include "INS_revive\rsctitles.hpp"

which i did , but it obviously is then in the wrong path , as it is looking @ arjay\dialog\INS_revive\rsctitles.hpp how can i change it to look @ the correct path i.e just "INS_revive"

hope that makes some sense !

Share this post


Link to post
Share on other sites

Hmm thats a problem alright, it would be good if you could use a relative address, but I don't think it would work..

class RscTitles {
   #include "capture_dialog.hpp"
   #include "..\..\INS_revive\rsctitles.hpp"
}; 

Maybe move

#include "define.hpp"
#include "capture_dialog.hpp"

class RscTitles {
#include "capture_dialog.hpp"
};

out of that file (arjay/dialog/config.hpp) and stick it back in the description.ext

#include "arjay\dialog\define.hpp"
#include "arjay\dialog\capture_dialog.hpp"

class RscTitles {
#include "arjay\dialog\capture_dialog.hpp"
       #include "INS_revive\rsctitles.hpp"  
};

Share this post


Link to post
Share on other sites

Hey, I am designing a PLA and North Korea style mission, full of looting and convoy awesomeness! lol!

my question is, how do you change gear, or change units or groups or whatever else from opfor to the NK units?

Thanks!!

also, I tried the same as above with INS Revive, Capture Dialog not found crash? LOLWHAT?

**EDIT** fixed.. err.... didnt follow the steps correctly

and again it said its already defined.... the define.hpp from arjay dialog.... why! lol!

heeeelp....????

  //Other Stuff - Start
 #include "arjay\dialog\define.hpp"
 #include "arjay\dialog\capture_dialog.hpp"
 //Other Stuff - End 
class RscTitles
{
//// Respawn Script - Start ////
   #include "arjay\dialog\capture_dialog.hpp"
#include "INS_revive\rsctitles.hpp"	
//// Respawn Script - End   ////

Edited by SturmFalkeRDA

Share this post


Link to post
Share on other sites

Amazing ARJay! Thx for your work! :)

Share this post


Link to post
Share on other sites

Hey ARJay,

Great work! We've been doing something similar in MSO for a while now. You may want to take a look at some of it. We populate all maps dynamically with a range of civ and enemy patrols, bases, insurgent homes etc. We even store the state of these locations to an external database. Would be great to collaborate on things if you are interested.

Cheers

Tup

Share this post


Link to post
Share on other sites

Hi Arjay,

Nice! Will AI respond long distance to any attacks, for example if a base is attacked will AI from other areas investigate/counter attack etc?

Edited by Katipo66

Share this post


Link to post
Share on other sites

I have updated the zip and github to move all shared base config classes back to the description.ext (Not sure what I was thinking moving them out, OCD probably.).

Also added a no audio version for download.

Hey, I am designing a PLA and North Korea style mission, full of looting and convoy awesomeness! lol!

my question is, how do you change gear, or change units or groups or whatever else from opfor to the NK units?

Thanks!!

also, I tried the same as above with INS Revive, Capture Dialog not found crash? LOLWHAT?

**EDIT** fixed.. err.... didnt follow the steps correctly

and again it said its already defined.... the define.hpp from arjay dialog.... why! lol!

heeeelp....????

Hi SturmFalkeRDA, the group members a defined in arjay/arjay_group.sqf - I'm not sure how the PLA units are setup - do they overwrite existing unit classes, or do they have new classnames? Anyway you can see on line 49 of arjay/arjay_group.sqf there is the definition for a fireteam, you should be able to follow that code to make new group types, just add a new case and it is usable in the mission locations group type array. Regarding the INS Revive one, did you get that working? I have tried it with that, but maybe try it with my updated release that puts everything back in the description.ext.

Imutep

Amazing ARJay! Thx for your work

Thanks Imutep!

ltsThomas

awesome. are there also divers / boats featured in this script?

Hi ItsThomas, I have boats that sometimes spawn by piers etc, but havent had a chance to add in any functionality to use them yet. I've been having some problems with auto generation patrol routes for on water, it would be nice if there was a BIS function that could return shore positions around the island, still need to think about that one..

Great work! We've been doing something similar in MSO for a while now. You may want to take a look at some of it. We populate all maps dynamically with a range of civ and enemy patrols, bases, insurgent homes etc. We even store the state of these locations to an external database. Would be great to collaborate on things if you are interested.

Hi Tupolov, wow looks like you guys have done a lot of work already in this area! I didn't even know MSO existed - but thats no suprise as I'm new to scritping for arma, would be interested in some co-lab, and some idea sharing.

Nice! Will AI respond long distance to any attacks, for example if a base is attacked will AI from other areas investigate/counter attack etc?

Hi Katipo, not at the moment, the agents are pretty much have individual AI currently. I'm thinking of making a overarching command type system that reacts to intelligence (simulating radio comms) and responds by sending re-inforcements etc. Of course at the moment the pure randomness might mean a patrol turns up. I've seen some pretty emergent stuff happening with just this limited AI set.

Share this post


Link to post
Share on other sites
...I'm new to scripting for arma...

You've made a grand entrance! This is pretty darned cool.

Share this post


Link to post
Share on other sites
Hi Tupolov, wow looks like you guys have done a lot of work already in this area! I didn't even know MSO existed - but thats no suprise as I'm new to scritping for arma, would be interested in some co-lab, and some idea sharing.

ARJay,

Your code looks very very good. Loving how you've structured it and gone about things, the AI routines are cool. Think there are some definite synergies here. MSO is a framework currently with a whole bunch of modules integrated, that mission creators can add/delete as necessary, which provides a very dynamic and "full map" experience. We are taking this one step further with a "new" approach for A3. This will allow people to drag and drop modules into the A3 Editor and have a very easy way of creating dynamic, immersive and persistent missions. We've got a system already that works out strategic locations and an "operational commander" that can take control of EN forces. We have HC integrated as well as a caching/distance based spawn/despawn mechanism (similar to you). There's a civ pop module which generates Civs, traffic etc. We have suicide bombers, car bombers, IEDs, insurgent groups, ambient enemy air/ships, ambient sounds, civilian interaction... we have a whole bunch of other goodies too and would love to have you either contribute/join the team or allow us to use your functions :) We have a skype dev channel (text) chat, so let me know via PM if interested! We've got devs in Sydney, UK, Europe and US so timezone wise we are pretty covered.

Cheers

Tup

Share this post


Link to post
Share on other sites

hmmmm..... wierd....

"arjay\dialog\define.hpp" is already defined RscCombo on line 262.... how do I fix this? lol?

**EDIT** just found this

//// Respawn Script - Start ////

#include "INS_revive\rsctitles.hpp"

//// Respawn Script - End ////

LOL

Share this post


Link to post
Share on other sites

this is very cool thanks!

I tried it and it works quite well, but the soldiers seems to walk funny sometimes =/

also how would I go about to use this with norrins revive script? your config.hpp and his config.cpp both define sounds.

I tried pasting your sound classes into his file and only import that one but it did not seem to work.

Share this post


Link to post
Share on other sites

Hi Mate,

OK we had a Mission last night 42 Players . and I added this to our mission.

We had a quick test at the start to make sure all was OK with just 5 players teleporting around all spawned great.

Then l reset dedo loaded all 42 players in to lobby and started the mission - for some reason NO Spawned units at all not even civilians with your scripts. we had other stuff to do so did not impact on the main mission , but was very strange as i was expecting certain locations to be populated but they was not.

Been in again now restarted on my own and they all spawn in ?

Could it just simply be a BIS thing or just one of those things or to many loading in at the start causing issues? -- Only MOD enabled was CBA

the .RPT log is to big to post here but i can PM/mail it to you?

Cheers

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  

×