Reset remaining time on HUD

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Shadow_knight

Carpe diem!
Jan 29, 2008
51
0
6
Prague
Hi guys.

I've got my own BotDeathMatch class - child of xDeatchMatch class and I want to reset the remaining time of the match. I've implemented this function, that works fine - the remaining time does get reset:

Code:
function RemoteRestartGameState() {

    // resets remaining time in game
    bGameEnded = false;
    bOverTime = false;
    ElapsedTime = NetWait - 3;
    RemainingTime = 60 * TimeLimit;

    GameReplicationInfo.RemainingTime = RemainingTime;
    GameReplicationInfo.RemainingMinute = RemainingTime;
    GameReplicationInfo.ElapsedTime = 0;
    GameReplicationInfo.reset();

    log("Restarting, TimeLimit:" $ TimeLimit $ ";RemainingTime:" $ RemainingTime);
    PlayStartupMessage();
}

However on HUD in game I still see the previous old value of the remaining time:HUDTime.png .
I wasn't able to solve this yet - the time is got in ScoreBoardDeathMatch.uc class, is that right? And that class should use info from GameReplicationInfo, so the code above should work, right? (as GRI is replicated). What am I doing wrong?

Thanks,
sk
 

meowcat

take a chance
Jun 7, 2001
803
3
18
hmm... The code I'm looking at is the 'DrawTimer' function in xinterface.HudCDeathMatch class. It seems that with your change to the GRI time, the HUD should also reflect your reset time. I'd recommend tossing in another log statement to interrogate/check the GameReplicationInfo values for 'remainingtime' etc. right after you call your RemoteRestartGame function (I am assuming that this function is within your xDeathmatch game subclass), just to see if they were set properly.

[edit] have you verified that this function is indeed running on the server? Are you storing a 'local copy' of the RemainingTime variable, and inadvertently placing that back into RemainingTime after you reset your GRI?
 
Last edited:
  • Like
Reactions: Shadow_knight

Shadow_knight

Carpe diem!
Jan 29, 2008
51
0
6
Prague
I think I see the problem now...

The GameReplicationInfo used in that DrawTimer function in HUDCDeathMatch (for some reason I completely missed this function) is using GameReplicationInfo from PlayerOwner class:
GRI = PlayerOwner.GameReplicationInfo;
and I am 99% sure that gets not updated by my code. Will try to fix it. Thanks for pointing me in the right direction, will let you know if it worked.

EDIT: Yes, that was it! Working now! Thanks!
So the lesson learned here for me was, that HUD actually uses GameReplicationInfo defined in PlayerController class for getting the information about the game.
 
Last edited:

meowcat

take a chance
Jun 7, 2001
803
3
18
Glad you figured it out! What kind of project are you working on? (if you don't mind sharing)
 

Shadow_knight

Carpe diem!
Jan 29, 2008
51
0
6
Prague
Glad you figured it out! What kind of project are you working on? (if you don't mind sharing)

Sure. This project is GameBots2004 - it is a mod for UT2004 enabling to prototype your own AI outside the UnrealScript. We have tightly coupled this with our Java framework called Pogamut enabling fast prototyping of AI for UT2004 bots in Java. We are using this for teaching students basics of AI coding in FPS games (part of university course Computer Game Development at Charles University in Prague). You can find more info about the platform here: http://pogamut.cuni.cz
This particular thing I was doing here was for our competition http://www.pogamutcup.com
If you would be interested in our lectures, here is the link to latest ones: http://pogamut.cuni.cz/pogamut-devel/doku.php?id=human-like_artifical_agents_2014-15_summer_semester

Best,
sk