magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Apr 10, 2021 5:12:41 GMT
I can't create a reproduction project at this time so I'm hoping you can think of something that might point me in the right direction on an issue I'm having. As far as I can tell I'm only seeing this on one level so that makes it even stranger.
So, what I have are the first 2 levels of my game where the first level has only a single spawner with some repeats. This works fine. Then I have Level 2 where the first wave spawns 8 enemies and then has 6 repeats with a Repeat Pause Min/Max set to 2 seconds. The first batch of 8 enemies works fine, but after 2 seconds the first repeat does not kick in. It's taking maybe 5-10 times that long before the repeat kicks in. And every repeat for this wave has the same problem.
However, and here's the weird part, if I run the game and start from Level 2 instead of starting from Level 1 then Level 2 works fine and the repeats happen regularly at 2 seconds. So, for some reason each repeat takes way too long when the levels are run in sequence, but works correct when I just run the level by itself.
I upgraded to the latest version tonight just to see if there might have been an issue with the version I had, but nothing changed.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Apr 10, 2021 20:39:51 GMT
OK, so I'm debugging this now and here is what I see. When this issue occurs I am looking at the checks in WaveSyncroPrefabSpawner::Update method. It is rejecting the wave repeat on the first condition. Here are the values at the time it's supposed to repeat:
Time.time = 122.6847, _waveStartTime = 122.6847, WavePauseTime = 16.56292
Which means that the calculations for the check become:
Time.time - _waveStartTime - WavePauseTime = -16.56292, WaveDelay = 0
Since the calculation is -16.56292 and that is less than WaveDelay, it does not start the wave. So, I'm checking now why the LevelSettings.WavePauseTime has this strange value. I don't know why there would be any pause time there at all. I'll post again when I find the cause of that part.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Apr 10, 2021 21:06:06 GMT
I found that the value is set in UnPauseWave as follows:
_wavePausedTime = Time.realtimeSinceStartup - _lastWavePauseTime;
I really don't know what this _wavePaused Time is supposed to be used for, but it doesn't seem to be used correctly in the case of a wave repeat as far as I can tell. What seems to be the result is that when waves are paused so I can transition to another level then this _wavePausedTime gets set to that pause time. And then it's used for every wave repeat on the next level. But why? I have no clue. So, for now I just added an extra check to make sure that one calculation that is negative is ignored if it's negative and that fixes my problem
|
|
|
Post by DarkTonic Dev on Apr 11, 2021 2:22:58 GMT
I'm not sure either, haven't looked at the code yet. Go ahead and send me your change and I will take a look. And let me know what line numbers in what file.
|
|
|
Post by DarkTonic Dev on Apr 11, 2021 5:49:04 GMT
Your fix is correct, it's in the next update. Thanks!
|
|