Midnight Sun uses a fairly standard experience point system with a few particular exceptions unique to MS.
Combat Experience
The primary form of experience point gain is from combat. As with all hidden game information, your experience point total is not shown to you, but there are a number of underlying mechanics that control how much experience you gain from combat. Every monster has a difficulty rating based on its stats, and certain kinds of special attacks. Players also have an equivalent difficulty rating based on their stats. The amount of experience you gain from combat is based on the difficulty of the monster, but it is capped at your own difficulty. That means that there are no additional experience gains fighting something much more powerful than you compared to something just as powerful as you. As well, the xp value of the monster is established at the time combat starts, and is given out on a per-hit basis. This means that having a higher level player along with you doing most of the damage will also take up most of the experience points, meaning you can't be "rushed" by a high level player. Since the total experience available from a given monster is established at the start of combat, this means that spells or abilities that reduce the stats of the monster, if used during combat will have no impact on the experience gained, but if used before combat starts (For example, a Blademaster using Disarm to initiate combat) they can reduce the total experience gained by lowering the difficulty of the monster before the experience gets 'locked in'. This also means that summoned creatures that fight alongside you in combat can also take some of the experience gain by dealing hits.
Quest Experience
Scattered throughout the world are various quests you can complete. Some involve combat, others do not, and they can be appropriate for a whole range of levels. The Quest Book on the website, or in the game will give you the names of the quests, a description of what they involve, as well as their level range, and whether combat is required to complete them. Quest experience works quite a bit differently than combat experience. There is a fixed total amount of quest experience available in the game, that is to say, all players who have completed 100% of the quests have the same amount of quest experience, all players who have completed 50% of the quests have the same amount of quest experience and so on. How much experience a quest is worth scales in real time to how many players have completed the quest. The idea is that the fewer players who have completed a quest the more difficult it must be to solve. This means that quests in the questbook are listed not in order of practical difficulty or what level you need to be to complete them, but instead from 'most completed' which is worth the smallest portion of the quest experience pool, to 'least completed' which is worth the largest portion of the quest experience pool. This also means that your quest experience (and thus your total experience) will fluctuate as other players complete quests. If another player completes a quest you have also completed, you lose a very small amount of experience since that quest became worth a smaller portion of the pool. Likewise if another player completes a quest you have not also completed, you can gain a very small amount of experience since the completed quest became worth slightly less experience. This is such a minuscule gain/loss as to be mostly unnoticed, but it is generally the cause of the rarely observed progress message "You are 99% from extremely far from raising your stats"
The other quirk of quest experience is that the game only counts quest experience towards your total if you have at least that much combat experience. This is due to the fact that death causes a loss of combat experience, and the option needs to exist for a player to return to level 1. Since quest experience is not lost due to deaths or resets, a player that completed enough quests could not reset back down to level 1 since they have no way to lose quest experience. So if you have more quest experience than you do combat experience and complete a quest, you still gain the requisite amount of total quest experience, but it doesn't contribute to your total experience until you earn the same amount of combat experience. This means that while your quest experience is greater, you are essentially gaining 'double' experience from combat. Each point is both gained combat experience and 'unlocks' a point of quest experience. Likewise, when you are ahead in combat experience, quests will be worth their full value right away, creating a cycle of questing and hunting for maximal advantage.
Gaining Experience
As you gain total experience points, you will earn the ability to raise your stats. You start the game at level 1 with a one in all stats. Every 6th stat that you raise causes your level to increase. This results in your level generally being expressed as level+stats, so you begin the game at level 1+0, and as you raise your stats you become level 1+1, 1+2, 1+3, 1+4, 1+5 and then 2+0 and so on. You can track your progress through each stat using the 'score' command which will give you both a description of your progress (extremely far, very far, far, somewhat far, etc up through 'extremely close' and 'can raise your stats') and a visual depiction via a slowly filling graph. Once you can raise your stats, you do so at the Guild of Adventurers, the room one south of the Square of Arrivals in Central Castle. Once you are at least 'halfway to raising your stats' you also have the option to buy the remaining experience points with gold.
Buying Experience
Another feature of Midnight Sun is the ability to buy experience for gold. Once you've reached 'halfway' to raising your stats, the remaining experience points can be purchased with coins at the guild of adventurers. The price shown at that time is the amount needed from that moment. As you continue to quest or hunt, the number will decrease as you get closer to earning the full stat. If you have access to the gold to buy a stat it is generally assumed to be substantially more efficient than hunting for the experience points. The amount of gold it costs to buy a stat is impacted by your charisma, which is one of the main features of the stat when deciding whether to build a charisma-based character outside a charisma-based guild.
Experience And Death
When your character dies, you will lose combat experience. The amount of experience you lose is proportional to the relative difficulty of the monster that killed you. Dying to a weak monster punishes you more harshly than dying to a powerful monster, to help make it worthwhile to risk death fighting dangerous foes. In virtually all cases, a death will cost you at least enough experience to set you back 1 full stat point, and sometimes more depending on the circumstances. Which stat you lose is chosen proportionately randomly, that is to say, if you had raised 6 strength, 10 constitution and 10 intelligence and lost one stat, you would have a 6/26 chance of losing strength, and a 10/26 chance each of losing constitution or intelligence.