通过命令行构建

注意 通过命令行生成可执行文件需要登录到 IDE

GameMaker除了通过IDE构建项目外,还允许您使用下面介绍的许多选项和命令通过命令行界面构建项目。您可以通过运行一个批处理文件来生成项目、测试项目并将其部署到多个平台,以及通过自动化服务器(如Jenkins)设置连续集成。

这是由运行Igor.exe可执行文件来完成的,该文件存在于你的运行文件夹中,并传入本页所列的选项和命令。

默认情况下,Igor可以在。

注意 在尝试命令行构建之前,你必须至少用你的账户登录过IDE。

 

Igor 持续集成构建

设置

要在计算机上设置CI构建,需要执行以下操作:

注意

选项

以下是运行Igor可执行文件时可以使用的选项:

选项描述
/lf=[licence_plist_file]The full path to the licence file, either from the IDE or from the Access Key service

To retrieve the licence from the IDE, the paths are as follows:
Windows: %appdata%\GameMakerStudio2\<user_name>_<number>\licence.plist
macOS: ~/.config/GameMakerStudio2/<user_name>_<number>/licence.plist
/uf=[user_folder]The user folder used for retrieving licence information, alternative to /lf

On Windows, this will be: %appdata%\GameMakerStudio2\<user_name>_<number>
On macOS, this will be: ~/.config/GameMakerStudio2/<user_name>_<number>
/rp=[runtime_root]The root folder of the runtime
/project=[project_YYP_file]The full path to the project's .yyp file
/cache=[cache_dir_path]The cache directory to use (defaults to \cache in the current directory)
/temp=[temp_dir_path]The temporary directory to use (defaults to c:\temp)
/of=[output_filename]The filename of the output executable without the extension, e.g. C:/output/game, which would output the executable at C:/output/game.zip (or a different file format depending on the platform)

If this is not specified, a directory named output will be created in the same directory as the .bat file (or where the command is running from), containing the extracted build files
/tf=[target_file]The actual file name of the ZIP file or NSIS installer that is created
/config=[configName]The name of the configuration to use (defaults to Default)
/runtime=YYC|VMThe output type (either YYC or VM), defaults to VM
/j=[NumCPUs]The number of CPUs to use during the build process
/df=[devices_json_file]The path to your devices.json file, required when building to other devices.

On Windows, this will be: %appdata%\GameMakerStudio2\<user_name>_<number>\devices.json
On macOS, this will be: ~/.config/GameMakerStudio2/<user_name>_<number>/devices.json
/device=[device_name_from_IDE]The name of the target device to build to, as set up in the IDE
/launchLaunch the executable on the target device after building; same as the "Create Executable and Launch" option in the IDE

访问密钥

/lf选项需要你的licence.plist文件的路径,你可以在登录IDE后从GameMaker安装中获取,如上表所述。

然而,如果你不能访问IDE安装,你可以从GameMaker网站上申请一个访问密钥,并从中生成一个licence.plist文件。

Hello World

下面是一个在Windows上运行游戏的步骤示例:

平台实例

下面您可以找到所有平台的构建命令示例:

GX.gamesGX.games

清理 GX.games 项目:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] -- OperaGX Clean

运行 GX.game:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] -- OperaGX Run

WindowsWindows

清理 Windows 项目:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] -- Windows Clean

为 Windows 进行 VM 构建 —— RunPackageZipPackageNsis :

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] -- Windows Run

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] -- Windows PackageZip

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] -- Windows PackageNsis

为 Windows 进行 YYC 构建 ——RunPackageZipPackageNsis :

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /runtime=YYC -- Windows Run

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /runtime=YYC -- Windows PackageZip

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /runtime=YYC -- Windows PackageNsis

macOSmacOS

重要 在 Mac 上需要使用 mono 来运行 Igor,所以在所有命令之前需要编写 mono ,例如: mono Igor.exe [options]"

清理 MacOS 项目:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] -- Mac Clean

在 Mac 上为 macOS VM 构建:

注意 使用 PackageZip 构建 ZIP 文件,使用 PackageDMG 构建 DMG。这些示例使用 PackageZip

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] -- Mac PackageZip

在 PC 上为 macOS VM 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /device=[device_IDE_Name] -- Mac PackageZip

在 Mac 上为 macOS YYC 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /runtime=YYC -- Mac PackageZip

在 PC 上为 macOS YYC 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /runtime=YYC /device=[device_IDE_Name] -- Mac PackageZip

Linux / UbuntuLinux / Ubuntu

清理 Linux 项目:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] -- Linux Clean

在 PC 上为 Linux VM 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /device=[device_IDE_Name] -- Linux Package

在 PC 上为 Linux YYC 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /runtime=YYC /device=[device_IDE_Name] -- Linux Package

HTML5HTML5

清理 HTML5项目:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] -- HTML5 Clean

构建 HTML5文件夹(确保用/tf 指定目标文件夹) :

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_folder] -- HTML5 folder

iOSiOS

在 Mac 上为 iOS VM 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] -- ios Package

在 PC 上为 iOS VM 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /device=[device_IDE_Name] -- ios Package

在 Mac 上为 iOS YYC构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /runtime=YYC -- ios Package

在PC上为 iOS YYC 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /runtime=YYC /device=[device_IDE_Name] -- ios Package

AndroidAndroid

清理 Android 项目:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] -- Windows Clean

使用 VM 构建 Android APK:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] -- Android Package

使用 YYC 构建 Android APK:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /runtime=YYC -- Android Package

tvOStvOS

清理 tvOS 工程:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] -- tvos Clean

在 Mac 上为 tvOS VM 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] -- tvos Package

在 PC 上为 tvOS VM 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /device=[device_IDE_Name] -- tvos Package

在 Mac 上为 tvOS YYC 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /runtime=YYC -- tvos Package

在PC上为 tvOS YYC 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /runtime=YYC /device=[device_IDE_Name] -- tvos Package

PS4PS4

清理 PS4 工程:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] -- ps4 Clean

在 PC 上为 PS4 VM 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /device=[device_IDE_Name] -- ps4 Package

在PC上为 PS4 YYC 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /runtime=YYC /device=[device_IDE_Name] -- ps4 Package

PS5PS5

清理 PS5 工程:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] -- ps5 Clean

在 PC 上为 PS5 VM 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /device=[device_IDE_Name] -- ps5 Package

在PC上为 PS5 YYC 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /runtime=YYC /device=[device_IDE_Name] -- ps5 Package

Xbox OneXbox One

清理 Xbox One 项目:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] -- XBoxOne Clean

在 PC 上为 Xbox One VM 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /device=[device_IDE_Name] -- XBoxOne Package

在PC上为 Xbox One YYC 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /runtime=YYC /device=[device_IDE_Name] -- XBoxOne Package

Xbox Series X/SXbox Series X/S

清理 Xbox X/S 系列项目:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] -- XBoxOneSeriesXS Clean

为 Xbox X/S 系列 VM 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /device=[device_IDE_Name] -- XBoxOneSeriesXS Package

为 Xbox X/S 系列 YYC 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /runtime=YYC /device=[device_IDE_Name] -- XBoxOneSeriesXS Package

SwitchSwitch

清理Switch项目:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] -- Switch Clean

在 PC 上为 Switch VM 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /device=[device_IDE_Name] -- Switch Package

在 PC 上为 Switch YYC 构建:

Igor.exe /uf=[user_folder] /rp=[runtime_path] /project=[project_YYP_file] /cache=[cache_dir_path] /temp=[temp_dir_path] /of=[output_filename] /tf=[target_file] /runtime=YYC /device=[device_IDE_Name] -- Switch Package

 

Igor 运行时

下面是可以与 Igor 运行时一起使用的选项:

选项描述
/uf=[user_folder]Set the user folder used for retrieving licence information so GameMaker knows which modules can be installed
/lf=[license_file]Set the direct path to a licence file, can be used as an alternative to setting a user folder (/uf)
/ru=[runtime_url]Set the URL to fetch runtime information from (defaults to the stable release)
/rp=[runtime_root]Set the local runtime install folder to list the installed runtimes or install new runtimes

下面是可以与 Igor 运行时一起使用的命令:

语法:

Igor.exe [command]

Command描述
Runtime ListLists the runtimes available on a feed (version number, date/time of build)
Runtime ListInstalled [-directory]Lists the runtimes available in the current folder (directory=full path to the folder)

You can specify a directory to look in, but if it's not specified it will default to the current directory

This also checks whether there is a receipt.json file and a manifest folder inside the directory (making sure that it's actually a runtime)
Runtime Info [-version]Prints out information about the most recent runtime on the given feed; also needs a licence file to show information regarding the modules available for the user

version can either by a string used to search through the feed titles (e.g.: "739" would show information for all builds containing 739 in their version numbers), or it can be all to show information for all feeds

It will list the modules with the .zip file names for each module
Runtime Install [-version]Installs the latest runtime from the given feed using the given version as a search filter; if that is not specified, it defaults to the latest version. It will get all the modules that the user has on their licence.
Runtime Verify [-folder=.]Calculates the checksums for all the installed files and compares them to the checksums written into the manifest folder. You can specify a folder to check, however if that is not specified it will default to the current directory.

This will flag any files where the checksums don't match, files that are missing and files that should not be there.

Do note that the manifest files themselves are not verified and a user can alter the manifest files to match the installed ones.
Runtime FetchLicences [-ak] [-of]Generates a licence.plist file (-of) from an access key (-ak), see Access Key

 

Igor 测试

下面是用 Igor 测试构建的选项:

选项描述
/uf=[user_folder]Set the user folder used for retrieving licence information so GameMaker knows which modules can be installed
/lf=[license_file]Set a direct path to a licence file, can be used as an alternative to setting a user folder (/uf)
/df=[device_file]Set a direct path to a devices.json file, can be used as an alternative to setting a user folder (/uf)
/timeout=[number_of_seconds_to_wait]The timeout to use for the test in seconds, defaults to 120 seconds; the test will be stopped after this timeout is over and will be marked as failed
/waittime=[number_of_seconds_to_wait]Number of seconds to wait in the main loop before declaring the test as passed, defaults to 30 seconds
/device=[device_name]Used to look up the device name in the user folder's devices.json file
/target=[list_of_targets]Comma-separated list of targets in the PLATFORM|DEVICE format, e.g.: /target="Windows|Local,HTML|Firefox"

If you specify all, the tests will attempt to run for every device in the devices.json file

有一个命令可以用来对 Igor 运行测试:

Igor.exe Tests RunTests [test_directory/test_filename]

必须指定测试目录或测试文件名。

 

Tests.json 文件

格式

tests.json文件必须具有以下格式:

例子

下面是tests.json文件的一个示例:

[
 {
  "name" : "Game Idea Windows",
  "path" : "C:/scratch/GameIdea.yyz",
  "platform" : "Windows",
  "command" : "Run",
  "timeout" : "500",
  "waittime" : "30"
 },
 {
  "name" : "Platformer Game Windows",
  "path" : "C:/Users/<MY USERNAME>/Documents/GameMakerStudio2/Platformer Game/PlatformerGame.yyp",
  "target" : "Windows|Local,HTML5|selenium:firefox,PS4|Default",
  "command" : "Run"
 },
 {
  "name" : "Puzzle Game Windows",
  "path" : "C:/Users/<MY USERNAME>/Documents/GameMakerStudio2/Puzzle Game/PuzzleGame.yyp",
  "platform" : "HTML5",
  "command" : "Run",
  "device" : "selenium:chrome"
 }
]