Release 1.4: Share Your Designs!
Published on 2020-01-30 by Stuart SpenceI'm extremely excited to share this new version!
You can now share your creations online. Sharing creates your own web page on the ChessCraft website like this one. Your friends can then use the share code to play your custom boards and custom pieces. Or, backup your favourites online before upgrading your phone.
For two years now I've wanted to send my favourite boards to people, and now I can! Try it out and let me know what you think.
This was an incredible amount of work, and I expect I'll have to smooth out some kinks in the coming months. Fingers crossed. If you don't see the update yet, patience! Google Play can be mysterious.
In other news: there's also a new web page explaining how the artificial intelligence works.
Challenges
This was even more work than the 11 language translation update. My goal for the rest of this newsletter is to convince you just how much. Here are just some of the challenges involved, in order of what I tackled first:
HTML & CSS
Writing the board and piece web pages, such that boards of any width and height can be inserted into my HTML templates and displayed nicely on both mobile and desktop resolutions. I started with this so I'd immediately see something that looks nice, which motivated me to finish the journey.
CCN Parser
Porting my ChessCraft Notation (CCN) parser from the csharp language to the Python language, so that the web server understands the board and piece data structures.
I considered having the web server run a special compilation of the ChessCraft CLI (commandline interface) to generate JSONs. This has the advantage of re-using core code for half the work. However, after a long analysis, I concluded that solution was too bloated. I went with duplication instead. Parsing is much easier in Python anyway! CCN has been stable for over a year, anyway.
I also needed Python and Unity csharp to parse JSON data identically, character for character, and pass it through network data and encoding.
In short, both the Python web server and the csharp app needed to have identical means to convert to and from CCN, to and from JSON, and to and from web forms. Yikes! Automated tests, tests, tests.
Share and Import Pages
In the ChessCraft app: the new screens, buttons, graphics, popups, and dozens of error scenarios and messages that you might see in the ChessCraft app. The internal logic for handling network requests and giving a smooth user experience.
Much of this must be tested manually, unfortunately, and so I've added to my long testing checklist that I run through before every release.
Security-ish
- Rate limiting so the web server is not easily attacked.
- Never trusting that user data is valid or safe.
- Buttons to report vulgar content or spam.
- No accounts, emails, or passwords. Done for technical and legal simplicity.
- Logging IPs and other metrics so I can make stronger defences in the future if necessary. Or better understand a security crisis.
Genuine ID
I will happily explain this security through obscurity feature to you, trusted reader and fan of ChessCraft. The genuine ID is a random value generated exactly once by every ChessCraft install. It also includes a checksum and salt. The web server verifies this checksum for every attempted interaction, and ignores requests with invalid genuine IDs. So this is a unique identifier for spammers and malicious requests. It will be annoying for attackers to generate more.
Security isn't about indestructible vaults... it's about vaults that are too hard to break to be worth breaking.
Translations
The most important text for 11 languages is supported on the piece and board pages, and new app pages. This adds about 80 new chunks of text (strings) to translate with my translation scripts. Note: if someone gives an English name to their chess piece, the Japanese page will still show it in English, of course.
Performance
Board and piece pages are permanent once generated, and therefore cached. However my simple solo web server still serves all images itself directly. If this becomes a problem I plan to upgrade my instance to buy time, then start using a CDN. The first step is probably tracking my website performance, which I'm not doing (aside from crash reports with sentry).
Google Banhammer Fears
I reviewed Google rules on user generated content (UGC) and age ratings. I don't want ChessCraft to get perma-banned when people share boards shaped like swastikas and penises! Creations like this are inevitable.
This included getting my legal team (me) to write a required privacy policy and terms of use.
Test Driven Development
And of course, automated tests for everything on this list and more.
So Much, I Can't Even
I hope I've given you a sense of the tremendous amount of work this involved! I'm starting to fee like only game developers truly understand how much work goes into game development. What do you think?
AI Explained
I recently wrote a new page on the website explaining a bit about how the artificial intelligence in ChessCraft works. Only about half of classic chess AI techniques apply to ChessCraft. For the other half, I had to get creative with graph theory. Even if you have no experience with programming or AI, the page might be an interesting read for you.
Next..?
Let me know what features you'd like next. I have plenty of ideas - tho I prioritize requests if lots of people ask.
If you like, you can sign up for the ChessCraft newsletter by email. Thanks so much for reading!