Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
94 lines (76 sloc) 3.26 KB


This page will focus on setting up your first game mode and giving you some direction on where to go from there. Before continuing, please make sure you've set up your server as described on the Setup page.

Creating a Project

  1. Click on File > New > Project (Shortcut: Ctrl + Shift + N).
  2. Select Visual C# from the list on the left.
  3. Select .NET Core from the expanded sub-list and choose Console App (.NET Core) from the list in the center.
  4. Type the name and Location of your new Solution.
  5. Click OK to save.

Referencing the Framework

To be able to interact with the server, you need to add the framework to your project's references.

  1. In the Solution explorer, right click on Dependenciesunder your project.
  2. Click on Manage NuGet Packages....
  3. Under Package source select the SampSharp repository.
  4. Click on any SampSharp.* package and click on Install.

Defining the Entry Point

You can now create the entry point of your gamemode. In you project, create a class named GameMode and let it inherit from BaseMode.

Here is a simple GameMode class:

using SampSharp.GameMode; // Contains BaseMode class
using SampSharp.GameMode.Controllers; // Contains ControllerCollection class

public class GameMode : BaseMode
    #region Overrides of BaseMode

    protected override void OnInitialized(EventArgs e)
        Console.WriteLine(" Blank Gamemode by your name here");

         * TODO: Do your initialisation and loading of data here.

    protected override void LoadControllers(ControllerCollection controllers)

         * TODO: Load or unload controllers here.


Starting the Game Mode

In the newly created project, you will have a class named Program. In that class, in the Main method, you will have to create a GameModeBuilder, which will run your gamemode (Refer to GameMode Builder for details on what a GameMode Builder is, how it works and different configuration options).

A sample of a standard Main class:

private static void Main(string[] args)
    new GameModeBuilder()

Publishing the project

Before running your game mode for the first time and after adding or updating the dependencies of your project, you need to publish the project to have your gamemode and dependencies .dll files copied to the output directory.

  1. Click on Build > Publish x (where x is your project name).
  2. Select so it publishes to a folder and provide a path.
  3. Click Publish
  4. Edit gamemode entry in the server config which points to the generated gamemode .dll in the provided publish folder.
You can’t perform that action at this time.