← Anton FiniukovOriginal (RU) ↗
Habr·June 2021·14 min readEN translation

Automation or death: managing thousands of game content items with Google Sheets

Translated from Russian by the author. The original was published on Habr in the Lightmap company blog; screenshots and the full code listings are in the original article.

A few years ago our online shooter ran into a slightly absurd problem: there was so much content that we could no longer handle it by hand. Hundreds of weapons, maps, mechanics, gadgets and much more, all of it has to be balanced against everything else or the gameplay falls apart. You can hire more people, but it is better to lean on algorithms, formulas and automation.

It sounds complicated, but plain Google Sheets were enough. Well, plain-ish: thousands of rows and formulas that don't fit on a monitor. Organising them took some effort, but now we run the whole game from a handful of documents.

Below I'll show with examples how to automate content work once a project has more than a thousand items, how to ship new mechanics and features without breaking balance and player experience, and even how to take extra work off QA and the programmers.

Balance is critical in an online shooter. The game has to feel good for everyone: no players who can't kill anyone at all, and no players who dominate and frustrate everybody else.

In the early years of Pixel Gun 3D we used a simple scheme: all content was added and edited by hand. Need to change a gun's damage? Open Unity, find the file and edit it. A couple of minutes.

Then the industry moved to freemium. We didn't want to fall behind, so the project changed its monetisation model too: we reworked the economy, progression and a lot more, but that's another story. DAU shot up, and we started adding more modes, weapons, characters and so on.

The trouble began when each weapon category reached 20 to 30 items, hybrid mechanics appeared, and there was simply too much data to sort through by hand. The barrier to entry for new people went up as well: a game designer who had just joined couldn't find their way around the content because they didn't even know it by name.

Something had to change at a fundamental level.

At first we only wanted to save a bit of time on balancing. In the end we automated most of our processes, cut out manual busywork and took load off the team. All with Google Sheets.

From Google Sheets to Unity

First we looked at how to make data easier to work with, and whether it could be loaded into Unity straight from ordinary Google Sheets. It turned out it could. That was the key moment and the first step towards automation. We called it remote control.

We use Google Apps Script to pull data from the sheets. At first we kept a separate script for every sheet that turned the data into JSON. The editor then received the JSON and applied it where needed.

Now we have a single published script. It returns raw data from any sheet, and the project converts it into the format it needs in C#. This approach is faster and more convenient.

The full Apps Script code is in the original article on Habr.

To use it, create a new script, paste in the code from the example, publish it and set the permissions so that anyone, even anonymous users, can run it.

After publishing you get a link in this format:

https://script.google.com/macros/s/WwlCZODTDRXJaHhdjfwFRcKtHRQOHqzYisjndduZzDihMpXehLrNxdi/exec

That link runs the script. So the script knows which spreadsheet you want, pass the spreadsheet ID in the GET request. You can take it from the spreadsheet URL: in https://docs.google.com/spreadsheets/d/example_habr/edit#gid=0 the ID is example_habr.

If you only need one sheet, add its name to the request and only that sheet comes back. The same works for a specific range of cells.

The full request looks like this:

https://script.google.com/macros/s/WwlCZODTDRXJaHhdjfwFRcKtHRQOHqzYisjndduZzDihMpXehLrNxdi/exec?table=example_habr&list=MyList&startRow=1&startColumn=2&numRow=10&numCol=5

Google limits the number of requests and the execution time. That's why you can't use this tool to, say, pull configs directly into players' clients: once the limit is exceeded, the script starts returning errors.

Most content parameters are now edited outside the project rather than inside it. The engine simply pulls the data from the sheet in real time. Say every gun needs +5 damage: type it into a cell, drag it down the column and press “load”. Done, all the data has gone to the client. In effect, we run the whole game from a few Google Sheets.

There are many such balance sheets now, each with access limited to the right specialists: separate ones for weapons, pets, gadgets, level economy and other things. But the principle is the same everywhere: nothing is changed by hand, item by item, in the client.

Then we went further.

From Unity back to Google Sheets

When a player plays a match, all the stats go to our server: the database stores, by player ID, which gun they used, how they performed and so on. There is a huge amount of this raw data for every user and every content item: kill rates, match results, how often each gun is picked and more. We had used it for analytics for a long time, but it was all manual, slow and painful.

So why not use the sheets not only to load data into Unity, but also the other way round: to process the stats and metrics we collect, find problem spots, and even generate the content itself?

We started with simple tasks. For example, we often went over Google Play's 500-character limit for update notes. The store rejects them, so you have to rewrite and resubmit. We asked ourselves: is there a formula that counts characters in a cell? Of course there is. Google Sheets has a long list of basic formulas you can combine any way you like to solve almost any problem. We added a cell that automatically checks the length of the update notes with =LEN(cell). Problem gone.

Google Sheets covers most of our needs. The formulas are built from simple operators, but the combinations sometimes don't fit on a 27-inch monitor. We have dedicated specialists who write them and know all the tricks: special rounding, complex error margins, selections.

Google Sheets has a huge number of functions. You can find all of them in the Google support docs.

For example, we decided to build collections for the weapon gallery: sets of guns grouped by a shared trait such as colour, setting or season. To put one collection together you need to judge the visuals, whether the guns look good together, whether they share a class and other details. So we made a sheet, exported the list of all guns from the database into it, wrote a formula and loaded preview images you can work with visually. Names, tags and the rest of the info come in from the balance sheets.

The result is a sheet you can pull into any other sheet and work with guns visually: they load automatically by tag. For example, the tag Weapon970 immediately brings in the gun's name, preview and so on. Now that's something you can actually work with.

Another example. We decided to rebalance shotguns: fire rate, range and so on. There are many mechanics and even more items. Each one has to be accounted for in the formulas as a separate coefficient. A game designer can't just go in and retype the parameters by hand: they would have to change every shotgun, and there can be dozens of them.

The formulas have lots of coefficients. There is even a “coolness” coefficient that we add if, say, a gun's texture turned out especially beautiful. With this approach we think in variables, not special cases. Nobody wants to redo 40 items by hand anymore. You want one coefficient that does it all.

In the end, the sheets save an enormous amount of time. Setup takes a couple of hours at most (if it's something really unusual), and after that you can move huge amounts of data or entities around. Done by hand, the same tasks can easily take a week.

Where we use automation

Pretty much everywhere we can. We are always looking for new ways to make life easier and hand part of the work over to formulas.

Content balancing

The most basic use, mentioned above. This is how we find problem spots, add new content without breaking the old, nerf or buff weapons and so on.

If a gun has a balance error, we fix it right on the server after recalculating it in the sheet. We try to move fixes like this to remote control so we don't have to ship separate patches to the stores.

Say the server doesn't control magazine size, and someone added an extra zero in the code, so a machine gun now has 50,000 rounds. Without a patch you can't fix that. By the time the patch is out, most players will have bought the machine gun, balance falls apart, and social media fills up with complaints. But if it's controlled on the server, you just delete one digit: everything is back to normal and players don't even notice. Moving as much as possible to remote control is a very good practice.

Generating entities

Automation isn't only for balance. It can also generate new content. Every battle pass of ours has about 140 different challenges, for example play 10 games in a certain mode or get 30 kills with a pistol. Inventing them by hand every time is slow and tedious, so we built a generator. We put together a detailed list of conditions and create the quests right from the Google Sheet. Now one formula comes up with all the tasks for each season.

Naturally, a person then works with the generated pool and tunes the difficulty curve. The player should ease into the event smoothly, which raises conversion to payment or to longer play sessions.

We generate clan war tasks the same way.

The generator inputs and the full formulas are shown as screenshots in the original article on Habr.

Simulating processes

Another example. We add a chest with items: the player opens it and gets a prize. The chest has many rules for what drops and how. You could write the code and hand it to QA to check, but there is a better way. We build a drop simulator right in a Google Sheet: enter the rules and conditions, open 1,000 chests and tune the whole model towards the outcome we want. No code, no programmer, just a sheet and the concept itself.

Examples of formulas used in the cells:

=RANDBETWEEN(1,100)
=AVERAGE(13,15)*6
=SUM(B4:F4)
=IFS($A32<=G32,"Mythic",$A32<=F32,"Legend",$A32<=E32,"Epic",$A32<=D32,"Rare",$A32<=C32,"Common")

The formulas themselves are simple, but with the right links between cells and the right order of operations you get exactly the result you need.

Of course, in the actual project a programmer writes all of this, but you can check it in advance. Essentially, anything in the game can be simulated in a sheet. And if the results look right, it goes into development.

How we build a sheet

The best way to show how we work with data and build sheets is an example. Say we want to find out which guns are the most popular in the game right now. For that we need to pull in a lot of extra data.

Here it is step by step (the numbers in the example have been changed for confidentiality):

  1. We export the raw stats for the period we need from the server as a CSV file. The same data can be taken from the balance sheet. The difference is that the balance sheet gives the current parameters (and no metrics), while the server stores information with dates, so you can export it for any period (along with the metrics).
  2. Then we create a Google Sheet where the main work will happen, and load the CSV file into it.
  3. For convenience, gun images are pulled in from another sheet with a formula. The art is uploaded in advance to a service that gives a direct link in this format (the file extension at the end of the link matters): http://service_address/path/number/image_name.jpg. To add an image to the sheet we use a simple function: =IMAGE("https://files.fm/u/wdrhemgnk#/view/special_offer_pixelman_reward_big.png"). Now you work with something visual instead of abstract rows. With 30 guns you could just open the game and look, but with 700 you can't.
  4. If needed, we also pull in each gun's name from the in-game store, plus any parameters the task requires, such as extra properties.
  5. We use conditional formatting too. It can do lots of useful things, for example colour cells whose value is greater than 2 or less than 1. Applied to a gun's kill rate (kills with the gun divided by the player's deaths while using it), it shows values over the limit as well as low values, which are a clear reason to pass the data to the balancing team.
  6. We add a column with weapon categories (we have six) and, again with conditional formatting, give each its own colour. Now it's visible that there are no Special guns at the top, which already prompts an analysis of that category's mechanics.

Important: once the data has loaded, we cut it (Ctrl+X) and paste it back as values only, then delete the formula. Otherwise it recalculates every row on each page refresh, in this case more than 800. After that, one base can be reused for every task that needs weapon images.

In the end, building a sheet like this with categories, properties, previews and so on meant pulling information from several different places. It took about 15 minutes, not a whole day, because the formulas are standard and the sheets with renders and data already exist.

Now you can sort, build charts, add sales or other information to draw solid conclusions quickly or test hypotheses.

To make it visual, you can also build a chart from the data. It's a simple Insert → Chart (you can select the range of cells right away).

Life after automation

Honestly, nothing but upside. Balance problems dropped significantly, and it became easier to keep track of content and anticipate issues, because the big picture is always in front of you and problem spots are highlighted.

Now it's easier to change something, re-upload it, or update an entire weapon class with 100+ items. Enter the new parameters and everything is automatically recalculated to the norm, taking the mechanics into account (and some parameters recalculate themselves for the new inputs).

We got rid of manual micromanagement, freed up people's time for more interesting work, took extra load off the tech team, and the programmers no longer get pulled away from writing code. And just as important: new team members now get into the processes easily and understand the project much faster by working on real tasks.

Moving to automation is a continuous, evolutionary process, and in many ways uncharted territory. We keep thinking about how to save resources and simplify tasks, try new options and formulas, and always look for more convenient solutions. Right now, for example, we're working on moving all these processes straight into the admin panel.

Book a free 30-min intro callMore articles