DEV Community

Maiu
Maiu

Posted on

JavaScript MMORPG - Maiu Online - #babylonjs - Ep41: Death

Hey Adventurers!
Death arrived into realm of Maiu. All other prerequisites (possibility to regenerate hp, reasonable strong monsters etc.) were done so it was time when death finally makes sense. Before that I added neutral zone in the spawn place in order to not die instantly if some monsters comes by.
After tests with friends I also disabled pvp because it was annoying when can attack attack and kill player by mistake. I will come back to it after some time.
One lonely npc doesn't have health component which makes it immune for damage.

I took idea from one of the open source projects and used black&white post processor to display death screen.

On the server side for the players commands I added notion of isAllowedByDeadEntity (disabled by default) and I'm filtering all incomming commands against entity state.

The one thing I struggled was teleporting player to the spawn place. Update of position is straightforward but I had one not covered case in the player movement prediction algorithm which effectively was blocking updating position until clicking some movement control in the client. At the beginning I tried to fix it with some hack but I failed and finally i found the problematic place and simple if with two line of code fix the problem.
Still missing some validation on the UI but I'll add it after bigger refactor which I'm planning to do.

What's next?

I'm working on rewriting AI system and I want to fix some issues which makes monsters group in corners of the map.
I want them to always stay in own area not matter how long server is running.
Next I will try to fix issue with client side prediction. Sometimes there's a small jump back of player after stopping player movement.
And i want to finish vat animations for monsters.

Top comments (0)