View Full Version : Xp gain skewed for multiplayer

02-16-2010, 06:01 PM
The rate of xp gain in multiplayer appears to be off a bit. At present, every player receives the complete amount of experience for the quest that is completed. While at first this seemed great, it appears to have cheapend the early game to the point of uselessness (but power leveing is great for testing).


Three players join a generated world. The world is set to level 20 (the hosts level).

Player 1
Level 20:
XP Required to level: 100,000

Player 2
Level 15:
XP Required to level: 75,000

Player 3
Level 2:
XP Required to level: 10,000

Quest xp rewards on a level 20 world tend to be anywhere from 2,000 to 5,000 xp. When one of these quests is completed, players 1, 2, and 3 get the full 2-5k of xp (a total of 6-15k distributed xp).

I believe that a better way of distributing xp earned when there are more than one player is to split the xp amongs all players in a way that is weighted by level. Below is a fairly simple method that would take the "xpToDistribute" from the quest and determines how much each player should receive based on their level. The snippet invents that a collection, "Players", that contains all the players on the server and has a property for the player level and the amount of xp that player is going to receive as a reward for completing the quest.

int accumulatedPlayersLevel = 0;

foreach (Player player in Players)
accumulatedPlayerLevel += player.Level;

double playerWeight = 0;

foreach (Player player in Players)
playerWeight = player.Level / accumulatedPlayerLevel;
player.XpToReceive = xpToDistribute * playerWeight;

In non-programming speak, this basically means that that each player receives xp proportional to his level based on a simple average. It is likely that the total xp to be distributed for quests will need to be bumped up a bit as well when there are more players to make sure that it is still beneficial to player together.