Building Game Assets for Android Games
This feature is in preview release and is subject to change. |
When you build an Android game using Lumberyard, you must first build the assets that
are included
with the game. All built assets are located in the cache
directory of your
Lumberyard installation. For example, when you build the Samples Project, the assets
are saved to
the \lumberyard\dev\cache\SamplesProject\es3
directory. The initial
build of the Samples Project assets may take up to an hour to process, but incremental
changes should process almost instantly.
To build Android game assets on your PC
-
Close all instances of Lumberyard Editor and the Asset Processor.
-
Edit the
bootstrap.cfg
file (located in the\lumberyard\dev
directory) to setsys_game_folder
toSamplesProject
(or the project you want to build). Save the file. -
Edit the
AssetProcessorPlatformConfig.ini
file (located in the\lumberyard\dev
directory) to uncommentes3=enabled
. Save the file.Note
If the Asset Processor was running when you edited the
AssetProcessorPlatformConfig.ini
file, you must restart the Asset Processor. -
Open Lumberyard Editor, which automatically launches the Asset Processor to process and build your game assets as you make changes to your game levels in Lumberyard Editor.
Note
You can also launch the Asset Processor (GUI or batch version) from the
\lumberyard\dev\Bin64
directory.
Using Assets in Your Game
You can use assets in your game by copying them to your device manually or by packing
them into an .apk
file. We recommend copying the assets to your
device manually for a faster build time during development.
Manually Copying Assets
As part of the build process, Lumberyard can automatically copy assets built by the
Asset Processor to your device, or you can manually copy assets from a command
line window using Android Debug Bridge (ADB). Game assets should be copied to the
/storage/sdcard0/
directory.
<Your Game
Name>
For example, to manually copy the Samples Project assets, type the following in a command line window:
adb push cache/SamplesProject/es3 /storage/sdcard0/SamplesProject
Building Assets into an .Apk File
To build an .apk
file that includes all of your assets, edit
the project.json
file for your game project and set
place_assets_in_apk
to 1
. This method
requires a longer build time than manually copying your assets.
For example, to build an .apk
file for the Samples Project
assets, edit the project.json
file (located in the
\lumberyard\dev\SamplesProject
directory) to set
place_assets_in_apk
to 1
:
"android_settings": { "package_name" : "com.lumberyard.samples", "version_number": 1, "version_name" : "1.0.0.0", "orientation" : "landscape", "place_assets_in_apk" : 1 },
When you generate a build, your computer creates an .apk
file
that includes an executable and game data. Be sure to run the shader compiler when
you run your game for the first time.
Note
If you receive an error indicating the
\dev\Solutions\android\SamplesProject\assets
directory does not exist, you can try running the command from a command
line window with Administrator privileges.
Sharing Game Assets Between PCs and Macs
After you build the assets to include with your Android game, you can share the cache
folder between your PC and Mac. This ensures that changes you make in Lumberyard
Editor on your PC are automatically retrieved by macOS.
To set up asset sharing on your PC
-
Navigate to the
\dev
folder in the directory where you installed Lumberyard. -
Right-click the
cache
folder and click Properties. -
In the cache Properties dialog box, on the Sharing tab, click Advanced Sharing. You must have administrator privileges.
-
In the Advanced Sharing dialog box, select Share this folder. Click OK.
-
(Optional) Click Permissions to set permissions for specific users. This step is required if you want to modify the shared assets on your Mac.
To view shared assets on your Mac
-
In the Finder, click Go, Connect to Server.
-
For the Server Address, type
smb://
IP address or DNS name of PC
/Cache -
Click Connect.
-
(Optional) Configure your system preferences to automatically connect to the shared folder when macOS starts:
-
Open System Preferences, Users & Groups, Login Items.
-
In the Login Items dialog box, click + to add a new login.
-
In the Shared pane, locate and select your PC. In the right pane, select your shared
cache
folder and click Add.
-
-
In a Terminal window, navigate to the
\dev
folder in the directory where you installed Lumberyard. -
To create a symbolic link to the shared
cache
folder, run the following command:sudo ln –s /Volumes/Cache Cache
If prompted, type the password for your macOS login.