You never know what opportunities this adventure might bring, but certainly more than just keeping it on your hard drive. Go for it mate.
You never know what opportunities this adventure might bring, but certainly more than just keeping it on your hard drive. Go for it mate.
Heroku restarts their servers once every 24 hours with only thirty seconds' warning. Since the games are in-memory, this of course kicks everyone out of whatever games they may be in the middle of.
I guess the solution is to have the games be on Redis instead of in-memory? I'm a bit more front-end oriented so I was bewildered to learn this was how it worked in the first place and I'm not 100% confident in my solution.
If you use a PaaS (platform as a service, e.g. Heroku, DO App Platform, AWS EB), they might assume your app to be stateless and do things like restart it at will.
If you use a VPS (virtual private server, e.g. DO Droplet, AWS EC2), this certainly shouldn’t happen, but of course it requires some Linux skills to maintain your VPS.
So it’s basically a trade-off between engineering your app to fit a PaaS or hand-managing your VMs (though the latter is usually the cheaper option).
Redis would work but I'd be afraid of race conditions. There probably wouldn't be any, but it's something to be aware of.
If you wanted to test the waters with at least the relative public, I'd consider doing step 1 of renting a server, but then hiding it behind a Tor hidden service. Inconvenient to connect to? Yeah. (Probably) safe from the Hasbro demons? Also yeah.
Feel free to message me and I’d be happy to help with server stuff.
I'd be happy to help if you need anything! Whether hosting or just backend related questions!
Also depending on how hard coded your architecture is, maybe you can separate out the Magic specific data from the app itself? So the MTG specific data could just be loaded as a datapack?
An open-sourced codedump will survive best if people (which effectively means "average technically-minded MTG player" in this case) can run it wherever they're most comfortable - which will almost certainly be something that smells like a VPS. Mayyybe a container.
If both players are still connected once the server comes up and client reconnects, both players can send state to server and if both players' global states match then the game resumes, if not then error out. If only one player reconnects cause the other couldn't wait & closed tab, then you gotta error out anyways.
Then you don't need Redis or any other additional dep at least.