I need to improve my engine

Started by
5 comments, last by nospiramos 20 years, 4 months ago
Hi, i am a newbie in game programming and i made a strategic game that uses SDL libs. My problem is that i get a low frame rate and i am not sure about what can i do to improve it. I have thought that maybe threading is a good choice (now, all the game runs in a single thread, running first the game engine and then drawing the images on the screen). I am not sure about what can happend if i run my game engine and the drawing functions into two different threads. Could it help some?? Because i need to increase fps about 50% (at least) What do u think about that??? i am wrong??? what else can i do??? Thank u all!
Advertisement
I think we need to know what you are doing to be able to tell you what your missing.
Rob Loach [Website] [Projects] [Contact]
Threading will not magically makes your game faster, in fact with the added syncronisation code you''ll be lucky to get it the same speed if you split things up like you suggest.

First rule of optimising: Run your code (release build!) though a profiler to see what takes the most time, otherwise you''re just guessing. And optimising something you''ve guessed at is just wasted time and effort.
Yup, you need to figure out what''s taking up your time before you try optimizing it.

Try reading the Enginuity articles, there''s a section which discusses a quick-and-dirty runtime profiler you can use to see where your code is slowing down.

Richard "Superpig" Fine
- saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Enginuity1 | Enginuity2 | Enginuity3 | Enginuity4 | Enginuity5
ry. .ibu cy. .y''ybu. .abu ry. dy. "sy. .ubu py. .ebu ry. py. .ibu gy." fy. .ibu ny. .ebu
"Don''t document your code; code your documentation." -me
"I''m not a complete idiot; parts of me are missing." -}}i{{

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

Besides the profiler, you need to figure out if you actually need to improve the frame rate: 60 fps is perfectly acceptable, you don''t have to have blazing speeds of 350 fps. That said, if you have onboard video like I do, it''s impossible to get the fps too high due to whatever constraints I haven''t discovered yet, so depending on your hardware you might be stuck.
i actually have the same problem.. i use SDL for 2d graphics, and i understand that my program doesnst have to run att 500 FPS, but atm my particle system runs at 20 fps with just a few particles on my 400 mhz celeron, and at 25 fps on my 2.4 GHz laptop. it is not the particles as just a few pixels and clearing the screen dosnt improve speed. the resolution is 640x480x32.
it doesnt matter if it is SDL_HWSURFACE or SDL_SWSURFACE, or SDL_DOUBLEBUF. i tried most different sdl surface settings, no difference.

i suppose that it *could* be my FPS-counting routines that slow it down, but i doubt it.

would be really thankful is this problem could be solved, as i want my game to run on linux, dont want to use dx.
Find a profiler tool or make your own. Amd has a free profiler avail. Two things to look for is xform or fill rate limited. If you decrease the screen resolution and you''ll see your app speed up then you''re fill rate limited. If you increase the screen res. and you''re rendering fps doesn''t change then you''re xform limited. You might also have inefficient data structures or traversing, etc. Kind of hard w/o a profiler. It''s like shooting darts blind folded.

This topic is closed to new replies.

Advertisement