With Nobody is a prototype for an HTML5 games website built with Drupal 8. As the domain name might suggest, the website is intended to host single-player and solitaire HTML5 games.
The system has the capacity to host an unlimited number of HTML5 games with the ability to store player scores for high score rankings and other statistical data.
The site currently features a single game called "Dice With Nobody" (a single-player Yahtzee like adaptation of the popular similarly named mobile game.)
The following is a brief technical overview of how everything works.
The data structure consists of 2 content types: a node to store game attributes and a custom entity to store player scores.
The game node includes a path field used in a field template to display the game inside an HTML object.
The score entity includes field references to the game node and user object. While the prototype only supports anonymous (unauthenticated) players, user accounts (part of Drupal core) could easily be enabled and expanded.
A custom module contains a hook that attaches a JSON variable when viewing a game node. The JSON contains attributes about the game node and player.
A REST web service is enabled to allow POSTing of player scores at the end of a game. This involved configuring 'trusted_host_patterns' and CORS in settings.local.php and services.yml respectively.
GAMEMAKER STUDIO 2 HTML5
There's still more work to do. The responsiveness of embedding the game in an HTML object is somewhat wonky. Also, the contents in the tabular score pages don't dynamically refresh after a score has been added.
But overall the combination of Drupal 8 and GM:S2 HTML5 is working great. In fact, I actually intend to use this method for an client e-learning project involving over a dozen education-oriented HTML5 modules written in GM:S2 to store student responses and other historical data.
For more information please contact me via my primary website heavykettle.com.