First off I have been reading around the forums for a while and have found a lot of information that has been helpful while creating my current game so thanks to everyone for that. I was also not sure exactly which area to post this in so apologies if this is incorrect.
I have been creating a game at the moment using DirectX 10 while reading Introduction to 3D Game Programming with Direct 3D 10 by Frank D. Luna. The game I am creating is a cross between Breakout and Pong (smartly named Breakong). My intention is to use this game as part of my portfolio to try and get into the industry.
I have got the game to a reasonable level and have begun to test the code on multiple machines. It runs fine on my desktop (fraps stating 900 – 1000 fps) however when attempting to run my game on a number of laptops the performance has taken a massive dip (down to 15-20 fps). I know that my (and friends) desktops all have a reasonable spec (Quad Core and ATI 4000/5000 cards) and the laptops are lower (dual core and ATI 3000/4000 mobility cards) however this seems a rather drastic performance difference.
The main graphics engine and all DirectX interaction is taken straight from the book, however some small elements have been changed such has adding more light sources to the effects file for each ball. I am really not sure where I should start looking to make my code more efficient. I did start programming this game on my laptop so I know it did run ok up until I added the bricks.
My guess is the problem is either in the way I am drawing the scene or I am spending too much time calculating variables within the update.
I am currently stepping through all the items in the level and drawing them in the same manor objects are drawn in the book. For the bricks as there are multiple textures I check the brick’s life to give the correct colour texture and also if it is a special brick. If it is a special brick I also draw a second texture which is an image of the special ability with alpha clipping to see the texture around the logo.
During the update process I do most the work within the Ball class. The ball will on each update check for collision with walls, players, other balls and bricks. For this I know that with each ball I have to check the position with all bricks (a 14x9 grid) and I have tried to limit as many distance checks to use the square distance to avoid square rooting, I actually find the closest brick to the ball and perform the full check on that brick only.. Also after the position updates of the ball I will go through all the bricks again to check for damage done and destroying bricks. I have also added in a basic AI now that will also perform a check to find the closest brick to aim for. Is there a more efficient algorithm of checking everything that I haven’t thought of?
As I am not sure what area could be the issue and there is a lot of code I thought it would be best to put code up upon request rather than spam too much code. I am also currently at work and can’t get access to my code till I get home.
I would appreciate any advice that could be given or any tools that are available for checking where my bottlenecks are.
If you wish to have a look at my game it can be found on http://www.andytagg.co.uk
An executable is also available at http://www.andytagg.co.uk/Breakong_Alpha.html
Many Thanks in advance,
astaggMember Since 07 Sep 2010
Offline Last Active Jun 11 2013 06:06 AM
- Group Members
- Active Posts 10
- Profile Views 748
- Submitted Links 0
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
astagg hasn't added any contacts yet.