DEV Community

Cover image for Babylon.js Browser MMO - DevLog #4 - Simple player movement by HTTP polling
Maiu
Maiu

Posted on • Edited on

Babylon.js Browser MMO - DevLog #4 - Simple player movement by HTTP polling

Hello!
Finally something starts to happening :) We have some action! Player can move around on the map. Long story short it works in a way that player is sending state (walk/idle) and the facing direction to the server. Server engine is responsible for calculating new position every loop tick.

Client UI updates are performed by HTTP polling. Every 200ms client it calling HTTP endpoint for getting player position and new position is rendered on the screen.

If you're interested in the implementation details please check my video:

Top comments (2)

Collapse
 
link2twenty profile image
Andrew Bone

Will you be implementing web sockets rather than polling at some point, or maybe even using Colyseus to handle the backend?

Collapse
 
maiu profile image
Maiu

Hi @link2twenty
I think I'll stick to websockets (actually I already implemented it - the project is several episodes ahead of the blog, I need to catch up with recording).
My first try was to use socket.io, it's really pleasant to work with but to be honest I dont need most of it features (rooms etc) and I'll switch to raw websocket.

I didn't really considered Colyseus, but I planned to read more about and decide If it'll be useful for me. I have raw idea what I want achieve, some shape of final architecture but It's evolving along with my knowledge :)