Archived

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

NightZero

I need speed!

Recommended Posts

I''ve developed this 2D platform game, a la Super Mario. On most computers it runns very smooth. However, with o few computers I tried it on, it is realy slow, even if they are "better". Why?! I have a timing funktion which updates my gameloop every 20th millisecond... It''s not any advanced graphics. I made it for DirectDraw with DirectX 8.1. If it helps, my game may be downloaded here: http://w1.457.telia.com/~u45706202/ regards, Mattias

Share this post


Link to post
Share on other sites
first make sure you use hardware accleration if
it is avilaible..
then check up the image format that you use, 256 is the best
performance you know..etc..
tell me what you get.
regards

Share this post


Link to post
Share on other sites
I fought this battle just only a few days ago.

On one on system ( Win ME, DX9, 2MB Video Card ) it ran fine.
On another system ( Win2K, DX9, 64MB GeForce ) it ran slower.

The source of my problem was GetTickCount() controlling the update. I switch to timeGetTime() in the multimedia library winmm.lib and everything worked correctly on ALL platforms again.

Hope this helps

- J

Share this post


Link to post
Share on other sites
Thanks for your answares...
I use hardware acceleration, but bitmaps (bmp) with a color depth of 24 bits. But it works fine with my old graphics card and is slower with a newer graphics card... Strange...

Joutlaw: Thanks I''ll try it out! (I use GetTickCount)

Regards,
Mattias

Share this post


Link to post
Share on other sites
Can't uninstall it, the uninstall.exe is bugging my system...
Can't even close the uninstall program... it keeps changing Process name...

[edited by - Pipo DeClown on January 31, 2003 5:28:04 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
timeGetTime is till not very accurate

instead use

QueryPerformanceFrequency
QueryPerformanceCounter

Share this post


Link to post
Share on other sites
timeGetTime is fine for times around 20ms. you really only need QueryPerfomanceCounter when you need to time things in the 1ms area and below.

Share this post


Link to post
Share on other sites
quote:
Original post by Pseudo
timeGetTime is fine for times around 20ms. you really only need QueryPerfomanceCounter when you need to time things in the 1ms area and below.

timeGetTime can return values within 1 ms of each other. you only need qpc if you go below 1 ms accuracy.

how? read the docs.

Share this post


Link to post
Share on other sites
All right I conceed QueryPerformanceCounter() is THE best way to go, however that being said, my evidence has shown the following:

GetTickCount() behaves inconsistently on different platforms/OSes

timeGetTime() behaves consistenttly on ALL platforms/OSes at has been much more better than GetTickCount() for synching the frame rate in my games.

Again, I agree QueryPerformanceCounter is THE best choice but for something quick and dirty, it hard to beat timeGetTime().

- J

Share this post


Link to post
Share on other sites
Well, i had the exact problem once, i was ussing 24 bits depth, some old card with only 2 or 4 MB can manage 24 bits, but newer cards use 16 or 32 bits, if you are ussing 24, change it to 16 and it is done.

Hope this helps

If God with me, Who against me?

Share this post


Link to post
Share on other sites
Two other things:

( 1 ) You may need to couple timeGetTime() with timeBeginPeriod(1). This call sets the resolution of timeGetTime() to 1 ms. You''ll also need to pair timeBeginPeriod(1) with timeEndPeriod(1).

( 2 ) The previous reply was right on. Stay away from 24 bit bitmaps. Video card support for them is something that is going to vary widely across card manufacturers. But you can on support for 8, 16, and 32 bit support virtually universally.

- J


Share this post


Link to post
Share on other sites
quote:
Original post by joutlaw
Again, I agree QueryPerformanceCounter is THE best choice

no it isn''t, because it takes longer to execute than timeGetTime. see nvidia developer site for benchmarks.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Use the QueryPerformanceCounter and QueryPerformanceFrequency functions to measure short time intervals at a high resolution.

look at DXUtil_Timer in dxutil.h in the common files that come with the DirectX SDK for a good example of a timer

it''s so nice I just use that one it''s already made for you nice and easy

Share this post


Link to post
Share on other sites
For timeing you could use the rdtsc opcode the code would look like

__int64 GetCPUCount(unsigned int loword, unsigned int hiword)
{
_asm
{
rdtsc
mov hiword , edx
mov loword , eax
}
return ( (__int64) hiword << 32 ) + loword;
}

but you would need to get the cpu speed and i dont now how to do that yet.

Share this post


Link to post
Share on other sites