Skip to content

Commit b30228e

Browse files
authored
Update packaging_games.md
Minor fixes and corrections
1 parent a5fb37b commit b30228e

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

articles/getting_started/packaging_games.md

+21-19
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ From the .NET CLI:
1616
`dotnet publish -c Release -r win-x64 -p:PublishReadyToRun=false -p:TieredCompilation=false -p:PublishAot=true --self-contained`
1717

1818
> [!IMPORTANT]
19-
> Note we are making use of the `PublishAot` option. Using `Aot` has some restrictions which may require changes to your game code. Especially if you are using Reflection.
19+
> We are making use of the `PublishAot` option. Using `Aot` has some restrictions which may require changes to your game code. Especially if you are using Reflection.
2020
2121
You can then zip the content of the publish folder and distribute the archive as-is.
2222

@@ -34,7 +34,7 @@ YourGame.app                    (this is your root folder)
3434
            - YourGame.icns     (this is your app icon, in ICNS format)
3535
        - MacOS
3636
- YourGame (the main executable for your game)
37-
     - Info.plist            (the metadata of your app, see bellow for contents)
37+
     - Info.plist            (the metadata of your app, see below for contents)
3838
```
3939

4040
So first lets create our directory structure.
@@ -52,16 +52,17 @@ dotnet publish -c Release -r osx-arm64 -p:PublishReadyToRun=false -p:TieredCompi
5252
```
5353

5454
> [!IMPORTANT]
55-
> Note we are making use of the `PublishAot` option. Using `Aot` has some restrictions which may require changes to your game code. Especially if you are using Reflection.
55+
> We are making use of the `PublishAot` option. Using `Aot` has some restrictions which may require changes to your game code. Especially if you are using Reflection.
5656
57-
Next we need to comibne the two binaries into one Universal Binary which will work on both arm64 and x64 machines.
57+
Next we need to combine the two binaries into one Universal Binary which will work on both arm64 and x64 machines.
5858
We can do this using the `xcode` utility `lipo`.
5959

6060
```cli
6161
lipo -create bin/Release/net8.0/osx-arm64/publish/YourGame bin/Release/net8.0/osx-x64/publish/YourGame -output bin/Release/YourGame.app/Contents/MacOS/YourGame
6262
```
6363

64-
The above command will combine the two output executables into one.
64+
The above command will combine the two output executables into one. It assumes you are using the standard `Output` path for your application.
65+
If you are using a custom `Output` folder, you will need to make adjustments to the above command.
6566

6667
Copy over your content
6768

@@ -116,8 +117,8 @@ The `Info.plist` file is a standard macOS file containing metadata about your ga
116117

117118
For more information about Info.plist files, see the [documentation](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html).
118119

119-
After completing these steps, your .app folder should appear as an executable application on macOS.
120-
However it does need an icon. So we need to create an `.icns` file. We can use online tools to do this or you can use the following
120+
After completing these steps, your `.app` folder should appear as an executable application on macOS.
121+
However it does need an icon. So we need to create an `.icns` file. We can use online tools to do this or you can use the following:
121122

122123
```cli
123124
mkdir -p bin/Release/YourGame.iconset
@@ -134,9 +135,10 @@ sips -z 1024 1024 Icon.png bin/Release/YourGame.iconset/[email protected]
134135
iconutil -c icns bin/Release/YourGame.iconset --output bin/Release/YourGame.app/Contents/Resources/YourGame.icns
135136
```
136137

137-
Note this code is expecting an `Icon.png` file to be in the same directory. This file should be `1024` x `1024` pixels.
138+
> [!NOTE]
139+
> This code is expecting an `Icon.png` file to be in the same directory. This file should be `1024` x `1024` pixels.
138140
139-
For archiving, we recommend using the .tar.gz format to preserve the execution permissions (you will likely run into permission issues if you use .zip at any point).
141+
For archiving, we recommend using the `.tar.gz` format to preserve the execution permissions (you will likely run into permission issues if you use `.zip` at any point).
140142

141143
### [Ubuntu](#tab/ubuntu)
142144

@@ -145,11 +147,11 @@ From the .NET CLI:
145147
`dotnet publish -c Release -r linux-x64 -p:PublishReadyToRun=false -p:TieredCompilation=false -p:PublishAot=true --self-contained`
146148

147149
> [!IMPORTANT]
148-
> Note we are making use of the `PublishAot` option. Using `Aot` has some restrictions which may require changes to your game code. Especially if you are using Reflection.
150+
> We are making use of the `PublishAot` option. Using `Aot` has some restrictions which may require changes to your game code. Especially if you are using Reflection.
149151
150152
You can then archive the content of the publish folder and distribute the archive as-is.
151153

152-
We recommend using the .tar.gz archiving format to preserve the execution permissions.
154+
We recommend using the `.tar.gz` archiving format to preserve the execution permissions.
153155

154156
---
155157

@@ -160,7 +162,7 @@ We recommend using the .tar.gz archiving format to preserve the execution permis
160162
### PublishAot
161163

162164
This option optimises your game code "Ahead of Time". It allows you to ship your game without the need to JIT (Just In Time compile).
163-
However you do need to currently add some additional settings to your .csproj.
165+
However, you do need to currently add some additional settings to your `.csproj`.
164166

165167
```
166168
<ItemGroup>
@@ -169,37 +171,37 @@ However you do need to currently add some additional settings to your .csproj.
169171
</ItemGroup>
170172
```
171173

172-
The `TrimmerRootAssembly` stops the trimmer removing code from these assemblies. This will on the whole allow the game to run without
174+
The `TrimmerRootAssembly` stops the trimmer removing code from these assemblies. This should allow the game to run without
173175
any issues. However if you are using any Third Party or additional assemblies, you might need to add them to this list or fix your code to be `Aot` compliant.
174176
It is recommended that you publish using AOT as it simplifies the app bundle.
175177

176178
See [Trim self-contained deployments and executables](https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trim-self-contained) for more information.
177179

178-
There are some known area's you need to watchout for.
180+
There are some known areas you need to watchout for:
179181

180182
1. Using `XmlSerializer` in your game will probably cause issues. Since it uses reflection it will be difficult for the Trimmer to figure out what needs to be kept.
181-
It is recommended that instead of using the `Deserialize` method, you write your own custom deserializer using `XDocument` or `XmlReader`.
183+
It is recommended that, instead of using the `Deserialize` method, you write your own custom deserializer using `XDocument` or `XmlReader`.
182184
Alternatively you can use the Content Pipeline and create a custom `Processor` and `Reader` to convert the Xml into a binary format that can be loaded via the usual `Content.Load<T>` method.
183185
2. Dynamically loading assemblies via `Assembly.LoadFile`.
184186
3. No run-time code generation, for example, System.Reflection.Emit.
185187

186188
### ReadyToRun (R2R)
187189

188-
[ReadyToRun](https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0#readytorun-images) is advertised as improving application startup time, but slightly increasing binary size. We recommend not using it for games, because it produces micro stutters when your game is running.
190+
[ReadyToRun](https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0#readytorun-images) is advertised as improving application startup time, but slightly increasing binary size. We recommend not using it for games because it produces micro stutters when your game is running.
189191

190-
Ready2Run code is of low quality and makes the Just-In-Time compiler (JIT) to trigger regularly to promote the code to a higher quality. Whenever the JIT runs, it produces potentially very visible stutters.
192+
ReadyToRun code is of low quality and makes the Just-In-Time compiler (JIT) trigger regularly to promote the code to a higher quality. Whenever the JIT runs, it produces potentially very visible stutters.
191193

192194
Disabling ReadyToRun solves this issue (at the cost of a slightly longer startup time, but typically very negligible).
193195

194-
ReadyToRun is disabled by default. You can configure it by setting the `PublishReadyToRun` property in your csproj file.
196+
ReadyToRun is disabled by default. You can configure it by setting the `PublishReadyToRun` property in your `.csproj` file.
195197

196198
MonoGame templates for .NET projects explicitly set this to `false`.
197199

198200
### Tiered compilation
199201

200202
[Tiered compilation](https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0#tiered-compilation) is a companion system to ReadyToRun and works on the same principle to enhance startup time. We suggest disabling it to avoid any stutter while your game is running.
201203

202-
Tiered compilation is **enabled by default**. To disable it set the `TieredCompilation` property to `false` in your csproj.
204+
Tiered compilation is **enabled by default**. To disable it, set the `TieredCompilation` property to `false` in your `.csproj`.
203205
MonoGame templates for .NET projects explicitly set this to `false`.
204206

205207
### SingleFilePublish

0 commit comments

Comments
 (0)