jjPlusPlus / bringme-react-native

A scavenger hunt game using React Native and MLKit
0 stars 1 forks source link

Match Screen #28

Open jjPlusPlus opened 11 months ago

jjPlusPlus commented 11 months ago

Overview: Time to build some game logic. We can further break this into sub-issues

jjPlusPlus commented 8 months ago

We're at the stage where we need to start thinking about how we store the Player submissions each round. There are three paths we could take to do this with varying levels of difficulty to implement. We don't want to spend too much time on this because it is really just an intermediary step before we get WebRTC going.

  1. Store the image as a base64-encoded string (varchar) in one of the database tables.
  2. We could store it on the players table (which is a JOIN table between Matches and Users), but there are two problems with this approach. The first issue is that we (might not?) don't want to convolute a JOIN table. I'm generally fine with this if it were a good solution. The second and more pressing issue is that the players rows live for an entire Match, not just a single round, so the submissions would persist from round-to-round.
  3. Store the player submissions as a structured JSONB column in the Rounds table. The format would tie the submissions for that round to the player ID's. I don't know if the base64-encoded images would be feasible here because of their long character lengths. This strategy might then need to be paired with a hosted image solution (via Supabase storage which uses s3 under the hood). We can talk about this down the road but for scalability reasons we would want to run a daily job to delete images older than (n) hours
  4. We could create a new JOIN table called submissions (between Players and Rounds, player_id, round_id, created_at, uri). Again, a join table with "extra" columns.