Skip to content

CSharpGodotTools/PacketGen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PacketGen

.NET Build & Test GitHub stars GitHub forks License Last commit Contributors Watchers Discord

Source generator for the netcode packet scripts in https://github.com/CSharpGodotTools/Template


Example:

public partial class CPacketPlayerInfo : ClientPacket
{
    public string Username { get; set; }
    public Vector2 Position { get; set; }
}

Source gen outputs:

public partial class CPacketPlayerInfo
{
    public override void Write(PacketWriter writer)
    {
        writer.Write(Username);
        writer.Write(Position);
    }

    public override void Read(PacketReader reader)
    {
        Username = reader.ReadString();
        Position = reader.ReadVector2();
    }
}

Installing as Local NuGet Package

Copy the .nupkg from bin\Debug to main project.

Add a file named NuGet.config to the main projects root folder with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="LocalNugets" value="Framework/Libraries" />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

The name for the key LocalNugets can be changed to anything you'd like. Change the Framework/Libraries path to point to the .nupkg package file.

Add the following to the main projects .csproj file:

<PackageReference Include="PacketGen" Version="*" />

Replace * with the explicit latest version or keep it as is.

About

Source generator for ENet multiplayer framework in Template.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages