Hello Heroic Labs community,
When it comes to make an online game, you always have items or characters that have stats.
Let’s say i have a sword, Excalibur, that have 40atk power.
Let’s also say that the stats of Excalibur cannot be changed by the player, it is a constant value.
The thing here is i have to store this data somehow both in server and client.
From a client perspective, i need to be able to check how much atk power my Excalibur sword have.
From a server perspective, i need to be able to compute how much damage my player did to its opponent.
Now let’s say i want to update my game and buff Excalibur to have 50atk power.
I then have to change my constant values both on server and client side. This can be a pain to change it on both side everytime you want to tweak a value or a stat when play-testing for example.
To solve this issue the obvious solution is to store this value in files shared by both server and client. This way i just need to tweak the stats of Excalibur in my weapon_stats.json and the modifcation is made in both ends.
So here is my question: what is the best way to store constant values like this in Nakama ?
More specifically i want to be able to load them automatically at each startup.
The game I’m trying to make is going to use the match handler feature. So i could just load this data inside the MatchInit() and store it for the duration of the match; but this would mean that everytime a match is created a whole copy of the data is loaded into memory and this bothers me for obvious optimisation reasons.
One approach i can think of is to make a module that would load the data and update some Collections.
I feel like this could work well but somehow i also feel like Collections are more made for storing player data or stuff like that and not constant values.
So yeah i don’t know if there is some sort of conventional way to do this or something, any insight or criticism on what i said is greatly appreciated.
(sorry if poor english i’m not native)
(also sorry if wrong category i didn’t know which one to choose between Game Design and Runtime Framework)