AWS Case Study: Clash Royale
Clash Royale is a real-time multiplayer mobile game developed and published by Supercell. In this game, players collect and upgrade cards featuring Clash of Clans troops, spells and defences. Players battle against each other online in real-time, aiming to destroy their opponent's towers and win trophies. The game has millions of daily active users and requires a high level of reliability, scalability, and performance to ensure a seamless gaming experience.
To manage the millions of daily active users and provide a seamless gaming experience, Supercell, the game's developer, has leveraged Amazon Web Services (AWS) to scale its infrastructure and optimize its performance.
Challenges:
The biggest challenge faced by Supercell is the massive scale of the game. Clash Royale has millions of players worldwide, and each player generates a large amount of data that needs to be stored and processed. Additionally, the game is constantly being updated with new features and content, which means that the infrastructure needs to be flexible enough to adapt to these changes quickly.
Solution:
Supercell uses AWS to support Clash Royale.
“Since the launch of our three games, our player base has expanded at an incredible pace. We don’t have to worry about being able to manage our infrastructure to match our growth—AWS tools make it easy for us.”
-Sami Yliharju, Special Projects, Supercell
They use a variety of AWS services to meet the needs of the game. Some of the services used by Supercell are:
EC2 is used to run the game servers. These servers are responsible for handling all the game logic, including matchmaking, battles, and rewards. EC2 instances are provisioned to handle the traffic load and ensure that the game runs smoothly for all players. EC2 provides scalable computing capacity in the cloud, allowing Supercell to quickly provision and configure new servers, whenever there is a crunch.
S3 is used to store game data, such as player profiles, game replays, game assets, game progress, and other important data that is needed to maintain the game's state across different devices. This allows players to seamlessly switch between different devices and pick up from where they left off. S3 is a scalable and reliable storage solution that allows Supercell to store and retrieve data quickly.
"Amazon Simple Storage Service (Amazon S3) to store up to 10 terabytes of games event data each day. Long-term storage, backups, and archiving are handled in the low-cost Amazon Glacier storage service."
-Sami Yliharju, Special Projects, Supercell
ElastiCache is used to improve the performance of the game servers by caching frequently accessed data in memory. This reduces the amount of time it takes to retrieve data from the database, resulting in faster response times for players.
In Clash Royale, CloudFront is used as a content delivery network (CDN) to distribute game assets globally. CloudFront caches game assets in edge locations worldwide, reducing the latency and improving the response time for players.
When a player requests a game asset such as an image, video, or audio file, the request is routed to the nearest CloudFront edge location. The edge location checks if it has the requested asset in its cache. If the asset is in the cache, the edge location returns the asset to the player with low latency. If the asset is not in the cache, the edge location retrieves it from the origin server, caches it, and returns it to the player.
By utilizing CloudFront, Clash Royale ensures that players worldwide receive game assets with low latency and high availability, improving the overall gameplay experience.
Before we take a look at how Clash Royale uses Amazon API Gateway, let's see what is the meaning of an API.
'APIs are mechanisms that enable two software components to communicate with each other using a set of definitions and protocols.’
Amazon API Gateway is a fully managed AWS service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at scale. It can be used to build RESTful APIs that can be consumed by other applications or services.
In the case of Clash Royale, Amazon API Gateway is used to expose certain game-related data or services via a RESTful API. This API could be used by other components of the game, such as the matchmaking system, the social features, or the in-game store.
For example, the game may use Amazon API Gateway to:
Actually play the game. Right from launching the game, choosing the deck, to selecting which card to play on what tile.
Provide real-time game data, such as the current state of a player's battle, to the game client on the player's mobile device.
Handle requests to purchase in-game items, such as new cards or gems, and process the associated transactions securely.
Enable social features, such as friend invitations, battle invites and clan management, by providing a RESTful API that can be used by the game client and other services.
Supercell uses Amazon CloudFront, Amazon ElastiCache and Amazon API Gateway to deliver dynamic web content around the world, using edge locations for improved latency.
Supercell is using Amazon Kinesis for real-time delivery of in-game data, handling nearly 45 billion events per day. Whereas it recently ran its own Hadoop instances on Amazon EC2, it now uses Amazon Elastic MapReduce (Amazon EMR) to provide a managed Hadoop framework before passing the data into its data warehouse service running on top of Amazon EC2 instances. Kinesis data is also read into Amazon DynamoDB.
“We collect data because our games don’t stay in the top-ten lists automatically. Success has to be earned by listening to the community and the players, providing additional features, and balancing the game to make it fair for everyone. Amazon Kinesis gives our business-critical analytics and dashboard applications the data streams they need, reliably and without delays.
Amazon Kinesis does a lot of the heavy lifting, and lets Supercell focus on delivering games that delight players worldwide.”
-Sami Yliharju, Special Projects, Supercell
In a game such as Clash Royale, groups of players join a session to play a game, and you must update a specific player’s record to indicate the amount of time the player has been playing, the number of kills they’ve recorded, the number of battles they’ve won, the number of gold coins and gems left with them and a lot of other game related data. Users want to see old games they’ve played, either to view the games’ winners or to watch a replay of each game’s action.
Amazon DynamoDB takes care of all the above-mentioned actions.
Amazon DynamoDB is a popular database service modelling game player data because it is designed for high-scale use cases where consistent performance is critical as your game grows. Amazon DynamoDB scales to more than 100 TB with no performance degradation.
Moreover, you don’t need to manage servers and apply patches to any infrastructure and Amazon DynamoDB handles upgrades, backups and other administrative tasks, so that you can focus on developing your game.
“Amazon DynamoDB is good for use cases like ours where scalability and speed are crucial.”
-Sami Yliharju, Special Projects, Supercell
Amazon CloudWatch and AWS CloudTrail
To monitor, manage, and control its environment, Supercell uses a range of tools in the AWS Console.
Amazon CloudWatch and AWS CloudTrail allow it to monitor the current environment and give it a detailed log of all actions in the development and production environments.
Lastly, the gaming company also benefits from AWS Enterprise Support where they get 24/7 phone, web and chat support by highly skilled Cloud Support Engineers.
Conclusion:
Ultimately, I would like to conclude this blog by emphasizing the fact that AWS has been very instrumental in supporting the growth of Clash Royale. By using a variety of AWS services, Supercell has been able to meet the needs of the game's massive player base. They can scale resources up and down as needed, store and process large amounts of data, and distribute game assets around the world. AWS provides a flexible and reliable infrastructure that allows Supercell to focus on developing and improving the game.
“The world of gaming never sleeps. We have a 24/7 audience. We owe every player a great experience, and AWS is our platform to make that happen.”
-Sami Yliharju, Special Projects, Supercell
If you have reached till here, you are one of the elite ones to successfully read my first-ever blog. I owe you a big thank you!
Cheers!
Subscribe to my newsletter
Read articles from Kamal H directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by