🏒
Puck
  • Welcome!
  • GETTING STARTED
    • Development environment setup
    • Using the Puck API
    • Testing your mod
    • Development optimizations
  • PUBLISHING
    • SteamWorkshopUploader
    • Publishing to the Steam Workshop
  • Puck API
    • Singletons
    • Harmony
    • Referencing the source
Powered by GitBook
On this page
  • Prerequisites
  • Environment
  • We're set up!
  1. GETTING STARTED

Development environment setup

PreviousWelcome!NextUsing the Puck API

Last updated 8 days ago

In order to get started with Puck development, you will need to set up some sort of development environment on your host system. This document will guide you through setting up a mod development environment in Visual Studio Code, though most steps will also apply to other IDEs.

Prerequisites

Environment

  1. Create a new folder anywhere on your system which will contain our project files. For the sake of this example, we'll create a folder called MyPuckMod on the desktop. The absolute path should look as follows: C:\Users\user\Desktop\MyPuckMod.

  2. Launch Visual Studio Code and open the MyPuckMod folder within it.

  3. Launch a new terminal window within Visual Studio Code.

  4. Validate your .NET installation by executing a dotnet command.

  5. Execute a dotnet new classlib command in order to set up a new .NET project. Since we're creating a Class Library (.dll), we use the classlib template.

  6. Validate if all project files were generated within your project's directory.

  7. Open the MyPuckMod.csproj file and remove the ImplicitUsings and Nullable tags, since those features are not available in .NET 4.8. Speaking of .NET 4.8, replace the contents of TargetFramework to net4.8, since we'll be targeting that particular .NET Framework version. Your MyPuckMod.csproj should looks as follows:

    <Project Sdk="Microsoft.NET.Sdk">
    
      <PropertyGroup>
        <TargetFramework>net4.8</TargetFramework>
      </PropertyGroup>
    
    </Project>

    Since we'll be targeting .NET 4.8, features like file-scoped namespaces will also be unavailable, so let's adjust the Class1.cs file to the following:

    namespace MyPuckMod {
        public class Class1
        {
    
        }
    }

  8. Execute the dotnet build command in the terminal in order to build our project.

  9. Validate the generated .dll of your mod in bin/Debug/net4.8

We're set up!

Awesome! This .dll is essentially our mod, though it does not do anything useful just yet. Not does it interact with the Puck in any way. We'll cover how to do so in the following steps, so stay tuned!

In order to get features like code-completion and C# project solution management, install the C# Dev Kit extension in Visual Studio Code from the Extensions tab.

Cover

Download & install .NET SDK

Cover

Download & install Visual Studio Code