In today’s game development, production time optimization is key. In any software development company, the time spent by developers on compiling code, packaging assets, testing applications, and deploying a release can rapidly become a nightmare. I have personally worked on projects where the entire pipeline, from the moment a line of code is changed to the moment the application is tested internally, takes up to 3 hours.
This is a nightmare.
On multiple levels, it is a huge problem for the company that encounters this issue:
Production: It is quite evident, LOST MONEY = LOST HOURS x MAN HOURS COST x NUMBER OF DEVELOPERS x DAYS OF DEVELOPMENT.
Morale: Probably the worst part of waiting is not the waiting itself, but the constant focus switching that it generates. The longer a developer waits, the more they will look for other subjects to handle in the meantime, causing continuous back and forth between tasks that ultimately leads to mistakes in the original task of the developer.
Confusion: The bigger the project, the more, in each phase of the development, specificities are added. Let’s see a common scenario:
An engine programmer adds a PRAGMA DEFINE for a specific platform at a given time. Some hours later, an AI developer starts to compile the project, and the first developer had no time to notify or forgot to add some info in the common documentation.
Of course, the build instantly fails, and the developer has to ask for information internally.
Why should they even care about compiling software if their task is to animate a beautiful crocodile?
Fortunately, we do not have to reinvent the wheel, and four letters have the solution to all our problems: CI/CD.
CI/CD stands for Continuous Integration/Continuous Deployment and is the combination of practices adopted by software development companies to avoid these kinds of problems.
If you are developing any kind of application and you are not using CI/CD, it’s like eating pasta without olive oil. You could… but why the hell???
More seriously, at Hectiq, when we started to develop Los Pingheros, we tackled and integrated a CI/CD pipeline from week 3. Although it requires 0.5 to 2 man-days per month to maintain, it is probably one of the most practical achievements of the Hectiq team.
There is no single way of setting up a CI/CD pipeline, and most of the time it depends on the tech stack used by your company.
Let’s see how we defined our CI/CD, keeping in mind that we use Unity as a game engine and Git as a version control system (link to previous article).
As I had no intention to spend money on a DevOps platform, I looked for a more affordable solution.
On the table, I didn’t have too many choices:
Jenkins: Completely open source, and I used it on multiple previous projects. It works like a charm for a video game project with an 8-person team.
GitLab CI: A standard for software development, though less so for the video game industry.
As we saw in our previous article, we had already installed GitLab to manage our Git project on an internal server. Of course, it is an on-premises version.
As I’m lazy, I try not to over-complicate things.
This means that even though I was comfortable with Jenkins, I wasn’t happy adding another tool to our tech stack right next to GitLab.
We would have ended up with GitLab as a Git repository manager and Jenkins as a DevOps platform.
It can work; however, as Los Pingheros does not aim to find the next cure for cancer, I estimated that a simple CI pipeline built with a powerful tool like GitLab would do the job.
It was definitely the right call so far.
Let’s dive deep into our CI/CD configuration. Keep in mind that this was my first GitLab CI/CD pipeline, and I learned on the job. Although it works very well for Hectiq’s use case, an expert user will surely find optimizations and sometimes a better way to express my intentions.
To integrate GitLab CI for Los Pingheros, we started by configuring the .gitlab-ci.yml file within our GitLab repository. This file defines the pipeline stages, including build and deploy. Periodically, on specific tag, and manually the CI pipeline, automating the build. This setup allowed us to streamline our development workflow, ensuring that code changes are automatically validated and ready for deployment, catching error earlier and improving efficiency.
stages:
- setup
- photon_build
- unity_build
- deploy
- upload
- release variables:
BUILD_TYPE:
value: PREDEFINED
options:
- "PREDEFINED"
- "release"
- "development"
description: "The build type to use."
STEAM_BRANCH:
value: PREDEFINED
options:
- "PREDEFINED"
- "beta_staging"
- "development"
- "staging"
description: "The steam branch to use."