Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Scalable and cloud-native mobile game CI/CD environment using Unity

Scalable and cloud-native mobile game CI/CD environment using Unity

JetBrains GameDev Day 2023
https://lp.jetbrains.com/gamedev-day-2023/

Tadashi Nemoto

October 14, 2023
Tweet

More Decks by Tadashi Nemoto

Other Decks in Programming

Transcript

  1. 1
    Scalable and cloud-native mobile
    game CI/CD environment using Unity
    Tadashi Nemoto
    CircleCI
    Senior Solutions Engineer

    View full-size slide

  2. 2
    Self-introduction
    ● Tadashi Nemoto
    ● Senior Solutions Engineer, CircleCI
    ● Career
    ○ SET(Software Engineer in Test) at C2C
    marketplace app company
    ○ DevOps Engineer at AI startup company
    tadashi0713
    tadashi-nemoto
    tadashi0713.dev

    View full-size slide

  3. 3
    About this session
    Developing continuously high-quality mobile games, with their frequent updates and large user
    bases, requires the use of good CI/CD (Continuous Integration / Continuous Delivery) tools
    and practices.
    However, the unique and complex requirements of building, testing, and deploying mobile
    games make configuring mobile CI/CD from scratch a daunting task.
    This session provides an easy-to-follow introduction to creating a scalable and cloud-native
    mobile game CI/CD environment using CircleCI, GameCI, and Unity.
    This approach will provide you with the following benefits and ultimately enable you to
    continuously deliver high-quality mobile games by:
    ● Increasing developer productivity and reducing maintenance overheads with scalable,
    on-demand, pre-configured build environments in the cloud, including M1 Mac.
    ● Reducing maintenance overheads by eliminating the need for complex custom build
    scripts

    View full-size slide

  4. 4
    Agenda
    ● Importance and Challenges of CI/CD in Mobile Game
    Development
    ● Unity Mobile Game CI/CD Pipeline using GameCI,
    fastlane, and CircleCI(Overview)
    ● How to create CI/CD pipeline step by step
    ● Summary

    View full-size slide

  5. 5
    Importance and Challenges of
    CI/CD in Mobile Game
    Development

    View full-size slide

  6. 6
    https://app.sensortower.com/top-charts

    View full-size slide

  7. 7
    ● Can update software with low cost
    ● Retention rate is important for success
    ● Continuous quality improvements for various devices
    Important to provide and improve features quickly and continuously
    CI/CD(Continuous Integration/Continuous Delivery) is essential
    Key points to make your mobile games successful

    View full-size slide

  8. 8
    Challenges of Mobile Gaming CI/CD
    ● Managing build fleet (especially Mac for iOS builds)
    ○ Requires machines with high specs
    ○ Provision and maintain Mac hardware
    ■ Buy your own, or use cloud providers with limitations
    ○ Regularly updating macOS and Xcode
    ● Difficulties setting up CI/CD pipelines
    ○ Installing Unity Editor
    ○ Activating Unity License
    ○ Preparing build scripts(build & distribute for each platform)

    View full-size slide

  9. 9
    モバイルゲームCI/CDに起きがちな課題
    ● 実行するビルドマシン(特にiOSビルドに必要なmac)
    ○ スペックの高いマシンが必要
    ○ macハードウェアの用意・メンテナンス
    ■ 自前で購入 or 制限のあるクラウド
    ○ macOS・Xcodeの定期的なアップデート
    ● CI/CDパイプラインのセットアップの難易度
    ○ Unity Editor のインストール
    ○ ライセンスのアクティベート
    ○ スクリプト(各プラットフォームへのビルド・配信)の準備
    ● CI/CD is not yet implemented
    ○ Builds and tests are run on local machines
    ● Managing on-prem environments(e.g. Jenkins)
    ○ High maintenance costs
    ○ Unable to scale development
    ○ Low developer productivity
    ■ Slow build speed, Unstable build,
    Poor debugging experience
    ○ Unsuitable for remote development

    View full-size slide

  10. 10
    Unity Mobile Game CI/CD
    Pipeline using GameCI,
    fastlane, and CircleCI(Overview)

    View full-size slide

  11. 11
    GameCI
    ● Open Source Project
    ○ https://game.ci/
    ● CI/CD setup and maintenance for Unity project is
    challenging
    ○ Installing Unity Editor
    ○ Activating Unity License
    ○ Build settings per platform
    ● GameCI makes it easy to implement these
    ● Supports CircleCI, GitHub Actions, and GitLab CI

    View full-size slide

  12. 12
    GameCI
    Docker Image CircleCI Orb(reusable config package)

    View full-size slide

  13. 13
    fastlane
    ● Open Source Project written in Ruby
    ○ https://fastlane.tools/
    ● Help automate tasks specific to mobile app
    development
    ● Supports running tests, taking screenshots, iOS
    code signing(fastlane match), builds, distributing
    debug/beta versions, and releasing apps on the
    App Store/Play Store
    ● Mainly used for mobile app
    development(iOS/Android/React Native/Flutter),
    but can also be used for mobile game
    development

    View full-size slide

  14. 14
    Creation Orchestration Operations
    Collaborate
    Source Control
    CircleCI
    Deliver
    Build • Test • Deliver・Release
    Run
    Monitor • Operate
    SHIP TO PRODUCTION
    CODE COMMIT

    View full-size slide

  15. 15
    Powerful resource classes for gaming CI/CD
    https://circleci.com/product/features/resource-classes/
    Maintenance-free and on-demand
    machines are available

    View full-size slide

  16. 16
    CircleCI provides powerful and constantly updated
    (macOS and Xcode) Mac environment
    ● CircleCI provides Apple Silicon Mac(M1 Mac) from
    2023
    Up to 2x faster build speed than Intel Mac
    ● Not guaranteed in SLA, but we aim to support a
    new Xcode within a couple of days.
    ○ https://circleci.com/docs/xcode-policy/
    Powerful resource classes for mobile CI/CD(Mac)
    Intel Mac
    M1(Apple Silicon) Mac

    View full-size slide

  17. 17
    CircleCI provides powerful and constantly updated
    (macOS and Xcode) Mac environment
    ● CircleCI provides Apple Silicon Mac(M1 Mac) from
    2023
    Up to 2x faster build speed than Intel Mac
    ● Not guaranteed in SLA, but we aim to support a
    new Xcode within a couple of days.
    ○ https://circleci.com/docs/xcode-policy/
    Powerful resource classes for mobile CI/CD(Mac)
    Intel Mac
    M1(Apple Silicon) Mac
    ● Various build environments for game development
    ● No maintenance required(especially for Macs)
    ● Automatically scales as needed
    ● Charged based on build time and the resource class of
    the build
    (Time not spent executing builds is not subject to billing)

    View full-size slide

  18. 18
    How to create CI/CD pipeline
    step by step

    View full-size slide

  19. 19
    Activating your Unity license
    ● Activation varies depending on the license used
    ○ https://game.ci/docs/circleci/activation/
    ● In this example, we are using a personal license

    View full-size slide

  20. 20
    Activating your Unity license
    License file
    https://license.unity3d.com/manual
    ● Activation varies depending on the license used
    ○ https://game.ci/docs/circleci/activation/
    ● In this example, we are using a personal license

    View full-size slide

  21. 21
    Storing License Files(CircleCI Context)
    ● UNITY_ENCODED_LICENSE is the license file obtained earlier,
    encrypted with base64

    View full-size slide

  22. 22
    Build & Distribute for Android Platform

    View full-size slide

  23. 23
    Build & Distribute for Android Platform
    .apk

    View full-size slide

  24. 24
    CPU / RAM Usage

    View full-size slide

  25. 25
    Build & Distribute for Android Platform

    View full-size slide

  26. 26
    Build & Distribute for iOS Platform

    View full-size slide

  27. 27
    Build & Distribute for iOS Platform

    View full-size slide

  28. 28
    Build & Distribute for iOS Platform
    ● Previous Job just generated an Xcode project from a Unity project
    ● You can generate a binary for an iOS application (.ipa) by building this Xcode project in a
    macOS environment in which Xcode is installed
    Xcode Build

    View full-size slide

  29. 29
    Build & Distribute for iOS Platform

    View full-size slide

  30. 30
    Build & Distribute for iOS Platform
    https://github.com/tadashi0713/circleci-demo-mobile-unity/blob/master/fastlane/Fastfile

    View full-size slide

  31. 31
    ● Cloud-native mobile game CI/CD environment using Unity
    ○ https://circleci.com/blog/unity-mobile-cicd/
    ● github.com/tadashi0713/circleci-demo-mobile-unity

    View full-size slide

  32. 33
    Summary
    ● CI/CD is essential for continuous development of mobile games with high release
    frequency
    ● CI/CD in mobile games tends to be a challenge in terms of build machines to
    run(especially Mac) and difficulty of setup
    ● Unity mobile game CI/CD pipeline using GameCI/fastlane/CircleCI
    ○ GameCI makes it easy to activate Unity licenses, and build for iOS/Android
    platform
    ○ Fastlane makes it easy to set up code signing (fastlane match), and
    distribution(Firebase, App Store, Play Store)
    ○ CircleCI provides maintenance-free and on-demand build machines required for
    mobile game CI/CD, including Mac

    View full-size slide

  33. 34
    Thank you!!

    View full-size slide