Source-checkedLibraries & compatibility

Mache

by willis81808 · for Sons of the Forest

The Fundamental SoTF Modding Framework

109KDownloads
4 yr agoLast updated
BepInExLoaders
ThunderstoreSource

About Mache

From Thunderstore

The Fundamental SoTF Modding Framework

Mache

Mache is a modding framework designed for Sons of the Forest. As a utility it provides support for modders, allowing simple creation of new game content and functions to tweak existing elements of the game. Mache provides access to a unified set of tools, menus, and actions that make the process of creating and implementing mods easier and more streamlined.

Usage

Press F1 to open the Mache mod menu

Modding API

Mod Menu

Easily register your own menu with Mache

Integrated Menu

You can implement interactable UI elements directly into the Mache menu for your mod! When registering your mod, Mache provides an OnFinishedCreating event that is executed when your mod's panel is fully initialized and ready to accept additional elements. Using the GameObject passed to this callback as the parent for your own UI elements will incorporate them into the existing scroll view of your mod's panel in the Mache menu. For example:

Mache.RegisterMod(() => new ModDetails
{
    Name = "Example Mod",
    Id = "your.unique.mod.id",
    Version = "1.0.0",
    Description = "Lorem ipsum dolor sit amet...",
    OnFinishedCreating = (parent) =>
    {
        MenuPanel.Builder()
            .AddComponent(new LabelComponent
            {
                Text = "Hello World!",
                FontSize = 24
            })
            .AddComponent(new ButtonComponent
            {
                Text = "Press Me",
                OnClick = (self) => MachePlugin.Instance.Log.LogMessage("Down the rabbit hole...")
            })
            .BuildToTarget(parent);
    }
});

Custom/Standalone Menu

If you provide a value for OnMenuShow when registering your mod Mache will only display the given name, version, and description in its own window. Instead of placing options there it will create an "Open Settings" button that, when clicked, will execute your OnMenuShow callback. This is intended for use when you want to have a totally independent and fully self-managed menu. It is up to you how your mod responds when the user clicks this button.

Mache.RegisterMod(() => new ModDetails
{
	Name = "Example Mod",
	Id = "your.unique.mod.id",
	Version = "1.0.0",
	Description = "Lorem ipsum dolor sit amet...",
	OnMenuShow = () => Log("Player clicked the 'Open Settings' button for your mod")
});

Expanded Item Database

Easily access the IDs and data of all in-game items

ItemData meatData = GameItem.Meat.GetData();
int meatId = GameItem.Meat.GetId();

Network Event Creation

NOTE: All network events must use unique identifiers, and the identifier for a given event must be the same across all clients!

There are two methods for creating and registering a custom network event:

  1. Auto serialize/deserialize
  2. With custom serialization/deserialization

Auto (De)Serialization

For auto serialization create a class that extends SimpleEvent<T>, for example:

public class ExampleEvent : SimpleEvent<ExampleEvent>
{
    public string Message { get; set; }
    public int MessageCount { get; set; }

    // called when an event of this type has been receieved
    public override void OnReceived()
    {
        for (int i = 0; i < MessageCount; i++)
        {
            MachePlugin.Instance.Log.LogMessage(Message);
        }
    }
}

Then register it with Mache:

EventDispatcher.RegisterEvent<ExampleEvent>();

Pros:

  • Much easier
  • Less boilerplate

Cons:

  • Your event class must only implement fields that can be automatically serialized to JSON (generally value types and collections of value types)
  • Only applies to classes that extend SimpleEvent<T>

Custom (De)Serialization

For more complex scenarios it may be necessary to implement custom serialization and deserialization methods for your class, or if you want to create a network event for types you do not control you can define your own method of serializing/deserializng them. In these cases you must define your own serialize, deserialize, and event recieved callback methods, for example:

EventDispatcher.RegisterEvent("Some.Unique.Event.Id", SomeEvent.Serialize, SomeEvent.Deserialize, SomeEventHandler.OnReceived);

Pros:

  • Maximum flexibility
  • Can register events that serialize any type

Cons:

  • This method is much more involved
  • Significantly more boilerplate

Raising Network Events

Events can be raised anywhere and sent to all clients. Using the ExampleEvent from above:

EventDispatcher.RaiseEvent(new ExampleEvent
{
    Message = "Hello World!",
    MessageCount = 10
});

Highlights

From source data

Loaders

Runs on BepInEx.

Footprint

Rated a light load on a server.

Dependencies

Needs 1 other project installed alongside it.

Mache on Nxeon

From our catalogue
One-click install
Not available. One-click install isn't available for this game's mods yet. Download it and upload it to your server in Files.
Server type needed
BepInEx
Server load
light
Smallest plan we suggest
Sons of the Forest — 4 GB (4 GB RAM). This follows our own load rating above, not a benchmark.
Latest build
0.2.0, released 2023-03-10

Game versions by loader

LoaderGame versionsNewest
BepInEx

From 13 recorded builds of Mache.

Recent builds

BuildReleasedGame versionsLoaders
0.2.02023-03-10n/aBepInEx
0.1.42023-03-07n/aBepInEx
0.1.32023-03-07n/aBepInEx
0.1.22023-03-06n/aBepInEx
0.1.12023-03-06n/aBepInEx
0.1.02023-03-05n/aBepInEx

Dependencies

Declared by the newest build that lists any. Required ones are installed with it on one-click installs.

Run Mache on a Sons of the Forest server

Deploy a server above, then upload the file in Files.

What kind of mod it is

From the catalog
Listed on Thunderstore as “Core”

Libraries & compatibility

Foundations and fixes other mods build on. Usually installed because something else needs it.

Compatibility

Game
Sons of the Forest
Loaders
BepInEx
Requires
One-click install needs a BepInEx server. 1 other project installed alongside it.

Verified at the source

  • ✓ThunderstoreOfficial listing, checked 2026-10-02Open ↗
  • ✓Authorwillis81808, as published on Thunderstore
  • ✓LicenseNot published by the sourceFree

Mache, answered

Generated from the mod’s own source data.

Which loaders does it support?

BepInEx.

Is it free?

Yes. Mache is free to download from Thunderstore.

How do I add it to my Nxeon server?

One-click install isn't available for this game's mods yet. Download Mache from Thunderstore and upload it to your Nxeon Sons of the Forest server in Files.

NxLabs

Run Mache on a Sons of the Forest server.

Deploy in about a minute from $9.99 a month, then upload Mache in Files.