Skip to content

Basic Attributes

Vinicius Reif Biavatti edited this page Oct 4, 2019 · 15 revisions

Attributes

The first thing to do is define some attributes that will be used to create the projection. The table below list the attributes used for this tutorial:

Attribute Description Value
Screen width The width of the screen 640
Screen height The height of the screen 480
Screen half width The screen width divided by 2 Screen width / 2
Screen half height The screen height divided by 2 Screen height / 2
Player FOV The field of view of the player. Normally, the value for games is 60. (In real case, humans have a FOV of 90 but this is not pretty good for 2D screens) 60
Player Half FOV The FOV divided by 2
Player X The x coordinate of the player 2
Player Y The y coordinate of the player 2
Player angle The angle for the player view direction 90
RayCasting increment angle The value to increment for each ray in relation of the screen width Player FOV / Screen width
RayCasting precision The amout of every ray position to check the wall (higher the value, more iterations) for each ray 64 is a good value
Map The integer matrix to be the map (Check the code for the value)

Clone this wiki locally