Fortress Forever

Go Back   Fortress Forever > Projects > Fortress Forever > Feature

Round timer issue for map extensions Issue Tools
issueid=394 06-13-2012 08:04 PM
Nade Whore
Round timer issue for map extensions

Currently, the clock just sits at 0:00, even though there is an extra 15 minutes in the map after it's been extended.

Could it be made so the map timer changes to however much time the map was extended for?
Issue Details
Issue Type Feature
Project Fortress Forever
Category General Game
Status Suggested
Priority 5 - Medium
Suggested Version Undefined
Implemented Version (none)
Votes for this feature 0
Votes against this feature 0
Assigned Users (none)
Tags (none)

06-13-2012 08:44 PM
Stuff Do-er
 
Would need to see how the plugin extends the round. Which plugin are you using?
Reply
06-13-2012 11:15 PM
Nade Whore
 
I believe it's the mapchooser plugin unless there is a RTV initiated, in which case the rockthevote plugin comes into play. Both plugins, you are able to extend the map.
Reply
06-14-2012 03:39 AM
Stuff Do-er
 
SourceMod? AMX?

A link to the source code of one of the plugins in question would be most helpful, I think.
Reply
06-14-2012 03:59 AM
Nade Whore
 
Sourcemod

http://mildsclan.com/mapchooser.sp
http://mildsclan.com/rockthevote.sp

Right click and save as unless you want it to open in your browser.
Reply
06-14-2012 05:25 AM
Stuff Do-er
 
I did a fix for this when Lua changes mp_timelimit, but it doesn't look like it applies to SourceMod because SourceMod is using cvar->SetValue() which doesn't update the client when the cvar is server-side and replicated.

Will have to look into it more. Might be out of our hands without doing something weird, though.
Reply
06-14-2012 05:38 AM
Stuff Do-er
 
Out of curiosity, do any other Source mods/games have a similar issue with a SourceMod plugin extending the map?
Reply
06-14-2012 01:27 PM
UI Designer
Front-End Developer
 
Quote:
Originally Posted by squeek.
Out of curiosity, do any other Source mods/games have a similar issue with a SourceMod plugin extending the map?
It's just the FF Timer that does it, running a timeleft with sourcemod shows the correct timeleft.
Reply
06-14-2012 09:47 PM
Stuff Do-er
 
Yes, because the server has the correct time. The client doesn't get updated of the new value when the cvar is updated internally (cvar->SetValue), so therefore the client-side timer doesn't get updated.

I don't know how to go about fixing the problem, because I'm not sure how replicated cvars are meant to update the client and why it's not working.
Reply
06-14-2012 11:40 PM
Nade Whore
 
Well, if the time extends for 15 minutes, wouldn't the updated time left on the server then allow the hud timer to look at that new time left and somehow update to that value?

Or, maybe a negative timer instead that just puts a - in front of the time and starts to count upward whenever the map gets extended?
Reply
06-15-2012 12:54 AM
Stuff Do-er
 
You're missing what the actual problem is. Here is an analogy to try to explain:

A guy named Server has 15 things. He tells Client he has 15 things and he promises Client he will tell him if he ever gains or loses things. Server then gains 5 more things, but doesn't tell Client because Bug told him not to and didn't give a reason. Client still thinks Server has 15 things, and reassures his pal User that Server still has 15 things, even though Server now has 20 things. Client never gets told about the additional 5 things, and keeps telling User over and over that Server still only has 15 things.

So, there are two possible fixes: 1) Figure out why Bug is such a jerk and make him stop telling Server not to update Client (potentially complicated and might delve into code we don't have access to, like how cvars are replicated in the first place); 2) Do some weird thing like force Client to ask Server at regular intervals if things have changed, which is not a great solution and wouldn't solve the underlying problem caused by Bug.
Reply
06-15-2012 01:01 AM
 
Squeek that story made my peepee hard.
Reply
06-15-2012 01:19 AM
Nade Whore
 
Quote:
Originally Posted by squeek.
2) Do some weird thing like force Client to ask Server at regular intervals if things have changed, which is not a great solution and wouldn't solve the underlying problem caused by Bug.
Well that could probably work well at least for map end votes to extend. You could just have the Client ask the Server when the time limit is just about to reach 00:00, to see if the intervals have changed. Once the interval changes, that new time becomes the actual time left. When another map end vote is initiated and the map gets extended a 2nd time, the new updated time will now be near 00:00 again and thus be able to continue to update the time.

But for initiating a RTV mid map, it probably wouldn't work too well unless you did the check every second for an updated time from Server, which I would assume could potentially cause the server to lag.
Reply
06-18-2012 02:35 AM
Community Member
 
Maybe contact the plug in coder and possibly he can issue a fix for this?
Reply
06-18-2012 11:25 PM
QUAD ROCKET
 
If the cvar is replicated then the client should have the same value as the server. You can create callbacks when a cvar is changed.

Taken directly from valves developer site (this should work in the client dll?):
Quote:
Sometimes you also want a notification when a user's or another subsystem changes your ConVar value, therefore a callback function can be installed:

Code:
static void OnChangeMyVariable ( IConVar *var, const char *pOldValue, float flOldValue )
{
	DevMsg( "ConVar %s was changed from %s to %s\n", var->GetName(), pOldString, (( ConVar* )var)->GetString() );
}
 
ConVar my_variable( "my_variable", "42", 0, "My favorite number", OnChangeMyVariable );
Reply
06-22-2012 02:32 AM
Stuff Do-er
 
Callback doesn't get called on the client when using cvar->SetValue. Looks like we'd need to force an update of all clients from inside the server's callback function or something (I don't know how to do that).
Reply
06-24-2012 08:07 PM
QUAD ROCKET
 
I wasn't 100% sure if the callback worked on the client or not. I figured it would since there can be client side only cvars (all cl_ cvars are client-side only right?)

But if callbacks won't work on the client you can try using a game event or usermessage. I would probably just stick with a game event for updating the time.
Reply
06-24-2012 08:43 PM
Stuff Do-er
 
Good thinking.

Normally, callbacks do get called on the client. It doesn't get called on the client in this instance because of a bug with replicated cvars. If they get their value set server-side by cvar->SetValue(), the server seems to bypass replication to clients. If you do it using ServerCommand( "mp_timelimit x" ), it replicates just fine.
Reply
Reply

Issue Tools
Subscribe to this issue

All times are GMT. The time now is 11:47 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.