Need for speed!

Hi

I’m designing a sort of football game (soccer). I have a field, 22 players and a ball moving around. The problem is that the game is too slow, the ball moves too slowly. Can anyone suggest some ways to speed up the game.

P.S. I’ve noticed that when the players r rendered outside the field, the ball moves faster. Is there a reason for that?

Thanks

Here’s where you turn on the profiler that came with your development environment, and figure out what part of your program is slow, and start optimizing that part. You could start making sure that you’re in hardware accelerated rendering (glGetString(GL_VENDOR) shouldn’t return anything comtaining “Microsoft”).

Repeat until satisfied.

A profiler that costs extra, but is very good, is Intel’s VTune. There’s a free 30-day demo downloadable from their site. However, it won’t give you hierarchical info (“this is slow because it calls that a lot”) so it requires some analysis skill to be effective.

If you’re on an AMD chip, AMD has a very similar tool called CodeAnalyst available for free download.

For optimizing your graphics, your gone need to use tricks to cull out nonvisible objects.

Frustum culling, spatial technics (BSP, quadtree, octree), reducing GL state changes, using special extensions, being careful so that you dont run into software mode, …

the list goes on.

V-man

Well I think in this scenario frustum culling won’t help too much - if this is the bottleneck - he’ll get an uneven framerate (striker 1v1 with keeper will be really quick - all 10 behind the ball will be really slow).

how many polys are in your players?!

Originally posted by Robbo:
[b]
Well I think in this scenario frustum culling won’t help too much - if this is the bottleneck - he’ll get an uneven framerate (striker 1v1 with keeper will be really quick - all 10 behind the ball will be really slow).

[/b]

Uneven frame number? That’s normal in many games. What would you do if in some cases your FPS goes down to 20FPS with all the optimization turned on?

V-man

The players have many polygons. They have been drawn in milkshape.

I think that for a start, I’ll try not to render what is not visible on the screen. If that fails, then I’ll use octrees.

I suppose the bottleneck comes from displaying the players, since there are 22 of them and they use many polygons as you said. I think that most of the time, at least half of the players will be visible, so the most obvious optimization IMHO would be to use LOD for players. An easy way to do that would be to store say 3 level of details of your players and then choose which model to display depending on its distance to eyepoint.

dude, octrees arent gonna really speed things up on a flat pitch… unless your using a terrain engine, which i doubt you are for a soccer game, octrees arent really gonna help alot and are just going to slow down the CPU. Use things like CVA’s, display lists, and whatnot.

If he is trying to render realistic stadiums, I think octrees will help a lot. They are static, can be really huge, and you see only a small part of them in typical soccer games.

The players, ball and referees can be rendered with simple sphere or box culling since there are not many of them (less than 30 models).

And as I said before, I think LOD for models will help.

What is “LOD”?

LOD == Level Of Detail

Level Of Detail == progressively using less polygons/shader tricks/smaller textures the further away (or smaller, or less important) an object is.