So, by good ol' trial and error, I managed to find the problem.
It's the system file.
I still can't find the issue with it. I'm 100% sure there are no problems with the pause and replay scripts, because when I excluded them from the system file, the lag still persisted.
I've been looking at it for hours now, and I'm still struggling. (I swear if it's going to be something glaringly obvious--)
Here's my system script.
You'll need more trial and error. The fun just started.
Start commenting out everything in
@Initialize.
Everything.- Now start from the top by removing the comment from
InitFrame(); first.
- Run your game > observe Log Window for threads, tasks, objects, shots, etc.
- If lag / fps drop > you found your problematic thread/task.
- If no lag, uncomment the next line > repeat from run game.
In the mean while I'll use this system file on my own end to observe and repeat same steps when there is lag.
EditWell, it is as I suspected. There is a reason why I told you to observe your Log Window. It is your best friend with detecting lag and such. Always use it when debugging/testing these things. If you haven't activated your log window. Shame on you! :flamingv:
So quickly activate it here.
[attach=1]
Now your problem is that there are objects being created endlessly.
[attach=2]
See how first there were ~500 and few moments later there are over 5000? Apply the above trial & error to find which task is responsible for this.
Edit 2- Upon enabling TBossLife(); I started seeing object_count going up.
Edit 3At Line #290 you're creating an object inside
function RenderLife(); which is called when
ObjScene statement is no longer invalid (the loop calls the function thus you're continuously making objects). You might want to deal with that, so the object is created once and then mutated/modified instead of recreated. No idea what you're trying to achieve here. But that might be source of your problems.
Make sure you check the rest of your script. Don't just stop here. Comment out the obj2 creation and continue checking other tasks for similar behaviour.
Hope you learned some effective trial & error. Will save you struggling in future