Hi devs,
I've got a development question that I can't seem to find an answer for in the documentation (or maybe I'm just looking in the wrong spot):
There appear to be two ways to save information relevant to a given player during a game (for instance, their money, resources, etc. that are accumulated during the game):
1. 'money'/'wood'/'energy'/'what have you' could be stored as a field in the `player` table of the game db, which would require ADD'ing fields to the `player` table via the game's dbmodel.sql file, and then accessing them via SQL queries (unless there are more efficient ways to access db data that I'm not aware of...)
2. those same pieces of information could also be stored in the `stats` table of the db, which would require adding them as an element to the array at $stats_type['player'] in stats.inc.php; this seems to make it a lot easier to access and transform these pieces of information from the game.php code via init/get/set/incStat
When would I want to use one method over another? Are there certain stats that *MUST* (or at even *SHOULD*) be in one table versus the other (for instance, I assume that the fields 'player_score' and 'player_score_aux' *MUST* be kept up to date in the `player` table for the automated final scoring & ELO point assignment to work)? Does one approach have valid use cases where the other does not? And, is there an easy way to use `stats` fields (and thus, ...Stat functions) to keep track of info for 'player_score' and 'player_aux' fields, and maybe even to sync these `stats` fields with `player` fields?
Or am I going in entirely the wrong direction here? Are these two approaches roughly equivalent, with a push to move away from one of them (what seems to be the older dbmodel.sql `player` approach) to the other (probably the seemingly easier to use stats.inc.php `stats` approach)?
Thanks,
Collin
I've got a development question that I can't seem to find an answer for in the documentation (or maybe I'm just looking in the wrong spot):
There appear to be two ways to save information relevant to a given player during a game (for instance, their money, resources, etc. that are accumulated during the game):
1. 'money'/'wood'/'energy'/'what have you' could be stored as a field in the `player` table of the game db, which would require ADD'ing fields to the `player` table via the game's dbmodel.sql file, and then accessing them via SQL queries (unless there are more efficient ways to access db data that I'm not aware of...)
2. those same pieces of information could also be stored in the `stats` table of the db, which would require adding them as an element to the array at $stats_type['player'] in stats.inc.php; this seems to make it a lot easier to access and transform these pieces of information from the game.php code via init/get/set/incStat
When would I want to use one method over another? Are there certain stats that *MUST* (or at even *SHOULD*) be in one table versus the other (for instance, I assume that the fields 'player_score' and 'player_score_aux' *MUST* be kept up to date in the `player` table for the automated final scoring & ELO point assignment to work)? Does one approach have valid use cases where the other does not? And, is there an easy way to use `stats` fields (and thus, ...Stat functions) to keep track of info for 'player_score' and 'player_aux' fields, and maybe even to sync these `stats` fields with `player` fields?
Or am I going in entirely the wrong direction here? Are these two approaches roughly equivalent, with a push to move away from one of them (what seems to be the older dbmodel.sql `player` approach) to the other (probably the seemingly easier to use stats.inc.php `stats` approach)?
Thanks,
Collin