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.

Newcomers DBPro Corner / How to improve game performance?

Author
Message
Robi
21
Years of Service
User Offline
Joined: 16th Sep 2003
Location: Bangladesh
Posted: 16th Sep 2003 18:31
When I start developing a game I see it very first. But after writing a large code I find the performance of the game become slower.

How can I improve game performance?

Robi

Zakaria Chowdhury
Eric T
21
Years of Service
User Offline
Joined: 7th Apr 2003
Location: My location is where I am at this time.
Posted: 16th Sep 2003 18:48 Edited at: 16th Sep 2003 18:48
1. Make sure your Models are reasonable, not 2000 poly humans having 19 on the screen at a time.

2. Check Matrices, alot of time's, if your matrices are too big, it'll go very slow.

3. Check your code, make sure there is no unused code, or just code that is repeated, or even try to make your code shorter by using different commands.


Usually those three things can get my games running a bit faster.

Working on 4 projects 2 RPG(programming texturing and 3d map), 1 3rd person shooter (Programming), and a special project.
Robi
21
Years of Service
User Offline
Joined: 16th Sep 2003
Location: Bangladesh
Posted: 17th Sep 2003 18:56
Hi Snake,
Thanks for your suggestion. But I think the performance of game is not only depend on the object poligon, matrix. I think there are another factors that make it slow. I need to know the codding style and more suggestion from others.

Thanks
Robi
Velorien
21
Years of Service
User Offline
Joined: 13th Sep 2003
Location:
Posted: 17th Sep 2003 20:35
Try using smaller textures and reuse them as much as you can because they take up video memory. Try using .dds textures instead (if that's possible), if not then at least compress the textures. There is an example in help on how you can compress them. Try checking your fps so that it doesn't drop below 30, if it does then turn down the camera range. Also try using the fog (if you aren't using it already).

Hope that helped
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 18th Sep 2003 02:50
Ok, coding suggestions ... think very carefully about your algorithms. The obvious way isn't always the best way.

Example: I want to add items to a list, and remove the lowest value. Both operations will be done regularly.

Ok, one way is to sort the list.

What kind of sort should I use? Is quicksort *always* faster than bubble sort? The answer is no. If you have an already sorted list and want to insert a new value, a bubble sort from the back of the list towards the front will always be faster than quicksort.

But this means that every time I add an item, I have to shift on average half the list each time to get the item positioned correctly. When I delete an item, I have to shift the whole list. In fact, under certain circumstances, it may be worse than that (if I'm continually adding items that are lower on average than the rest of the list).

Do I really want a sorted list? Well, no. That's just one way to keep the item I want next easy to find. What other things can I do?

Ok, I could keep the data in a binary tree arrangement, but I don't really want the overhead needed to keep the tree balanced and in sequence, and I really don't want to keep track of deleted entries. Let's look for something lighter still...

What I could settle on in the end is a heap arrangement. It has the properties of keeping the lowest or highest value first (although other items are not easy to locate), automatically balancing itself (so one side is never more than one level deeper than the other), automatically fills the gap when the first item is removed, and it's actually fairly easy to understand and code. More importantly, it matches my requirements exactly.

... You'll find this example right at the centre of the A* pathfinder code I've posted in Codebase, and a stripped down heap example there also with a link to a site with an explanation

So think smart, and make sure that your code does as much as it needs to do ... but no more.

Login to post a reply

Server time is: 2024-09-21 01:09:03
Your offset time is: 2024-09-21 01:09:03