I spent the first three days of this week doing something that was out of sequence: the process of transforming Mr Football into a working Progressive Web App using Google Workbox. This is something that really should have been done after the other stuff on my list, but I’m a solo developer and it needed to be done, so I jumped in that rabbit hole because I had to at some point, it might as well be now.
The real reason I did it was because I could finally get the app to a state where I could send it to someone else to install it on their device, which is an emotional milestone as well as a technical one. My old mate Phil Malone (known universally online as mollyfud) was my most important early user on FanFooty, donating a raft of insightful suggestions which turned into features that are still at the core of the site nearly two decades later. Testers are an underappreciated but very necessary part of a successful software project, be it Web development or game apps or whatever. Molly deserved to be the first person other than me to see Mr Football, and it gave me some strong positive feelings to bring it to him. I look forward to hearing his feedback as the app moves through alpha stage through beta and then to launch.
Mr Football is now a Progressive Web App, a process on which I spent three days but could apply many more to perfect it. Google Workbox is a powerful tool but its documentation is sparse and disjointed… not unlike Phaser has been at times! This is what we have to deal with in free software, you learn from others and extend and then post your own lessons, and we all stand on the shoulders of each other to reach greater heights.
The main complexity is in caching techniques. There are various elements of the Workbox toolkits that achieve caching in different ways; for the moment I chose a rather obscure one, as detailed in this blog post. I am pretty sure I will figure out a more elegant solution later on, but for now it will do to hardcode all the URLs I need – of which there are only about 60 thanks to TexturePacker which consolidates well over 1500 of my source images.
One of the problems I am having is that I am hosting the files on WPEngine, which also hosts my “day job” Web site FanFooty. Its cloud servers and backend systems are optimised for WordPress, including very aggressive caching strategies to minimise LAMP database calls. This complicates the process of hosting a PWA, because I have to keep refreshing the cache and figuring out how to get the client to validate at the right times. I haven’t worked it all out yet, a task that will be completed during the beta, suffice it to say that the app is at least up and working.
I had to make a conscious decision to step away from the Byzantine workings of Workbox to return to my Phaser code, and I am pleased to say that even though it took me a couple of extra days, I have finally got the match code back up and running all the way through to the match loot scene and back. As I said in last week’s crunch post, maintaining similar but subtly differing code bases for client and server made the process of debugging tiresome and time-consuming. It’s done now though, and I feel like week 7 will commence the downhill run towards beta.
An issue I am going to have to solve before the full launch is a discrepancy between random numbers generated on client and server. I am using a function based on the Mersenne Twister algorithm, but I am now looking at a variation of the Web standard Xorshift algorithm. I need it to be pseudorandom because I want a mountain of consecutive dice rolls and raffle choices, totalling hundreds of calls of the RNG function, with the same result from similar Javascript code in Phaser and Cloud Functions. Another item to tick off in the run home.
It was another week where I was able to single-underline a lot of elements on my Roadmap spreadsheet, indicating an iteration rather than a completion, and left untouched a lot of double-underline elements that I had planned to work on. I am very much looking forward to changing a lot of colours starting on Monday.
Leave a Reply