Open wadelee1986 opened 6 years ago
Firebase is actually not used for data storage, but rather only for user authentication, and as a simple static-file hosting.
(Storage is plugged into the main game engine via the StorageManager interface; there are sub-packages for an MySQL-backed storage system, a BoltDB-backed one, and a simple in-memory one.)
In terms of replacing Firebase for the static file hosting, that should be quite simple, and just require a bit of configuration changes. server/README.md
contains information towards the bottom about setting up either Firebase or Google Cloud Storage. Obviously, neither will work in China, but that should give you an idea of generally what kind of configuration you'd have to do on your own. (Note that in the demo environment you just run the simple static server, no Firebase Hosting required.)
It's theoretically possible to extract Firebase and supply a different authentication system. That would primarily require factoring out two pieces:
These changes wouldn't be particularly challenging to make. If you have another client-side authentication approach you'd like to use and concretely want to factor the project so it's easier to plug it in, pull requests are very welcome!
Thanks a lot,
I will try it out.
If you do plan to try a pull request to allow a different authentication server, a few notes on design:
For the 1st bullet, above, note that right now the server/static/index.html has a google analytics ID and Firebase config baked right into index.html. That's a bit odd because it makes customizing those config parameters a pain. Issue #231 captures the work to factor those out of index.html somehow.
For the 2nd bullet, we'd probably need some kind of approach similar to how we do game-src/ components, that is to say, a component at a specific import location with a specific API that encapsulates which authentication backend to use.
For the third bullet, I'd imagine we'd need an AuthenticationVerifier interface (similar in design and spirit to StorageManager
) where a struct that implements that interfaces is passed at Server start up time.
I am from China, can't connect to google firebase server.