Tile Raycast Native Extension

This tiny native extension is for raycasting in the tiled words using DDA algorithm.
DDA is a very simple(but elegant I suppose) and fast solution for tile raycasting in tile based worlds like platformers or top-down games.

This implementation is based on(adapted from) Raycasting and Super Fast Ray Casting in Tiled Worlds using DDA - YouTube

There is a simple platformer example which I’m still working on(I need to fix some rough edges). It might contains problems but they are not related to native extension. Simply because of the implementation. Developing perfect platformer is hard and require a lot of time(which I don’t have for this small sample right now.). It is here to be a proof of concept, not for been the perfect platformer implementation.

Source:

Test:
https://selimanac.github.io/defold-tile-raycast-platformer/

18 Likes

Thanks for another awesome extension!
Ive downloaded the platformer example to give a try (and see how it works) but I can’t run it locally. Some problems with the native extension idk


it’s something with the raycast.cpp. I’m using the 1.3.7 editor

2 Likes

Ah! Ok. Fix is on the way.
It is related to missing header on Windows(and probably on Linux). Works fine on MacOS.

Edit: turns out I use abs for floats :stuck_out_tongue:

2 Likes

@Dat_Indie I pushed the fix. You should at least restart the Defold.
If same thing happens, please delete the “build” and “.internal” folders from project directory.

1 Like

And also there is a much more simple example on the base repo:

1 Like

It’s working, thank you!

2 Likes