arjanfrans / realtime-multiplayer-in-html5

:computer::earth_africa::computer: Realtime multiplayer game in the browser.
MIT License
22 stars 10 forks source link

Add tile based collision #3

Open jgamedev opened 8 years ago

jgamedev commented 8 years ago

For what I can see the current collision system just checks for a bounding box, which severely limits the types of games that can be created.

Support for walkable/non-walkable regions would be a great addition ;-)

jgamedev commented 8 years ago

So I'm sharing my naive approach to adding this functionality, although it doesn't really quite work. I thought that I'd be able to pull it off by changing just the server collision code, however I may have to find a way to implement it in both the client and the server. Here's the code: http://hastebin.com/orihubayow.js

Hope you can shed some light into how this could be improved upon or otherwise implemented

arjanfrans commented 8 years ago

Your code is in the right direction. The CollisionSystem code is shared across the server and client, so you don't even have to update anything in the server folder.

The point of this game is to demonstrate the multiplayer aspect. But adding a bit more features to the collision system would be a nice addition.