Home   Help Search Login Register  

Author Topic: Retroactive syncronization of mutliple objects (JIP)  (Read 1544 times)

0 Members and 1 Guest are viewing this topic.

Offline Inkompetent

  • Members
  • *
Greetings

I'm currently looking at how to retroactively syncronize a whole bunch of individual objects for JIP clients over the network without causing unnecessary data transfers to people already having recieved the data.

I have code triggered by a Fired EH, which in the end will run a script to create a physical object in the world. Since the object is just eye-candy I wanted it created locally on all machines, so that position data and stuff won't have to be transmitted across the net as soon as something happens with it. Question is, how do I do this effectively?

Do I use call compile format to uniquely name a publicVariable for each transmit, having it execute the script with the relevant parameters, or is there something which I can have more control of and that's more efficient? A lot of unique publicVariables doesn't sound very friendly to either connection-time for the client or the desync of the rest of the server.

If I want to skip sending data to the JIP clients of all objects originally created through this that are one hour or older, is there any decent way of doing that without publicVariableing an empty string or somesuch to everyone?


Thank you.

/ Inkompetent

Offline Rommel92

  • Members
  • *
Re: Retroactive syncronization of mutliple objects (JIP)
« Reply #1 on: 02 Dec 2009, 21:36:22 »
Code: [Select]
_tube = _tubeModel createVehicle _worldPosition;
_tube setPos [(_worldPosition select 0) + ((cos _unitDirection) / 3), (_worldPosition select 1) - ((sin _unitDirection) / 3), _worldPosition select 2];
_tube setDir ((_unitDirection) - 90);
_tube setVelocity  [(_unitVelocity select 0) + (cos _unitDirection), (_unitVelocity select 1) - (sin _unitDirection), _unitVelocity select 2];

That is your original code. Should roughly become similar to this (with optimisations obviously).

Code: [Select]
_unit setvehicleinit format["[this,%1] call INKO_Tube_drop", _tubeModel]; processinitcommands
Function needed to be defined on all ends (cept the server of course ;) )
Code: [Select]
INKO_Tube_drop = {
_unit = _this select 0;
_tubeModel = _this select 1;

_selectionPosition = _unit selectionPosition "RightShoulder";
_worldPosition = _unit modelToWorld _selectionPosition;
_unitDirection = getDir _unit;

_tube = _tubeModel createVehicleLocal _worldPosition;
_tube setPos [(_worldPosition select 0) + ((cos _unitDirection) / 3), (_worldPosition select 1) - ((sin _unitDirection) / 3), _worldPosition select 2];
_tube setDir ((_unitDirection) - 90);
_tube setVelocity  [(_unitVelocity select 0) + (cos _unitDirection), (_unitVelocity select 1) - (sin _unitDirection), _unitVelocity select 2];
};

As for JIP, this should work on JIP, however testing will be needed to prove it.
As for the time stamp, throw in [this, %1, time] and if the time is more than (if (_time > time + (60*60*60)) exitwith {}) an hour old, exit.
The other option is a PVEH, but that will just be a pain to handle, and won't be able to easily solve all the tubes that were created.

Something else that may help you (even for advanced people, the BIKI is awesome) : http://community.bistudio.com/wiki/setVehicleInit

Hope I helped, just woke up so excuse any problems in the code, was checking through the news and opened OPFEC and saw this :P. Damn waking up early...
« Last Edit: 02 Dec 2009, 21:43:02 by Rommel92 »

Offline Inkompetent

  • Members
  • *
Thanks for the help. Ended up scrapping JIP support in the end though and just went with a simple PVEH solution. Easy to code, and much nicer on performance. :)