tresinformal / drakkar

The tresinformal video game called 'Drakkar'
GNU General Public License v3.0
11 stars 4 forks source link

Players' stats and event logs #643

Open EvoLandEco opened 1 year ago

EvoLandEco commented 1 year ago

Player class may or may not need a score member.

If the scores are calculated based on event logs and player stats, then the scoring board itself can do the job. We may have the scoring board to keep the K/D/As and other stats for the players and synthesize these with the event logs (which may be implemented as a new class) to get the final scores and set the final winner(s).

But one may also think that in the above case we give too much power to the scoring board. An alternative approach is to let the players keep their own stats and records and report them to the scoring board when enquired.

To sum up, we need to decide where to keep the event logs and players' stats.

richelbilderbeek commented 1 year ago

Great idea! Write one or more tests to put your ideas into code :+1:

EvoLandEco commented 1 year ago

@richelbilderbeek I am looking for a proper way to design the event logs, e.g., how to store the entries:

A player eats a food, we need an entry with (player_id, food_type, amount, n_ticks), A player hits another player, we need (player_id, another_player_id, n_ticks) A player collects an item, we need (player_id, item_type, amount, n_ticks)

And maybe much more different combinations in the future, std::variant seems legit here, but I don't think we are using c++ 17 standard? Could you please give some advice on this?

richelbilderbeek commented 1 year ago

@EvoLandEco, my advice will be: (1) write a first simple test. (2) expand from there, while keeping the test.

I would enjoy seeing the reasoning behind using std::variant, a log message seems like a std::string to me :-)

We do use C++17, you can see that in game.pro.

I hope that helps. Again, start writing simple tests.

Note that this Issue is actually two: (1) a player has stats, (2) the game has an event log. About (2): Do we really need a log? If yes, write a simple test.

Again, I hope that helps. Again, start writing simple tests.

EvoLandEco commented 1 year ago

@richelbilderbeek Sure, I'll write a few tests today to illustrate the ideas, and I think I just thought too much, and it would be the best to just keep things as simple as possible, such as, parsing a simplestd::string

EvoLandEco commented 1 year ago

@richelbilderbeek Sure, I'll write a few tests today to illustrate the ideas, and I think I just thought too much, and it would be the best to just keep things as simple as possible, such as, parsing a simplestd::string

And yes, event log may not be really needed as we could just let things happen without recording it in a separate place

richelbilderbeek commented 1 year ago

@EvoLandEco yup, writing tests prevents one from overthinking :-) . Welcome to The Good Life :+1: