Nerves app structuring

1 & 2 could(should?) be simple clients that have a socket connection open to 3 (perhaps with https://github.com/Aircloak/phoenix_gen_socket_client)… so they could share code and configs would decide if it was respawn for gameX or playerX for gameX…

you will face and be fighting latency issues - player A tags B, and then B tags A - however wifi latency etc. can change the order of those messages. so you will need to timestamp the event messages on the device… (you might need a device with RTC or add it to the board https://www.adafruit.com/category/858 - so clocks don’t drift)…

and even then you still need logic on the ‘judge’ if a tag event comes in it should wait x ms to see if another and contrary event comes in - and then decide based on the timestamps if A gets the tag or not.

mnesia doesn’t solve this logic so I would not venture there. start with ets and then you can always lazily persist things to sqlite etc.

also you will face rfid latency… you might have to use battery assisted tags…

3 Likes