GameMakerHelpBlog

Thursday, April 15, 2010

The GM3D Snail

Take a ride on the Snail my friends. When it comes to 3D, sooner or later your gonna hit this one trust me. I was looking last night at my experimental project of creating a 3D world and just trying out different things. I had some nice cartoony trees with reeeaaallllyyy nice shading on it. I was so happy with my efforts i actually smiled (gosh i made sound like i never smile, no i just rarely take pride in my work before the end). But on a second look i found that uh-oh snail trail, my game had dropped to 19 FPS. Now my computer is by no means old. Infact it is brand new just less than a week old with a lovely 9800GT 1GB in it. So i was a bit stumped to find this happening. Of course the trees, being about 40 of them drawing 2 shapes and with lighting was causing the lag.

But what to do.... I don't want to less the amount of trees and deactivation is definately out of the question. Of course if you haven't got the answer yet, stay on the snail it is currently travelling faster than your brains thinking (just a bit of wit in there please don't be put down by it).

So if you thought of the following:

- Don't draw outside of the sight of the camera (eg. fog)
- Don't draw them behind objects
- Don't use lighting for objects furthur away
- Turn culling on
- Billboarding.

Now that i have search the gmc you can find ALL these techniques but the third one here:
Speeding up 3D

The third one is simple:

[CODE]

if (distance_to_point(Camera.x,Camera.y)
{
 //Draw normally
}
else
{
d3d_set_lighting(false)
//Draw object
d3d_set_lighting(true)
}

[/CODE]

Simple but it may save you 1 or 2 FPS but hey, 1 or 2 can be the difference between a good review and bad. For the rest, that topic shows it FAR better than i ever would.

Have fun peeps :P

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home