Jump to content
  • Advertisement

Archived

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

jimywang

help needed on data structure of DOOM style FPS

This topic is 5481 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 am doing a DOOM style FPS game at the moment.the data structure i am using to represent the wall looks like this: typedef struct WALL_TYP { float x1; float y1; float x2; float y2; float m; float b; }WALL, *WALL_PTR; where x1,y1,x2,y2 is for the positions of the start and end points of the wall.m is for the slope of the wall and b is for the the line equation y = mx + b. then i have an array of WALL to contain all of walls in the map which looks like this: const WALL map [] = { (0,200,200,200,0,200) }; however,when i tried to render this wall on screen with raycast algorithm,all the value in the array appears all wrong.i mean,the wall actually rendered is (200,0,0,0,0,0) instead (0,200,200,200,0,200).no matter how i change the value in the array,it always renders (200,0,0,0,0,0) for me.Can someone tell me what it is going on here plz?Thx.

Share this post


Link to post
Share on other sites
Advertisement
So everything is in 2.5D space then? I don''t get why you''ve included slope numbers for the walls. I guess I''m asking how exactly you use this structure in rendering.

Share this post


Link to post
Share on other sites
my basic idea is with all these value in WALL,i can get a line equation for the wall that is rendering.also i have the line equation for the current ray i am casting.then the algorithm will calculate the intersection between the lines and distance between the intersection and current player position.

Share this post


Link to post
Share on other sites
const WALL map [] =
{
(0,200,200,200,0,200)
};

try like this const WALL map []=
{0,200,200,200,0,200}
};

PROGAMERS









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!