Giter Site home page Giter Site logo

derfleck / cub3d Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 203 KB

First steps with raycasting using the minilibx library, project for 42 Vienna

C 97.28% Makefile 2.72%
42 42vienna game-development raycasting raycasting-engine raycasting-game wolfenstein-3d

cub3d's Introduction

cub3d

Passed Cub3D with 115

Passed with 115/100

Screenshot from the game

cub3d is a project that challenges you to recreate game history. Your goal is to build a simple pseudo-3D-game using an approach called ray casting. This has been pioneered in 1993 by id Software with the title Wolfenstein 3D (depending on your age you might know its successors Return to Castle Wolfenstein, Wolfenstein: New Order or even its predecessor Castle Wolfenstein).

Ray casting allows you to render 2D images of simple 3D scenes. For the full explanation, have a look at the linked tutorials in the resources section.

The project requires you to use the minilibx library by 42 Paris. There's an improved (and better documented) version by Codam (42 Amsterdam) called MLX42, but if it's allowed to use is up to your local Bocal (ask them if you're not sure). There's only a limited set of functions permitted in general:

  • all functions of miniLibX and math library

  • system functions for files: open, close, read, write

  • functions for printing output (mainly used for error handling): printf, perror, strerror

  • functions for memory management and process termination: malloc, free and exit

Resources

Lode's tutorial on Raycasting: probably the best tutorial on raycasting out there, with code examples step by step (links provided as list here, part 4 is linked on the main page, but somehow not on part 3)

Could also be useful for some, if you haven't worked with it on so_long: Lode's tutorial on floodfill. Many colleagues from other campuses recommended the Permadi tutorial on Raycasting, but it uses only the angle instead of vectors for the looking direction, which I found harder to use.

I highly recommend the Game Engine Black Book: Wolfenstein 3D, 2nd Edition by Fabien Sanglard, which documents the whole development process of Wolfenstein 3D from a technical perspective. Additionally, if you're into game history, read DOOM Guy: Life in First Person by John Romero, written by one of the founders of id Software.

Coding Train has a helpful explanation how raycasting works, but his code examples are in JS. The video series by 3DSage is closer to the subject of cub3d because it uses C and OpenGL. There's also a course by Pikuma which has been highly recommended, but it's 60 USD for enrolling.

MLX specific resources

Testers

  • Cub3D Leaks Maps Tester: outdated, but contains some test maps that can be repurposed (but remove the resolution line at the top)

cub3d's People

Contributors

derfleck avatar rekamocsai avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

cub3d's Issues

Minimap: check large maps

Cub3D should be able to display minimaps of maps of all sizes. In order to do this, it automatically creates a copy of the map that has at most 30 by 30 items. Check with different sizes if this works as intended and if the minimap gets correctly redrawn.

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.