Creating a Game Project for Windows

Page update date :
Page creation date :

summary

Create a project for your game for Windows in XNA.

* This tip is described in "Visual Studio 2010 Professional Edition", but it can be operated in other editions of Visual Studio 2010 as well. If you are using a version other than Japanese, replace the name and operate.

Visual Studio 2010

Operating environment

Prerequisites

Supported XNA Versions 4.0
Supported Platforms Windows XP SP3 or later, Windows Vista SP2 or later, Windows 7
Windows Required Vertex Shader Version 2.0
Windows Required Pixel Shader Version 2.0

Operating environment

platform Windows 7

substance

Create a project

Let's create a "project" to make a game for Windows. A "project" is a structure that collectively manages resources such as programs and images. If you're making a game, you always start by creating this project.

Let's start the development environment "Visual Studio 2010". Creating projects and creating programs is basically done with this software.

If you have a higher version of Visual Studio 2010, start "Microsoft Visual Studio 2010 - Microsoft Visual Studio 2010" from the Start menu.

If you have a free version of Visual Studio 2010, start "Microsoft Visual Studio 2010 Express - Microsoft Visual C# 2010 Express" or "Microsoft Visual Studio 2010 Express for Windows Phone" from the Start menu.

A screen similar to the one shown in the figure will appear. This is "Visual Studio".

Now, let's create a project. From the toolbar at the top right of the screen, press the "New Project" button.

You can also do the same from "File" in the menu.

This will open the "New Project" dialog as shown in the figure.

On the left side of the dialog, select XNA Game Studio 4.0 from Installed Templates. The only programming language is C#.

First of all, select "Template". It's possible to start with a blank project with no files at all, but you can use a pre-made template to generate basic programs, files, etc., so you can start developing your goals right away.

In this case, we will create a "game for Windows", so select "Windows Game (4.0)".

Next, there is an item to enter "Name (project name)" at the bottom of the dialog, but it is a good idea to enter the name of the game you are creating. This project name is also a namespace, so it is preferable to enter it in alphanumeric characters if possible.

This time, we will proceed with "Windows Game 1" entered from the beginning.

Next, specify the location (folder path) where you want to create the project. You can enter the location directly, or you can specify the folder path from the "Browse" button on the right. If possible, it is better to create a path consisting only of alphanumeric characters.

The "solution" at the bottom is the framework for organizing the project. Typically, you specify the name of the entire project, but for smaller projects, it can be the same as the project name. In XNA Game Studio 4.0, whenever you create a new project, two projects are created, so they are created together in this solution.

When you are done, press the "OK" button.

After a while, the project will be created and you will see the program on the screen. This will be the base template.

If you look at the Solution Explorer on the right side of the screen (which may be in a different location depending on your Visual Studio environment), you'll see that there are two projects under the solution and a few files in them.

This time, I would like to run the program without making any changes to the program. Press the "Start Debugging" button on the toolbar on the screen. The build will start and run the program when it is complete.

By the way, "build" refers to a series of tasks that are performed at once, such as automatically checking the program for mistakes, creating resources, and creating an executable file that can be launched by the program.

When the program is executed, you will see a screen similar to the one shown. This will be the actual Windows game screen. Nothing is displayed yet, but it will be possible to do various things by building a program from now on.

When you look at this screen, it looks like you're just displaying a window, but in fact, the framework initialization process checks whether the game can actually work, creates a graphics device, and performs Mr./Ms. processing internally.

In conventional game development, you had to create this process yourself, so it was quite a high threshold for those who were trying to make a game for the first time. The XNA Framework takes that out of the equation so you can get right to the essentials of the game.

There is nothing more to do on this screen, so close the window with the "×" button in the upper right corner of the screen.

This time, the purpose is to create a project, so this is the end.

To close the project, select "Close Solution" from the menu "File". The project will be closed, so if you don't have anything else to do, you can close the window.

By the way, even if you don't bother to do this, if you close the window, the project will be closed automatically. If you have made any edits, you will be prompted to confirm the save, so please save and exit.

From now on, you will open the project you created, but there are several ways to do it.

Open from the start page

At the bottom left of the "Start Page" that appears when you start Visual Studio, there is an item called "Recent Projects", and as the name suggests, there are several recently used projects, so you can open it by simply clicking on the project you want to open.

Open from the menu

If you select "File", "Open", or "Project/Solution" from the menu, the file selection dialog will open, so navigate to the folder where you saved the project and open the "XXXXX.sln" file.

You can also do the same from "Open Project" on the start page.

Open from file

In File Explorer, for example, type . Simply double-click on the "sln" file directly to open the project at the same time as Visual Studio 2010 starts.