xp_inactivitySpectator and server-side demos

6 replies [Last post]
GrosBedo
grosbedo's picture
Offline
Joined: May 2010
Posts:

Hello,

I'm currently making an engine patch to allow server-side demos recording on OpenArena (which patch should be easily portable to ioquake3), and I face a problem with xp_inactivitySpectator, which sets democlients to spectators (because of course democlients aren't real clients but simulated clients).

So I would like to know more informations on this cvar: how does it work? On what field does it bases its timing?

I assumed that it was based on about the same principle as g_inactivity, so I added the simulation of usercmd_t, but it doesn't work better...

Thank you for reading me,
GrosBedo

0MS
Offline
Joined: Apr 2010
Posts:
Re: xp_inactivitySpectator and server-side demos

It must be something like this ( but with xp_inactivitySpectator instead of g_inactivity ) -->

GrosBedo
grosbedo's picture
Offline
Joined: May 2010
Posts:
Re: xp_inactivitySpectator and server-side demos

It seems not, at first I thought it was a similar approach that was taken for xp_inactivitySpectator as g_inactivity, but since replaying usercmd_t packets (and so user movement) does not break the timer, I think it must rely on something else than user movement.

Can an E+ dev give some more details please?

D e c e m b e r
Developer
brb24hours's picture
Offline
Joined: Aug 2008
Posts:
Re: xp_inactivitySpectator and server-side demos

Make sure that your simulated usercmd_t packets are read from within GAME_CLIENT_THINK vmcall. It will reset the timer if either forwardmove or rightmove or upmove or BUTTON_ATTACK was nonzero right before GAME_RUN_FRAME. It will also ignore the timer if SVF_BOT flag was set or userinfo IP is "localhost".

0MS
Offline
Joined: Apr 2010
Posts:
Re: xp_inactivitySpectator and server-side demos

this -->

GrosBedo
grosbedo's picture
Offline
Joined: May 2010
Posts:
Re: xp_inactivitySpectator and server-side demos

Thank's a lot for the quick replies, and for posting the code!

I'll take a closer look later.

GrosBedo
grosbedo's picture
Offline
Joined: May 2010
Posts:
Re: xp_inactivitySpectator and server-side demos

Ok thank's this is now fixed.

In fact it's not possible to directly set the ip key to the userinfo, one must craft a fake remoteAddress (because SV_UserinfoChanged() will change the ip key depending on the remoteAddress). That was why localClient was not set.

Feel free to test the patch, it's pretty much stable now and works with ExcessivePlus (if not, please feedback and post the bugs!).