MonoGame 的游戏开发简介Introduction to Game Development with MonoGame

此多部分演练演示了如何使用 MonoGame 创建简单的2D 应用程序。它介绍常见的游戏编程概念, 如图形、输入、游戏实体和物理学。This multi-part walkthrough shows how to create a simple 2D application using MonoGame. It covers common game programming concepts, such as graphics, input, game entities, and physics.

本文介绍了用于制作跨平台游戏的 MonoGame API 技术。This article describes MonoGame API technology for making cross-platform games. 有关平台的完整列表,请参阅 MonoGame 网站For a full list of platforms, see the MonoGame website. 本教程将使用 C# 代码示例,虽然 MonoGame 也完全可以使用F#。This tutorial will use C# for code samples, although MonoGame is fully functional with F# as well.

MonoGame 是一个跨平台的硬件加速API、提供图形、音频、游戏状态管理、输入以及用于导入资产的内容流水线。MonoGame is a cross-platform, hardware accelerated API providing graphics, audio, game state management, input, and a content pipeline for importing assets. 与大多数游戏引擎不同,MonoGame 不提供或强加任何模式或项目结构。Unlike most game engines, MonoGame does not provide or impose any pattern or project structure. 虽然这意味着开发人员可以随意组织他们的代码,但这也意味着首次启动新项目时需要一些设置代码。While this means that developers are free to organize their code as they like, it also means that a bit of setup code is needed when first starting a new project.

本演练的第一部分重点介绍如何设置一个空项目。The first section of this walkthrough focuses on setting up an empty project. 最后一部分介绍了如何编写我们所有的游戏逻辑和内容 — 大多数都是跨平台的。The last section covers writing all of our game logic and content – most of which will be cross platform.

本演练结束时,我们将创建一个简单的游戏,玩家可以通过触摸输入控制动画角色。By the end of this walkthrough, we will have created a simple game where the player can control an animated character with touch input. 虽然这在技术上并不是一个完整的游戏(因为它没设置赢或输的条件),但它展示了许多游戏开发概念,可以作为许多游戏类型的基础。Although this is not technically a full game (since it has no win or lose conditions), it demonstrates numerous game development concepts and can be used as the foundation for many types of games.

下面显示了此演练的结果:The following shows the result of this walkthrough:


MonoGame 和MonoGame and XNA

MonoGame 库旨在模仿 Microsoft XNA 库的功能和语法。The MonoGame library is intended to mimic Microsoft’s XNA library in both syntax and functionality. 所有 MonoGame 对象都存在于 Microsoft.Xna 命名空间下 - 允许大多数 XNA 代码在 MonoGame 中使用而无需修改。All MonoGame objects exist under the Microsoft.Xna namespace – allowing most XNA code to be used in MonoGame with no modification.

熟悉 XNA 的开发人员已熟悉 MonoGame 的语法,想寻找更多有关使用 MonoGame 的信息的开发人员可参考现有的在线XNA演练、API 文档和讨论。Developers familiar with XNA will already be familiar with MonoGame’s syntax, and developers looking for additional information on working with MonoGame will be able to reference existing online XNA walkthroughs, API documentation, and discussions.

演练部分Walkthrough Parts