Alef/JIP – User

From Bohemia Interactive Community
Jump to navigation Jump to search

General

The server is already running a mission. At least has the mission.sqm processed. Instanced of object/vehicles are in the server address space.

Now, the JIP needs to download from the server the status and keep it updated.

mission.sqm can't be processed like the server does, because of the randomness of units/vehicles. What if server creates and object and the client not, or if the position is different? This should be an easy remember thing.

Client get data from server. Sickboy's page explains that.

JIP test

source

// JIP test only. Put "p" as variable name in mission.sqm for JIP player.
#define  TEST( xx ) if ( xx ) then { _s=_s+ #xx +" ;" };
#define PRINT( xx ) _s=_s+ #xx + " = " + (xx) +" ;" ;
_s="init.sqf\n";
for [{ _x=0 },{ _x<2 },{ _x=_x+1 }] do {
    // _u=player; // not needed
    // isNull
    // this happens in JIP if no sleep are performed before.
    TEST( isNull p )
    TEST( isNull player )
    _s=_s+"\n";
    // locality
    TEST( local p )
    TEST( local player )
    _s=_s+"\n";
    // isPlayer 
    TEST( isPlayer p )
    TEST( isPlayer player )
    _s=_s+"\n";
    // name
    PRINT( name p )
    PRINT( name player )
    // 20090415 name: "No vehicle", add an additional check for vehicle
    PRINT( vehicle p )
    PRINT( vehicle player )
    // alive
    PRINT( alive p )
    PRINT( alive player )
    _s=_s+"\nsleep 0.001;\n";
    sleep 0.001;
};
hint _s;
localize _s;

output (edited)

hosting game (p != player)

time
isNull
local
isPlayer
name
vehicle
alive
p player p player p player p player p player p player
any false false true true false true Roberto Duarte alef TODO TODO TODO TODO

JIP

time
isNull
local
isPlayer
name
vehicle
alive
p player p player p player p player p player p player
0 false true false false false false Roberto Duarte Error: No vehicle TODO TODO TODO TODO
0.001 false true false false false false Roberto Duarte Error: No vehicle TODO TODO TODO TODO

JIP, changed to sleep 1 second

time
isNull
local
isPlayer
name
vehicle
alive
p player p player p player p player p player p player
0 false true false false false false Roberto Duarte Error: No vehicle TODO TODO TODO TODO
1 false false true true true true alef (2) alef (2) TODO TODO TODO TODO

comments

_u and player are the same thing.

  • remove _u

So what's happened?

  • isNull _u ; isNull player ;

ok, as we enter, player is null. so just waitUntil{!(isNull player)}, like XEH does.

  • name p = Roberto Duarte ; name _u = Error: No vehicle ; name player = Error: No vehicle ;

name of unit p is the random created one (no setIdentity in the mission).
setIdentity would work looking in description.ext/CfgIdentities.
name player says there is no vehicle for it, because player is still null.
Maybe arma waits assigning a vehicle until Description.ext has been parsed.

  • local p ; local _u ; local player ;
  • isPlayer p ; isPlayer _u ; isPlayer ;
  • name p = alef (2) ; name _u = alef (2) ; name player = alef (2) ;

Now the name of unit p has been assigned to the player's name. XEH does a waitUntil{local player} after checking for null. It could be possible that under heavy load (ACE bug #778), name is not assigned while player being local.

Call stack in ace tracking:

XEH: PostInit.sqf, time == 0
XEH:  isNull player
XEH:   waited for !(isNull player)
XEH:   waited for local player
time > 0
XEH:   waited for !isNull (group player)
XEH: ... { [] call _x } forEach _PostInits; -> XEH_PostInit_Once.sqf
XEH: { _x call SLX_XEH_init } forEach SLX_XEH_OBJECTS; // Run InitPosts
SLX_XEH_init=XEH\Init.sqf

config.cpp:h\Eventhandlers.hpp:
Extended_InitPost_EventHandlers::CAManBase::ace_sys_tracking::
		init = "(_this select 0) call ace_sys_tracking_initMan";
		onRespawn = 1;
s/initMan.sqf: spawn s/loopGroup.sqf
s/loopGroup.sqf:    
first time and every 10 or more seconds (very roughly)
s/loopGroup.sqf:35:   call { call ace_sys_tracking_fUpdateUnits }
s/fUpdateUnits.sqf: [_units] 
s/fUpdateUnits.sqf:  alive _x &&  _x getVariable "ace_sys_tracking_player" = "<null>"
s/fUpdateUnits.sqf:   _x setVariable ["ace_sys_tracking_name", name _x]