Fake Raycasting Lights

joewan

  • Posts: 46
Here is something I was playing around with for a few hours. Its fake raycasting lightning that works with tiles. It only uses drawn polygons. Not that frame rate friendly, but still between 40 and 50 fps. Except for one line of code from the tile API it only uses block coding.

http://www.stencyl.com/game/play/23140

« Last Edit: December 15, 2013, 04:59:47 am by joewan »

miaubian

  • Posts: 99
thats awesome, any chance you can upload this on forge?

gamegirlxl

  • Posts: 713
Except for one line of code from the tile API it only uses block coding.

http://www.stencyl.com/game/play/23140

Would that be what finds the corners of each tile?  I have a fairly good idea of how this works; you are SHADOW CASTING 8) ;D.


But anyways, I really like this behavior.  I might try to use this as a 2D model (or inspiration) for my 3D engine (which used to be in Stencyl, but I recently started using C++/OpenGL, which helps frame rate.  It functions entirely by drawing polygons ;D) .  Since I know how to darken a polygon based on mathematical coloring, I can have "tile" (well, in 3D, you call them blocks) based shading, where I can even make the light die out the further you get from its source.  I have a bit more work to do before I can add this to my stuff, but I am excited.

I guess the next thing for you to do with this behavior would be permitting multiple light sources, although something that major would probably rewrite lots of code.

joewan

  • Posts: 46
I uploaded it to Forge. Its named "Shadow Ray Casting".

pyxelbit

  • *
  • Posts: 83

joewan

  • Posts: 46
Oh, these are the player's x and y position. Had these as global attributes, so they are not in this behavior.