   Program Having some Problems *New Problem*
  Hi, my 2d ORPG client seems to be a little bit slower, as if the game is skipping.I used to go at 60 fps, and now its between 30-40 and I can't remember doing any changes to the code.  Is there an easy (and free) way of identifying any potential bottlenecks?EDIT:  Ok, I have discovered that the FPS is at 60 when I am using some media type program, such as Windows Media Player or watching youtube, etc.Does anyone have any idea on how I can fix this?[Edited by - Crazyfool on June 16, 2009 6:04:02 PM]
  have you try'd profiling your code?   ;Quote:Original post by freeworldhave you try'd profiling your code?What do you mean by "profiling his code?"I would start by commenting out portions of code that do not interfere with it running by using beginning /* and ending */ until you find the source and can narrow it down.. A brute force guess and check method, but it will get you there. How does one profile code, though, seems as though it may be a more efficient way to narrow it down.   ;Quote:Original post by freeworldhave you try'd profiling your code?I am not sure how to do this to be honest.  I would love to know how to do it :)   ;  Every decent compiler should have a profiler tool. It shows how much time each function takes to execute amongst many other things. See here:Click heredoorMaster, I would recommend against your methode because:1) A profiler will show you what portion EXACTLY slows down your game2) Takes a long time to search through a whole game;Quote:Original post by pseudobotEvery decent compiler should have a profiler tool.Come now, I can't think of any free C or C++ IDE off the top of my head that comes with a profiler, and free IDEs are often the most popular among hobbyists.Now, down to business. If such profilers don't come with your IDE, where are you getting one? That would depend upon your language. CodeAnalyst should be OK for C++. nprof works for .NET code. Python comes with it's own profiler, in the profile or cProfile module.(I've never used CodeAnalyst or nprof, so their recommendations come from hear-say knowledge.)   ;Quote:Come now, I can't think of any free C or C++ IDE off the top of my head that comes with a profiler...To be fair, OS X comes with a very good profiler (Shark), which is free. However, Xcode and the OS X development suite in general can be a bit difficult to work with in some cases...(Personally, I use Shark in OS X and AMD CodeAnalyst in Windows.)   ;Quote:Original post by EzbezNow, down to business. If such profilers don't come with your IDE, where are you getting one? That would depend upon your language. CodeAnalyst should be OK for C++. nprof works for .NET code. Python comes with it's own profiler, in the profile or cProfile module.(I've never used CodeAnalyst or nprof, so their recommendations come from hear-say knowledge.)I hear very good of CodeAnalyst and will try it out soon. Another very, very decent tool is valgrind, together with KCachegrind. It is really many tools combined into one (has a thread-checker, a decent leak-detector, a call-graph generator, and ofc an "ordinary" profiler). It comes with most Linux-Distros, and unfortunately, it is not for windows (except through MinGW or Cygwin).   ;Quote:Original post by EzbezCome now, I can't think of any free C or C++ IDE off the top of my head that comes with a profiler, and free IDEs are often the most popular among hobbyists.I felt it may be worth mentioning that Code::Blocks has a code profiling plugin. It can be enabled from "Plugins -> Manage plugins..." and can then be used from "Plugins -> Code profiler". It produces a flat profile and a call graph.Note: I've only used Code::Blocks on Linux, but I am assuming the Code profiler plugin will work regardless of platform.Code::Blocks is a completely free, cross-platform C++ IDE.   ;Quote:Original post by AsraiQuote:Original post by EzbezCome now, I can't think of any free C or C++ IDE off the top of my head that comes with a profiler, and free IDEs are often the most popular among hobbyists.I felt it may be worth mentioning that Code::Blocks has a code profiling plugin. It can be enabled from "Plugins -> Manage plugins..." and can then be used from "Plugins -> Code profiler". It produces a flat profile and a call graph.Note: I've only used Code::Blocks on Linux, but I am assuming the Code profiler plugin will work regardless of platform.Code::Blocks is a completely free, cross-platform C++ IDE.Which release would that be? I think the version I have handy is 8.02 (stable), and it only has a debugger. I guess it's a nightly build?edit: Ah, it's a contributed plugin: link.   