Creating a Game Project
A New Game Project
When you first boot up the s&box editor you'll be greeted with the Welcome screen.
The first step is to create a Game Project. You can do this by clicking "New Game Project..." in the top right.
You'll be presented with Create New Game
window. Choose the template type "Shooter Game".
Pick a name for your project and choose where you'd like to store it.
Shooter Game
The shooter game project gives you the basic code that you need to make a first, or third person shooter game.
Once you create your game you'll be put in the menu for it.
To play the game you can either use your game's menu, or you can click "Start Game" in the game window. You can click the "Show Game Menu" button to return back to your game's menu.
Editing The Code
To open the solution in Visual Studio, go to File > Open Solution
in the S&box Editor. The solution will contain a project containing your game's code, but will also include projects containing common code for the game and editor. You might wish to right click your game's project in the Solution Explorer
and choose Scope To This
to isolate just your project.
This works flawlessly 99% of the time, but if you've changed something that we can't hotload you might have to restart the game (using the restart icon at the top of the game window).
For the most part the templates are designed to act like tutorials. They are heavily documented to help explain what's going on.
Glossary
We might use some terms that you don't understand, so here are a few explanations.
Client
- A Client is generally a human that is connected to the gameEntity
- An Entity is usually an object that exists in the world. They are usually synchronized between the server and client.Pawn
- A Pawn is an entity that a player owns and controls - this could be a car or a humanoidPanel
- A Panel is a UI elementRootPanel
- A RootPanel is a panel that holds a bunch of other panels. The HUD is usually on its own RootPanel.GameManager
- each game has one game manager. The GameManager is actually anEntity
Tick
- one server cycle. A tick is independent of the frame rate. The tick rate is adjustable.
Shooter Game Overview
When the game starts, the MyGame
GameManager entity is created.
When a client joins, ClientJoined
on GameManager
is called. From there a Pawn is created for that client.
Each tick, Simulate
is called on the Pawn (automatically). This method takes client input and acts on that. The Pawn's current weapon is also simulated here too.
On the client only, each frame GameManager.FrameSimulate
is called. This method is used to position the camera.
Testing
If you want to test your multiplayer game, you don't have to publish it. If you start a server, people will download everything they need from you.
If you edit code, the code changes will be sent to them as you make changes. If you edit UI and stylesheets, they will be synchronized to your remote clients too.
Publishing
To publish your game go to your game's Project Settings and choose Upload To Asset Party
from the menu on the left.
From there you will be guided through the process of publishing your first release. Once you make your game live, other people will be able to discover and play it.