MP Player Stats

Description #

This component serves as a hub for all the common gameplay stats of a player in multiplayer. It does not hold any data itself, but collects it from various external components and exposes it through public ‘Get’, ‘Set’, and ‘Erase’ methods. MPPlayerStats is heavily relied upon by MPMaster. The basic stats include CharacterIndex, Team, Health, Shots, Position, and Rotation.

Note: By default, this component is automatically added to every player upon spawn. If you inherit the component, you must update the class name to be auto-added. This can be altered in the Inspector by going to your MPPlayerSpawner component -> Add Components -> Local & Remote.

Note: New stats can be added by inheriting this class. For an example of this, refer to MPDMPlayerStats and MPDMDamageCallbacks.

MP Player Stats does not actually hold data, but instead it keeps required stats in sync via components designated, this system prevents hackers from modifying any of the provided stats and does not rely on PUN player props. Please study this and its extension MP DM Player Stats, you will easily see how to include your own custom stats, that can even be unique per game mode due to the modular design. These stats can be fed to scoreboard and score monitor for example. MPMaster will ensure these stats are kept up to date upon a player joining or leaving or in the case of a master handover.

Stats #

Shots #

The stat named “Shots” is provided as an example of how you can bridge stats with modules. You can create your own extra modules. The ShotsFiredTracker module should be added to the FireEffects module group. For a great combination, you could create another stat “Hits”. Design a module for it for the ImpactEffects group and add it. You would then have both of the stats required to calculate “Accuracy”. I will leave this for you to do, it will be a great learning experience and building block to create some very in depth stats.

Health #

Player health is kept in sync via master only. This stat relays the value.

Frags #

The amount of kills accumulated during a round.

Deaths #

The amount of deaths accumulated during a round.

Score #

The amount of score accumulated during a round.

What are your feelings
Updated on August 14, 2023