Jump to content
Sign in to follow this  
fn_Quiksilver

Dynamic Simulation scripting problem

Recommended Posts

Hi guys, 

 

having an issue the past few months that I didn't run into before, regarding scripting some dynamic simulation (not the official one).

 

what I do is basically use client "enableSimulation" on non-local entities when they are distant from the player.

 

this works fine if the entity is stationary, like an empty vehicle or prop. player moves into range, the entity sim is enabled. player moves out of range, entity sim is disabled.

 

problems arise when a distant entity (disabled) moves toward the player, on the players machine the entity is never detected as being nearby in order to enable sim again.

 

When i was designing this system i tested this sort of thing, and player was able (IIRC) to get the actual position of the vehicle, but it seems this is not the case?

 

Is there any way from the client to get the true position of a remote entity if simulation is disabled?

 

Here's the code for the script

 

https://github.com/auQuiksilver/Apex-Framework/blob/master/Apex_framework.terrain/code/functions/fn_clientSimulationManager.sqf

Share this post


Link to post
Share on other sites

I've gone through a similar thing.
I ended up setting up a server loop and then sending an array of units to be uncached from the server to the client

 

Share this post


Link to post
Share on other sites

You could also ask the server at regular intervals, sacrifices a bit of network but  an interval of 5 s ( or so ) shouldn't be too bad. It might get nasty with large numbers of clients though. 

 

Pseudocode: 

remoteExec to server. 

Server gets remoteExecClient and position and remoteExec back. 

 

It would probably be better to have the server broadcast the data, like @computer said. 

Share this post


Link to post
Share on other sites
21 hours ago, mrcurry said:

You could also ask the server at regular intervals, sacrifices a bit of network but  an interval of 5 s ( or so ) shouldn't be too bad. It might get nasty with large numbers of clients though. 

 

Pseudocode: 

remoteExec to server. 

Server gets remoteExecClient and position and remoteExec back. 

 

It would probably be better to have the server broadcast the data, like @computer said. 

 

clients machine must know the true/predicted position of each entity, to handle the internal network simulation bubble, but i dont know how to get this info with SQF.

 

i dont really want to use remote exec or variable propagation. with 60+ clients i think the cost would outweigh the benefit

 

for variable propagation, id probably only send a position update when the entity enters a new “cell”, like map grid.

Share this post


Link to post
Share on other sites

Checking if all the units are in a new cell is quite costly.

I just thought of an alternative method.

Update the position of the units as setVariable on the server every ~10 seconds. I doubt the unit would travel too close within that time.
You can also reduce the network traffic by checking if the unit has moved more than 50 meters for ex.

 

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, computer said:


You can also reduce the network traffic by checking if the unit has moved more than 50 meters for ex.

 

 

yeah something like this

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  

×