1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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.

Reset remaining time on HUD

Discussion in 'Unreal Tournament 2003/2004' started by Shadow_knight, Feb 28, 2016.

  1. Shadow_knight

    Shadow_knight Carpe diem!

    Joined:
    Jan 29, 2008
    Messages:
    51
    Likes Received:
    0
    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
     
  2. meowcat

    meowcat take a chance

    Joined:
    Jun 7, 2001
    Messages:
    789
    Likes Received:
    1
    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: Mar 2, 2016
    Shadow_knight likes this.
  3. Shadow_knight

    Shadow_knight Carpe diem!

    Joined:
    Jan 29, 2008
    Messages:
    51
    Likes Received:
    0
    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: Mar 10, 2016
  4. meowcat

    meowcat take a chance

    Joined:
    Jun 7, 2001
    Messages:
    789
    Likes Received:
    1
    Glad you figured it out! What kind of project are you working on? (if you don't mind sharing)
     
  5. Shadow_knight

    Shadow_knight Carpe diem!

    Joined:
    Jan 29, 2008
    Messages:
    51
    Likes Received:
    0
    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
     

Share This Page