Git Product home page Git Product logo

rayce's Introduction

Rayce


Ray Casting engine based in the library of LibGDX.

Features

  • Texture mapping in walls.
  • Multiple sprites.
  • Shadow distance.
  • Collision detection (objects and walls).
  • Optimized Ray Casting algorithm.
  • Forward, back, and lateral movement with horizontal rotation.
  • Algorithm that creates a map from a .tmx file (1st Layer: Walls, 2nd Layer: Collisionable objects, 3rd Layer: Non collisionable objects.

Code Explanation

The Ray Casting algorithm draws all of the environment column by column using rays, in this case the columns are not draw directly but instead are stored in three arrays that saves the characteristics of the ray/colum (one for the distance, one for the position of the texture and other one for the texture itself). In this case, it's done because the colums are drawn from the farthest to the nearest.

In the RayCasting method the rays are fired from the player's position and when it collides with a wall, their characteristics are stored in the 3 arrays previously mentioned.

Then the entities are sorted from farthest to nearest (for drawing them in the correct order), after that, the rays are drawn in the same way from farthest to nearest, if any of the entities are closer than the previous ray, it simply gets drawn on the screen.

Compile and run

  1. Install the Gradle plugin in your IDE.
  2. Go to the folder with the source code.
  3. Run.

rayce's People

Contributors

usbac avatar

Stargazers

 avatar  avatar Tomas avatar Theofanis Despoudis avatar Raymundo Obeso avatar CvC avatar  avatar  avatar  avatar

Watchers

James Cloos avatar  avatar  avatar Raymundo Obeso avatar  avatar Naju 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.