Cloud Gaming
Enabling gameplay on any web-connected device
JavaScriptTypeScriptSASSCSSReact.jsReact NativeNext.jsNode.js
/_next/static/media/cloudGaming.6c3f948e.png
Picture This
Imagine you're looking at a website, you see some compelling games, and then… There's just a download link. Bummer. The game might be good, but what if you don't enjoy it? Wouldn't it be great if there was a way to preview the game first? That's where Cloud Gaming comes in.
How do we allow users to preview games?
To start, there are two actors in this system: the players and the hosts. The players should be able to:
  1. Visit the site
  2. Log in
  3. Press "Play"
  4. Start playing
Our goal was to build a seamless user experience. We broke this down into two high-level tasks: find a place to host the games and create an access point for users to play said games.
Host the game
  1. Find somewhere to host the servers
  2. Download emulators onto the servers
  3. Download the games to be played on the emulators
  4. Expose the emulators to the web through the servers
  5. Allow a connection to the emulators
  6. Create a bridge between the emulators hosted on the web and where the user's browser
Create an access point for users to play
  1. On the website, create a way for users to log in to the ecosystem
  2. Manage user login authenticity
  3. Ensure the user experience runs smoothly
  4. Enable logging out
  5. Gracefully handle any issues that may arise
I was largely responsible for the second task, for which I created the path through which users logged into the existing ecosystem, managed and refreshed their login tokens, and ensured errors were handled gracefully.
Let's break it down.
First, a user visits the site to play a game. But before they can play, they need to log in. To enable logging in, I first created an element on the hamburger menu that redirects a user to the in-house login flow. Upon coming back to my page after a successful log in, the user would have two cookies: one that shows that they have been authenticated, and another that allows us to refresh both tokens.
Now, after a user logs in, they need to be able to launch a game. To allow this, I integrated a wrapper component that represents the emulators on the servers, which allows the user to connect to the server.
Finally! Using the tokens from the first step, we can communicate with the server through this wrapper, the user is authenticated by the server, and then they can begin playing!
Why do we need refresh tokens?
Refresh tokens are needed because of how we implemented a solution to prevent abuse. When users interact with the system, they should not have indefinite access that could potentially be misused. To solve for this, we implemented expirations on the tokens.
However, expiring tokens would result in users being spontaneously logged out during their gaming experience. To avoid this potential interruption, I periodically refreshed the authentication token by requesting new tokens through the login API service used earlier. The refreshed tokens would then be sent to the game server to authenticate the user, keeping them in the game without interruptions.
Reflection
Through this work, we were able to create a seamless cloud gaming experience that is still live years later. It involved cross-functional collaboration with project managers, designers, and fellow engineers. While there have been some updates to how the experience is handled now, the core remains the same: allow people to play games on the cloud.
In the end, this project increased the average length of time users spent on the site by more than 10%.
Other Projects
/_next/static/media/moreGameGenres.d84f91ed.jpg
Game Genres
Adding genres to games for easier discovery
/_next/static/media/siteStockImageAlt.4e1c1931.png
Personal Website
Showcasing my skills by building a website from scratch
Coming Soon!