PDA

View Full Version : How is the score calculated?



Blanchflower
December 8th, 2013, 05:31
OK, I have been wondering about this for a long time. I would like to know how is the score in Dungeon Keeper calculated after completing each level. Anyone has any clue?

Thanks.

;)

mefistotelis
December 8th, 2013, 16:08
You should look at KeeperFX sources to find out.

Here's the line which gives your final score for High Scores table:

dungeon->lvstats.player_score = compute_player_final_score(player, dungeon->max_gameplay_score);

Now, you need to know what "compute_player_final_score()" does and how "dungeon->max_gameplay_score" is computed.

The first mystery is solved below:

long compute_player_final_score(struct PlayerInfo *player, long gameplay_score)
{
long i;
if (((game.system_flags & GSF_NetworkActive) != 0)
|| !is_singleplayer_level(game.loaded_level_number)) {
i = 2 * gameplay_score;
} else {
i = gameplay_score + 10 * gameplay_score * array_index_for_singleplayer_level(game.loaded_lev el_number) / 100;
}
if (player_has_lost(player->id_number))
i /= 2;
return i;
}

About the 2nd, you need to find "update_dungeon_scores_for_player()" in KeeperFX sources.

DragonsLover
December 9th, 2013, 00:00
If I remember well, the score is calculated by the amount of battles you win along with the efficiency of your rooms. This also goes along with the level position, higher is the level number, higher would be the score. I don't know however if it applies to custom levels too. Does a Map65535 for instance will cause the player to get a ridiculous amount of score? Can you answer this, Mefisto?

Blanchflower
December 9th, 2013, 05:03
Thanks for the reply. So the amount of time taken into completing a level is not under consideration?

mefistotelis
December 9th, 2013, 17:06
Does a Map65535 for instance will cause the player to get a ridiculous amount of score?

No, at least not in KeeperFX (I don't remember how it was in original code).

For single player levels, level index in campaign (not number from file name) is used, so every level previously beaten adds +10%:

i = gameplay_score + 10 * gameplay_score * array_index_for_singleplayer_level(game.loaded_lev el_number) / 100;

For MP and free play levels, the multiplication is constant:

i = 2 * gameplay_score;

DragonsLover
December 10th, 2013, 03:30
Thanks for the reply. So the amount of time taken into completing a level is not under consideration?

I don't think so.

And Mefisto, good to know.