Code generation

To generate the code using the protoc tool, you will first need a schema.

Schema

A simple schema can be something like this:

message Example {
    int32 id = 1;
}

Which would, after the code generation, create an object that contains a single varint.

Code generation

To generate the code from the above schema, you will have to save it into a file, for this example test.proto, and run:

$ mkdir csharp
$ protoc test.proto --csharp_out=csharp/

Which should result in a new file, located at csharp/Test.cs, with code that can serialize and deserialize packets.

Code generation inside of the project

To generate the code inside of the project, you can follow two instructions:

NixOS / Nix-enabled Linux

You have to open the Memory repository and type nix develop to get the required dependencies installed.

Then you simply run update_protobuf in the root of the Memory and new code should be generated

Windows / Other Linux distros

You have to clone the Memory repository.

You have to make sure you have Python 3.10 (or newer) installed, and Protobuf 27 (exactly) installed.

Then you simply run

Linux

protoc --plugin=protoc-gen-eams=protoc-gen-eams -I.. --eams_out=../generated communication.proto   

Windows

protoc --plugin=protoc-gen-eams=protoc-gen-eams.bat -I.. --eams_out=..\generated communication.proto   

in the root of the Memory and new code should be generated.