Technical question about VOTE string


#1

Hello everyone who read this!

My question is concerning something I consider as a bug in idtech3, though I’m not 100% sure if it is a bug at all!

THE (possible) BUG:
In some specific situations the VOTE string (most notably with Team Arena mod) don’t vanish. The text/string will stay on screen until a new map restart. This happens if more than one vote is called. For example you vote for a new map, and realize you voted for the wrong map and will vote again for the correct map you was looking for.
It seems as if the vote commands are added in a vote queue, but I never saw that the vote system is working like this, maybe I missed something here…

HOW TO REPRODUCE:

  1. Start Team Arena mod (either via Spearmint or ioquake3).
  2. Start any map e.g.: q3dm1.
  3. Now open the VOTE menu and vote for a new/different map (e.g.: q3dm2).
  4. The menu will close, immediatly before the new map will restart bring down the VOTE menu again and vote for another different map (e.g.: q3dm3).
  5. Now the first map voted for will start and the Vote string: Vote: Yes: 0, No: 0. Press F1 to vote for Yes or F2 to vote for No (or press ESC then click Vote). will appear on screen.
  6. No matter what you do, the vote string will not disappear, as long as a new map restart will happen.

Now my QUESTIONS are:
A: Is this a common idtech3 bug, or is this behaviour intentionally?
B: Personally I find this behaviour annoying, does someone know how to fix this, even if it isn’t a bug at all?

All suggestions and every information is welcome!
Thank you!


#2

Work around: CGame doesn’t check for vote configstrings when it starts (which is a bug) so running vid_restart will stop drawing the vote string. :sunglasses:


What you describe is a bug. When the second callvote happens Cmd_CallVote_f() sees that there was a vote that hasn’t been executed yet. The vote string is added to the command buffer so it’s executed when the server runs Cbuf_Execute().

Cmd_CallVote_f()

	// if there is still a vote to be executed
	if ( level.voteExecuteTime ) {
		level.voteExecuteTime = 0;
		trap_SendConsoleCommand( EXEC_APPEND, va("%s\n", level.voteString ) );
	}

Then Cmd_CallVote_f() sets up the new vote which adds pending reliable “cs” commands with the vote configstring changes. The server runs Cbuf_Execute() and changes map and clears configstrings. The client reliable commands still have “cs” commands. The next snapshot will contain the map change and the configstrings changes (“cs” reliable commands) from before the map change resulting in the client having different configstrings than the server!

So the client has configstrings not set on the server and display the message for a vote that does not exist on the server.

Running configstrings; vid_restart; configstrings; first list has the vote strings but second list does not because server does not have them set.


The simplest solution is probably to drop call vote when already voted to change maps.

Cmd_CallVote_f()

	// if there is still a vote to be executed
	if ( level.voteExecuteTime ) {
		// don't start a vote when map change or restart is in progress
		if ( !Q_stricmpn( level.voteString, "map", 3 )
			|| !Q_stricmpn( level.voteString, "nextmap ", 7 ) ) {
			trap_SendServerCommand( ent-g_entities, "print \"Vote after map change.\n\"" );
			return;
		}

		level.voteExecuteTime = 0;
		trap_SendConsoleCommand( EXEC_APPEND, va("%s\n", level.voteString ) );
	}

Alternatively the game VM could handle carrying the vote across map change. Though, CGame always disables vote string when map_restart happens and CGame doesn’t check for vote on start up. So unless CGame is changed, carrying the call vote across map change/restart seems like a bad idea.

This could be solved by fixing the issue where clients have different configstrings than the server. However, then callvote just forces map change and the vote disappears so it doesn’t really serve a purpose. It’s probably still a good idea to ignore callvote after voted for map change.


#3

Thank you very much zturtleman!

The solution you suggested works fine!
Code is applied and credit is given to you on my personal Spearmint project!
Probably useful for all Spearmint mods and even ioquake3!
Anyways,…

Thanks a lot! :+1: