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.

UE1 - UT What's wrong with Deltatime online?

Discussion in 'Programming' started by XxDangerxX, Jul 20, 2008.

  1. XxDangerxX

    XxDangerxX New Member

    Joined:
    Jan 20, 2008
    Messages:
    128
    Likes Received:
    0
    To clarify, I am referring to function Tick()'s float variable, (usually) known as Deltatime.

    When I define function Tick, it is called offline with a correct deltatime, properly showing the time between the last tick and the current tick. When I run it online, however, the deltatime that is defined when Tick() is called is many times what it should be. I'm finding that 3-5 seconds worth of operation is executed in just 1 second. This is hazardous to my Inventory's charge, which depletes itself based on the deltatime, at a rate much faster than the proper rate demonstrated in a standalone game.

    I could use function Timer(), but it is already in use as inherited (and slightly modified) code from the Inventory's superclass, UT_JumpBoots.

    What's wrong, and how can I fix it?

    To aid your investigations, here is the source code for my JetBoots.

    Any and all help is greatly appreciated. :)

    EDIT:
    The Deltatime problem might be related to a problem with Timer that I have found. I call SetTimer(0.05,true) and Timer() gets called every second, by the looks of it.

    It's not something wrong with my machine, for the record, because the class 'flakslug' calls Timer() every 0.04 seconds successfully. I don't know why it works for the flakslug but not for the JetBoots. it's very frustrating. What variables do I need to change??

    Anyway, I found this Timer problem because I:
    figured out what the UT_JumpBoots' original timer did -> concluded I didn't need it -> moved appropriate code from Tick() into Timer()

    So here's an updated version of the mod with the attempted Timer fix:
     

    Attached Files:

    Last edited: Jul 21, 2008
  2. Wormbo

    Wormbo Administrator Staff Member

    Joined:
    Jun 4, 2001
    Messages:
    5,911
    Likes Received:
    35
    UT does not properly recognize modern CPUs' dynamic clock speed. Sometimes it'll run a lot faster than usual. That is not related to online/offline play.
     
  3. XxDangerxX

    XxDangerxX New Member

    Joined:
    Jan 20, 2008
    Messages:
    128
    Likes Received:
    0
    So what you're saying is that it's just a coincidence that Deltatime is consistently perfect offline and incorrect online?

    I don't think my CPU's clock speed is dynamic. The core I have assigned to UT runs at full speed, at least while UT is running. I have set UT process priority to Realtime.

    As for the Timer, turns out I overlooked UT_JumpBoots calling SetTimer(1.0,true) in PickupFunction(). I just redefined the function and deleted the SetTimer() call and it worked!

    My jetboots are making major headway now. They're almost ready to be released at Beta! I just have to make some final touches...

    EDIT:

    OK, I haven't tested it yet, but I think I know what the problem is. when I click "Dedicated" and the button calls the console command "relaunch etc", it doesn't include the "-CPUSPEED=2500" switch that I put in the command line. Maybe it'll work when I use the dedicated server shortcut I have. Of course I have no intention to test it. I'll just trust it works until I find it doesn't (which is pretty likely in the case that I begin a new coding endeavour).
     
    Last edited: Aug 10, 2008
  4. Zur

    Zur surrealistic mad cow

    Joined:
    Jul 8, 2002
    Messages:
    11,717
    Likes Received:
    4
    I think what Wormbo means is that the approach UT uses to quantify time doesn't work properly on more recent computers.
     
  5. XxDangerxX

    XxDangerxX New Member

    Joined:
    Jan 20, 2008
    Messages:
    128
    Likes Received:
    0
    Is there a way to make Windows or, possibly, my CPU support UT in that respect? As in make UT run correctly while using all 4 cores of my AMD Phenom 9850?

    My friend (XxDeadlyxX / deado - as you may know him) has an Intel quad and he has no troubles. Surely there's a way...?
     
  6. Wormbo

    Wormbo Administrator Staff Member

    Joined:
    Jun 4, 2001
    Messages:
    5,911
    Likes Received:
    35
    UT (and UT2003, btw.) simply don't work if they run on more than one core. There's no problem with hyper-threading on a single core, but if the UT process switches between different cores, time calculations will break.
     
  7. Zur

    Zur surrealistic mad cow

    Joined:
    Jul 8, 2002
    Messages:
    11,717
    Likes Received:
    4
    It's a problem with many games from circa 98-99. I read somewhere that the way the new cpus work kind of bork the timing. That's why you'll get some people detected as speedhacking when they've done nothing.

    I guess one solution would be to set core affinity or use the executable that Baiter posted on UnrealAdmin. You can also set the priority level of the program to high or real-time to increase the load.
     
  8. XxDangerxX

    XxDangerxX New Member

    Joined:
    Jan 20, 2008
    Messages:
    128
    Likes Received:
    0
    I know. I've done all that. I've got imagecfg to configure the affinity (which has come in very handy :-)) and everything, but nothing of what either of you said explains why my friend has had no trouble running UT with his Intel quad core.
     
  9. elmuerte

    elmuerte Master of Science

    Joined:
    Jan 25, 2000
    Messages:
    1,936
    Likes Received:
    0
    it's not a quad core issue, it's an issue with all scaleable CPUs, which is pretty much every CPU since 2004. For example AMD64 has the same issues. You can test it by loading a level, look at the ground and run around. You should notice speedsup and slowdowns in the walking. The problem is much less noticeable when you disable the CPU scaling features.
     
  10. eblade

    eblade New Member

    Joined:
    Jan 29, 2006
    Messages:
    113
    Likes Received:
    0
    Hm. I guess this explains why an item i made for land of the dead (engine 2226, same as ut03) that is dependent upon deltatime to calculate it's remaining power lasts approximately 10 times longer online than it does standalone. interesting.
     
  11. XxDangerxX

    XxDangerxX New Member

    Joined:
    Jan 20, 2008
    Messages:
    128
    Likes Received:
    0
    Ahhh, OK so it's about the speed scaling!

    Please please please tell me how I can change it!! :)
     

Share This Page