Giter VIP home page Giter VIP logo

42-cub3d's Introduction

Cub3D

Cub 3D

Maze project using raycasting, with minilibx. Emulating FPS Wolfenstein game (1992)

Definitions / Infos:

  • Raycasting is a rendering technique to create a 3D perspective in a 2D map.
  • Raycasting is not the same as raytracing!
    • Raycasting is a fast semi-3D technique that works in realtime even on 4MHz graphical calculators.
    • while raytracing is a realistic rendering technique that supports reflections and shadows in true 3D scenes, and only recently computers became fast enough to do it in realtime for reasonably high resolutions and complex scenes.
  • DDA - The Digital Difference Analyzer(DDA) algorithm is used to draw lines on a screen in an incrementally. The algorithm is called the Digital Difference Analyzer because it interpolates based on the difference between the start and end points. The algorithm itself is very easy to understand and implement.
  • Ray Casting:
    1. Walls are always at 90° angle with the floor.
    2. Walls are made of cubes that have the same size.
    3. Floor is always flat.
  • FOV - Field of View The player should be able to see what is in front of him/her. For this, we will need to define a field of view (FOV)
  • "To put the player inside the world, we need to define the player’s X coordinate, the player’s Y coordinate, and the angle that the player is facing to. These three attributes forms the 'point of view' of the player."
  • Fisheye Effect: The fisheye effect is an effect you see if you use the real distance, where all the walls become rounded, and can make you sick if you rotate.

Technical Details:

  • DDA Will handle the "hit" in wall, looking the intersections of ray until hit the wall. This framework will give to us what block was hited, not the distance If this was handled by looking for a fixed distance until the wall, we are not able to get a good design.
  • DDA is able to identify block to block where the ray will pass (x or y)
  • 0.66 is a good size in FPS games (Size of plane)
  • Formula: Dir + Plane + Multiplier (-1 a 1)

Images:

Distance to wall:

Distance to wall

Calculating heading:

Calculating heading

Pythagoras:

pythagoras

More information:

  • Libft allowed.
  • GetNextLine allowed.
  • Folder structure apply (managed by Makefile).
  • No leaks are allowed.
  • Norma must be run.

To run:

$ git clone --recursive https://github.com/rlinsdev/42-Cub3D.git
# or
$ git clone https://github.com/rlinsdev/42-Cub3D.git
$ git submodule update --init --recursive

Git sync main

$ git checkout main
$ git pull
$ git checkout validator
$ git merge main
$ git push

Links:

42-cub3d's People

Contributors

rlinsdev avatar ilucaspires 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.