1. 28
  1. 8

    This is a project I did a couple years ago. Even though it seems simple now, while working on it I never thought I’d be able to finish it.

    It’s written in React and renders each vertical bar as a div (no canvas!). Why? Just wanted to see how well it would work, which it does pretty well.

    The main lesson I got from this is that I can understand things that seem completely out of my reach at first.

    1. 3

      Genius. This engine could probably even handle 2.5D sprites if you set the z-index properly.

      1. 1

        That’s a really good idea! I’ve also been meaning to look into using textures on walls. Not sure that’s possible or not, but would be interesting to try. As well as your idea.

      2. 3

        Please always add return false or e.preventDefault() to all key handlers, because without it the browser doesn’t know you use them, and may use the keys for its own shortcuts. For example, in Firefox’s case it launches find-in-page dialog searching for “wassesdfsfdsfsd”.

        1. 1

          Are you hitting cmd or ctrl or any modifier keys, in addition to wasd? It works without any issues for me in Firefox.

          1. 2

            I have a search-as-you-type option enabled in Firefox. It’s not on by default. But the handler thing applies regardless. It’s been the same with Opera. It would be visible in all browsers if you used other keys like space.

      3. 2

        Very cool! Can you add a license?

        1. 1

          Good call, and I’ve added MIT.

          The package.json already listed the MIT license, but I’m not sure if that’s “enough”. Either way, it definitely makes sense to make it more obvious, and thanks for the suggestion.

        2. 2

          Needs a run key ;). Awesome work, very cool and surprisingly smooth!

          1. 2

            Thanks! When I first got this working (sometime in 2017), it was much smoother in Chrome than in Firefox. Once Firefox Quantum came out, though, they became basically equivalent.

          2. 1

            Very cool! This sort of thing is a stupid amount of fun.

            raycasting buddies : https://github.com/mankyKitty/reflex-demo-game (no guarantees on buildability ><)