Jump to content
  • Advertisement


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


performance problem

This topic is 5304 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

i almost got my first FPS game finish.it is a doom clone uses advanced raycasting.at the moment,in the map i have 4 sectors of map.each of them contains about 15 walls.so in the worst case 3 sector will to be check for intersections.there are only 2 sprite at the moment which perform some moving functions.all went well until i put the texture for floor and ceil.the algorithm i use for that is calculate the distance from every pixel on the screen which is not draw as a wall to the floor or ceiling,then find the offset and memcpy the value from bitmap.the screen resolution is only 320X200.at the moment i just render the floor on and its damn slow.i tried to do some optimisation,but it doesnt make too much difference.also i havnt put my A* pathfinder in as well.cant imagine what it will be like when i finish the whole thing.im sure there is something wrong with it.my cpu is celeron 2.4Gh.there is no way i cant do a doom clone on it.here is the code i done for drawing floor:

inline int raycaster::Draw_Floor_and_Ceiling(int x,int y,int r,int face,int px,int py,int destlpitch,unsigned short* destination,int bitmappitch,unsigned short* bitmap)
int dr;
int distance_to_point;
int Xincr;
int Yincr;
int offsetX;
int offsetY;
for(int i = y;i < PROJECTION_HEIGHT;++i)
dr = abs((int)(face - r + lookup->ANGLE360)%lookup->ANGLE360);
		distance_to_point = 32 * 277 / (i - PROJECTION_HEIGHT/2) / lookup->cosTable[dr];
		Xincr = (int)(distance_to_point * lookup->cosTable[r] * -1);
		Yincr = (int)(distance_to_point * lookup->sinTable[r] * -1);
		offsetX = abs((px + Xincr)) % 64;
		offsetY = abs((py + Yincr)) % 64;		
		memcpy(destination + i*destlpitch + x,bitmap + offsetY*bitmappitch/2 + offsetX,2);

	return (1);

somebody please help me.thanks very much. [edited by - jimywang on April 14, 2004 11:20:33 PM] [edited by - jimywang on April 14, 2004 11:21:25 PM]

Share this post

Link to post
Share on other sites
btw,i just tried to get rid of the memcpy.it turned up to be normal again.i tried the blt function as well.thats even worse.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!