I have a game where constantly spawns identical enemies from layer 2. Each is 812 tris, 426 polys and 17 bones for armature 13 of bones has collision hitboxes parented to them to dected bullet hits(static ghost physics). Each time identic enemy gets spawned. After more enemies gets spawned, even if they are covered by mist, when I look at the direction, where they are, the game starts to lag a lot. Profiler shows 20+ FPS, but it gets noticeably slower, jerk violently and gets almost unplayable. How do I optimise it so it doesn’t lag so much and run on more solid FPS even if there are a lot of enemies?
Wow, I found out that physics metter grows up slowly for each enemy spawned and after 4-5 minutes it is 90% and I get 10 FPS. What is it and how do I fix it?
That’s the symptom of a permanent collision - that is a dynamic object is the parent of a static or dynamic object.
Check that all the model parts inside the collision box are set to no collision.
You can also have collidable stuff inside a dynamic collision box, using different collision groups.
Different collision groups? How? Will they work at raycasting(will rays collide)? I need the hitboxes inside of the dynamic mesh. Maybe sensor physics will work? Adding hitboxes to col group 2 leaves the raycast on them working fine, but will it improve FPS in this case?
Well, the game still slowly loose FPS, even using different collision group for hitboxes. What else can be done? Can armatured objects use LOD?
If it is still spending too much time in physics then your configuration is still causing permanent collisions and you should hunt down what has a wrong physics setup. Try setting all objects (all of them) to “no collision” and then enable only the outer hit boxes.
Can reason be that hitboxes doesn’t have collision bounds checked?
one method for a acurate hitBox that is kinda a pain,
use a convex hull, and animate copies of it, and use replace mesh to replace the physics mesh, its faster then deforming a physics mesh and reinstancing every frame, but is less performant then the walking ragdoll,
one reason the walking ragdoll is better, is that each piece up the chain uses linked collisions so they dont bump each other.
and nothing has to be updated each frame.
my current versions use about .15 - .25 ms physics or less.
I think you could do the collision layers, but it has nver worked out for me,
(could be user error though)
I’d say no but it is an educated guess. Try to turn on physics visualization and see if you can spot the intersection between the physic volumes.
How do you mean this? I have multiple hitboxes parented to emties which are parented to bones. They all are static ghosts. Will using convex hull on them increase FPS? They are mostly standart boxes; head, chest and torso are a bit more detailed(~16 polys each).
the problem is anytime the objects pass through each other they generate collision data, and they are all inside the players main physics bound
What fix do you reccomend?
I will give you .blend - maybe you can take a look?
i not use it from a bit of time but, but it was necessary for make some sort of ragdool
you can create different group collision
and this should solve the problem of lag.
as default all objects are of the first group, that i call “A”
and can collide with all other groups.
a possible setup can be:
make all projectiles as groub “B” (this group is what you want that have collision with hitboxes)
make all hitboxes(parented to bones) group “D”
then now do the setup of groups in this way:
group -> can collide with -> group
B -> can collide with -> all
D -> can collide with -> “B”
the result should be:
box of character can collide with projectiles , ground , all except hitboxes
projectiles can collide with all, also hitboxes
hitboxes can collide ONLY with projectiles
keep in count that can give some trouble later, for example you add a “bomb” and you not understand why the hitbox not sense it.
or something like this
PS: also the rays can make some “joks”, i guess