Troubleshooting Performance

Io

So I'm almost done with a game - a handful of scenes to write, followed by typo/bug/balance hunting. All the actual coding is done.

Problem is, as I test it, sometimes I get... REALLY bad performance. Specifically during fight scenes, due to how they're coded. Like, the first ~2 paragraphs would display, there'd be a notable pause, and then the rest would fill in all at once. It seems to get worse as the game is played longer.

Now, I haven't deliberately tested for the performance issue's cause yet; that'll be the typo/bug/balance thing I highlighted. So I'm not looking for ideas on what could be causing it after posting a metric ton of code onto this site.

What I'm looking for is general ways I can measure the game's performance, general things to look out for, that I can keep in mind for when I do start specifically hunting down the performance issues.

(My current suspect is that destroy() isn't erasing as thoroughly as I'd like. Anyone have a link to how destroy() handles the stuff it mulches?)


I thought it was... Nevermind.

Could you paste your code?


I can't give you general tips, but have you ever tried to avoid destroy() completely? Simply move unneeded objects into a trash room


Io

@Pertex My game uses a lot of cloning objects, so there'd be a LOT of unneeded objects simply tossing them into another room.


Io

@jmnevil54 that's not really practical, because there's a LOT of it. I'll give the short version.

When starting a fight, clone FighterCharacterBase, move to the Fight Room, and set their attributes.

During a fight, order is:

Player Takes Turn
Update everything's stats and status effects (Status effects supplied by clones of BuffBase object)
Check if Fight is Over

If Not, for each Ally still in the fight, have them take their turn
Update everything's stats after each Ally's turn
Check if Fight is over after each Ally's turn

If every Ally has taken their turn and the fight is still going, have each enemy take their turn
Update everything's stats after each Enemy's turn
Check if Fight is over after each Enemy's turn

If every Enemy has taken their turn and the fight is still going, let the player take another turn

If fight ends, destroy unneeded clones (Like Faceless Enemy Soldier #5364), give any needed XP and Money, and move player back to conventional rooms.

You could put in a few print messages around where there's a pause to see exactly where the delay is.


Io

Dcoder, how would that work? I can only imagine that being useful if it ONLY fires in the event OF a delay.


Like, the first ~2 paragraphs would display, there'd be a notable pause, and then the rest would fill in all at once

Does this occur in the web player, or only on desktop?

I'd second Dcoder's suggestion. Adding a bunch of messages as it goes through the code means that by watching it, you can see exactly where in the code the delay is happening. As Quest's backend isn't multithreaded, if there's one particular piece of code running slowly you should be able to pin it down quite well.


Put print messages directly before and after code that you suspect might be causing the delay. If there is a pause after the first message but before the second, then you at least have isolated a problem area.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums