[ENG] Developer Guidance, Basics: Using calculated or precalculated Stat-Tables in your Game

Hello everyone!

currently i am developing a RPG Game in Unity, with considerations of creating a MMO-RPG. During the development, I had to think of some logical parts of the game, for example things like level-dependend stats (for auto-leveling a character) or experience points for leveling up.

I’ve made some good progress and the developing steps are currently satisfactory – there’s a good progess on that. In the current stage, I though about the advantages and disadvantages in calculation exp-, damage-, stat-tables and so on during run time. The other option could be precalculated datasets, either in a (lite) database or a cvs-file, where the corresponding values are stored. Here I want to present my considerations during the evalulation process of both options.

These are my suggestions:

  • Using run-time calculation
    You plan to use run-time calculation values,  so there are following constraints for this task. The game should be:

    • …single player or,
    • …LAN/Internet game with a limited number of players, with around ~72 players at maximum. Reminder here: all the calculations should be done on server side and the maximum players depends strongly on the processor and RAM of the server the game is hosted at.
    • …either the values are dynamically calculated on the startup at the program,
    • …or the values are calculated on the fly when needed in a very short time. My suggestions is far under 1ms on real-time, during start-up can be discussed separately
  • Using precalculated values (Note: all calculations and evalution should be done on the server)
    If you plan to use precalculated values, the game should be:

    • …planned as a MMO or other high-playercount game,
    • …implement a fast search / lookup-method in your table (maybe representation of the table as a tree)
    • …the search should be performed for 100 players (or 1000 players…or even more!) under 5 ms.
      The precalculation can be done in two ways:
    • …either do the fixed precalculation at the start of your server,
    • …or a fixed dataset, like a cvs-file or stored within a database. Important here: try to load all the values into the memory for faster evaluation/search

Some side notes on…
…precalculated values:
As stated above, you can either calculation the values on runtime or by a fixed dataset. You should keep following hints in mind:
Using fixed datasets means, that if you plan a change on your tables you have to update all the datasets. This could be an issue if you use some bulk-datasets and experiments during the developing time and decide to change the whole steps or logic of your calculations. I don’t see this as a huge problem since you can update the datasets in a smart way.

…runtime calculation:
Runtime calculation implies that if you change the calculation logic, you’ll need to recompile your whole game and you need to roll-out the update.

… general:
Calculation at the startup on the program could be considered as a mix between run-time calculation and precalculated values. The small difference is that the precalculated values on datasets exists and needs to be parsed and evaluated, while the run-time calculation could be assigned directly into the appropriate actors/gameobjects/entities.

That’s it for this topic!

Last but not least I’d ask you to leave any questions or comments on this article. Either on the grammar and spelling or on the content itself – thanks!

Ersten Kommentar schreiben


Deine E-Mail-Adresse wird nicht veröffentlicht.


Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.