Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Question about game performance  (Read 7494 times)

0 Members and 1 Guest are viewing this topic.

slucis7593

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Question about game performance
« on: May 11, 2014, 10:40:48 am »
Hello :) !

I built a game from book sfml game development and this is result:


Problem: FPS is so low, FPS < 10 when i shoot bullet.

So, is window 8.1 cause this or my computer's hardware is weak?
My computer:
- CPU: Core i3 - 2310M ~2.1GHz
- RAM: 4GB.
- VGA: Intel HD Graphics 3000

Sorry for my English is not good.
« Last Edit: May 11, 2014, 10:44:05 am by slucis7593 »

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Question about game performance
« Reply #1 on: May 11, 2014, 11:17:24 am »
Long story short: You need to use a profiler.  Anything else would be guessing, and humans are very bad at guessing the root causes of performance problems.

http://en.sfml-dev.org/forums/index.php?topic=15131.msg107126#msg107126 gives a list of profilers you might want to look into.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Question about game performance
« Reply #2 on: May 11, 2014, 11:25:02 am »
Make sure you run in Release mode and without debugger.

The collision detection algorithm we developed is not very efficient because we focused on simplicity; this is also mentioned in the book and several optimizations are proposed. This could have an impact on performance if a lot of objects are on the screen, but it seems strange to me that it's so massive. The computer on which I tested had quite similar specifications.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

slucis7593

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Question about game performance
« Reply #3 on: May 11, 2014, 02:02:02 pm »
@Ixrec: 'profiler' word is seem new to me, so tks for your link :)

@Nexus:
- Oh, i didn't know that debug and release is diffirent :P
- I'll keep reading to 'optimizations' part.
- I think that performance is low because of i compiled in Visual Studio. Then, when i compiled in GCC 4.7.1 (CodeBlock), it's run better. Thanks for your reply :D

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Question about game performance
« Reply #4 on: May 11, 2014, 02:10:42 pm »
I think that performance is low because of i compiled in Visual Studio.
Hardly. As mentioned, you probably forgot to start without the debugger.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Question about game performance
« Reply #5 on: May 11, 2014, 02:23:00 pm »
If there was no difference between Debug and Release why would they exist?
Unoptimized debug builds try to produce code that closely match what you wrote that is easy to debug - but it won't perform well.
Optimized release builds sacrifice debug ability for performance. They are hard to debug but run fast. The optimizer is crucial in making C++ code perform well.

AFS

  • Full Member
  • ***
  • Posts: 115
    • View Profile
Re: Question about game performance
« Reply #6 on: May 11, 2014, 06:11:54 pm »
I find it really strange that you get < 10 FPS on your computer. It only happens when you shoot bullets or you always get poor performance?

Besides what the guys already said about Debug mode, I would like to add two more possibilities:

- Something is very wrong with your code (like doing something unnecesary, like making a huge amount of collision checks per frame or something). You can either use a profiler or comment parts of the code out until you discover the source of the problem. Still, I find it very strange that you get such poor performance on a i3 processor, unless you are doing something really taxing like taking screenshots every frame without noticing.

- You don't have the drivers for your Intel graphics card installed. My computer also has an Intel and I remember that I got awful performance (like 5 FPS), which turned out it was because I installed the wrong drivers. Make sure you have something called Intel Graphics Controller on your system tray (the little icons next to the clock, bottom right corner). If you don't, install it.
« Last Edit: May 11, 2014, 06:16:20 pm by AFS »

Veritas

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
    • Email
Re: Question about game performance
« Reply #7 on: May 11, 2014, 06:30:33 pm »
You may want to reinstall your drivers before diving into finding code problems. It's what happened with me and it resulted into 3 pages of discussion.
"Lasciate ogni speranza, voi ch'entrate"

SeriousITGuy

  • Full Member
  • ***
  • Posts: 123
  • Still learning...
    • View Profile
Re: Question about game performance
« Reply #8 on: May 12, 2014, 08:21:49 am »
Also the Intel 3000 HD Graphics is known to have a poor OpenGL Performance and SFML relies on OpenGL, therefore this also could be a problem.
I also build the game from the book, and on my gaming machine it runs with over 300fps, (Core 2 Duo E6850, 8 GB RAM, GeForce GTX 260, running on Ubuntu 14.04) even with the unoptimized collision detection algorithm.

Try (re)installing your graphics drivers.
After this use a profiler.

Good Luck ;)

slucis7593

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Question about game performance
« Reply #9 on: May 13, 2014, 09:09:31 am »
:D Thank's everybody for helping!
I thought that the issue was solved. It's slow because i ran with debugger.
When i run in Release mode and without debugger, it's pretty good.
Thanks Nexus for your anwser.

I want to ask one more question:
When i run in Visual Studio, Although i copied Sansation.ttf file to Release/Media folder but it's still could not found, console print that: "Failed to load font "Media/Sansation.ttf" (failed to create the font face)".
How can i fix this? Thanks :)

Geheim

  • Full Member
  • ***
  • Posts: 201
    • View Profile
    • Email
Re: Question about game performance
« Reply #10 on: May 13, 2014, 09:55:30 am »
I want to ask one more question:
When i run in Visual Studio, Although i copied Sansation.ttf file to Release/Media folder but it's still could not found, console print that: "Failed to load font "Media/Sansation.ttf" (failed to create the font face)".
How can i fix this? Thanks :)

If you run directly from VS, you need to put the Media folder where your "Projectname.vcxproj" file is (thats probably also where your source code is)
Failing to succeed does not mean failing to progress!

slucis7593

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Question about game performance
« Reply #11 on: May 13, 2014, 02:40:15 pm »
Quote
If you run directly from VS, you need to put the Media folder where your "Projectname.vcxproj" file is (thats probably also where your source code is)

@Geheim: Wow, it's work. Thank u very much! :D

SeriousITGuy

  • Full Member
  • ***
  • Posts: 123
  • Still learning...
    • View Profile
Re: Question about game performance
« Reply #12 on: May 14, 2014, 09:26:03 am »
A better solution to this, is to set the working directory correctly in the VS project properties to the output directory of the .exe file. Then starting debugging in VS works ;)

jannugimes

  • Guest
Re: Question about game performance
« Reply #13 on: May 15, 2014, 03:44:03 pm »
Yes it looks fine to me.