Giter VIP home page Giter VIP logo

42_cub3d's Introduction

cub3D (February 2022)

My first RayCaster with miniLibX.

This project is inspired by the world-famous Wolfenstein 3D game, which was the first FPS ever.
It will enable you to explore ray-casting.
Your goal will be to make a dynamic view inside a maze, in which you’ll have to find your way.

result

Contents

Short description of the project

This project’s objectives are similar to all this first year’s objectives: Rigor, use of C, use of basic algorithms, information research etc.

As a graphic design project, cub3D will enable you to improve your skills in these areas: windows, colors, events, fill shapes, etc.

To conclude cub3D is a remarkable playground to explore the playful practical applications of mathematics without having to understand the specifics.

With the help of the numerous documents available on the internet, you will use mathematics as a tool to create elegant and efficient algorithms.

For the detailed instructions on the project,check the subject.pdf.

Our cub3D

Requirements to run the game

only tested on macOS Catalina (Version 10.15.7)
For all other OS it is not guaranteed to work.
OpenGL and AppKit is required to run it.
If you want to run it on Linux here is a tutorial that might help and here is the required version of miniLibX, this is not tested with our cub3D.

How to cub3D

  1. run make or make all in the root of the directory
  2. run ./cub3D maps/42.cub in the root of the directory
  3. move the character with WASD
  4. turn the FOV left and right by pressing arrow_left and arrow_right or by moving the mouse right or left

Things to enjoy

  • wall collition
  • moving hands while walking
  • opening and closing doors by walking into them
  • fully customizable maps

back to Our cub3D
back to Contents

Map requirements

  • decide which texture is displayed on which side
  • 0 define walkable spaces
  • 1 define walls
  • 2 define doors
  • the players position is displayed by:
    • N player is facing north (top of the 2D map)
    • E player is facing east (right side of the 2D map)
    • S player is facing south (bottom of the 2D map)
    • W player us facing west (left side of the 2D map)
  • the map has to be enclosed by walls on all sides
  • doors have to have walls on two opposite sides
  • any other characters other than the ones above are forbidden
  • if there is a (space) inside the map it has to be enclosed by walls, as you can see here
  • only one player position is allowed
  • you have to set all the textures that should be used as wall texture i.e.
    • WE images/1.xpm
    • EA images/2.xpm
    • SO images/3.xpm
    • NO images/4.xpm
  • you have to set the ceiling color, i.e.:
    • C 0, 183, 183
  • you have to set the floor color, i.e.:
    • F 141, 1, 126

back to Our cub3D
back to Contents

Texture requirements

The wall textures as well as the door texture is interchangeable, as long as:

  • the texture is 64 by 64 pixels
  • the texture is a .xpm file
  • the textures are called 1.xpm, 2.xpm, 3.xpm, 4.xpm, 5.xpm with 5.xpm being the door

If you want to change the windowsize, this can be done in the cub3d.h file.
But the hands are currently not resized to the windowsize, so either you have to resize the texture itself and replace the existing hand-textures in images or just disble the hands by commenting out line 113 in draw.c.

back to Our cub3D
back to Contents

Example

This is the map file used in the example.


back to Our cub3D
back to Contents

42_cub3d's People

Contributors

tblaase avatar vytkuklys avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

tblaase

42_cub3d's Issues

Corner collision

*** Issue ***

View can get closer to the wall when the wall is approached from the corners.

With an exact 0, 90, 180 or 270 angles textures are disrupted.

Inconsistent left most single ray

** Issue **

Of the left most ray (when x = 0) wall begins and ends at a different point. Which is inconsistent with the view and the rest of the map.

** Possible solution **
Not printing the left most ray

hands textures can be set as wall texture

Describe the bug
hand texture can be set as a wall texture and will kinda break the programm

To Reproduce
Steps to reproduce the behavior:

  1. set i.e images/left_hand.xpm as a wall texture
  2. start cub3D
  3. turn in circles
  4. See error

Expected behavior
only textures with the size of 64 by 64 pixels should be allowed as wall texture

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

doors can be placed without being connected to a wall

doors can be placed without being connected to a wall which results in the door creating its own wall when used

To Reproduce
Steps to reproduce the behavior:

  1. run ./cub3D maps/42.cub
  2. walk through the door in the middle of the room
  3. watch the door creating walls to its left and right

Expected behavior
should be an error while parsing

crashes when thexure path in the map file is not a texture

Describe the bug
crashes when thexure path in the map file is not a texture, if you try to launch with the current maps/box.cub it segfaults

To Reproduce
Steps to reproduce the behavior:

  1. run './cub3D maps/box.cub'
  2. See error

Expected behavior
print a message that some texture is not a valid texture

movespeed sometimes varies

Describe the bug
We both noticed an inconsistent movementspeed when walking around the game, where the player would randomly speed up.

To Reproduce
Steps to reproduce the behavior:

  1. run top in a seperate terminal
  2. Play the game
  3. look at the state of the process
    You will notice that everytime the state of the process gets changed to sleepingand then back to running the game speeds up

Expected behavior
consistent movement no matter what

Make everything work perfectly

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Scaling for minimap

*** Issue ***
How to deal with bigger maps and minimap?

*** Details ***
If map is big enough it would cover a big portion of the 3D map.
Currently 5 pixels are given per element in the array.

*** Possible solutions **
Cheap and dirty fix: give a lesser amount of pixels per element depending on size of actual map size.
Optimal: show just part of the map and reveal more based on movement.

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.