Skip to content

Commit c4eb32b

Browse files
Merge pull request #38 from MonoGame/feature/content_update
Migration of XNA upgraded documentation and general tidy up
2 parents 2f235bc + 1dbce67 commit c4eb32b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1699
-176
lines changed

articles/getting_started/1_setting_up_your_development_environment_unix.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
---
22
title: Setting up your development environment for macOS and Linux
3-
description: A step-by-step guide for setting up your development environment on macOS and Linux.
3+
description: This section provides a step-by-step guide for setting up your development environment on macOS and Linux.
44
---
55

6-
# Setting up your development environment for macOS and Linux
7-
8-
This section provides a step-by-step guide for setting up your development environment on macOS and Linux.
9-
106
The only development environment that MonoGame officially supports on Linux is [Visual Studio Code](https://code.visualstudio.com/).
117

12-
## Install .NET 6 SDK
8+
## Install .NET 8 SDK
139

1410
- .NET SDK at: [https://dotnet.microsoft.com/en-us/download](https://dotnet.microsoft.com/en-us/download)
1511
- If you are intending to target mobile platforms, make sure that you have the corresponding workload installed
@@ -34,6 +30,7 @@ code --install-extension ms-dotnettools.csharp
3430
```
3531

3632
If you want, you can also install the C# Dev Kit extensions, which are not open source:
33+
3734
```sh
3835
code --install-extension ms-dotnettools.csdevkit
3936
code --install-extension ms-dotnettools.dotnet-maui

articles/getting_started/1_setting_up_your_development_environment_vscode.md

+88-76
Large diffs are not rendered by default.

articles/getting_started/1_setting_up_your_development_environment_windows.md

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
---
22
title: Setting up your development environment for Windows
3-
description: A step-by-step guide for setting up your development environment on Windows.
3+
description: This section provides a step-by-step guide for setting up your development environment on Windows.
44
---
55

6-
# Setting up your development environment for Windows
7-
8-
This section provides a step-by-step guide for setting up your development environment on Windows.
9-
106
MonoGame can work with most .NET compatible tools, but we recommend [Visual Studio 2022](https://visualstudio.microsoft.com/vs/)
117

128
Alternatively, you can use [JetBrains Rider](https://www.jetbrains.com/rider/) or [Visual Studio Code](https://code.visualstudio.com/).
@@ -37,31 +33,31 @@ To create new MonoGame projects from within Visual Studio 2022, you will need to
3733
1. Launch Visual Studio 2022
3834
2. Select **Continue without code**. This will launch Visual Studio without any project or solution opened.
3935

40-
![Visual Studio Launcher Continue Without Code](images/1_continue_without_code.png)
36+
![Visual Studio Launcher Continue Without Code](images/1_continue_without_code.png)
4137

4238
3. Click "*Extensions -> Manage Extensions* in the Visual Studio 2022 menu bar. This will open the Manage Extensions dialog window.
4339

44-
![Extensions -> Manage Extensions Menu Selection](images/1_visual_studio_extension_menu.png)
40+
![Extensions -> Manage Extensions Menu Selection](images/1_visual_studio_extension_menu.png)
4541

4642
4. Use the search box in the top-right corner of the Manage Extensions dialog window to search for **MonoGame**, then click the **MonoGame Framework C# project templates** extension as shown below and download it to install it.
4743

48-
![Visual Studio Extension Manager](images/1_visual_studio_extension_manager.png)
44+
![Visual Studio Extension Manager](images/1_visual_studio_extension_manager.png)
4945

5046
5. After it is downloaded, an alert will appear at the bottom of the Manage Extensions window that states "Your changes will be scheduled. The modifications will begin when all Microsoft Visual Studio windows are closed." Click the **Close** button, then close Visual Studio 2022.
5147

5248
6. After closing Visual Studio 2022, a VSIX Installer window will open confirming that you want to install the **MonoGame Framework C# project templates** extension. Click the **Modify** button to accept the install.
5349

54-
![VSIX Installer Window](images/1_vsix_installer_window.png)
50+
![VSIX Installer Window](images/1_vsix_installer_window.png)
5551

5652
You now have the MonoGame templates installed and are ready to create new projects.
5753

5854
**Next up:** [Creating a new project](2_creating_a_new_project_vs.md)
5955

6056
## [Alternative] Install the .NET 6 SDK (compatible with JetBrains Rider and Visual Studio Code)
6157

62-
If you prefer to use JetBrains Rider or Visual Studio Code, and after installing either of them, you will also need to [install the .NET 6 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/6.0).
58+
If you prefer to use JetBrains Rider or Visual Studio Code, and after installing either of them, you will also need to [install the .NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0).
6359

64-
Once the .NET 6 SDK is installed, you can open a Command Prompt and install the MonoGame templates by typing the following command:
60+
Once the .NET 8 SDK is installed, you can open a Command Prompt and install the MonoGame templates by typing the following command:
6561

6662
```sh
6763
dotnet new --install MonoGame.Templates.CSharp

articles/getting_started/2_creating_a_new_project_netcore.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
title: Creating a new project
2+
title: .NET CLI (JetBrains Rider or Visual Studio Code)
33
description: A step-by-step guide for creating a new project using JetBrains Rider or Visual Studio Code.
44
---
55

6-
# .NET CLI (JetBrains Rider or Visual Studio Code)
7-
86
This guide will walk you through building a starter game with MonoGame using only the command line/terminal on your operating system and a lightweight coding tool of your choice (such as [Visual Studio Code](https://code.visualstudio.com/) or [JetBrains Rider](https://www.jetbrains.com/rider/)).
97

10-
> It is assumed that you have already properly installed the .NET 6 SDK and MonoGame.
8+
> [!NOTE]
9+
> It is assumed that you have already properly installed the .NET 8 SDK and MonoGame.
1110
11+
> [!IMPORTANT]
1212
> Be aware that for iOS/iPadOS and Android, development might be limited when using the .NET CLI. Many of the development features for those targets are exclusive to Visual Studio 2022.
1313
1414
## Create a MonoGame Project
@@ -23,13 +23,13 @@ You can now create new MonoGame projects. To do that:
2323

2424
For example:
2525

26-
```
26+
```cli
2727
dotnet new mgdesktopgl -o MyGame
2828
```
2929

3030
> To know which platform identifier (short name) to use for your project, please refer to [Target Platforms](./platforms.md), or type the following command into the command prompt to list the installed templates and their corresponding short names:
31-
>
32-
> ```
31+
>
32+
> ```cli
3333
> dotnet new -l
3434
> ```
3535

articles/getting_started/2_creating_a_new_project_vs.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
---
2-
title: Creating a new project
2+
title: Creating a Project with Visual Studio 2022
33
description: A step-by-step guide for creating a new project using Visual Studio
44
---
55

6-
# Creating a Project with Visual Studio 2022
7-
86
This guide will walk you through building a starter game with MonoGame using Windows and Visual Studio 2022.
97

8+
> [!NOTE]
109
> It is assumed that you have already properly installed Visual Studio 2022 and MonoGame.
1110
1211
Start Visual Studio 2022 and select **New Project...** in the upper left corner.

articles/getting_started/3_understanding_the_code.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
---
22
title: Understanding the Code
3-
description: A look at the code that is generated after creating a new project.
3+
description: This tutorial will go over the code that is generated when you start a blank project.
44
---
55

6-
# Understanding the Code
7-
8-
This tutorial will go over the code that is generated when you start a blank project.
9-
6+
> [!NOTE]
107
> For help with creating a project, please look at the Creating a New Project section of the [Getting Started guide](index.md).
118
129
Within the **Game.cs** class file, which is the core of any MonoGame project, you will find several critical sections necessary for your game to run:

articles/getting_started/4_adding_content.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
---
22
title: Adding Content
3-
description: Learn how to add content such as images or sounds to your game.
3+
description: This tutorial will go over adding content such as images or sounds to your game.
44
---
55

6-
# Adding Content
7-
8-
This tutorial will go over adding content such as images or sounds to your game.
9-
6+
> [!NOTE]
107
> For help with creating a project, please look at the [Creating a New Project](index.md) section of the Getting Started guide.
118
129
## MonoGame Content Builder Tool (MGCB Editor)

articles/getting_started/5_adding_basic_code.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
---
22
title: Adding Basic Code
3-
description: Learn how to add basic logic to your game.
3+
description: This tutorial will go over adding basic logic to your game
44
---
55

6-
# Adding Basic Code
7-
8-
This tutorial will go over adding basic logic to your game, continuing from where [Adding Content](4_adding_content.md) left off.
6+
> [!NOTE]
7+
> this tutorial continues from where [4. Adding Content](4_adding_content.md) left off.
98
109
---
1110

@@ -133,14 +132,14 @@ Find the **Update** method in the Game1.cs class file and add:
133132
if(Joystick.LastConnectedIndex == 0)
134133
{
135134
JoystickState jstate = Joystick.GetState(PlayerIndex.One);
136-
135+
137136
float updatedBallSpeed = ballSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
138-
137+
139138
if (jstate.Axes[1] < 0)
140139
{
141140
ballPosition.Y -= updatedBallSpeed;
142141
}
143-
else if (jstate.Axes[1] > 0)
142+
else if (jstate.Axes[1] > 0)
144143
{
145144
ballPosition.Y += updatedBallSpeed;
146145
}

articles/getting_started/index.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
---
22
title: Getting Started
3-
description: Get started creating games with MonoGame.
3+
description: This section walks you through the basics of MonoGame, and helps you to create your first game.
44
---
55

6-
# Getting Started
7-
8-
This section walks you through the basics of MonoGame, and helps you to create your first game.
9-
106
First, select the operating system and toolset you will be working with to create your first MonoGame project, then continue reading to understand the basic layout of a MonoGame project.
117

128
By the end of this tutorial set, you will have a working project to build for your target platform and will be ready to tackle your next steps.

articles/getting_started/packaging_games.md

+4-7
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ title: Package games for distribution
33
description: How to package your game for distribution.
44
---
55

6-
# Package games for distribution
7-
8-
Once your game is ready to be published, it is recommended that you package it properly for consumption by players.
9-
106
## Desktop games
117

128
To publish desktop games, it is recommended that you build your project as a [self-contained](https://docs.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained) .NET application. As such, your game will require absolutely no external dependencies and should run out-of-the-box as-is.
@@ -35,14 +31,14 @@ We recommend using the .tar.gz archiving format to preserve the execution permis
3531

3632
From the .NET CLI:
3733

38-
```
34+
```cli
3935
dotnet publish -c Release -r osx-x64 /p:PublishReadyToRun=false /p:TieredCompilation=false --self-contained
4036
dotnet publish -c Release -r osx-arm64 /p:PublishReadyToRun=false /p:TieredCompilation=false --self-contained
4137
```
4238

4339
We recommend that you distribute your game as an [application bundle](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html). Application bundles are directories with the following file structure:
4440

45-
```
41+
```text
4642
YourGame.app                    (this is your root folder)
4743
    - Contents
4844
        - Resources
@@ -56,6 +52,7 @@ YourGame.app                    (this is your root folder)
5652
```
5753

5854
The contents of the entry point script:
55+
5956
```sh
6057
#!/bin/bash
6158

@@ -67,7 +64,7 @@ else
6764
fi
6865
```
6966

70-
The Info.plist file is a standard macOS file containing metadata about your game. Here's an example file with required and recommended values set:
67+
The `Info.plist` file is a standard macOS file containing metadata about your game. Here is an example file with required and recommended values set:
7168

7269
```xml
7370
<?xml version="1.0" encoding="UTF-8"?>

articles/getting_started/platforms.md

+2-29
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@ title: Supported Platforms
33
description: Platforms that MonoGame supports building games for.
44
---
55

6-
7-
# Supported Platforms
8-
96
MonoGame supports building games for the following **systems**:
107

118
| **Desktop PCs** | **Mobiles** | **Gaming consoles*** |
129
| --------------------------- | -------------------------- | ------------------------------------------------------------------------------ |
1310
| Windows<br/>macOS<br/>Linux | iOS<br/>iPadOS<br/>Android | Xbox<br/>PlayStation 4<br/>PlayStation 5<br/>Nintendo Switch<br/>Google Stadia |
1411

15-
**Gaming consoles are restricted to registered developers and are not publicly available nor publicly documented. To get access to those platforms, please contact your console account manager(s). MonoGame documentation for closed platforms is available in their respective repositories.*
12+
> [!IMPORTANT]
13+
> **Gaming consoles are restricted to registered developers and are not publicly available nor publicly documented. To get access to those platforms, please contact your console account manager(s). MonoGame documentation for closed platforms is available in their respective repositories.*
1614
1715
## Understanding MonoGame's platform types
1816

@@ -26,7 +24,6 @@ Below is a list of public platforms with their corresponding NuGet package, the
2624

2725
- [WindowsDX](#windowsdx)
2826
- [DesktopGL](#desktopgl)
29-
- [Windows Universal](#windowsuniversal)
3027
- [Android](#android)
3128
- [iOS](#ios)
3229

@@ -68,28 +65,6 @@ You can target Windows 8.1 (and up), macOS Catalina 10.15 (and up), and Linux wi
6865

6966
DesktopGL currently does not have a `VideoPlayer` implementation.
7067

71-
### WindowsUniversal
72-
73-
| **Supported Systems** | **NuGet Package** | **Template ID** |
74-
| ------------------------------------ | ----------------------------------- | --------------------------------------------------- |
75-
| Windows 10, Xbox (UWP-only, not XDK) | MonoGame.Framework.WindowsUniversal | mguwpcore (core app, no xaml), mguwpxaml (xaml app) |
76-
77-
The WindowsUniversal platform runs on [Universal Windows Platform (UWP)](https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide).
78-
79-
WindowsUniversal uses **DirectX** for graphics, and XAudio for audio just like the WindowsDX platform.
80-
81-
UWP comes in two flavors, each with its own project template:
82-
83-
- **XAML app template**: an app in which your game will be hosted within an XAML page. This can be useful if you wish to offer a more complex UWP experience with multiple pages or XAML controls.
84-
85-
- **Core app template**: a raw app without any XAML, more straightforward if you don't need XAML controls.
86-
87-
This platform is meant to publish games on the **Windows Store**, for both **Windows** and **Xbox** (through the [Xbox Live Creators Program](https://www.xbox.com/en-US/developers/creators-program)).
88-
89-
Note that UWP games running on Xbox get [restricted access](https://docs.microsoft.com/en-us/windows/uwp/xbox-apps/system-resource-allocation) to the console capabilities. To unlock those restrictions, MonoGame has a dedicated Xbox platform for registered [ID@Xbox](https://www.xbox.com/en-US/Developers/id) developers targeting the XDK (this platform is private and requires you to contact your ID@Xbox manager).
90-
91-
Building for UWP requires the Windows SDK version 19041 or better to be installed.
92-
9368
### Android
9469

9570
| **Supported Systems** | **NuGet Package** | **Template ID** |
@@ -135,5 +110,3 @@ A project template to create a [shared project](https://docs.microsoft.com/en-us
135110
**Template ID**: mgpipeline
136111

137112
A project template for writing custom logic for handling content and building it into XNB files.
138-
139-
#

articles/getting_started/preparing_for_consoles.md

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
---
22
title: Preparing for consoles
3-
description: How to get your game ready to run on consoles.
3+
description: If you would like to port your game to consoles, there are some best practices to follow if you want to avoid running into issues while porting.
44
---
55

6-
# Preparing for consoles
7-
8-
If you would like to port your game to consoles, there are some best practices to follow if you want to avoid running into issues while porting.
9-
106
MonoGame for gaming consoles uses a dedicated .NET runtime that is not maintained by Microsoft. Therefore, a 100% accuracy and reliability is not guaranteed. Moreover, the console runtime makes use of `ahead-of-time` native compilation (AOT), which means that some .NET features will not, and cannot work on consoles.
117

128
This article explains the most common pitfalls and suggested guidelines to optimize your chances of having a smoother porting experience.
@@ -27,7 +23,7 @@ To publish with AOT:
2723
- Add `<PublishAot>true</PublishAot>` to your `.csproj`.
2824
- Then run `dotnet publish` from the command-line/terminal.
2925

30-
This will nativily compile your game in a fashion similar to consoles. The output executable will be in your output folder, within a sub-folder nammed `publish`.
26+
This will natively compile your game in a fashion similar to consoles. The output executable will be in your output folder, within a sub-folder named `publish`.
3127

3228
From there, you can try running this executable. If it does not start or crashes later on, you likely are using reflection or another unsupported feature in a AOT runtime.
3329

@@ -41,7 +37,7 @@ It should show you on which C# lines it crashed.
4137

4238
It is important to note that you should test every aspect of your game, and not just if it starts. Run through all the menus/screens, scene transitions and gameplay.
4339

44-
Another way to make sure that everything is safe is to enable `<EnableTrimAnalyzer>true</EnableTrimAnalyzer>` in your `.csproj`, and then **rebuild** (not just build) your game and check the build output for AOT warnings. Those warnings will tell you which parts of your code might trigger crashes or unexecpted results when running on AOT compilation. You should seek to resolve all of them.
40+
Another way to make sure that everything is safe is to enable `<EnableTrimAnalyzer>true</EnableTrimAnalyzer>` in your `.csproj`, and then **rebuild** (not just build) your game and check the build output for AOT warnings. Those warnings will tell you which parts of your code might trigger crashes or unexpected results when running on AOT compilation. You should seek to resolve all of them.
4541

4642
## No runtime compilation / IL emit
4743

@@ -61,7 +57,7 @@ It is advised to choose very carefully the libraries that you are using when por
6157

6258
The best way to make sure if they will work, is to search if they are **"AOT-compatible"**, or try to compile with the `<EnableTrimAnalyzer>true</EnableTrimAnalyzer>` setting in your `.csproj` and check if there are any warnings related to those libraries.
6359

64-
For example, here are some parsing libraries known for their compliance with AOT compilation and good handling of memrory:
60+
For example, here are some parsing libraries known for their compliance with AOT compilation and good handling of memory:
6561

6662
- [TurboXML](https://github.com/xoofx/TurboXml)
6763
- [TinyJSON](https://github.com/zanders3/json)
@@ -88,7 +84,7 @@ Even though your game has good performance on PC and does not show stutters, you
8884

8985
The garbage collector is slower on consoles and if your game generates a lot of garbage memory, there will be visible stutters.
9086

91-
To verify that your game is not too garbage-prone, you can run Visual Studio's Perfomance Profiler (`Debug/Performance Profiler...`) and check the **".NET Object Allocation Tracking"** tool.
87+
To verify that your game is not too garbage-prone, you can run Visual Studio's Performance Profiler (`Debug/Performance Profiler...`) and check the **".NET Object Allocation Tracking"** tool.
9288

9389
From there, you can check which parts of your code generate garbage and you can pinpoint where to optimize.
9490

@@ -103,7 +99,7 @@ In order to avoid garbage, here are some best practices:
10399

104100
## Do not rely on system calls
105101

106-
If your game calls directly to system functions, like kernel, win32 or unix commands, you might want to get rid of them.
102+
If your game calls directly to system functions, like kernel, win32 or Unix commands, you might want to get rid of them.
107103

108104
## Consider I/O to be asynchronous
109105

@@ -116,4 +112,3 @@ If you consider all your I/O and system operations as asynchronous, you will lik
116112
## Suggestions
117113

118114
If you have other tips or suggestions when building for consoles, then let the MonoGame team know by raising an issue and we will improve this article even further over time.
119-

0 commit comments

Comments
 (0)