Download

Weird issue: firing a missile for the first time hangs the game for a few seconds (solved)

Hi,
I’m making a small space game, where ships are able to fire missiles.
The game works perfectly fine as I want it, except for one very weird issue.

After I open the editor, the FIRST time I preview the game and try to fire a missile, the game is stuck for about 5 seconds. Nothing happens, the game is frozen.
Then the missile is launched and the game goes on normally.

If I try to preview the game again, the game works perfectly normal, and the issue doesn’t show up again.
If I close the editor and re-open it, I have again the same issue.

I tried to add the missile object into the level, in case it’s an asset loading issue. No change. I added both the specific missile fired and its “master missile” parent object class. No change.

I try to log these events in the Session Frontend, but I only see “CPU Stall, Wait for Event” for a few seconds. I could not find any other clue of what instruction or process is causing this issue.

Anyone has any clue of what is happening?
Also random recommendations on where to look for clues are appreciated! :slight_smile:

look like an asset issue since it can play smooth on cache/ram, better isolate the issue to test if it only the missile or other things. Try to reduce it tris or texture resolution or remove it animation.

Hi Arodi, thanks for the advice :slight_smile:

I actually managed to find the issue in the meantime, by using the Session Frontend.
It was quite a sneaky issue, due to a plug-in function I use to avoid the missile to hit the shield of its own ship when launched.

I followed these steps:

  • I used the command ‘stat startfile’ to produce a log, then opened it in Session Frontend
  • I found a big peak of lag where the ‘hanging time’ was. I selected only the time period of the lag for analysis
  • I found ‘GameThread’ and opened it, going to the root process causing the lag
  • I found it was MasterMissile.DisableCollision, a function from a plugin I downloaded from the Markeplace

Now, the DisableCollision function wasn’t the actual culprit: I was using the function both in BeginPlay and in an InitializeMissile function I had made from an Interface.
The DisableCollision in the Interface was causing the issue, I have no idea why.
I removed the DisableCollision from the Interface call and left it in the BeginPlay block.

The issue has disappeared.
No idea why exactly :slight_smile: I guess I have to be careful in calling plugin function libraries from Interfaces, who knows… :slight_smile:

2 Likes