Scores and Leaderboard

How the players earn score points by defeating enemies and other players, and where the leaderboard is shown. The scores are the scores feature (enabled in Features).

How it works in the game

  • When a player defeats an enemy the player gets the server/scores/obtainedScorePerNpc points (5 in the basic config), and when a player kills another player the server/scores/obtainedScorePerPlayer points (10).
  • The scores icon opens the Top Players Scores box with the first 10 players and the player own score ("My score"); the box is updated after every kill.
  • With server/scores/fullTableView/enabled the server also publishes the full leaderboard as a web page at /scores, 100 players per page.

Each enemy can give its own points: with the server/scores/useNpcCustomScore config at 1, add "useNpcCustomScore": 25 (the points) to the enemy object Private Params; the enemies without it give the default points.

Managing the scores in the admin panel

The scores are in the Users section of the admin sidebar:

  • Scores - one row per player with the total score, the players and enemies kills count and the time of the last kill of each type.
  • Scores Detail - one row per kill with the obtained points and the killed player or enemy, useful to review how each score was earned.
Admin Panel - Scores list

Editing the total score of a row changes the player position in the leaderboard. See Scores Entity and Scores Detail Entity.

Configuration reference

  • server/scores/obtainedScorePerNpc (5), server/scores/obtainedScorePerPlayer (10) and server/scores/useNpcCustomScore (1).
  • server/scores/fullTableView/enabled (1), server/scores/fullTableView/scoresPath (not installed, /scores by default) and server/scores/fullTableView/title (not installed, "Scores Table").
  • client/ui/scores/enabled, with the x, y, responsiveX and responsiveY position of the box.
  • The box texts are the scores client translations (lib/scores/client/snippets/en_US.js): scores.scoresTitle, scores.scoresContent and scores.myScore.

Code integration (advanced)

  • Server: ScoresPlugin (lib/scores/server/plugin.js) increases the score on reldens.battleEnded (enemies) and reldens.playerDeath (players) through IncreaseScoreOnKill, sends the scores to the player on reldens.joinRoomEnd and creates the public route on reldens.serverBeforeListen.
  • The public page renders the theme assets/features/scores/templates/ui-scores-table.html template inside assets/html/layout.html.
  • Client: lib/scores/client/plugin.js with ScoresMessageHandler for the box.
Go Up