No announcement yet.

Help Optimizing Game Thread

  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    After checking and rechecking code i could not get a decent amount of enemies moving about so I have changed my enemies to be crowd agents.
    Crowd agents are not really suited to be enemies but with a little tweeking they work fine. As moving the pawns had the greatest impact on performance, crowd agents remove that impact.
    Now i can have 20 of my basic enemies with dynamic lights and shadows working at +30fps on the iphone4s where as before i got up to 5-6 with 25-30 fps.

    I could have probably just implemented the crowd movement on my pawns but i dont know how to do that so i just implemented my enemies as crowd agents.
    Hope this helps some one.


    Leave a comment:

  • replied
    Nice solutions

    Leave a comment:

  • replied
    Ok so after many deploys to the phone I have got it to work at an average of 30 fps, with a couple of drops to 25-20 on the most heavy parts of the level which now need to be made lighter.
    So for any one interested:
    I started out by trying to get rid of most of the peaks in framedrop by spreading stuff over time, AI Spawns and Loot Drops.
    This 2 are now handled by a "loot manager" and "spawn manager" and requests for spawns are added to an array and then the Managers spawn them in the tick function with a limit to spawn per frame, set to 1 by default, so now only 1 piece of loot and 1 ai can be spawned in a single frame.
    Also sounds, sounds are quite costly so sounds that get played a lot go through a manager TryPlaySound(soundcue cue) that holds an array of AudioComponents, if that cue that is trying to play exists in the array it will try to play it if its not already playing, if its not in the array it will create a component for that cue and play that sound. This also helped quite a bit reducing peaks when several sounds overlaped.

    With those peaks out of the way i got constant frame drops (ie, this area here with this spawns works at a constant 20fps, no more 25-15-20-30-10...) and started doing what Spoondog sugested.
    So deploy just an empty map with a bsp floor: excelent results over 20 enemies all trying to kill me with full skeletal animations working fine. (just to check it wasnt something on the ai/movement side of script.
    Deploy just the ground collision mesh -> same results as above.
    Deploy collision mesh + non collidable static meshes and lights -> still good results, no severe increase in game thread on moving.
    Deploy all the above with collidable static meshes -> slight drop but still good.
    Deploy all the above + a few kactors we have -> terrible, this kactors have no update in dynamic ligts and none of them are active however calculating collisions with them when moving any actor was costly.

    Solution: Kactors now if they are 1500uu away from player party down and remove collision, physics and disable tick.
    The player then has a slow tick (looping timer set at 0.5sec) that checks for kactors in a 1000uu radius and activates them)
    This has left the whole level at a very decent frame rate without having to sacrifice any visual stuff, the next step will go through the lower frame rate areas of the level and removing the offending actors/spawns.

    Thanks for the help, and hope this helps some one.

    Leave a comment:

  • replied
    Thanks Spoondog, im gonna give that a try see if i can narrow down the issue, cheers.

    Leave a comment:

  • replied
    Do you have more than one map? Does it do the same thing in another map? Sometimes weird things can cause huge slowdowns e.g. a colliding mesh being outside the unreal grid (octree warning in the log) or a mesh having any scale set to 0. I'd be trying to rule those things out before crunching content too hard (save out different versions and try them all, one without any BSP, one without static meshes, one without the big collision meshes, until you narrow it down).

    Also assuming you've seen this page:

    Leave a comment:

  • started a topic Help Optimizing Game Thread

    Help Optimizing Game Thread

    Hi, im getting a slowish frame rate on an iphone4s.
    The draw calls and the render thread are working fine, the bottle kneck is the game thread, specially when moving actors (mostly pawns)

    I have optimized all i know in scripts and before starting to mutilate lights, shadows, art... i thought id post my profiling file and see if any of you with fresh eyes can give me any pointers.

    Just by moving or rotating the player the Game thread takes ~10ms longer than stationary. Some have pointed out that its probably collisions, but I already have all ground/wall collisions combined in 5 meshes for the whole level and then there are some kactors and a few obstacles (~20) objects at any time including enemies, to that then add gameplay triggers, there are not that many.
    However more objects have collision with weapons, not sure if that would affect movement checks.

    Before starting to combine more collisions or removing them i would like to see what you have to say.
    Thanks in advance.

    Profile file:

    Profiler screenshots:
    aggr. function call graph
    Click image for larger version

Name:	aggrfunccallgraph.jpg
Views:	1
Size:	92.7 KB
ID:	3253889

    aggr. function sumary
    Click image for larger version

Name:	aggrfuncsummary.jpg
Views:	1
Size:	104.8 KB
ID:	3253890

    frame actor/class call graph (frame 270)
    Click image for larger version

Name:	frame270.jpg
Views:	1
Size:	97.5 KB
ID:	3253891