in0finite / SanAndreasUnity

Open source reimplementation of GTA San Andreas game engine in Unity
https://discord.gg/p6jjud5
MIT License
2.1k stars 348 forks source link

Physics peformance issue. #140

Closed nathan130200 closed 1 year ago

nathan130200 commented 1 year ago

With physics rate at default value (60), i'm having a extreme lower framerate. When i decrease physics update rate on client, game runs smooth. Tried all settings on very low preset, with shadows disabled. Still same issue with physics update rate.

Also another thing, when controller is plugged on computer, player aim constantly rotate infinite even if i'm not moving controller and aim analog isn't stuck.

I can set Physics update to 3 player get teleporting but achieve 60 fps, when i back to 60 (default value) fps drops around to 20~30 FPS. Even reducing world draw distance (that is excepted to unload some non visible areas and stop ticking that areas, but i think in SanAndreasUnity camera just cull distance) keep same lower framerate around physics update rate

image

in0finite commented 1 year ago

Controller: I never tested controllers, so yes, this is probably a bug.

Physics:

This kind of FPS drop never happened so far. Which objects are spawned ? How many vehicles and peds ? Try resetting all options to defaults. Another thing to keep in mind is that Unity uses PhysX as physics engine, so maybe something is wrong with your PhysX installation ? What hardware you have ?

in0finite commented 1 year ago

Does it happen on server also, or only on client ? You could also try with older version (eg 3.0).

nathan130200 commented 1 year ago

Does it happen on server also, or only on client ?

I started default gamemode in client mode with Don't listen checked.

This kind of FPS drop never happened so far. Which objects are spawned ? How many vehicles and peds ? Try resetting all options to defaults.

Just small amount of default NPC spawn and i've spawned single vehicle. Phyx installation is ok at this moment (i will check again). I have an geforce 710 2gb vram with 8gb ram.

You could also try with older version (eg 3.0). I will try.

UPDATE1: v3.0 working extremly fine, 60fps even with maximum graphics settings. (avg 58~60 stable framerate)

image

UPDATE2: Seems fixed, for strange reason windows was forcing SAUnity in IntelGPU instead of NVIDIA GPU. Now with Phyiscs update rate: 60 getting 60 fps fixed (at least on Good quality, after that FPS become unstable by my hardware limitations).

Sorry for mistake 😅

nathan130200 commented 1 year ago

Also not big important issue, some vehicle logos, keep flickering, this can cause some peformance impact in future.

zKSrYR8PxI

in0finite commented 1 year ago

I am glad you resolved the issue :).

Vehicle logo flickering was already fixed, but not yet made into a release.

nathan130200 commented 1 year ago

Oh, also the map has an issue. In v4 display like this:

image

Also make some areas don't load for example near groove street (world render distance at max): image

in0finite commented 1 year ago

Do you have modded GTA:SA, or is it original ?

nathan130200 commented 1 year ago

Its original (all img/dat/map files are untouched), all mods i use Modloader to inject direct into game.

in0finite commented 1 year ago

Modloader modifies img/dat/map files. Try to use the original GTA:SA, without any mods and without Modloader.

nathan130200 commented 1 year ago

Ok.

nathan130200 commented 1 year ago

UPDATE: Thanks for info & help, i reinstalled the game as clean install and fixed map issue also reduced alot laggy on v4 (even physics update rate on 100 with max world render distance is running fixed 60 fps). 🥳🥳

image