Alef/JIP – User
Lou Montana (talk | contribs) m (Text replacement - " (={2,})([^ = ])(.*)([^ = ])(={2,}) * " to " $1 $2$3$4 $5 ") |
|||
(31 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
==General== | Work in progress | ||
== General == | |||
The server is already running a mission. At least has the mission.sqm processed. | The server is already running a mission. At least has the mission.sqm processed. | ||
Instanced of object/vehicles are in the server address space. | Instanced of object/vehicles are in the server address space. | ||
Line 6: | Line 8: | ||
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. | 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. | ||
However,OFPEC says mission.sqm/init fields are executed too. | |||
Client get data from server. Sickboy's page explains that. | Client get data from server. Sickboy's MP page explains that. | ||
==JIP test== | == JIP test == | ||
===source=== | === source === | ||
<pre> | <pre> | ||
#define SPON_THIS_FILE init.sqf | |||
#include "SPON\Core\core.inc.sqf" | |||
#include "SPON\Core\macros\macros.inc.sqf" | |||
["DEBUG_CLIENT",9999,true] call compile preprocessFileLineNumbers "SPON\Core\initCore.sqf"; | |||
// JIP test only. Put "p" as variable name in mission.sqm for JIP player. | // JIP test only. Put "p" as variable name in mission.sqm for JIP player. | ||
#define TEST( xx ) if ( xx ) then { | #define TEST( xx ) if (xx) then { s=#xx } else { s="not "+#xx }; | ||
#define PRINT( xx ) | #define PRINT( xx ) s=#xx+" = "+(xx); | ||
#define PRINTF( xx ) s=#xx+" = "+format["%1",(xx)]; | |||
c=0; | |||
waitUntil | |||
{ | |||
TEST( isNull p ) | TEST( isNull p ) | ||
SPON_TRACE_1( s, c ); | |||
TEST( isNull player ) | TEST( isNull player ) | ||
SPON_TRACE_1( s, c ); | |||
TEST( local p ) | TEST( local p ) | ||
SPON_TRACE_1( s, c ); | |||
TEST( local player ) | TEST( local player ) | ||
SPON_TRACE_1( s, c ); | |||
TEST( isPlayer p ) | TEST( isPlayer p ) | ||
SPON_TRACE_1( s, c ); | |||
TEST( isPlayer player ) | TEST( isPlayer player ) | ||
SPON_TRACE_1( s, c ); | |||
PRINT( name p ) | PRINT( name p ) | ||
SPON_TRACE_1( s, c ); | |||
PRINT( name player ) | PRINT( name player ) | ||
SPON_TRACE_1( s, c ); | |||
PRINTF( vehicle p ) | |||
SPON_TRACE_1( s, c ); | |||
// | PRINTF( vehicle player ) | ||
PRINT( | SPON_TRACE_1( s, c ); | ||
PRINT( | PRINTF( alive p ) | ||
SPON_TRACE_1( s, c ); | |||
PRINTF( alive player ) | |||
SPON_TRACE_1( s, c ); | |||
// what about getVariable ? | |||
PRINT( p getVariable "undefined" ); | |||
SPON_TRACE_1( s, c ); | |||
PRINT( player getVariable "undefined" ); | |||
SPON_TRACE_1( s, c ); | |||
c=c+1; | |||
name player != "Error: No vehicle"; | |||
}; | }; | ||
</pre> | </pre> | ||
===output (edited)=== | === output (edited) === | ||
hosting game< | {| border="1" cellpadding="2" cellspacing="0" | ||
local p | |colspan="13"|hosting game (p != player) | ||
|- | |||
|rowspan="2"|time | |||
|colspan="2"|<center>isNull</center> | |||
local p | |colspan="2"|<center>local</center> | ||
|colspan="2"|<center>isPlayer</center> | |||
|colspan="2"|<center>name</center> | |||
< | |colspan="2"|<center>vehicle</center> | ||
|colspan="2"|<center>alive</center> | |||
|- | |||
|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 | |||
|- | |||
|colspan="13"|JIP | |||
|- | |||
|rowspan="2"|time | |||
|colspan="2"|<center>isNull</center> | |||
|colspan="2"|<center>local</center> | |||
|colspan="2"|<center>isPlayer</center> | |||
|colspan="2"|<center>name</center> | |||
|colspan="2"|<center>vehicle</center> | |||
|colspan="2"|<center>alive</center> | |||
|- | |||
|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 | |||
|- | |||
|colspan="13"|JIP, changed to sleep 1 second | |||
|- | |||
|rowspan="2"|time | |||
|colspan="2"|<center>isNull</center> | |||
|colspan="2"|<center>local</center> | |||
|colspan="2"|<center>isPlayer</center> | |||
|colspan="2"|<center>name</center> | |||
|colspan="2"|<center>vehicle</center> | |||
|colspan="2"|<center>alive</center> | |||
|- | |||
|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 | |||
|- | |||
|colspan="13"|JIP, monitored with SPON Core, waitUntil name player != "no veh" | |||
|- | |||
|rowspan="2"|time | |||
|colspan="2"|<center>isNull</center> | |||
|colspan="2"|<center>local</center> | |||
|colspan="2"|<center>isPlayer</center> | |||
|colspan="2"|<center>name</center> | |||
|colspan="2"|<center>vehicle</center> | |||
|colspan="2"|<center>alive</center> | |||
|- | |||
|p | |||
|player | |||
|p | |||
|player | |||
|p | |||
|player | |||
|p | |||
|player | |||
|p | |||
|player | |||
|p | |||
|player | |||
|- | |||
|0 | |||
|false | |||
|true | |||
|false | |||
|false | |||
|false | |||
|false | |||
|Roberto Duarte | |||
|Error: No vehicle | |||
|p | |||
|<NULL-object> | |||
|true | |||
|false | |||
|- | |||
|c=1 | |||
|false | |||
|true | |||
|false | |||
|false | |||
|false | |||
|false | |||
|Roberto Duarte | |||
|Error: No vehicle | |||
|p | |||
|<NULL-object> | |||
|true | |||
|false | |||
|- | |||
|c=2 | |||
|false | |||
|true | |||
|false | |||
|false | |||
|false | |||
|false | |||
|Roberto Duarte | |||
|Error: No vehicle | |||
|p | |||
|<NULL-object> | |||
|true | |||
|false | |||
|- | |||
|c=3 | |||
|false | |||
|false | |||
|true | |||
|true | |||
|true | |||
|true | |||
|alef (2) | |||
|alef (2) | |||
|p | |||
|p | |||
|true | |||
|true | |||
|} | |||
=== comments === | |||
So what's happened? | |||
ok, as we enter, player is null. so just waitUntil{!(isNull player)}, like XEH does. | |||
= | * name p = Roberto Duarte | ||
* name player = Error: No vehicle | |||
name of unit p is the random created. No [[setIdentity]] in the mission: it would work looking in description.ext/CfgIdentities.<br> | |||
"name player" says there is no vehicle for it, because player is still null. | |||
* | * local p ; local player ; | ||
* isPlayer p ; isPlayer player ; | |||
* name p = alef (2) ; name player = alef (2) ; | |||
Now the name of unit p has been assigned to the player's name. p is player, I suppose is just a check on the player pointer. | |||
name | XEH relevant code for JIP:<pre> | ||
waitUntil{!(isNull player)} | |||
waitUntil{local player}</pre> | |||
==== Call stack in ace tracking for bug #778 ==== | |||
XEH | <pre> | ||
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: register fUpdateUnits | |||
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; | |||
XEH_PreInit_Once.sqf:ace_sys_tracking_initMan = { ace_sys_tracking_units += [_this]; ...} | |||
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 && "<null>" == _x getVariable "ace_sys_tracking_player" | |||
s/fUpdateUnits.sqf: _x setVariable ["ace_sys_tracking_name", name _x] | |||
</pre> |
Latest revision as of 19:30, 31 January 2021
Work in progress
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. However,OFPEC says mission.sqm/init fields are executed too.
Client get data from server. Sickboy's MP page explains that.
JIP test
source
#define SPON_THIS_FILE init.sqf #include "SPON\Core\core.inc.sqf" #include "SPON\Core\macros\macros.inc.sqf" ["DEBUG_CLIENT",9999,true] call compile preprocessFileLineNumbers "SPON\Core\initCore.sqf"; // JIP test only. Put "p" as variable name in mission.sqm for JIP player. #define TEST( xx ) if (xx) then { s=#xx } else { s="not "+#xx }; #define PRINT( xx ) s=#xx+" = "+(xx); #define PRINTF( xx ) s=#xx+" = "+format["%1",(xx)]; c=0; waitUntil { TEST( isNull p ) SPON_TRACE_1( s, c ); TEST( isNull player ) SPON_TRACE_1( s, c ); TEST( local p ) SPON_TRACE_1( s, c ); TEST( local player ) SPON_TRACE_1( s, c ); TEST( isPlayer p ) SPON_TRACE_1( s, c ); TEST( isPlayer player ) SPON_TRACE_1( s, c ); PRINT( name p ) SPON_TRACE_1( s, c ); PRINT( name player ) SPON_TRACE_1( s, c ); PRINTF( vehicle p ) SPON_TRACE_1( s, c ); PRINTF( vehicle player ) SPON_TRACE_1( s, c ); PRINTF( alive p ) SPON_TRACE_1( s, c ); PRINTF( alive player ) SPON_TRACE_1( s, c ); // what about getVariable ? PRINT( p getVariable "undefined" ); SPON_TRACE_1( s, c ); PRINT( player getVariable "undefined" ); SPON_TRACE_1( s, c ); c=c+1; name player != "Error: No vehicle"; };
output (edited)
hosting game (p != player) | ||||||||||||
time | ||||||||||||
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 | ||||||||||||
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 | ||||||||||||
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 |
JIP, monitored with SPON Core, waitUntil name player != "no veh" | ||||||||||||
time | ||||||||||||
p | player | p | player | p | player | p | player | p | player | p | player | |
0 | false | true | false | false | false | false | Roberto Duarte | Error: No vehicle | p | <NULL-object> | true | false |
c=1 | false | true | false | false | false | false | Roberto Duarte | Error: No vehicle | p | <NULL-object> | true | false |
c=2 | false | true | false | false | false | false | Roberto Duarte | Error: No vehicle | p | <NULL-object> | true | false |
c=3 | false | false | true | true | true | true | alef (2) | alef (2) | p | p | true | true |
comments
So what's happened?
ok, as we enter, player is null. so just waitUntil{!(isNull player)}, like XEH does.
- name p = Roberto Duarte
- name player = Error: No vehicle
name of unit p is the random created. No setIdentity in the mission: it would work looking in description.ext/CfgIdentities.
"name player" says there is no vehicle for it, because player is still null.
- local p ; local player ;
- isPlayer p ; isPlayer player ;
- name p = alef (2) ; name player = alef (2) ;
Now the name of unit p has been assigned to the player's name. p is player, I suppose is just a check on the player pointer.
XEH relevant code for JIP:
waitUntil{!(isNull player)} waitUntil{local player}
Call stack in ace tracking for bug #778
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: register fUpdateUnits 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; XEH_PreInit_Once.sqf:ace_sys_tracking_initMan = { ace_sys_tracking_units += [_this]; ...} 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 && "<null>" == _x getVariable "ace_sys_tracking_player" s/fUpdateUnits.sqf: _x setVariable ["ace_sys_tracking_name", name _x]