Archived

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

diskheadyXI

platform game demo

Recommended Posts

Hi there I''ve just uploaded the first demo of my platform game and i''d appreciate it if you''d let me know what you think. its a 127kb download from: http://mysite.freeserve.com/andy_williams/platform.zip I realise that a lot of the graphics are not mine but I simply can''t draw so I will be replacing them latter. cheers Andy

Share this post


Link to post
Share on other sites
thanks for the feedback

I was worried about that - it works fine here but I have a p4 1.4ghz - I didn''t have a clue how it would work on other machines.

what graphics card do you have?

better get optimizing!

cheers

Andy

Share this post


Link to post
Share on other sites
I''ve got a 2 Ghz Pentium 4 with a GeForce 4.

It took about 2 minutes for the main character to fall to the ground, so you''ve done something very very wrong indeed.


Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

Share this post


Link to post
Share on other sites
AMD Athlon 1.2GHz
256M SDRAM
Voodoo 5 5500 AGP Video
Microsoft Windows 2000 Server

Runs smooth... A bit slow, although I''m sure the framerate was good, I think this is more of a logic issue than actual engine speed as it was extremely smooth. There were a few issues that I''m not sure if they were intentional or what, such as some of the enemies seemed to be a couple pixels off the ground, but top notch demo. Keep up the good work.



DracosX:

Master of the General Protection Fault

Share this post


Link to post
Share on other sites
Pentium 4 1.8ghz 256MB

Runs fine on system(smooth). Needs alittle more work in some areas. I got easily frustrated with trying to jump on obstacles, some places I easily got stuck and couldn''t move. In one area not sure what level I fell off a ledge and returned onto the screen and fell again this happened over and over again in a loop with noway to stop.


PaulJ

Share this post


Link to post
Share on other sites
Hi there

btw - I''m the guy who wrote the demo

paulj - I can understand why you got frustrated with the jumping - it needs a little work - I''m going for a slow paced game so it is intentionally slow. about falling forever - I realise this is possible - its because i don''t have a damage system in place yet - you can solve it by altering the maps actually

this demo was just really to see how smoothly it ran on other machines - if your having trouble then restart your machine and try again - I have trouble on my machine if i run it after IE or any other graphically intensive programs

DracosX thanks for your kind words - some of the enimies are floating - shouldn''t be too hard to fix - cheers

this has been very helpful thank you all very much

Andy

Share this post


Link to post
Share on other sites
Ok here is how my timer works

first of all the initialisation I try to find out if there is a performance counter
and initialise the relivent variables depending:



      
// is there a performance counter available?


if (QueryPerformanceFrequency((LARGE_INTEGER *) &perf_cnt)) {

// yes, set time_count and timer choice flag


perf_flag=TRUE;
time_count=(unsigned long)perf_cnt/60;
QueryPerformanceCounter((LARGE_INTEGER *) &next_time);
time_scale=1.0/perf_cnt;

} else {

// no performance counter, read in using timeGetTime


next_time=timeGetTime();
time_scale=0.001;
}

// save time of last frame


last_time=next_time;



then in the main game loop I try to get the current time and then I test to see
if it is time to render the next frame
if it is I draw the frame and update the next_time variable


  
// use the appropriate method to get time

// and calculate elapsed time since last frame


if (perf_flag)
QueryPerformanceCounter((LARGE_INTEGER *) &cur_time);
else
cur_time=timeGetTime();

// is it time to render the frame?


if (cur_time>next_time) {

// calculate elapsed time


time_elapsed=(cur_time-last_time)*time_scale;

// save frame time


last_time=cur_time;

// yes, render the frame


//render_frame();


draw();


// set time for next frame


next_time = cur_time + time_count;
}



this code is from teach yourself directX 7 in 24hrs

cheers

Andy

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Your timer code is very wrong. You have to remember that you are dealing with 64-bit integers. Probably to maintain compatibility with future (and present) 64-bit CPUs that might run windows without the need to thunk. At the moment only the low 32-bits are utilised/needed. The book that you mentions only gives you a fluffy overview of what you need to do. I am not surprised that you are in difficulties.

Basically what you want to do is this:

1. Store the reciprocal of frequency. That is 1/frequency. Think of this as beats per second.

// Retrieve the frequency of the performance timer...
QueryPerformanceFrequency ( &Frequency );

// Store the reciprocal..
RecipFrequency = 1.0f / (float) ( Frequency.u.LowPart );


2. Once per frame query the time (measured in beats) and subtract this from the last time (measured in beats). Now you want to divide this result by the number of beats per second. You do this by multiplying by the reciprocal of frequency. [You could just divide by frequency but multiplication by the reciprocal is faster and gives the same result.] Now you have your frame time in seconds.

// What''s the time?
QueryPerformanceCounter ( &ThisFrameTime );

// Frame time is...
Frametime = ( ThisFrameTime.u.LowPart - LastFrameTime.u.LowPart ) * RecipFrequency;

// Store ThisFrameTime into LastFrameTime...
LastFrameTime = ThisFrameTime ;

I would advise you also to initialise LastFrameTime when you first calculate the reciprocal of frequency. This way when you first calculate frametime you will have a valid LastFrameTime to do the comparison with. Also remember that the frametime has a period and so every so often it will wrap around. You need to have a check for this to ensure that when this happens you handle it gracefully. The same goes for when you are using time GetTime.

Good luck
Kevin


Share this post


Link to post
Share on other sites