Monday, 31 August 2020

How we adapted Tetris for the cloud

I remember it fondly … long road trips with my family and hours in the car, with Tetris on my brother’s Game Boy keeping us company. Clearing line after line, nailing a Tetris whenever I could, having that iconic music loop in my head for hours until the batteries died … for many of us, this was our first experience with Tetris. And for that reason, Tetris is instantly identifiable as a mobile experience for an entire generation of gamers.

Recently, N3twork able to team up with The Tetris Company to bring Tetris to a new generation of players. For many of us on the team, this opportunity meant a great deal to us. It meant that we had the chance to take this game for which we had an immense amount of love and nostalgia, and show it to players for the first time. It also meant that we were tasked with the exciting challenge of how to modernize this classic with new features that today’s players expect. We aimed to introduce new features and modes that give players social elements, to give players the ability to share, compete, and connect with each other.

Tetris has always felt at home as a mobile game, given that it had such prevalence on the Game Boy. Bringing it back to mobile devices felt like a natural fit, one that immediately sparked nostalgic feelings in gamers who grew up with it on Nintendo’s handheld, while fitting perfectly into the lifestyles of today’s gamers on the go who want to grab a game when they can on their smartphones.

Connecting a new world of players

We wanted to make Tetris more social and go beyond simply bringing the franchise to the world of smartphones using social features like leaderboards or chats. We’ve developed multiple competitive modes for the game, like Tetris Royale, matches 100 people from around the world to all play a last-player-standing round on the same board. In Tetris Together, you create rooms to play with friends. We’ve taken this a step further so players can talk to each other while playing, making it feel more like a hangout. You can also customize each Tetris Together match to suit either casual or highly competitive play.

Making things appear seamless is often the most labor-intensive thing you can do. In developing Tetris Together, we discovered that making our deadline for the feature meant efficiently using our existing multiplayer infrastructure and adapting it to the needs of the new mode. We wanted to allow people to invite their friends to their games using text messages, which would direct players to download the game then connect through a lobby with functional voice chat. To make this all happen in time for the worldwide launch date, we had to do a lot of engineering work to take the Tetris Royale mode’s multiplayer functionality but bypass matchmaking. Efficiently reusing our existing resources for a bigger multiplayer experience helped prepare us for an even more ambitious multiplayer mode down the road.

Like a real battle royale skirmish, integrating the new BR mode involved a great number of challenges. As a mode with 100 players, we had to make sure that every player would have a consistent gameplay experience regardless of what device they were running and despite countless network conditions on mobile phones. We were able to refine the gameplay based on developer playtesting, but to make sure it was stable on a larger scale we used automated testing. We built tools to load-test our game with hundreds of thousands of players concurrently playing and mimicking player behavior captured from the employee and EP tests. These results of these tests assured us that our servers were up to the task for the next big feature we were ready to reveal.

There’s one mode we’re especially excited about, and that’s Tetris Primetime. It’s a live game show hosted nightly. In Tetris Primetime, you’re simultaneously playing against potentially hundreds of thousands of competitors across the globe. You play in rounds, with a new goal to accomplish in each, and winners are entered into the drawing for real-cash prizes each night.

Getting the Primetime mode to properly synchronize across thousands of devices was tough, we also struggled to create a city-by-city leaderboard that shows players how they fared against nearby peers. How do we constantly synchronize each major city’s leaderboard, and how do we gather those players to form comparative results? For that, the team had to engineer a dynamically scalable leaderboard using AWS Elasticache to keep the scores up to date.

Getting help from the cloud

If you’re a game developer, you know this issue … we dedicate a significant amount of effort to deliver players the perfect multiplayer experience. If you’re running live ops for a multiplayer game, players expect a flawless experience, and they will not stick around if it stutters. Giving the same hard-hitting action as players would enjoy on console or PC presents some unique challenges for mobile developers. Consoles and PCs typically have stable connections with reliable internet access. For mobile, network conditions can be much more challenging. Mobile means movement, so you have to take into account higher latency and inconsistent connections from people playing on the go.

At previous companies, some of us built and operated our own server infrastructure. But when we started N3twork, we committed to never do that again. For Tetris, we built the game on Amazon Web Services’ (AWS) cloud, and that gives us some clever ways we can mitigate the latency caused by mobile.

With Gamelift FleetIQ, we can quickly provision large amounts of server capacity for Primetime just before the game starts, ensuring we have servers ready to go for everyone around the world. In Tetris Royale, you can play with anyone in the world, so when each player transmits game data to our servers, we quickly synchronize using Elasticache, and ultimately to Amazon DynamoDB, to keep everyone in sync. If one player’s connection drops for whatever reason, we can keep the game running in-sync for the other players, and the impacted player, because we know where everyone is progressing on the board.

Above: N3twork uses the cloud to help it run different modes in Tetris.

Image Credit: N3twork

There’s also another topic that all game developers can relate to — how to scale when your game needs it. With Tetris Prime Time, we know exactly when a surge of players will arrive. Every evening there’s a huge onrush from everyone showing up at once for the live game show; we see 80% of players arrive in the first 30 seconds. We need to access and provision enough server capacity very rapidly to consistently meet this demand and provide a good experience for players. That’s where the cloud comes in again.

Amazon Web Services, and their Amazon GameLift service, solved this big problem for us. By having access to compute power through the cloud, we’re able to get the server capacity we need, fast enough, without having to provision and manage servers. Because Primetime games only last about 30 minutes, we can get the server capacity we need quickly, and then return it when we are done. Having to manage enough servers to handle the load of potentially hundreds of thousands of players would have been a huge amount to handle on our own. Working with the cloud means we don’t have to add additional staff to manage infrastructure. This helps improve the bottom line not just from overhead but also from server-hosting by tapping into unused EC2 Spot instances at a discount when compared to on-demand pricing. We have less to worry about and can focus more on Tetris and our players, while scaling with the growth of the game. Another advantage of the cloud is the capability to get capacity to run full scale load tests that allow us to simulate hundreds of thousands of players showing up at once, ensuring our entire architecture scales up simultaneously to handle the load. AWS made it easy for us to make these load tests part of our normal QA process, which is very helpful in testing any new modes or content where we expect a large number of players will hit it at once.

Evolving a legend

Moving forward, data will help us learn what players want, and we’re already working on making Tetris Royale more competitive, adding new ways to challenge players. Primetime is also growing to feel even more immersive. Game infrastructure can be a complicated system, so for us, fewer moving parts makes it easier to scale. All of our game modes sit on a common architecture backed by AWS, so we can easily add new features on top of it.

We feel that Tetris is a great example of how new technology can breathe new life into classic franchises. The cloud can instantly provide teams, both large and small, with access to pools of resources that can be turned on or off as needed. Having the capability to take the worries of managing game infrastructures and resources off of your team’s plate frees them to focus on what we’re all passionate about — making games players love, and bringing the games we love to new players around the world.

Stephen Detweiler is the cofounder and CTO of N3TWORK, and before that, he was the cofounder or ngmoco (a pioneer in mobile and free-to-play games in the smartphone era. DeNA acquired it).

Source

The post How we adapted Tetris for the cloud appeared first on abangtech.



source https://abangtech.com/how-we-adapted-tetris-for-the-cloud/

No comments:

Post a Comment