Playmentum + Stepford County Railway
What is Stepford County Railway?
Stepford County Railway is a railway simulation game on Roblox. Players choose to play as a Passenger, Driver, Dispatcher, Guard or Signaller and carry out different tasks depending on the role they choose. The Hub Site allows players to track their own statistics and see those of other players who have chosen to share them.
As players carry out their tasks, live information is streamed from the game onto the Hub Site - this allows them to, for example, track the progress of the train they're driving.
What did we build together?
The Hub Site is a "world first" for Roblox. Together, we built an end-to-end solution which captures events that take place in-game and turn them into meaningful data beyond the game.
The solution comprises five main components.
- Roblox Scripts: A series of Roblox ModuleScripts and functions that capture in-game events and submit them to the Event Sourcing API.
- Event Sourcing API: A RESTful API which receives batches of events and distributes them for processing by the Event Engine. The API supports the latest encryption standards, and each request is required to present an API key to help ensure that only legitimate data can be passed to the Hub Site. The API component runs concurrently on multiple nodes in the swarm to provide resilience, non-disruptive upgrades, and load balancing. As an HTTP service, it's also deployed Cloudflare DDoS protection.
- Event Engine: A scalable and resilient state machine which processes the events sent from the game and uses them to track players, servers, role activities, and the overall state of each SCR game in progress. Event Engine does not expose any public endpoints. It receives events sourced via the API using RabbitMQ, processes these (often concurrently) and updates the database and cache accordingly. Multiple instances of Event Engine run concurrently, and the number of running instances can be scaled up or down to suit demand.
- Scheduler: A process which performs aggregate statistics calculation, updates live departure boards, and performs maintenance tasks. Tasks are carried out once the Scheduler service injects pseudo-events into the Event Sourcing API, and are processed on instances of Event Engine .
- Web Site: A modern, clean and high performance web frontend that allows players to view their statistics and watch games play in real-time.
As well as the Roblox Luau scripts which run inside the SCR Game, the Hub Site tech stack includes:
- Docker Swarm, used to host a fully containerised environment on virtual machines hosted and managed by Playmentum. We use Docker Swarm to easily scale and add resilience to the solution.
- MongoDB, chosen for its incredible speed and low development overheads.
- Redis, chosen to provide highly scalable and low latency caching and pubsub capabilities.
- RabbitMQ, chosen as a reliable messaging queue which can scale to hundreds of thousands of messages per hour, and can support hundreds of concurrent producers and consumers.
- .NET 8, chosen for the strength of both C# and the associated package ecosystem.
- Blazor WebAssembly, chosen for its blazing fast client-side performance and the ability for us to reuse code across the client/server boundary.
- SignalR, chosen for its ability to deliver real time notifications from the Hub Site servers straight into the client-side WASM application.
Using the architecture designed and built by Playmentum, the Hub Site processes nearly a million events each day, collating them into real-time and historical information to display on the site. New information appears on the site less than 2 seconds after events occur in game.
What do the team at Stepford County Railway think about Playmentum?
Playmentum, working in collaboration with Stepford County Railway, develops and supports the Stepford County Railway Hub Site. Combining historical statistics with real-time insight, the Hub Site brings the Stepford County Railway experience "beyond the game", and into the browser.
The Hub Site went live in December 2023.