This problem is so specific It’s going to be hard to describe, but basically I have this counter set up and attached to IA_Move. This system counts how much the player has traveled and plays a footstep sound when the max distance is reached.
The issue is, usually the sound plays about once a second with normal movement speed, but when I play the game in stand alone mode, or after packaging, the interval decreases to about once every 2 seconds.
I realized, that the V-sync is on (or at least I assumed it was on), limiting the game to 60FPS, but my editor runs in 120. Of course, the IA_Move must be tied to the fps, so I unlock the FPS via t.maxfps 120 and it works fine, but then, just out of curiosity, I set t.maxfps to 10 and it still worked. I set it back to 60 again and the interval was in fact 1 second.
I tied up a print to an event tick and it does count up the distance slower until I change fps to literally anything. This only happens in standalone releases of the game, in-editor one works perfectly fine and so does my other game, which uses the exact same system.
My current hack solution is to force the game to execute the “t.maxfps 120” command on start up, but I am genuinely perplexed as to what’s happening and would love to get an answer.
For reference, some quick tests showed that a distance of 2000 units gets me almost 3 footsteps before the command and 4,5 foot streps normally/after inputting the command
Hey there @V_vix! Is your project 3D or 2D? If you’re using 3D animations, you could instead use animation notifies on foot plants and that’d automatically handle the timing on footsteps once setup.
Understandable! If you do ever intend to go with animations, that’d be where I’d implement the footsteps as before that (prototyping/working with capsules) I’d ignore it until then to save you the extra work/headache.
Though to correct this I’d usually recommend tying to tie it to delta time but it seems you already have so this is entirely odd. Something is happening specifically at the standard 60. I’m going to try and replicate this to see if I can get a grip on what’s affecting it.
Thanks. Although it might be hard to replicate, as I used this code already in other projects and it never had similar issues. I could try to package my game into a zip file for you to have the original thing to compare to if that would help in nailing down the issue.
Just a quick info about the Editor and VSync: It seems, that to get VSync actually working properly with the Editor, you need to use a special console command.
I had some graphic problems in some of my 2D test projects, which were VSync related, and it turned out, that VSync never actually worked on my machine in the editor, despite it being turned on.
Use that command to make sure, that it works for your editor too, then maybe you can figure out more easily, what is going on with your code and counter. (i just added that to my character at the “Begin play” event)
I can absolutely take a look into it to see if I can find anything out if you’d like, though it could be related to the way Vsync works in editor, so that’d track with what @Suthriel was saying. Do builds work appropriately?