Jahed Ahmed

Playing around with Phaser and Websockets

Played around with websockets using Socket.IO and Phaser today and hacked together an extremely barebones multiplayer online game. The client will probably die with 10 peers so I'm not calling it an MMO (even though the project name is literally "mmorpg"). The amount of optimisations you need to do to get so many active players on the screen updating in real-time is pretty amazing.

MMORPG Preview

I'm in two minds about Phaser. I like that it makes it easy to get started with game development on web browsers. But I don't enjoy using its API. Maybe it's just a matter of getting used to but I never seem to be able to fully predict what's going to happen and why something is happening.

For example, while my previous project with Phaser had working collision detection out of the box through Phaser's Tiled JSON support, this project AFAIK uses exactly the same code but it doesn't work. Spent hours trying to figure out why but gave up in the end. It's probably something obvious I missed but debugging Javascript is a massive pain when you're using large third-party libraries. Moving to Typescript might alleviate that. Though, it also doesn't help that web browsers slowdown/halt Javascript execution when they're not in focus, so I can't test with two clients on the same machine AFAIK which is also why the GIF above doesn't show the other guy moving.

On a positive note, this time round I actually remembered to use OpenGameArt for assets instead of wasting time making my own trashy ones. Other than Bomberman -- which I only used because Phaser's Sprite class for it was already setup from a previous project I did -- the tiles are from here.

Related Tags