Search Unity

Nine use cases for Unity’s Game Backend tools

March 11, 2022 in Games | 10 min. read
Backend Header
Backend Header
Share

Building a backend to support your game systems isn’t easy, and you may not have the time, expertise, or money to build, host, and (most importantly) scale your own servers. 

By using Unity’s Game Backend suite, particularly with other Unity Gaming Services, you can focus on creating content while we handle the heavy lifting. Find out below what Unity’s Cloud Code, Cloud Save, Economy, and Authentication can do for you.

Breaking down game backend

1. Use centralized server time

Backend 1 - Green circuits

The simplest way to build timed elements in a game is to use device time. While that’s viable, unreliable device times can pose a challenge considering some players may use device time to cheat.  

For example, players could manipulate the time on their device in order to expand the window during which they can access limited-time items. 

Cloud Code allows you to write stateless server-side code and can offer a trusted, centralized "server” time that you can use when writing game logic. 

2. Offer redeemable coupons

Backend 2 - Building

Designing a rich system of in-game rewards can keep players engaged for a long time. Using Cloud Code, you can write scripts that can validate coupon codes and reward items in your game. 

Plus, you can alter coupon logic even when the game is live without requiring a new game client update. Publishing changes on the server is enough to enforce new coupon redemption rules in the client.

You can use Cloud Save to track whether a player has redeemed their coupon and, once you’ve set up Economy, you can gift resources like in-game currencies or items.

3. Create daily reward schedules

Backend 3 - Servers

Daily rewards can be an effective way to keep players coming back while letting them earn a variety of in-game items, especially in mobile games.

Since Cloud Code can be integrated with other Unity services, it’s a great tool for building the logic around daily rewards. You can define items and currencies in Economy, probabilities in Remote Config, and write the underlying algorithm in Cloud Code. 

This allows you to alter the logic of daily rewards on the fly, without needing to update the game client.

4. Save player data across devices

Backend 4 - User chats

Players expect to have all their in-game achievements and purchases to be preserved, no matter what. Their progress should not only be intact, but tied uniquely to them and consistent across all the devices they use to play. 

By combining Cloud Save, Economy, and Remote Config with Authentication, you can save a player’s progress automatically and link it to their account.

When you use Authentication, you can set up sign-ins with platform accounts so the same player can sign in from Google, Facebook, Apple, or Steam and continue playing from wherever they left off from any device.

5. Protect your game economy

Backend 5 - Highway to events

Once you’ve designed your in-game economy, you need to make sure you set up safeguards for it. Some ill-intentioned players may try to impersonate others in order to reap their in-game rewards or in-app purchases. 

Economy works with Authentication and allows you to identify each player using unique tokens and IDs which can’t be manipulated by cheaters. This way, you’ll know which player has logged in and what their current inventory of currencies and items is.

Adding Cloud Code can make this process server authoritative, which adds another layer of protection to your in-game economy.

6. Change in-game logic instantly

Backend 6 - Friend requests

Rolling out live updates, bug fixes and improvements to your game often come with a difficult release process.

By moving in-game logic away from the game client by using Cloud Code, you can make changes for all of your players instantly. If you isolate your game logic away from the client device, you could update the game logic without requiring the player to update their installed version.

7. Build a smooth user experience

Backend 7 - Users joined

Using many online services for a mobile game means sending data via the internet multiple times. This can cause a jarring experience if a player’s connection is slow.

Normally, when you make changes to services like Economy or Cloud Save, you would read data from the server and decide what happens on the device. The resulting data would then have to be sent back to the server.

With Cloud Code, there is only one round-trip of information and the changes are implemented directly on the server. This creates a smoother experience for all players, no matter the speed of their internet connection.

8. Implement P2P for your multiplayer game

Backend 8 - Tunnel

If you’re using the Unity engine to develop a multiplayer game, you can take advantage of tools that are integrated in the editor in order to build and test your game securely, as well as maintain a consistent tech stack. 

You can use Unity’s Relay service with Authentication to authenticate players connected on Relay in one of two ways: Anonymous sign-in or platform-specific sign-in.

These tools allow you to build, test, and operate your multiplayer game without needing a third-party solution or a dedicated game server.

9. Form compatible parties and lobbies​​​​​​​​​​​​​​

Backend 9 - City

When developing multiplayer games, you have to consider how your game’s features will encourage people to connect and play together. 

Having a good understanding of which players to group into specific lobbies, parties, or matches can greatly impact players’ experiences. 

By combining Unity’s Lobby and Matchmaker services with Authentication, you can group specific types of players and allow them to anonymously authenticate, connect, communicate, and play together. 

These tools are flexible enough to support an array of game types, and scalable enough to support an influx of players in your game.

Learn more ways to use Game Backend tools

If you want to get started with Game Backend tools and other Unity Gaming Services, check out our collection of Game Operations samples

In these sample scenes and their associated script files, you’ll learn how to combine various tools to solve common game development challenges, including:

  • Loot boxes - Reward players with a random Economy currency using Cloud Code to perform the Economy grants.
  • Daily rewards - Grant players random collections of both currencies and inventory items at timed intervals.
  • Starter Pack - Allow players to purchase a Starter Pack using Cloud Code to implement the one-time-only purchase.
  • Seasonal events - Update game content remotely based on timed special events.
  • A/B testing for level difficulty - Segment players into multiple test groups in order to determine which variation of a specific variable is the most engaging to the players (in this case, the amount of XP required for leveling up).
  • Idle clicker mini-game - Update server authoritative game state in real-time, similar to idle clicker and social games.
  • Cloud AI mini-game - Server authoritative gameplay in a simple Tic-Tac-Toe game played against AI running on UGS with persistent state, currency rewards, stats, and straightforward AI.
  • Command batching - Group game commands into a queue and process them on the server in a single batch to reduce the volume and frequency of server calls made during gameplay.
  • Battle Pass - A seasonal reward tier system with a free track and a premium track.

Click here to learn more about Unity Gaming Services and all our products currently in beta.

March 11, 2022 in Games | 10 min. read