Skip to content
This repository was archived by the owner on Mar 31, 2023. It is now read-only.
/ 21_wolf3d Public archive

School 21's graphics project about raycasting

License

Notifications You must be signed in to change notification settings

StarNuik/21_wolf3d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wolf3d

21 School's project about computer graphics and raycasting.

What I did

At first, I drew some walls, using a simple raycasting technique. In short, every column of the screen is a ray, which goes through a 2D array, until it hits a wall. Then, based on the distance to the wall, I can calculate the height of the wall on the screen.


Sprites are, at first, just squares on the screen. To know where on the screen they go, I use the angle between camera's direction and sprite's position. And size is just the distance between the two.


To hide sprites behind walls I remember distances to walls, then I draw objects column by column, comparing distance to the sprite with wall distance, and not drawing if the latter is smaller. I also use magenta as a transparency color, so if the sprite has a magenta pixel, I just don't draw it.


A small command line profiler is very useful so that I know if I'm under my preferred 60 fps limit.


As I wanted to add some mobs, I needed pathfinding, so I implented an ordinary A* algorithm.


This is how the map that Wolf3D reads looks like.

End result

In the end, I added some guns, animations, which are as simple as changing sprites and mobs. Here is the end result!

Made by

Starnuik aka sbosmer

About

School 21's graphics project about raycasting

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published