#Performance issues

1 messages · Page 1 of 1 (latest)

spiral gorge
#

Lets continue in here not to interrupt the other conversation

rose tree
#

Yeah thanks

spiral gorge
#

Can you show your general physics settings?

rose tree
#

The project settings?

spiral gorge
#

yes

rose tree
#

wrong ss

#

its a topdown game if that matters at all

spiral gorge
#

Oh and the settings under "Time"

rose tree
spiral gorge
#

Any reason you changed the max allowed timestep?

rose tree
#

I was trying to see if that would improve but it didn't do anything

#

Should I change it back?

spiral gorge
#

unless you want to achieve something specific i would stay on default settings

rose tree
#

Okay

spiral gorge
#

0.3333333

#

is default

rose tree
#

Thank you

spiral gorge
#

are you triggering the FixedUpdate manually somewhere?

rose tree
#

No, its just running the movement trough fixed update

spiral gorge
#

cause this is how its supposed to look, 1 update on fixed step per frame maximum

#

and then one run per active entity (enemy or player)

#

is this just a small prototype project or something bigger?

rose tree
#

Well its gonna be an actual game, so bigger and its really scaling up

#

Bot the player and enmies just have their movement in fixedupdate including collider checking things like seperation

spiral gorge
#

can you send the players code for that?

rose tree
#

One sec il upload to pastebin

spiral gorge
#

also does every frame show these 1000 calls to fixed update or was it just the one you picked?

rose tree
#

Well I just clicked on the spike which happened when enemies spawned, but it showed that many times before too while I was debuging myself

spiral gorge
#

so a regular frame doesnt do that?

#

also you shouldnt lag that heavy if you are just spawning 16 enemies

rose tree
rose tree
#

But my fps drops by 20 even when I start moving

spiral gorge
#

are you using some kind of pathfinding?

rose tree
#

No just following the player

spiral gorge
#

oh you are manually doing local avoidance?

rose tree
#

Yes

spiral gorge
#

can you disable that as a test and see how your performance is?

rose tree
#

Yep give me a second

#

Do you want to see the profiler too?

spiral gorge
#

just comment it out and see if your performance improves

#

we can look deeper afterwards

rose tree
#

Very slight improvement the first 6 enemies drop it to 20, and when other spawn it goes to 2

#

Didn't do much

spiral gorge
#

Mhh at this point two things for you to try:

  1. Find out why you have 1000 iterations on the physics step
  2. Simplify the enemy further and further to see if anything triggers a big improvement
rose tree
#

We could cut out the animation from the code and see if that improves it

#

The enemy bodyTilt

spiral gorge
#

i would just do a very simple follow script and see if its different, if it is you atleast know the problem is in the enemy movement code

rose tree
#

Okay il try that

#

Without the animating stuff, i had 20 more

#

I guess that affects it too but its still dies after many more spawn so

spiral gorge
#

if there is something you cant find via profiling you always reduce the code until you find whats going on, you can always reset via git (I hope you can!)

rose tree
#

Yes I can using github so all good

#

Ok using the simple movment fixes it for like first 2 waves but as more and more appear it drops back to 2, so after around 15/20 enemies its back to 2

spiral gorge
#

do inactive (pooled) enemies maybe keep trying to do this aswell?

rose tree
spiral gorge
#

Mhh

Yeah then last is to check if a normal frame also calls the FixedUpdate 1000 times per frame, then that might be the culprit

rose tree
#

This is before any enemies spawn so all quiet

rose tree
#

heres with the first wave spike and normal

rose tree
#

deep profile

#

also i just realised i forgot to turn on the simple movement il see if it improves stuff now

#

@spiral gorge So I got some big news, it only drops fps when i load from main menu if i play the scene it directly it stays around 100 fps

spiral gorge
#

so you can load the gameplay scene directly?

rose tree
#

Yes and then it does not drop

#

But if i load from the main menu scene it drops after they spawn

spiral gorge
#

oh good point, now to find out whats causing that 😄 maybe you load more and more gameplay scenes

rose tree
#

hmm how can i check that?

spiral gorge
#

you should see that in hierarchy

#

the problem is too specific to just tell you what might be the solution, you will have to experiment and find out, I have no clue what it could be

rose tree
#

right, i dont see anything unusal in the hierachy

#
        private static IEnumerator LoadSceneAsyncRoutine(string sceneName)
        {
            var op = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Single);
            op.allowSceneActivation = true;

            while (!op.isDone)
                yield return null;
        }

This is how I load it

rose tree
#

I think i got the issue

#

something is changing the Time.fixedDeltaTime value

#

when loading from the menu scene

#

still dont know what

rose tree
#

@spiral gorge I have fixed it

spiral gorge
#

What was it in the end?

rose tree
spiral gorge
#

can you disable your slowmo script and the thing where you set the value each frame and then check if it still changes?

rose tree
#

Yep no lags

spiral gorge
rose tree
#

https://pastebin.com/cP6qx2Py

it still has the fix in it applied but the only things i changed is i made it stop spawning you can see i commented out and added the test.SlowmoActive

spiral gorge
#

only timeScale

rose tree
#

I should avoid doing it?

spiral gorge
#

Yeah