shadows — Multiplayer Shadowy Halloween Maze Game!
Welp, I misread the timestamp on the bramjam, so I guess I can't submit this, but I'm posting it here anyway! ( @bramley that is right, correct?)
This was a little experiment in raycasting and FOV graphics. The goal is to get to the green light at the end of the maze... the problem is that you only have a tiny lantern which casts light in one direction! So, it's basically a maze game where you can't see the goal, only what you could see in real life. Sounds fun, eh? :D
There is a server, so you can race your friends to the end. Additionally, you can drop beacons to help others out... provided that you're going the right way!
- WASD/Arrow keys to move
- SPACE to drop beacon
How'd you do ray casting? Is it just extending a line until you hit a wall? But if that's the case it would seem very inefficient
@DynamicSquid Basically, there are a bunch of "rays" each going from the player to the edge of the FOV (the angle of the ray being the variable). For each ray, it finds the nearest wall that it intersects and passes that to the player. The player then renders the walls based on that data.
The way it finds that nearest wall is lines 122 to 148. It's standard raycasting math, so I won't explain it here, but basically it calls
cast on each wall and takes the closest point.
@fuzzyastrocat yeah, I mean I understand why you choose to do it client side, it would be exponentially harder on server, but just slightly disappointing lol
Still very good though, maybe you could make a version where your lanterns light up the map for other players as well
(also I see you used msgpack! basically no one uses msgpack for websockets except for me and the people I've talked to lol)
@realTronsi I'm not really sure what the value of doing it server-side would be.
That was planned, I just didn't have time to implement it. I was also worried that you'd end up with a situation where there's a billion players all lighting up the maze, which ruins the fun part.
(Lol it's so useful, mega compressor)
@fuzzyastrocat well what method are you taking? I never tried raycasting but I think I know the ideas behind it. If you use line intercepts, which in this case you could easily do so since all the walls are perfect mod 90 and the player rotation is also stored, it won't be a toll on the server
If you're just doing like a while loop and incrementing some coordinate by 1 each time then seeing if it is on a line or something, then that's really inefficient and slow
@realTronsi OH gosh no, that's not at all what I'm doing. It's just "do math and boom insta-get the coordinate of intersect":
And I still don't really get how having it on the server would help. It'll just mean a lot more socket traffic. And doing those calculations has basically no performance drag on the client.
@fuzzyastrocat well the point of having it on the server is so people don't cheat, because that's really what makes multiplayer difficult.
I mean with raycasting on the client side, although from a efficiency standpoint it might make sense, but people are able to cheat the main theme of your game which is quite unfortunate