Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Games Speed Tips

Author
Message
DragonsLair
15
Years of Service
User Offline
Joined: 3rd May 2009
Location: Scarborough
Posted: 12th May 2009 00:49
Hi

I have a game that requires alot of models to be displayed and controlled at the same time. 300 of them actually. The only thing is my game slows almost to a halt.

I know other people have managed to create some excellent quality games and they run fine but even though mines a pretty low polygon game, it doesnt!

Why is this? Is there anyway of using other features that DX9 holds to speed this process up?

Im not even using shadows, fx or shaders.

Please help me

AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 12th May 2009 02:34
It's because of the large amount of objects you're using. Despite what most people believe poly-count does not play that large of a factor in how well your game runs--it's the number of objects that slows it down. The more objects you create the more data DBP has to process--that means transformation, color, visibility/culling, collision, etc. And of course the more objects you have the more draw calls DBP is making. Generally speaking try to keep the number of objects you use down to a minimum. Combine all your static geometry into only a couple different objects, and if in your case you have 300 models all up and running at the same time, you'll have to find some optimizations to make. Make sure you use dbExcludeObject() on objects that aren't visible or close to the player. Use instancing whenever possible. Or, if you'll only ever have 50 objects on screen at once, make only 50 objects, and reposition them whenever the player moves to make it look like there are more than there actually are.

Hope that helps.

i like orange
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 12th May 2009 02:43
The number one optimization is :
wherever you have more than one of the same object, ALWAYS use dbCloneObject() to create the multiple copies of the objects.

The number two optimization :
Avoid using dbMakeMatrix() to make any parts of your model, terrain, etc. Always make the mesh in a modeling program as an *.x file. For some reason the Matrix graphical objects are very very slow.
DragonsLair
15
Years of Service
User Offline
Joined: 3rd May 2009
Location: Scarborough
Posted: 12th May 2009 09:41
i dnt like usin makematrix. just dnt like em. GDK seems t have a proble, when I use dbCloneObject. Would it help if i made a whole town as 1 object?

DragonsLair
15
Years of Service
User Offline
Joined: 3rd May 2009
Location: Scarborough
Posted: 12th May 2009 09:41
the plan u see is to make a MMORPG

sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 12th May 2009 12:05
Quote: "GDK seems t have a proble, when I use dbCloneObject."


From that I take it you have around 300 non-cloned objects in your game.
If that is the case, then no wonder you have things slowing down.

What problems are you actually having when you try to clone objects?
Without cloning objects there is almost no way of getting decent speed from a large object count.
DragonsLair
15
Years of Service
User Offline
Joined: 3rd May 2009
Location: Scarborough
Posted: 12th May 2009 12:12
hers what I am doing, this is to test if I can run the game with the amount of objects required.....



but when I build it it tells me that there isnt enough parameters in the dbCloneObject funtion.

go2none
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location: London
Posted: 12th May 2009 14:26
It seems to me that you are trying to clone object 6. It does not exist.

See whether this helps:

DragonsLair
15
Years of Service
User Offline
Joined: 3rd May 2009
Location: Scarborough
Posted: 12th May 2009 14:28
oh yeah lol just gonna try n fix it.........


fixed it now it loads without errors, just it real slow

outputting at 2 fps

DnB
15
Years of Service
User Offline
Joined: 28th Feb 2009
Location:
Posted: 12th May 2009 15:59
How about dbInstanceObject? Does that run faster than dbCloneObject?
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 12th May 2009 17:12
dbInstanceObject should easily double or even tripple the FPS but that still will not help if he is only at 2FPS at the moment.

What sort of video card is being used????
go2none
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location: London
Posted: 12th May 2009 18:54
I just hope you're not running the clone code in the main loop like my example suggests. My bad . That would explain 2fps...
DragonsLair
15
Years of Service
User Offline
Joined: 3rd May 2009
Location: Scarborough
Posted: 12th May 2009 19:43
lol no its not mate I checked that first. Using dbInstanceObject has knocked it up to 20!! So I think the best way forward maybe to reduce the distance I render the objects at.

Any thoughts on this?

go2none
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location: London
Posted: 13th May 2009 11:29 Edited at: 13th May 2009 11:30
I've just checked something.

I put 500 (cloned) objects in a vector and update them every frame.

- some basic free-fall math, updating velocity and position
- every object performs two collision checks every frame against its group of 500 (Sparky's)
- there's a basic physics system that transfers kinetic energy when objects collide
- I topped it up with a high resolution scrolling background
- every object displays a message using dbText (which is claimed to be sluggish)
- transparent interface made of *.png
- there's slightly above 540.000 polys in the scene
- basic AI (follow, avoid and runaway)
- some more stuff to keep it all in place

On a C2D 1.6GHz laptop with ATI's X1800 video card it still churns out 59fps (it never goes above or below that value). When I turn one of the cores off and drop the clock to 900MHz, it still outputs 49fps with occasional dips to 45. Memory consumption is below 200MB.

My desktop machine C2Q 3.2 and GTX 8800 happily handles 1000 objects without breaking a sweat.

Bear in mind that GDK still utilizes only one core. My conclusion is that something must have gone horribly wrong with your code or you are running it on a really low spec machine.
DragonsLair
15
Years of Service
User Offline
Joined: 3rd May 2009
Location: Scarborough
Posted: 13th May 2009 11:34
so do you think my problem is a polycount issue

go2none
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location: London
Posted: 13th May 2009 11:45
As AndrewT said:

Quote: "Despite what most people believe poly-count does not play that large of a factor in how well your game runs--it's the number of objects that slows it down."


..and I second that. I think that you have something nasty in your main loop that slows everything down.

You can use this ugly bit of code to display poly count if that is one of your concerns.



I say, create an empty project, clone 300 of your objects and see where it takes you.
DragonsLair
15
Years of Service
User Offline
Joined: 3rd May 2009
Location: Scarborough
Posted: 13th May 2009 12:07
thats what i did. I used a preformed human model from poser. I ended up using a poser 4 model, duplicated it 100 times. then I got the problem Im havin now. but when i do the same thing with a cube or sphere its ok

DragonsLair
15
Years of Service
User Offline
Joined: 3rd May 2009
Location: Scarborough
Posted: 13th May 2009 12:09
By the way, is there a way of 'getting' the total number of objects in 'existance'

go2none
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location: London
Posted: 13th May 2009 12:22
I am not sure. You can count them on creation, store them in a vector and then ask about its length or fit them into an array. Once you organize it somehow, counting should not be a problem.

Well, there's int dbObjectExist ( int iObject ). Iterate through that and there you have it.
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 13th May 2009 12:36
Until one knows what video card is being used, and the poly count of your models, there is no way for anyone to know if you are running into a poly-count problem. For all we know you may be using an integrated video solution.
Put you model into your modeling package and find out how many polys it has.
DragonsLair
15
Years of Service
User Offline
Joined: 3rd May 2009
Location: Scarborough
Posted: 13th May 2009 13:12
42,000 vertices if thats any help, not sure about the video card

go2none
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location: London
Posted: 13th May 2009 14:09 Edited at: 13th May 2009 14:15
The objects I used have 600 vertices each and I am planning on reducing that number by 1/3 at least. But it all depends on how complex your geometry needs to be. Characters are the most demanding because you want them to be as life-like as possible.

I think that in one of your other posts you mention adding clothing as separate objects. That would complicate thing even further, wouldn't it?

Smart texturing, baking shadows can do really nice tricks if used properly. Bumping the number of polys up is not always the best solution (hardly ever, tbh).

Create a high poly object, texture it, add bump maps, lightning and so on. Then, render to it to a texture and then slap it onto a low poly object and the results can be surprisingly good.

Edit:

to check the video card just right click the desktop, go to properties and setting tab
or
- hit Win+R and type dxdiag and go to Display tab
or
- hit Win+Break >> Device >> Hardware Manager >> Display Adapters
or
- display it in-game using dbCurrentGraphicsCard$ : char* dbCurrentGraphicsCard$ ( void ) - I've never tried it though.
DragonsLair
15
Years of Service
User Offline
Joined: 3rd May 2009
Location: Scarborough
Posted: 13th May 2009 14:19
thats an excellent idea for building the characters. I know it may be a well known technique but ive never heard of it. cheers go2none

sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 13th May 2009 16:59 Edited at: 13th May 2009 17:01
Quote: "42,000 vertices if thats any help, not sure about the video card"


AHHHHHH and you are trying to handle about 300 of these .....ie: about 130,000,000 vertices.

Are you sure you are not pulling my leg?

Unless you are doing very aggressive frustum culling, as well as cutting back on the poly count with different Level Of Detail (LOD) models, I am not sure if there is a modern video card in existance that will do what you want.
go2none
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location: London
Posted: 13th May 2009 17:15 Edited at: 13th May 2009 17:17
Yeah, 40k+ seems very high. For comparison: World of Warcraft character is around 1000-1500 poly. Naked. (you're making an MMO, arent' you?)

You will also need to render rest of your scene, handle sound, AI, collision detection... the list goes on and on. Save those precious cycles as often as you can. You can always add bells and whistles later on once everything starts fitting into place.

Good luck with those.
DragonsLair
15
Years of Service
User Offline
Joined: 3rd May 2009
Location: Scarborough
Posted: 13th May 2009 21:53
ye im makin an mmorpg. and seriously thats the amount. I put it into deep exploration demo to have a look. Really, wow's only 1500? Think I'll just build em by hand.

I thought the lower set of poser models would of been alot less. Guess I was wrong lol.

Login to post a reply

Server time is: 2024-10-01 01:35:51
Your offset time is: 2024-10-01 01:35:51