So far we have created an empty project called Rock Blaster. Next we will create a skeleton for our game.
A skeleton…with bones?
When we refer to a game skeleton, we mean an initial setup which contains empty or nearly-empty Screens and Entities. We are not referring to an actual skeleton, but rather the simplified structure that a skeleton implies.
Creating a skeleton is a great exercise because it can quickly get you to think about what your game will contain. You can quickly add Screens and Entities – nearly as quickly as you can think them up because there is no implementation required.
As you become more experienced with making games (especially with Glue) you will find it easier to create skeletons.
How to start creating a skeleton
The first step is purely conceptual. You can start creating a skeleton with any tool that you find comfortable. You may prefer to use a simple text or spreadsheet document, or perhaps you prefer to write a list on a piece of paper.
The point of this step is to create a list of screens and entities which you expect to include in your game. This game will be about flying a space ship, shooting rocks, and attempting to stay alive long enough to earn a high score.
First we’ll start with screens. We’ll only have one Screen for this game, so this list is easy:
Next we’ll create a list of Entities. The following Entities will be needed for our game:
What if we don’t think of everything?
If you don’t think of all of the Screens and Entities that you’ll need, that’s okay! The purpose of this isn’t to fully define the game, but rather to get you to think about the game from a development perspective – something which you may not do immediately when you think up a game idea. Working through the Screen and Entity list may help you realize things that you may need.
Creating the skeleton
Now that you have a list, you can implement the empty Screens and Entities using the list above. To add a Screen:
- Right-click on the “Screens” item
- Select “Add Screen”
- Enter the name “GameScreen” and click OK
You are modifying your Visual Studio Project
All of the work that you do in Glue results mainly in code being generated and in your Visual Studio project (which may be .vsproj, .csproj, or .contentproj) being modified. Although Visual Studio will automatically reload any changes to any projects, it will also notify you that the project has changed. As you work with Glue you may encounter popups in Visual Studio notifying you that things have changed. Don’t worry, this is expected behavior – your projects will continue to work just fine.
Next you need to add all of the Entities. To do this:
- Right-click on the “Entities” item
- Select “Add Entity”
- Enter the name, such as “MainShip”
- Click OK
- Repeat for all of the other Entities listed above
What does “Is 2D” mean?
You can specify whether an Entity should use 2D or 3D coordinate systems. You can leave the “Is 2D” check box checked for all Entities in Rock Blaster.
First pass done, let’s do another!
At this point we’ve done our first pass of creating our game skeleton – we have a Screen which will contain all of the action in our game, and we have a list of Entities.
The next step is to add our Entities to our Screen. This step is both useful because it advances the development of the game, but it also forces you to review the list of Entities and Screens that you’ve created. For the most part, any Entity that appears in a game should either be added to a Screen, added to another Entity, or should exist in either a Screen or Entity in a List (specifically a PositionedObjectList).
Therefore, we can go through every one of our Entities, think about where it should exist, and add objects appropriately. As you will see, this step also forces us to make some initial decisions about game design as well.
Our first Entity is Bullet. If we are modeling our game after Asteroids, we know that our GameScreen will contain bullets – more than one. This means that the GameScreen needs a list of Bullets. To add a list of Bullets:
- Push the right-mouse button on the Bullet entity
- Continue holding the right mouse button down and drag the mouse down to the GameScreen screen
- Release the mouse button. You should see a popup appear
- Select “Add Entity List”
Now you should have a list of Bullets in your GameScreen:
Next let’s add a list of Rocks. This will exist in our game screen as a list just like Bullets. Therefore, repeat the above steps with the Rock Entity to create a RockList.
Single player or multi-player?
This tutorial will assume that the game will be built for multi-player. Therefore, we will also need to add a list of MainShips. If you would like to make your game single-player you should still add a list as the code later in the tutorial assumes working with a list.
To do this:
- Hold the right mouse button over MainShip
- Drag it down to the GameScreen
- Select “Add Entity List”
Adding instances to GameScreen
Now that we have our lists defined, we can add the single instances of Entities to our GameScreen. You can add an instance by using the same right-click drag and drop action ( and selecting “Add Entity Instance” instead of “Add Entity List”), or you can use the left mouse button to drag and drop an Entity into the GameScreen – both methods work equally well.
Drop the following Entities into your GameScreen:
- EndGameUi – this will create an object in GameScreen called EndGameUiInstance
- Hud – this will create an object in GameScreen called HudInstance
What about HealthBar?
If you have been keeping track of the Entities that we’ve dropped into the GameScreen you may notice that we haven’t used the HealthBar yet. The reason for this is because the HealthBar will be part of the Hud. However, we can set this up by dropping a list of HealthBars into the Hud – we are using a list since each player needs his own HealthBar:
- Push the right mouse button on the HealthBar Entity
- Continue to hold the right mouse button down and drag it to the Hud Entity
- Release the right moue button
- Select “Add Entity List”
Wow! Even though our game isn’t functional yet, we have done a lot of work defining the skeleton – and it shows in Glue too. Next we’ll begin creating something that will be visible in-game: the MainShip.