Off-Topic Discussion > Programming

My Game Engine is too Lame

(1/37) > >>

I'm making a first-person shooter where you fight giant space bugs!

But it's too slow :(

The problem is primarily the AI and the physics. I did a simple experiment, recording the framerates with and without each of these two features.

frames per second           AI off           AI onPhysics off           ~30           ~15Physics on           12-14           4-7
I've actually made some changes that make the AI faster since I recorded those data, but you get the gist.

Of course, this only tells me that the physics is taking a lot of my time; it doesn't tell me that I could do it any better than Bullet could, or that I'm even using Bullet as efficiently as I could be. Still, there are a few issues I have with Bullet...

Ragdolls. It's not reflected in the above statistics because I refrained from killing any enemies for that experiment, but just a handful of ragdolls can cause a considerable performance hit. I wish there were a way I could tell Bullet "all of these rigid bodies are parts of a whole, and that whole will never be bigger than some size; thus, you should only check for collisions between the parts of two separate ragdolls if they are near one another" ... But afaik there is no easy way to do it (there are ways, but they aren't easy). Unfortunately, all of my past attempts at implementing ragdoll physics have been miserable failures  :sigh:

Terrain. I don't know if Bullet is putting the triangles of the terrain mesh into some sort of spatial partitioning tree, but it would be profoundly stupid of it not to do so. I recently wrote a system for destructible terrain, and I want to be able to integrate that into this game engine, but the polygon counts this thing produces are much higher than what I have currently. However, the triangle data is already conveniently partitioned into cubic chunks. It would make sense to me to keep track of which physics objects (or game entities) are in which chunks, and consult that to figure out which objects need collision detection... maybe Bullet has something I can use for that, but making it match up with my destructible terrain system may prove difficult.

So yeah, suggestions?

The E:
Okay, stupid question first, have you run a profiler on your program to see where the hotspots in the AI and physics code are?

Yes, I have run a profiler (AMD CodeAnalyst)... however, I am thinking about switching to another one, because some of the info I'm getting from this one is bull****.

But anyway, here's the top entries (sorted by "total")...

Name        Self     Children     Total     btGjkPairDetector::getClosestPointsNonVirtual3720622099btMinkowskiPenetrationDepthSolver::getPenetrationDirections4818611909btDiscreteDynamicsWorld::debugDrawConstraint316881691btCompoundCollisionAlgorithm::CreateFunc::CreateCollisionAlgorithm310001003
I'm not sure how I managed to not notice it previously, but that third one is quite peculiar, as I never used the debug drawer while I was recording this stuff.

I'm going to double-check that the version of Bullet I'm static-linking with is not a debug build, since lower on the list (10th highest as far as "total") is _wassert, which shouldn't be getting called in a release build  :ick:

Then again, maybe that is related to the bull**** I mentioned I'm getting from AMD CodeAnalyst... for example, it says that CibraryEngine::SkinnedCharacter::UpdatePoses (one of my functions) is being called by __GLeeLink_GL_VERSION_1_2, and that it's calling __GLeeLink_GL_VERSION_1_3... which is complete and utter bull****. The function in question has nothing to do with OpenGL. Similar bull**** exists elsewhere.  :sigh:

The E:
Which version of Visual Studio are you using (if any)? If yes, have you tried the VS profiler?

Another question would be if you are building with all the optimizations switched on, especially the SSE2 options.
Also, which OpenGL version are you developing against? Are you using all the nice little go-faster switches, like Vertex Buffer Objects, non-immediate mode rendering and all that stuff?

It turns out it was a debug version of Bullet. I tried again with a release build and it's much faster.

I am using MSVC++ 2010 Express; no I have not tried the VS profiler.

I have not tried SSE2.

OpenGL version... it's a hodge-podge  :ick: I know I ought to pick one and stop using the deprecated features, but I haven't done it. Yes, I'm using VBOs for most things.


[0] Message Index

[#] Next page

Go to full version