Crunch week 1: Authentication and onboarding with Phaser 3 and Firebase

I am going to take the opportunity of Friday night football games, when I am liveblogging a match for FanFooty, to write a weekly update during the ten (or more) weeks of crunch time in the lead up to the Mr Football beta, scheduled for October 2023.

The first task on the Sequences outline was onboarding, which starts with the process for creating new accounts and logging in. This is one of the more complicated areas that I had been leaving until late, so the fact that I haven’t finished it after five days of work is not that worrying. I have had to think a fair bit about the workflow of how I want it to operate, and there aren’t many templates or examples out there for how to get it done.

After reading a fair bit about onboarding best practices in recent weeks, I didn’t want to confront players with a login screen on their first load of the game. My vision is for a new coach to wait the minimum amount of time to load up the opening cutscene – which would just be a handful of images and text in a montage, so it would be relatively quick – and play it while the preloader scene loaded up all the other Phaser assets and established the new user’s credentials with Firebase. The cutscene would be skippable as soon as the preloader is finished assembling all the assets, and it would only be shown on first login (or at the start of a new season).

This means every new coach logs in anonymously to the Firebase authentication system, and if they prefer to stay that way then they can… but if they want to use that same account on another device, they have to convert that anonymous account by logging in from a third party provider, of which Firebase enables six different options.

That system was what I spent most of today doing, after figuring out the login flow in preceding days. At the moment I have the same login code in the preloader scene and a separate login scene for when you want to log out, though I have had the bright idea to separate them out, and will get to that presently. I haven’t seen an example online of a separate Firebase login scene working concurrently with a preloader scene in Phaser, but I think that’s the best way to do it because that means I can keep the listener from the login scene operating after the preloader goes to sleep. The login scene code would thus be lurking throughout the game, not displaying anything but responding to Firebase authentication events like a log out request.

Another rumination I have had this week was implementing Firebase authentication for FanFooty, which would mean a lot of problems disappear for me as I have always sucked at login systems on my Web sites. I wouldn’t have as much control over my FF user database, but that seems like a small price to pay. I was never particularly comfortable doing mass unsolicited mailouts for sponsor clients, and if I can earn my keep doing other things than I am happy to drop that.

It may seem like I haven’t ticked off many items on my colour-coded spreadsheet, but I am happy with progress this week and expect things to quicken up from here.

Previous post in this series: Mr Football Q3 2022 Roadmap… a beta?! 

Exit mobile version