PvP

This describes how PvP (Player versus Player) is realized in the game. It contains low-level programmer explanation, and therefore might not be suitable for a random visitor. User level explanation can be found here


This is sub-layout for documentation pages

This was last updated when game had version: dev - 2.1.2
Top

1 Introduction

If two players are in PvP area, they can attack each other
Also, skull effects apply, and players may drop all of their carried items, depending on the skull state

2 PvP skull acquirement

When player attacks another player, he acquires a pvp skull.
Whenever any pvp propery changes for player, cache for network is built up, and it is sent to a broadcast within current map (because others need to see the skull along with the coin icons next to it)

3 PvP area

PvP area is an area marked in a map. If two players are in that area, they can attack each other


3.1 Watching the flag

The question is, how can we keep tracking, whether player is within PVP area. Obviously, we could be constantly checking for that, every single time player moves, which, however, would be slow solution.


3.1.1 The clever solution

We define, that only entrance to the PvP area will be through door / series of door. In other words, there will never exist plain node to node transition, such as player would be able to enter / leave PvP area just by walking (without using any door)

Then, we can add a watch code to a map transition function. Such a function is triggered every time, when player transitions from one map to another, or from one map to the same map, but to different node (door / teleports)
If we in that function always check for pvp area collition, and flip a bit adequatelly in the Player object, we will acquire both safe and dynamic solution, as long as the prerequisites are held.