Raycaster

Creations

anarkavre

5 years ago

Hi, I have been working on a Raycaster project for the Arduboy and decided to port it to the Gamebuino META. It currently has the following features.


Movement

Move Forward

Move Backward

Turn Left

Turn Right

Strafe Left

Strafe Right


Interaction

Wall and door collision with a nice sliding effect

Doors that open when you stand in front of them


This version includes texture mapped walls, doors, ceiling, and floor. The Wolfenstein 3D textures are placeholders I used for testing.


I hope you enjoy this preview.

View full creation

bfx

NEW 5 years ago

Very cool!!!  Thanks for sharing.

Maybe worth mentioning that you need the FixedPoints library to compile (Sketch>Include Library>Manage Libraries then search for FixedPoints).

jicehel

NEW 5 years ago

Thanks fo the share and i hope you'll continue it to make a complete game.

If you want compare with some other raycasting codes, you can have a look on:

Raycaster by Arnakavre (https://gamebuino.com/fr/creations/raycaster)

Advanced Raycasting by drummyfish (https://gamebuino.com/fr/creations/advanced-raycasting)


jicehel

NEW 5 years ago

Code is fine and works fine but it's not easy to understand as there is alot of maths and not alot comments. Could you had some in your code ?

As it's a preview and as you wrote: "It currently has the following features" , it's mean that you'll add some more, know you already that you'll add ? possibility to have ennemies and a hit function with some parameters as range, shoot angle, full_damages_points ?


sentinel87

NEW 5 years ago

Incredible. In the free time i will try to analyze your source code. I am curious how to do this "fake" 3D :)

jicehel

5 years ago

If you analysis code maybe you could do a fork with your comments. I'm not developping atm but it was not easy to understand when i have had a look on code. It's a really good project and i think it's could be great to have a good study of the code and explain to all how to use it, personnalize and use motor for any imaginable game (or adaptation) or be able to use other methode technics explained by bfx in Affine3D or methods explained in Affine.  I don't think that metohds explained by Steph here could be easy to use with this motor but maybe i'm wrong

Alban

5 years ago

I have not studied this piece of code thoroughly, but this is a very "classic" problem, and the implementation looks as "basic" as this type of problem can be.

This looks 3D, but this is a 2D problem :

  • imagine you are in a place with a fixed ceiling and a fixed floor, every wall has the same height
  • More interestingly, at every angle you can look at, you can see one and only one wall.
  • Thus, to draw this "3D" scene, you "just" have to determine 2 things per view angle (i.e. per pixel column) :
    • Which wall you are looking to, and which part of the wall -> this gives you a texture coordinate
    • How far it is -> this gives you a scale factor
    • -> this is a problem of finding the intersection of a view line and a list of walls

Angles and scale factors are stored in look-up tables, to make things faster.

My 2 cents, I hope this is clear enough. I can invite you to read "Game Engine Black Book : Wolfenstein 3D" by Fabien Sanglard if you want to know more (there is much more than raycasting in this book).

jicehel

NEW 5 years ago

sentinel87 sentinel87

If you analysis code maybe you could do a fork with your comments. I'm not developping atm but it was not easy to understand when i have had a look on code. It's a really good project and i think it's could be great to have a good study of the code and explain to all how to use it, personnalize and use motor for any imaginable game (or adaptation) or be able to use other methode technics explained by bfx in Affine3D or methods explained in Affine.  I don't think that metohds explained by Steph here could be easy to use with this motor but maybe i'm wrong

Alban

NEW 5 years ago

sentinel87 sentinel87

I have not studied this piece of code thoroughly, but this is a very "classic" problem, and the implementation looks as "basic" as this type of problem can be.

This looks 3D, but this is a 2D problem :

  • imagine you are in a place with a fixed ceiling and a fixed floor, every wall has the same height
  • More interestingly, at every angle you can look at, you can see one and only one wall.
  • Thus, to draw this "3D" scene, you "just" have to determine 2 things per view angle (i.e. per pixel column) :
    • Which wall you are looking to, and which part of the wall -> this gives you a texture coordinate
    • How far it is -> this gives you a scale factor
    • -> this is a problem of finding the intersection of a view line and a list of walls

Angles and scale factors are stored in look-up tables, to make things faster.

My 2 cents, I hope this is clear enough. I can invite you to read "Game Engine Black Book : Wolfenstein 3D" by Fabien Sanglard if you want to know more (there is much more than raycasting in this book).