Giter Site home page Giter Site logo

cub3d's Introduction

Cub3D - raycasting game

Cub3D

This project is inspired by the world-famous Wolfenstein 3D game, which was the first FPS ever. It is a raycasting game, which means that it uses raycasting techniques to render a 3D environment in a 2D map.

The goal of this project is to create a dynamic view inside a maze, in which you can move around and interact with objects.

How to play

Installation

To install the game, you need to run the following commands:

Note: This project was developed on macOS, so it may not work on other operating systems, also it requires the minilibx library to run.

git clone https://github.com/bablilayoub/cub3D
cd cub3D
make all bonus clean

Running the game

To run the game, you need to run the following command:

Without bonus

./cub3D maps/map.cub

With bonus

./cub3D_bonus maps/map_bonus.cub

Controls

  • W A S D to move around
  • โ† โ†’ to rotate the camera
  • ESC to exit the game
  • SPACE to open/close the doors

Map configuration

The map is configured in a .cub file, which is a text file that contains all the information needed to render the game.

Here is an example of a map configuration:

NO ./textures/wall_n.xpm
SO ./textures/wall_s.xpm
WE ./textures/wall_w.xpm
EA ./textures/wall_e.xpm

F 220,100,0
C 0,100,220

1111111111111111111111111
1000000000110000000000001
101100000111000000W000001
1001000000000000000000001
1111111110110000011100001
1000000000110000011100001
1011100000000000000000001
1000100000110000000000001
1000100000110000000000001
1000111101111100000000001
1000000000000000000000001
1111111111111111111111111
  • NO, SO, WE, EA are the paths to the textures of the walls
  • F is the color of the floor
  • C is the color of the ceiling
  • The map is composed of numbers and letters:
    • 1 is a wall
    • SPACE / TABS are empty spaces
    • 0 is an empty space (floor)
    • N, S, W, E are the player's starting position and orientation
    • D is a door

Bonus

  • Wall collisions
  • Sprite
  • Minimap
  • Doors
  • Mouse rotation

Conclusion

This project was a great opportunity to learn more about raycasting techniques and game development. It was a challenging project, but it was also very rewarding to see the final result.

I hope you enjoy playing this game as much as I enjoyed creating it!

cub3d's People

Contributors

achraflaalalma avatar bablilayoub avatar

Stargazers

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