S&box Wiki

Revision Difference

Games/GettingStarted#560091

<cat>Dev.Projects</cat> <title>Creating a Game Project</title> # A New Game Project When you first boot up the s&box editor you'll be greeted with the Welcome screen. <upload src="b3ffd/8db87a6ad738324.png" size="74489" name="image.png" /> The first step is to create a [Game Project](GameProject). You can do this by clicking "New Game Project..." in the top right. <upload src="b3ffd/8db83a335dd501b.png" size="5963" name="image.png" /> You'll be presented with `Create New Game` window. Choose the template type "Shooter Game". You'll be presented with `Create New Game` window, choose a template. Pick a name for your project and choose where you'd like to store it. <upload src="b3ffd/8db83a34b73fabd.png" size="33295" name="image.png" /> ⤶ # 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.⤶ ⤶ <upload src="b3ffd/8db83a7530f2810.png" size="1601" name="image.png" />⤶ # 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. <note>Any changes you make to the code will be applied on save. The game will compile and hotload the new assemblies. You don't need to compile in Visual Studio. 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). 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. </note> 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](Client) is generally a human that is connected to the game⤶ * `Entity` - An [Entity](Entity) is usually an object that exists in the world. They are usually synchronized between the server and client.⤶ * `Pawn` - A [Pawn](Pawn) is an entity that a player owns and controls - this could be a car or a humanoid⤶ * `Panel` - A [Panel](Panel) is a UI element⤶ * `RootPanel` - A [RootPanel](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](GameManager) is actually an `Entity`⤶ * `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](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](ProjectSettings) 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.