Forcing intermission countdown via server-side

With the OSP mod, if none of the players are /ready, the server will sit in intermission endlessly.

I’m trying to force the intermission process to begin (from the server code only).

level.readyToExit = qtrue;
level.exitTime = level.time;

This returns the following error:

code/server/sv_game.c:168:20: error: ‘level’ undeclared (first use in this function)

I’ve tried using svs. instead of level to no avail.

Can anyone point me in the right direction? Thanks.

You can’t access the level structure from the server side. This is only within mod code.

How about then being able to set the ready state of each client? For example:

cl->ps.stats[STAT_CLIENTS_READY] = 1;

It’s set every frame while in intermission waiting by gamecode.

And changing the engine for mod stuff is still wrong. Because then you assume its always the same value etc.

But, you’re saying, it is possible to overwrite the STAT_CLIENTS_READY value for each player via the server code. It’s just not advisable?

If I have spectators who are idling, and bots are playing instead of actual players, it will sit endlessly in the intermission state with OSP.

I know you can read values like this: SV_GameClientNum(killerID)->stats[STAT_ARMOR] — But, is it possible to change the values, as far as the server is concerned, too?

No, you won’t be able to change it. It’ll just get set back.

And I was advising against what you are trying to do as a whole making server code to fix OSP.

Such as adjusting STAT_HEALTH won’t actually update ent->health.

Wouldn’t this cvar accomplish what you’re trying to do?

seta g_doWarmup 0

MANATARMS, no. The warmup period cvar you’re referring to is when a map first starts. Intermission is when a map ends (eg: fraglimit or timelimit has been met & scoreboard is shown).

I’ve come across multiple servers now which automatically set your stats[STAT_CLIENTS_READY] to 1 during intermission to force the OSP intermission to end in 10 seconds.

So, this has to be possible.

Does anyone have any suggestions on how to do this?

SV_GameClientNum(killerID)->stats[STAT_CLIENTS_READY] can read the info, but not set it.

There’s got to be some way of forcing stats[STAT_CLIENTS_READY] during intermission. New players are just sitting in intermission, not realizing they need to click mouse1 to change their status to ready. OSP just sits there indefinitely unless someone is ready.

There’s multiple other servers currently doing it.

Anyone have any suggestions, no matter what type of sloppy, hack-job it might be?


It seems I might just be able to force it through: CheckIntermissionExit()

I had some code archived where I’d played with this. All I could find was this… in g_main.c about line ± 1555 theres a function-
void CheckIntermissionExit( void )

I never did anything fancy with it, but this will get you started. It’s the heart and soul of the intermission with players waiting.
The pieces parts are pretty well labeled and a number of years ago, I pretty much got it to work even with my limited knowledge at the time.
It starts with // see which players are ready, and goes on down through,
// never exit in less than five seconds, and on from there. I’ll look for my old code and see if I can find it. Try it and see though. It’s pretty clear cut.

Yup. That’s where I’m at right now. (Check last line from my previous post). Thanks though.

Ha, should have scrolled down a tad… anyway, I’d be happy to share if I find it… still looking. :slight_smile:

I take it there is no source code available for OSP, so that is why you need to do this modification in the engine? I’m not familiar with OSP specifically, but what does it do at the end of intermission? Does it just start another map or do some more specialized operation? If its specialized, one sloppy approach would be to simulate a click (attack) usercmd from all the unready clients when you want to force the exit.

Ok, this was so simple, but I remember it took me forever fiddling with the code. It’s trickier then it looks was my opinion. This worked, I forget why I did it like this, it’s been like six years since I played with it. But it could get you started.

void CheckIntermissionExit( void ) {
int ready, notReady;
int i;
gclient_t *cl;
int readyMask;

//Clint
// if we have waited ten seconds since at least one player
// wanted to exit, go ahead
if ( level.time < level.exitTime + 10000 ) {
return;
}

// never exit in less than five seconds
if ( level.time < level.intermissiontime + 5000 ) {
	return;
}

ExitLevel();

//endClint
if ( g_gametype.integer == GT_SINGLE_PLAYER ) {
return;
}

// see which players are ready

Obviously I just cut and pasted, rearranging existing code did it for me.

OSP is closed source. And it does absolutely nothing during intermission, it just sits there waiting for a player to issue the attack command. So, if there’s a player or two who are AFK in spectator mode and the only active players are bots, it’ll just sit endlessly in intermission and never switch maps.

Any idea on how to force through a attack command for a client?

Thanks. I’ll try it out.

If all it does is switch maps, is there anything stopping you from just running the map command and not even worrying about whether players are ready?

With OSP, you can have custom map configuration files. And if the server calls /map, OSP doesn’t load up the individual map’s custom settings.

Would it be possible to send the attack command via:

VM_Call( gvm, GAME_CLIENT_COMMAND, cl - svs.clients );


Update: Didn’t work. All this is for is when clients enter commands like /say blah, /join team, /kill, etc