Skip to content

Commit 2a01a7c

Browse files
Merge pull request MonoGame#42 from SimonDarksideJ/feature/proof-run
Chapter proof review
2 parents 4a1d4ca + fbbfcdc commit 2a01a7c

File tree

33 files changed

+1028
-798
lines changed

33 files changed

+1028
-798
lines changed

articles/tutorials/building_2d_games/01_what_is_monogame/index.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ description: Learn about the history of MonoGame and explore the features it pro
55

66
## A Brief History
77

8-
In 2006, Microsoft released a game development framework named *XNA Game Studio* to facilitate game development for Windows PC and the Xbox 360 console. It revolutionized game development for indie creators by bringing a simplified approach to building games and offering a set of tools that lowered the entry barrier for aspiring game developers. Out of XNA Game Studio came critically acclaimed titles such as [Bastion](https://www.supergiantgames.com/games/bastion/) and [Terraria](https://terraria.org/). In 2008, XNA was expanded to support development for both the Zune and Windows Phone.
8+
In 2006, Microsoft released a game development framework named *[XNA Game Studio](https://learn.microsoft.com/en-us/previous-versions/windows/xna/bb203894(v=xnagamestudio.42))* to facilitate game development for Windows PC and the Xbox 360 console. It revolutionized game development for indie creators by bringing a simplified approach to building games and offering a set of tools that lowered the entry barrier for aspiring game developers. Out of XNA Game Studio came critically acclaimed titles such as [Bastion](https://www.supergiantgames.com/games/bastion/) and [Terraria](https://terraria.org/). In 2008, XNA was expanded to support development for both the Zune and Windows Phone.
99

1010
> [!NOTE]
1111
>
12-
> Fun fact, provided by community member stromkos, The release of XNA 3.0 in 2008, which added the support for Windows Phone, is also the release that specified the default window resolution of 800x480 for new projects as this was the preferred resolution on Windows Phone. [It is still the default resolution used in MonoGame projects today](https://github.com/MonoGame/MonoGame/blob/8b35cf50783777507cd6b21828ed0109b3b07b50/MonoGame.Framework/GraphicsDeviceManager.cs#L44).
12+
> Fun fact, provided by community member [stromkos](https://github.com/stromkos), The release of XNA 3.0 in 2008, which added the support for Windows Phone, is also the release that specified the default window resolution of 800x480 for new projects as this was the preferred resolution on Windows Phone. [It is still the default resolution used in MonoGame projects today](https://github.com/MonoGame/MonoGame/blob/8b35cf50783777507cd6b21828ed0109b3b07b50/MonoGame.Framework/GraphicsDeviceManager.cs#L44).
1313
1414
As XNA became more popular, the need for cross-platform development started to grow. In 2009, [José Antonio Leal de Farias](https://github.com/jalf) introduced *XNA Touch*, an open-source project that aimed to make games with XNA playable on iOS devices. This marked the beginning of what would later become MonoGame. [Dominique Louis](https://github.com/CartBlanche) came on board in 2009 and soon took over as full-time project lead, driving its initial development and expansion. The project attracted other developers, such as [Tom Spilman](https://github.com/tomspilman), who were interested in expanding the scope of the project as well as its reach.
1515

@@ -23,6 +23,10 @@ Today, MonoGame is a mature cross-platform framework, that is built with the spi
2323
| ![Figure 1-3: Streets of Rage 4](./images/sor4.jpg) | [Figure 1-4: Bastion](./images/bastion.jpg) |
2424
| **Figure 1-3: Streets of Rage 4** | **Figure 1-4: Bastion** |
2525

26+
> [!NOTE]
27+
>
28+
> For more details about MonoGame's history, check the [About](https://monogame.net/about/) on the official MonoGame website.
29+
2630
## Features
2731

2832
MonoGame, following in the footsteps of XNA, is a "bring your own tools" framework. It provides developers the basic blocks to design the game, engines, and/or tools. As a code-first approach to game development, MonoGame does not include any pre-built editors or interfaces; instead, it gives developers the freedom to create their own working environment.

articles/tutorials/building_2d_games/02_getting_started/index.md

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: "Chapter 02: Getting Started"
33
description: Setup your development environment for .NET development and MonoGame using Visual Studio Code as your IDE.
44
---
55

6-
Unlike game engines, MonoGame is a *framework*. This means it does not come as a standalone program that you download and install, and does not include a graphical user interface used to create games. Instead, MonoGame integrates into the standard .NET development workflow, offering a code-first approach to game development. This approach offers several advantages:
6+
Unlike game engines (such as Unity, Unreal or Godot), MonoGame is a *framework*. This means it does not come as a standalone program that you download and install, and does not include a graphical user interface used to create games. Instead, MonoGame integrates into the standard .NET development workflow, offering a code-first approach to game development. This approach offers several advantages:
77

88
* **Flexibility**: Developers are not locked into using a specific editor or interface, allowing them to use their preferred development tools.
99
* **Integration**: As a .NET library itself, MonoGame can easily integrate with other .NET libraries and tools.
@@ -21,7 +21,7 @@ The first thing we need to do is install the .NET *Software Development Kit* (SD
2121
2222
### [Windows](#tab/windows)
2323

24-
1. Open a web browser and navigate to https://dotnet.microsoft.com/en-us/download.
24+
1. Open a web browser and navigate to [https://dotnet.microsoft.com/en-us/download](https://dotnet.microsoft.com/en-us/download).
2525
2. Choose the version of the .NET SDK to install and click the **Download .NET SDK x64** button to start the download.
2626

2727
> [!NOTE]
@@ -31,7 +31,7 @@ The first thing we need to do is install the .NET *Software Development Kit* (SD
3131

3232
### [macOS](#tab/macos)
3333

34-
1. Open a web browser and navigate to https://dotnet.microsoft.com/en-us/download.
34+
1. Open a web browser and navigate to [https://dotnet.microsoft.com/en-us/download](https://dotnet.microsoft.com/en-us/download).
3535
2. Choose the version of the .NET SDK to install and click lick the *Download .NET SDK x64 (Intel)* button start the download of the .NET SDK Installer.
3636

3737
> [!NOTE]
@@ -81,31 +81,31 @@ To install VSCode, follow the instructions for your operating system below:
8181

8282
### [Windows](#tab/windows)
8383

84-
1. Open a browser and navigate to https://code.visualstudio.com/.
84+
1. Open a browser and navigate to [https://code.visualstudio.com/](https://code.visualstudio.com/).
8585
2. Click the *Download for Windows* button to start the download of the installer.
8686
3. Once the download finishes, run the installer.
8787

8888
### [macOS](#tab/macos)
8989

90-
1. Open a web browser and navigate to https://code.visualstudio.com/.
90+
1. Open a web browser and navigate to [https://code.visualstudio.com/](https://code.visualstudio.com/).
9191
2. Click the *Download for macOS* button to start the download of the *.zip* archive.
9292
3. Once the download finishes, double click the *.zip* archive to extract the *Visual Studio Code.app* application package
9393
4. Drag-and-drop the *Visual Studio Code.app* application package into your *Application* folder to make it available in the macOS *LaunchPad*.
9494

9595
### [Linux](#tab/linux)
9696

97-
1. Open a web browser and navigate to https://code.visualstudio.com/.
97+
1. Open a web browser and navigate to [https://code.visualstudio.com/](https://code.visualstudio.com/).
9898
2. Click the *.deb* download button to download the package for Debian based Linux distributions, or the *.rpm* download button for Red Hat based Linux distributions.
9999
3. Once the download finishes, open the package downloaded to install.
100100

101101
---
102102

103103
## Install the C# Dev Kit Extension
104104

105-
For C# development using VSCode, it is recommended to use the official *C# Dev Kit* extension provided by Microsoft. Installing this extension will add additional features to VSCode such as a project system and *Solution Explorer* for C# projects. It also provides code editing features such as syntax highlighting, code completion, code navigation, refactoring, NuGet package management, and debugging tools.
105+
For C# development using VSCode, it is recommended to use the official *[C# Dev Kit](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit)* extension provided by Microsoft. Installing this extension will add additional features to VSCode such as a project system and *Solution Explorer* for C# projects. It also provides code editing features such as syntax highlighting, code completion, code navigation, refactoring, NuGet package management, and debugging tools.
106106

107107
> [!NOTE]
108-
> The *Solution Explorer* panel is a hierarchial view provided by the C# Dev Kit extension that displays your solution structure similar to Visual Studio's Solution Explorer.
108+
> The *Solution Explorer* panel is a hierarchical view provided by the C# Dev Kit extension that displays your solution structure similar to Visual Studio's Solution Explorer.
109109
>
110110
> When you open a workspace in Visual Studio Code containing a .NET solution file (*.sln*), the *Solution Explorer* panel automatically appears and loads your solution. From this panel, you can perform common operations like:
111111
>
@@ -181,12 +181,21 @@ wget -qO- https://monogame.net/downloads/net8_mgfxc_wine_setup.sh | bash
181181
With your development environment setup, it is time to create your first MonoGame application.
182182

183183
1. Launch the VSCode application
184-
2. Open the *Command Palette* by clicking *View > Command Palette* or by using the keyboard shortcut `CTRL+SHIFT+P`.
184+
2. Open the *Command Palette* by clicking *View > Command Palette* or by using the keyboard shortcut `CTRL+SHIFT+P` (`CMD+SHIFT+P` on Mac).
185185
3. Type `.NET New Project` in the *Command Palette* and choose the *.NET New Project* command
186186
4. Next, you will be presented with a list of the available .NET project templates. Enter `MonoGame` into the prompt to filter the project templates to only show the MonoGame ones, then choose the *MonoGame Cross-Platform Desktop Application* project template.
187-
5. After choosing the template, a dialog window will appear asking you to choose a location to save the project.
188-
6. Next, you will be prompted to enter a name for the project. Enter the name `DungeonSlime`.
189-
7. Finally, select the *Create Project* prompt.
187+
188+
> [!NOTE]
189+
> If the MonoGame templates are not showing up, then you skipped the step to install the templates, exit the project creation and click `Terminal -> New Terminal` in VSCode and run the following command:
190+
>
191+
> ```sh
192+
> dotnet new install MonoGame.Templates.CSharp
193+
> ```
194+
195+
5. After choosing the template, a dialog window will appear asking you to choose a location to save the project, this is a folder where your projects will will be created by default.
196+
6. Next, you will be prompted to enter a name for the project. Enter the name `DungeonSlime`, which will create your project in a new folder with the same name.
197+
7. If this is your first time creating your project, you will be asked to choose a solution format, simply select the default `.sln` option and click `Next` to continue. (This does not occur with subsequent projects)
198+
8. Finally, select the *Create Project* prompt.
190199
191200
After selecting *Create Project*, a new C# project will be generated based on the chosen MonoGame template and opened automatically in VSCode.
192201
@@ -215,7 +224,7 @@ You can exit the game at any time by pressing the `Esc` key on your keyboard.
215224
>
216225
> Desktop applications are event based, meaning once loaded, they do not do much at all while waiting for input from the user. They respond to user interactions and redraw the window only when necessary.
217226
>
218-
> In games, things are always happening, such as objects moving around like the player or particle effects. To handle this, games implement a loop structure that runs continuously, first calling a method to update the game logic, and then a draw method to render the current frame, until it is told to exit.
227+
> In games, things are always happening, such as objects moving around like the player or particle effects. To handle this, games implement a loop structure that runs continuously, first calling a method to **`update`** the game logic, and then a **`draw`** method to render the current frame, until it is told to exit.
219228
220229
## Conclusion
221230
@@ -226,7 +235,7 @@ In this chapter, you accomplished the following:
226235
* You installed VSCode and the necessary extension to develop C# applications with VSCode
227236
* You created and ran your first MonoGame project.
228237
229-
Now that your development environment is setup and ready to go, you can dive in and start building your first game. In the next chapter, we will cover the contents of the *Game1.cs* file that was included in the MonoGame project you just created.
238+
Now that your development environment is setup and ready to go, you can dive in and start building your first game. In the next chapter, we will cover the contents of the `Game1.cs` file that was included in the MonoGame project you just created.
230239
231240
## Test Your Knowledge
232241
@@ -235,10 +244,10 @@ Now that your development environment is setup and ready to go, you can dive in
235244
:::question-answer
236245
Any two of the following:
237246
238-
- Flexibility: Developers can use their preferred development tools
239-
- Integration: MonoGame easily integrates with other .NET libraries
240-
- Cross-platform Development: Projects can be developed on Windows, macOS, or Linux
241-
- Version Control Friendly: The code-first approach works well with systems like Git
247+
* Flexibility: Developers can use their preferred development tools
248+
* Integration: MonoGame easily integrates with other .NET libraries
249+
* Cross-platform Development: Projects can be developed on Windows, macOS, or Linux
250+
* Version Control Friendly: The code-first approach works well with systems like Git
242251
243252
:::
244253

articles/tutorials/building_2d_games/03_the_game1_file/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ title: "Chapter 03: The Game1 File"
33
description: Explore the contents of the Game1 file generated when creating a new MonoGame project.
44
---
55

6-
After you created a new MonoGame project using the *MonoGame Cross-Platform Desktop Application* template in [Chapter 02](../02_getting_started/index.md#creating-your-first-monogame-application), you will notice the generated files and project structure that serve as a starting point for your game application. While MonoGame offers different templates based on target platform, all projects will contain the *Game1.cs* file.
6+
After you created a new MonoGame project using the *MonoGame Cross-Platform Desktop Application* template in [Chapter 02](../02_getting_started/index.md#creating-your-first-monogame-application), you will notice the generated files and project structure that serve as a starting point for your game application. While MonoGame offers different templates based on target platform, all projects will contain the `Game1.cs` file.
77

88
## Exploring the Game1 Class
99

10-
At the core of a MonoGame project is the [**Game**](xref:Microsoft.Xna.Framework.Game) class. This class handles the initialization of graphics services, initialization of the game, loading content, updating, and rendering the game. When you create a new Monogame project, this [**Game**](xref:Microsoft.Xna.Framework.Game) class is implemented as the `Game1` class that you can customize as needed for your specific game.
10+
At the core of a MonoGame project is the [**Game**](xref:Microsoft.Xna.Framework.Game) class. This class handles the initialization of graphics services, initialization of the game, loading content, updating, and rendering the game. When you create a new MonoGame project, this [**Game**](xref:Microsoft.Xna.Framework.Game) class is implemented as the `Game1` class that you can customize as needed for your specific game.
1111

1212
> [!TIP]
1313
> While the default template names the class `Game1`, you are free to rename it to something more appropriate for your project. However, for consistency, the documentation will continue to refer to it as `Game1`.
1414
15-
Locate the *Game1.cs* file that was generated when you created the MonoGame project and open it. The default content will be:
15+
Locate the `Game1.cs` file that was generated when you created the MonoGame project and open it. The default content will be:
1616

1717
[!code-csharp[](./snippets/game1.cs)]
1818

@@ -89,15 +89,15 @@ While this can make for a neat effect, it is not something you want all the time
8989
> | :---: |
9090
> | **Figure 3-3: The game window clearing the screen using the MonoGame Orange color** |
9191
92-
Each time the game loops completes and the game is drawn to the screen, we call this a *frame*. So if MonoGame is running the game loop at 60 frames per second, that means it is performing and update and a render of each frame in 16ms. Notice that both the [**Update**](xref:Microsoft.Xna.Framework.Game.Update(Microsoft.Xna.Framework.GameTime)) and the [**Draw**](xref:Microsoft.Xna.Framework.Game.Draw(Microsoft.Xna.Framework.GameTime)) methods both receive a parameter of the type [**GameTime**](xref:Microsoft.Xna.Framework.GameTime). The [**GameTime**](xref:Microsoft.Xna.Framework.GameTime) parameter provides a snapshot of the timing values for the game, including the amount of time that it took for the previous frame to execute. This is commonly referred to as the *delta time*.
92+
Each time the game loops completes and the game is drawn to the screen, we call this a *frame*. So if MonoGame is running the game loop at 60 frames per second, that means it is performing and update and a render of each frame every 16ms. Notice that both the [**Update**](xref:Microsoft.Xna.Framework.Game.Update(Microsoft.Xna.Framework.GameTime)) and the [**Draw**](xref:Microsoft.Xna.Framework.Game.Draw(Microsoft.Xna.Framework.GameTime)) methods both receive a parameter of the type [**GameTime**](xref:Microsoft.Xna.Framework.GameTime). The [**GameTime**](xref:Microsoft.Xna.Framework.GameTime) parameter provides a snapshot of the timing values for the game, including the amount of time that it took for the previous frame to execute. This is commonly referred to as the *delta time*.
9393

9494
*Delta time* allows you to track time accurately for things such as animations and events based on *game time* and not the speed of the processor (CPU) on the machine running the game. While in ideal circumstances, the delta time will always be 16ms, there are any number of things that could cause a temporary slow down or hiccup in a frame, and using the delta time ensures that timing based events are always correct.
9595

9696
## Conclusion
9797

9898
In this chapter, you accomplished the following:
9999

100-
- You read through the default code provided in a *Game1.cs* file created by a MonoGame template.
100+
- You read through the default code provided in a `Game1.cs` file created by a MonoGame template.
101101
- You learned about the lifecycle of a MonoGame game project.
102102
- You learned what a game loop is and how it is implemented in MonoGame.
103103

@@ -108,7 +108,7 @@ In the next chapter, you will start working with sprites and learn how to load a
108108
1. Can the `Game1` class be renamed or is it required to be called `Game1`
109109

110110
:::question-answer
111-
It is not a requirement that it be called `Game1`. This is just the default name given to it by the templates when creating a new MonoGame game project.
111+
It is not a requirement that it be called `Game1`. This is just the default name given to it by the templates when creating a new MonoGame game project. However, you cannot change the name of the *BASE* class `Game`, as this is a MonoGame construct.
112112
:::
113113

114114
2. What is the [**SpriteBatch**](xref:Microsoft.Xna.Framework.Graphics.SpriteBatch) used for?

0 commit comments

Comments
 (0)