#### Archived

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

# 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.

## 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 on other sites
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 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 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 on other sites
quote:
Original post by isiahil
try like this const WALL map []=
{0,200,200,200,0,200}
};

wouldn''t it be:
WALL map[] = { { 0, 200, 200, 200, 0, 200 } };

?

my poetry

##### Share on other sites
thanks so much guys!!I really appreciate that.it is working now.you guys are superb.

1. 1
Rutin
40
2. 2
3. 3
4. 4
5. 5

• 18
• 20
• 12
• 14
• 9
• ### Forum Statistics

• Total Topics
633364
• Total Posts
3011515
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

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!