Jump to content
Sign in to follow this  
wolffy.au

Ambient Civilians, Ambient Vehicles and Ambient Animals in Multiplayer

Recommended Posts

But there is a problem when you shoot at civilians. ALICE works fine in editor, but on dedicated server after killing one, immediately there is lag and desync grows up.

Try this yourself.

Just saw this post. Is this the case with ALICE2 as well, or just ALICE1? While the Ambient Civilian module is very cool, I don't want to risk using something that could cause desync.

Share this post


Link to post
Share on other sites
I don't want to risk using something that could cause desync.

Suggest you test it yourself. I've never experienced it personally, not that I shoot that many civilians! :P

Share this post


Link to post
Share on other sites

Trying this in a mission I'm working on. The first night I included it my mission some friends and I were testing on a dedicated server, we noticed something odd. One friend joined late and as soon as he joined, my AI starting shooting at invisible enemy soldiers in a town I was moving through. My friends and I drove around the area for awhile trying to spot the enemy, but only our AI squads were spotting them, calling locations and shooting.

We thought it was just some random bug. Played the same mission again last night and the same thing happend. This time invisible enemy spawned at our main base, our AI squads were going nuts just shooting.

Going to take the ambient civilians out first and test the mission again... shall report back with my findings.

Share this post


Link to post
Share on other sites

Tested further. After removing all the ambient modules, I haven't encounterd any invisible enemy AI.

Placed them back in my mission again and had the same results as before. Someone joins late and suddenly invisible AI spawn causing friendly AI to go nuts and shoot at thin air.

Share this post


Link to post
Share on other sites
Tested further. After removing all the ambient modules, I haven't encounterd any invisible enemy AI.

Placed them back in my mission again and had the same results as before. Someone joins late and suddenly invisible AI spawn causing friendly AI to go nuts and shoot at thin air.

Sorry, never seen it before.

Are you running it on a dedicated server? You may want to add:

isServer

To the Condition field of the module, maybe that will help.

Share this post


Link to post
Share on other sites
Sorry, never seen it before.

Are you running it on a dedicated server? You may want to add:

isServer

To the Condition field of the module, maybe that will help.

Thanks, I'll give this a try!

Also, you wouldn't happen to know a good way to add something in the int line of the ambient vehicles to delete them when they are destroyed? I have the JIP "fire sky" bug going when too many of them are destroyed and deleting them would clear that up.

Share this post


Link to post
Share on other sites

The Garbage Collector module will remove all destroyed objects once you are 500m away I believe. Give it a go and post the results here.

Share this post


Link to post
Share on other sites
The Garbage Collector module will remove all destroyed objects once you are 500m away I believe. Give it a go and post the results here.

Trying to get this to work, but it doesn't seem like I'm doing it right.

BIS_silvie_mainscope setvariable ["vehicleInit", {[] execVM "delete.sqf";}];

delete.sqf

_vehicle = _this select 0;

waitUntil {!alive _vehicle};
sleep 30;
deleteVehicle _vehicle;

Edited by doomanchu

Share this post


Link to post
Share on other sites

Got the ambient civilian vehicles to delete when destroyed with the following:

BIS_silvie_mainscope setvariable ["vehicleInit",{_this addEventHandler ['Killed',{(_this select 0) spawn {sleep 300; deleteVehicle _this}}]}];

That'll delete them after 5 min of being destroyed.

Share this post


Link to post
Share on other sites

ALICE already starts GC on it's own:

//--- Is Garbage collector running?
if (isNil "BIS_GC_trashItFunc") then {(group _logic) createUnit ["GarbageCollector", position player, [], 0, "NONE"]};

Share this post


Link to post
Share on other sites

Garbage Collector is unfortunately broken in MP, but you can avoid ALICE's use of it by defining your own version of "BIS_GC_trashItFunc" in the init field of the ALICE logic. This will trick ALICE into thinking Garbage Collector is running when it's actually not, and it will allow you to define your own MP-friendly cleanup function that ALICE will call whenever a civilian is killed (passing the civilian that was killed as _this select 0).

Whether or not Garbage Collector is fully to blame for ALICE's slowdown/screwups in MP, I am not yet sure. If so, then using ALICE in MP environment would be a simple matter of disabling GC, but I need to test more.

Share this post


Link to post
Share on other sites
Garbage Collector is unfortunately broken in MP, but you can avoid ALICE's use of it by defining your own version of "BIS_GC_trashItFunc" in the init field of the ALICE logic. This will trick ALICE into thinking Garbage Collector is running when it's actually not, and it will allow you to define your own MP-friendly cleanup function that ALICE will call whenever a civilian is killed (passing the civilian that was killed as _this select 0).

Whether or not Garbage Collector is fully to blame for ALICE's slowdown/screwups in MP, I am not yet sure. If so, then using ALICE in MP environment would be a simple matter of disabling GC, but I need to test more.

what version of modules and game is it ? todays beta ?

if not please try if yes any sample mission or CIT ticket # ID ?

Share this post


Link to post
Share on other sites

There's really no need for a test mission. All you need is one unit and ALICE2. Put it on a dedicated server; shoot a civilian. Desyncs every time.

After messing around with it for a bit, I've figured out that the problem lies with the "BIS_fnc_respect" function. When this function is called by the "Hit" EH given to all ALICE2 civilians, it causes the desync. If you assign the BIS_fnc_respect variable to a blank function ( {} ) shortly after the mission starts, it won't be run when the EH is fired, and the desync will not occur (however, this destroys the respect system). I am not yet sure why the respect function is causing problems, but it's definitely the culprit.

Edited by ST_Dux

Share this post


Link to post
Share on other sites

Interesting find.

Could you share how one would go about assigning BIS_fnc_respect to a blank function?

Thanks muchly!

Share this post


Link to post
Share on other sites

Mhmm... Guess I could search first but :rolleyes: is there a global trigger/script I could use that would set civilians to be "safe/careless" usually if im driving a truck on the road civ cars will pull to the side passengers will eject and go prone kinda immersion breaker :D

Possibly also for another script that can set AI to retreat from _player has fired within a radius of civilian spawn? Im a complete newb with no scripting abilities so... anyone know how to do that ?

Share this post


Link to post
Share on other sites

Might be able to do something using this:

ALICE_civilianinit = <array>; - array of codes which is executed upon every civilian unit created.

Example: [bis_loc_acityc_kozlovka,"ALICE_civilianinit",[{_this setBehaviour "CARELESS"}]] call bis_fnc_variablespaceadd;

(use function BIS_fnc_variablespaceadd to prevent replacing currently existing codes)

Default value: none

Taken from here:

http://community.bistudio.com/wiki/Ambient_Civilians

Share this post


Link to post
Share on other sites
Interesting find.

Could you share how one would go about assigning BIS_fnc_respect to a blank function?

Thanks muchly!

Simply make a trigger that goes off automatically a few seconds after mission start (use a true condition with a short delay), and put this in the activation field:

BIS_fnc_respect = {}

Like I said, though, this destroys the whole respect system thing, so it's not really an ideal solution. Alternatively, you can set the ALICE_civilianinit variable to remove the hit event handler, which will remove the desync issue without wiping out the respect function. Civilian deaths will have no affect on a town's respect rating if you do this, but this usually isn't very important for MP missions, anyway.

As for actually solving the root of the problem rather than working around it, I still have no idea why the respect function is causing desync. It is called multiple times in the ALICE initialization, and it seems fine here. It's only when it's triggered by the hit event handler that is causes desync.

Share this post


Link to post
Share on other sites

Would removing the respect system have any other ill effect, other than disabling how civilians react to people that have done them harm?

Regards the hit eventhandler; something like this in the module's init then?

["ALICE_civilianinit",[{this removeAllEventHandlers "hit"}]] call bis_fnc_variablespaceadd;

Thanks again!

Is that placed in a .sqf or the init of the module?

I would presume so. Never tried it though. Also, the first bit can probably be dropped, if you want it applied to all areas.

Edited by Harlow[16AA]

Share this post


Link to post
Share on other sites
Regards the hit eventhandler; something like this in the module's init then?

Pretty much, except you'll need to use "_this" instead of "this." As far as removing the respect system goes, I'm honestly not sure. But I figure I may as well leave the function in-tact if I can.

Also, one disclaimer:

I have tested this on a dedicated server, but not with a high player count and not with any JIP players. It's feasible that there are other parts of ALICE that will break when these two things are added to the mix. If I find out for sure, I'll post my my findings here.

Share this post


Link to post
Share on other sites

I'll add this to our upcoming Sunday Op mission, see how it goes and post findings.

We'll have about 25-30 people on and there'll likely be a few JIPs.

Thanks for your research and help ST Dux.

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  

×