├── .addon ├── .gitignore ├── README.md ├── code ├── BoilerplateGame.cs ├── BoilerplatePlayer.cs └── ui │ ├── BoilerplateHUD.cs │ └── Hud.scss ├── icon.jpg ├── maps └── readme.md ├── materials └── readme.md ├── models └── readme.md ├── particles └── readme.md ├── sounds └── readme.md └── textures └── readme.md /.addon: -------------------------------------------------------------------------------- 1 | { 2 | "name": "boilerplate", 3 | "version": "1.0", 4 | "sharedassets": "*.*", 5 | 6 | "depends": 7 | [ 8 | "base", 9 | "citizen" // Optional if you already have a model and animations, etc. 10 | ], 11 | 12 | // 13 | // Addons can contain multiple addons, describe them here 14 | // 15 | "gamemodes": 16 | [ 17 | { 18 | // These will show in the console when you load into the game. 19 | // They will not show on the gamemode list! To do that make an organization 20 | // and fill the proper information on gamemode creation. 21 | "name": "boilerplate", 22 | "title": "Boilerplate", 23 | "description": "A boilerplate for S&box addons", 24 | "icon": "https://github.com/cr4yz/sbox-boilerplate/blob/main/icon.jpg?raw=true" 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /obj/ 2 | /properties/ 3 | sbox-boilerplate.csproj 4 | accesslist.txt -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # sbox-boilerplate 2 | A boilerplate for kickstarting your S&box addon 3 | 4 | # Getting started 5 | 6 | There are a few steps to take to turn this boilerplate into your own addon. 7 | 8 | First, download this repository and place it inside a new folder inside your `/{steam}/sbox/addons/` folder. For example, `/{steam}/sbox/addons/my-gamemode/{boilerplate files}` 9 | 10 | ### .addon 11 | 12 | This file contains information about the addon, it must be modified to suit your addon. In the future .addon files might no longer be needed, but for now we have to make sure to update them for each individual gamemode. 13 | 14 | * name - your addon name (alphanumeric with no spaces) 15 | * version - your addon version 16 | * sharedassets - ?? 17 | * depends - an array of other addons that your addon will load first and have access to. For example, `base` includes a basic player and movement controller. 18 | * gamemodes - I think this is used to tell S&box to load your gamemode scripts? 19 | * name - your addon name. This should be an all lowercase alphanumeric string 20 | * title - your addon title. This can be a user-friendly string with capitals and spaces 21 | * description - your addon description 22 | * icon - full url to an icon that will display in the main menu. 23 | 24 | 25 | Here is an example of a bare minimum .addon, you might want to do something like this if your addon is just a map. 26 | 27 | ``` 28 | { "name": "my-gamemode" } 29 | ``` 30 | 31 | ### BoilerplateGame.cs 32 | This is the script that initializes your gamemode. 33 | 1. Rename the file, namespace, class, and constructor to suit your addon, i.e. `MyGamemode.cs` 34 | 2. Edit this line: `[Library("boilerplate", Title = "Boilerplate Addon")]` 35 | 36 | ### Cleaning up 37 | 38 | If you don't need any of the content folders (materials, models, textures, etc), feel free to delete them. If your addon is just a map, all you need is the `maps` folder. 39 | -------------------------------------------------------------------------------- /code/BoilerplateGame.cs: -------------------------------------------------------------------------------- 1 | using Sandbox; 2 | using Boilerplate.UI; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Boilerplate 10 | { 11 | [Library("boilerplate", Title = "Boilerplate Addon")] 12 | partial class BoilerplateGame : Game 13 | { 14 | public BoilerplateGame() 15 | { 16 | Log.Info("Boilerplate Game Started"); 17 | if (IsServer) 18 | { 19 | new BoilerplateHUD(); 20 | } 21 | } 22 | 23 | public override Player CreatePlayer() => new BoilerplatePlayer(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /code/BoilerplatePlayer.cs: -------------------------------------------------------------------------------- 1 | using Sandbox; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Boilerplate 9 | { 10 | partial class BoilerplatePlayer : BasePlayer 11 | { 12 | public BoilerplatePlayer() 13 | { 14 | Log.Info("Boilerplate Player"); 15 | } 16 | 17 | public override void Respawn() 18 | { 19 | SetModel("models/citizen/citizen.vmdl"); // If you have your own model, you can place it here instead. 20 | Controller = new WalkController(); 21 | Animator = new StandardPlayerAnimator(); 22 | Camera = new FirstPersonCamera(); 23 | EnableAllCollisions = true; 24 | EnableDrawing = true; 25 | EnableHideInFirstPerson = true; 26 | EnableShadowInFirstPerson = true; 27 | base.Respawn(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /code/ui/BoilerplateHUD.cs: -------------------------------------------------------------------------------- 1 | using Sandbox; 2 | using Sandbox.UI; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Boilerplate.UI 10 | { 11 | [Library] 12 | public partial class BoilerplateHUD : Hud 13 | { 14 | public BoilerplateHUD() 15 | { 16 | if (!IsClient) return; 17 | 18 | RootPanel.StyleSheet.Load("/ui/Hud.scss"); 19 | RootPanel.AddChild(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /code/ui/Hud.scss: -------------------------------------------------------------------------------- 1 | .element{} -------------------------------------------------------------------------------- /icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cr4yz/sbox-boilerplate/54e0170d453589df62484eac924f122104249c22/icon.jpg -------------------------------------------------------------------------------- /maps/readme.md: -------------------------------------------------------------------------------- 1 | # Maps Folder 2 | 3 | Save your Hammer maps to this folder. When building the map, it will also be placed in this folder and accessible in-game. 4 | 5 | Examples: 6 | 7 | de_dust2.vmap (Hammer version) 8 | de_dust2.vpk (Compiled version) 9 | -------------------------------------------------------------------------------- /materials/readme.md: -------------------------------------------------------------------------------- 1 | # Materials 2 | 3 | Save and edit your materials in here 4 | -------------------------------------------------------------------------------- /models/readme.md: -------------------------------------------------------------------------------- 1 | # Models 2 | 3 | Save and edit your models in here 4 | -------------------------------------------------------------------------------- /particles/readme.md: -------------------------------------------------------------------------------- 1 | # Particles 2 | 3 | Save and edit your particles in here 4 | -------------------------------------------------------------------------------- /sounds/readme.md: -------------------------------------------------------------------------------- 1 | # Sounds 2 | 3 | Save and edit your sounds in here 4 | -------------------------------------------------------------------------------- /textures/readme.md: -------------------------------------------------------------------------------- 1 | # Textures 2 | 3 | Save and edit your textures in here 4 | --------------------------------------------------------------------------------