Before, there was no way to track the the state of the world after all player's logged off. Since i am using peer to peer (master - peer), there is no dedicated server, thus, no way to keep the game's state after the players leave. So i had this idea Friday evening. Basically, all i really needed was to record the NPCs stats (level, might, health), and their location. then every so many seconds, i needed to update it. When the first player joins, they will be the master client, and they will be the one keeping the server up to date & loading the world's state initially.
For example, player 1 joins, they are the master client now. Then, they play for a while, every 5 seconds the game does inventory and gives back all of the NPC's and their stats as a 2d text string array. This string array is encoded into a text file and sent to the github repo. 10 other players join (then due to other syncing I set up), they do not need to reload the world from the file, nor do they need to keep it updated (only one client needs to handle this).
Github allows 50,000 actions per hour, given that in order to update a file, you need to first pull the repo to see if a file exists & then get the file's sha. Essentially, you can have about 7.5 commits per second or about 133ms latency. Since only one client in the game is doing all of this, (updating the world's state, loading the world), there is no chance of exceeding the limit. Also, the latency for actually putting the file is normally around 400-800ms...
Yeah, also, the CDN will try to have give you the cashed version of the file, so make sure you force a new request each time you upload or the sha will mismatch. Also, when pulling the file, you may think that you can just use the raw url (atleast since it is a public repo), however, the CDN will just give you a shit copy of an older cached version.
So apart from all this, the hardest part is integrating it with webgl and unity. Unity is a piece of shit when it comes to networking, it does not support Asyn, so you need to use enumerators for everything.. Also, you cannot use any non-native networking modules. So everything must be done using UnityEngine.Networking. Lastly, headers are a joke in webgl, do not even try to use any headers other than Authorization and Content-Type or CORS will fuck you.
Now, the fact that you can do this is pretty cool. There are a ton of services that offer the same functions, yet charge alot. Even more, if you were developing a game that isn't super high-paced / a strategy game etc. Or you dont care about having potentially terrible latency (50,000 requests (2 requests per put), 133ms minimum delay, more users, less requests etc.etc.), so if your users can go with a 5000ms latency, this could be used for other multiplayer scenarios.