Advertisement

Anyone want to test my first 3D game

Started by June 18, 2003 05:52 PM
58 comments, last by rickp101 21 years, 7 months ago
A few people have said 30 fps. Is that with V-Sync on? I know V-Sync limits my PC to 60 fps (my monitor refresh rate) but my housemates limits his to 30 even though his monitor is at 75Hz.


The start screen is just a JPEG textured to a polygon the size of the screen, see code....

int StartScreen(void)		{				glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  //Clears screen				glMatrixMode(GL_PROJECTION);				//Selects projection matrix						glLoadIdentity();														glOrtho(0,1024,0,768,-1,1);		//Changes to orthographic projection in order to display text on top			glMatrixMode(GL_MODELVIEW);					//Selects modelview matrix						glLoadIdentity();						GLfloat emission[] = {0.8f, 0.8f, 0.8f, 0.0f};			glMaterialfv (GL_FRONT, GL_EMISSION, emission );					glDepthRange (0, 0.3);				glBindTexture(GL_TEXTURE_2D, TextureArray[7]);	//Front screen JPEG			glBegin(GL_QUADS);		//Begins draw procedure with triangles selected				glTexCoord2f(0.0f, 0.0f); glVertex2i(0,  0);				glTexCoord2f(1.0f, 0.0f); glVertex2i(1024,  0);				glTexCoord2f(1.0f, 1.0f); glVertex2i(1024, 768);				glTexCoord2f(0.0f, 1.0f); glVertex2i(0, 768);  			glEnd ();				glFlush();			return TRUE;}  


Sound is very basic...

PlaySound("Data/reload.wav", NULL, SND_ASYNC);  


I am gonna probably look into updating the sound

Input is Windows input using

case WM_KEYDOWN:

within the WndProc procedure

but to get around the problem of pressing and holding the key and getting an initial move then a pause then a constant move I added this in a different procedure instead of using the WndProc...

void MoveCamera(bool keys[]){				if (( keys[VK_UP] ) || (keys['W']))				{........  


yeah the framerate is stumping me at moment, really not sure how to improve it any more.

I exported the data from 3DS Max using Deep Exploration and it creates display lists. I have optimised the polygons within 3DS Max as much as I can but am still left with 8000ish polygons with everything, obviously not everything is drawn at once in OpenGL but a lot of it is.

I have tested it without the majority of polygons and it speeds right up to a few hundred fps so I know this is the bottleneck but it is just a case of finding a way around it.

[edited by - rickp101 on June 19, 2003 7:42:42 AM]
Was just wondering, i thought that textures in OpenGL were limited to the size of 256X256?

Then how is it that you are able to texture map a 1024X768 map with the resolution being 1024X768 onscreen?

As for the polygon count, i don''t think 8000 polygons should be pushing framerates down so much.

I have been able to push about 20k textured polygons per frame on a 450mhz with a TNT card running at 60fps.Roughly about 1.2 mtri/s. And it''s still way short of the TNT''s theoratical 6m/s as im not using any frustum culling or octrees.

Are you using backface culling?, if you are not it might give a nice boost.Oh yes, i was using display lists too, so its a really good optimization.
Advertisement
Dunno about max size for textures, it is a 1024x768 JPEG.

Yeah I have backface culling on (except barrels which need both sides showing in case you look inside).

It is really stumping me why it is as slow as it is for what it is.

I am going to sit down tomorrow and remove parts at a time and see if I can really narrow down any problem points
Excelent game, I must say. Muuuuch better than my first game (which I don''t like to associate my name with these days). You should make mouse speed adjustable (I''m just used to playing first person shooters with the mouse set to extremely sensitive). I have no complaints otherwise. I got ~58 fps consistantly on a p4 2.5 with 512 RAM and a gf4 mobile. Again, great work!

--- Alex Broadwin
--- Domini Nocti Games
- [email=atronic@gamebox.net]Alex Broadwin[/email]- Adroit Creations- My Journal- The All-Knowing One
oooh, you just reminded me.

It has got adjustable mouse sensitivity.

NumPad + and - adjusts mouse sensitivity.

Just forgotten to put that anywhere on the start screen
Ahhh! Excelent! In that case, all is good :-D

--- Alex Broadwin
--- Domini Nocti Games
- [email=atronic@gamebox.net]Alex Broadwin[/email]- Adroit Creations- My Journal- The All-Knowing One
Advertisement
This is my third post on this topic today, but you said you had problems when pressing and holding a key, that Windows was doing the move, wait, move a lot thing. Here''s how to fix that. Don''t use Windows Message Handling on this one, do it yourself. Use the command GetAsyncKeyState. Look up the list of VK keycodes and use only the keys you are currently using right now. I don''t know how to indent in these things, so stick with me.

short up_key; //used to store key status
up_key = GetAsyncKeyState(VK_UP); //st the up key status
if(up_key != 0) //key is pressed
{
//do whatever the up key does here
}


You could streamline it more:

if(GetAsyncKeyState(VK_UP) != 0)
{
//do whatever up key does here
}

Include windows.h and make sure winuser.lib is linked.

I hope this helped your program, as it tests the condition of a key each frame, so that if the key is pressed down there is no lag. If you don''t want to do that, tell the users to go to their keyboard configurations in the Control Panel and set repeat speed to fast.

"Donkey, if it were me, you''d be dead."
I cna ytpe 300 wrods pre mniute.
"Donkey, if it were me, you'd be dead."I cna ytpe 300 wrods pre mniute.
Thanks for the help Duncan.

I was actually saying that my way did solve the problem of the hit, wait, go problem with windows Proc keys but I do realise that this isn''t the best way of doing it so I may have a play with your method as well.
your hand and target goes though the walls try using glDisable(GL_DEPTH_TEST); and glEnable(GL_DEPTH_TEST); after you draw the hand.


---------------------------
The pipes clangor all the time.
---------------------------The pipes clangor all the time.
Really!!

I use glDepthRange() and as far as I knew it didnt disappear anywhere.

Was it doing it all the time? or just in certain places.

EDIT:
Oh yeah, just checked, if you walk straight into the wall it is OK but by moving around against the wall it does sometimes disappear.

Thanks for pointing that out

[edited by - rickp101 on June 20, 2003 4:37:15 AM]

This topic is closed to new replies.

Advertisement