Git Product home page Git Product logo

cherdantsevilya / cub3d Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 21.41 MB

πŸ‘Ύ 🎲 This project is inspired by the world-famous game of the same name of the 90s, which became the first FPS in history. The goal of the project is to create a dynamic view inside the maze, using raycasting technology.

Makefile 2.47% C 77.86% Objective-C 19.67%
3d game raytracing school21 wolfenstein

cub3d's Introduction

CUB3D


πŸš€ Description

My first RayCaster with miniLibX πŸ’‘

Introduction

The aim of the cub3d proyect is to create a 3D game using the raycasting technique which is a rendering method implemented in the world-famous Wolfenstein 3D game.

Map

The cub3D executable receives as a single argument the map file we read, which must be of .cub filetype.

The file must follow these rules:

  • There must be header lines before the actual map containing the following:
    • At least a line containing NO, SO, EA and WE followed by a valid path to an xpm image
    • A line starting with F (floor) or C (ceiling) followed by a color in RGB separated by commas
  • Only (empty), 1 (wall), 0 (floor), and either N, S, E or W (Player starting position looking at North, South, East or West), will be accepted characters in our map (except if you add other characters as bonus)
  • The map may not be rectangular, but it must be surrounded by walls
  • Spaces are allowed but the player cannot walk on them, thus every space must also be closed/surrounded by walls
  • There must be a single player on the map

Here's an example of a valid map (not rectangular but still valid):

NO ./textures/WALL2.xpm
SO ./textures/WALL21.xpm
WE ./textures/WALL8.xpm
EA ./textures/WALL22.xpm

F 112,112,112
C 53,53,53

        1111111111111111111111111
        1000000000110000000000001
        1011000001110000000000001
        1001000000000000000000001
111111111011000001110000000000001
100000000011000001110111110111111
11110111111111011100000010001
11110111111111011101010010001
11000000110101011100000010001
10000000000000001100000000001
10000W00000000001101010010001
1100000111010101111101111000111
11110111 1110101 100000010001
11111111 1111111 111111111111

Raycasting

Raycasting is a rendering technique to create a 3D perspective in a 2D map. The logic behind RayCasting is to throw rays in the direction of the player view. Basically, we need to check the distance between the player and the nearest wall (i.e. the point where the ray hits a wall) to caculate the height of the vertical lines we draw. Here is a simple depiction of it:

Raycast Example 1 Raycast Example 2

Controls

Here is a summary of the various controls in the game:

  • The WASD keys move the player up, down, left and right relative to the player's viewing angle
  • The left and right arrow keys rotate the viewing angle of the player
  • Press the ESC key or the X button on the window to exit the game
For detailed information, refer to the subject of this project.

πŸ“Œ Useful links

cub3d's People

Contributors

cherdantsevilya avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.