• Advertisement

Archived

This topic is now archived and is closed to further replies.

Game Smoothness ?

This topic is 6012 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Firstly, I''d like to mention that I sincerely hope GameDev makes it through this difficult period. Unfortunately, I have no way of contributing (Being in South Africa, our money is worth sh*t, and my time is also incredibly taxed) Onto my ''beginner'' problem My trouble is that my game runs ''jumpy''. Its a VC++ Win32 App game, and the logic is run in a separate thread. The reason I did this is to make the development easier (I don''t need to worry about interrupting the messaging loop) But even on THREAD_PRIORITY_HIGHEST it does not run as smoothly as I would like. Could someone give me some insight into how THEY develop their games to run smoothly? The light at the end of the tunnel is probably oncoming lights of the train

Share this post


Link to post
Share on other sites
Advertisement
Well it depends on what you mean by smoothness? Do you mean frame rate? Do you mean characters are not animating smoothly? In order to fix the problem, you must know what the problem is.

This is a question of "When to optimize" Through every project I have been on (4 games, 4 years) there is a point where you hae to optimize. Optimizing too early gets you into trouble. You must take a step back and find out what the biggest bottle neck is in the entire system.

On PC, VTune can help you gain insight into what is going on with your game. Is the AI taking too long? Is the Rendering taking too long? Is the communication between your two threads causing the problem?

Sounds like you need to go on a good fact finding mission. Also maybe adding some realtime profiling inside of your code can help. Block out systems in your game that you want to time. Such as Collision, AI, Drawing etc... You might be suprised at the results...

-JT

Share this post


Link to post
Share on other sites
If you are using GetTickCount() or timeGetTime() for your timing you should consider switching to HighPerformanceTimer.

Share this post


Link to post
Share on other sites
Thanks for the reply.
Maybe I should have been a little more specific:

I''ve eliminated things so that I know its not the speed of any particular element in my game.
However, as its a multi-processing OS (Windows98), it seems my thread gets interupted in little bits - all the time.

End result = random jumpiness in graphics + rules.
By random I mean that the jumps are not steady.
eg. XXX--X-XX-XXX-X--X-X-XXXXX-XXX
where ''X'' is a frame and ''-'' is a gap (no processing)

Not random would be : XXX-XXX-XXX-XXX

How do you usually make your games? with separate threads?
if so - how many and for what?
If not - how?

Thanks again

--------------------------------


The light at the end of the tunnel is probably oncoming lights of the train

Share this post


Link to post
Share on other sites
Ahh - granat - I AM using GetTickCount.

That may be the cause.

How do I use HighPerformanceTimer? is it an API call too?

The light at the end of the tunnel is probably oncoming lights of the train

Share this post


Link to post
Share on other sites
If you are running 64meg of ram (or less, or not a lot more) under 98 maybe you are victim to the hard drive I/O lag of virtual memory.

Share this post


Link to post
Share on other sites
You can use a Mutex and consider the rendering thread a critical section that should not be interrupted. Definitely switch to the highperformancetimer for accurate time measurements.

Give that a shot

-JT

Share this post


Link to post
Share on other sites
Thanks guys!
I''ll try that tonight (its 4:23PM for me now)

For the GameDev staff:
Would you have a problem with me writing articles - considering that I''m still (relatively) a beginner?

The light at the end of the tunnel is probably oncoming lights of the train

Share this post


Link to post
Share on other sites
Uuh - I just realised - I still dunno how to use the HighPerformanceTimer.

I''ve seen it somewhere - but usually ignored it.

Could someone give me a push

The light at the end of the tunnel is probably oncoming lights of the train

Share this post


Link to post
Share on other sites
HighPerformance Timer...check out:

http://glvelocity.gamedev.net/

There is also some code on the threads topic here. Something to go off of.

-JT

Share this post


Link to post
Share on other sites
None of those downloads are working
(seems like the files folder is missing!)

Doh

The light at the end of the tunnel is probably oncoming lights of the train

Share this post


Link to post
Share on other sites
For my game I dont use multiple threads. I dont know of any reason that would justify an extra thread for game logic. And if something has no benefit there''s no reason to use it.
my game logic works like this:

(pseudocode)

main loop:
handle windows messages
update game logic:
paint game
main loop end


The update works as follows:

  
// delay between game updates in milliseconds

DWORD dwFrameDelay;
// time when next frame has to be calculated

DWORD dwNextFrameTime;

//

while( timeGetTime() < dwNextFrameTime )
{
dwNextFrameTime += dwFrameDelay;

theGame->UpdateOneFrame();
}
theGame->Paint();


Game updates dont consider the exact time passed by since the last frame. If a frame gets updated a millisecond late, the next frame will automatically be in time again.

HTH

Jan Rehders
http://www.turtlegame.f2s.com

Share this post


Link to post
Share on other sites

  • Advertisement