evergreen 0.2.0-alpha

Network backend build on libp2p
// Copyright (c) 2026 Anders Olsen
//
// Permission is hereby granted, free of charge, to any person obtaining 
// a copy of this software and associated documentation files (the "Software"), 
// to deal in the Software without restriction, including without limitation the 
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is 
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in 
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS 
// OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 
// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH 
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

syntax = "proto3";


message Passport {
    string jwt = 1;
}


enum PeerState {
    // Do not send or receive data for this peer
    Waiting = 0;
    // Able to send and receive data
    Ready = 1;
}

message InitPacket {
    // "who/what" I am
    repeated Passport passports = 1;
    // Where I think I am (if using rooms)
    optional string room_id = 2;
    // Who I'm with (may be empty)
    repeated string other_peers = 3;
    // // How ready I am for data
    // PeerState state = 4;
    // Other optional connection data (per implementer of evergreen)
    optional bytes data = 5;
}

message UpdatePacket {
    optional string room_id = 1;
}


message DataPacket {
    bytes data = 1;
}


message BasePacket {
    uint64 timestamp = 1;
    oneof packet {
        InitPacket init_packet = 2;
        
        UpdatePacket update_packet = 3;

        DataPacket data_packet = 4;

    }
}

message PuppetCommand {
    uint32 object_id = 1;
    oneof command {
        Puppet puppet = 2;
    }
}


message CreateObject {
    string object = 1;
}

message DestroyObject {

}

message ReleaseObject {

}

message TakeoverObject {

}

message Puppet {
    repeated sint32 transform = 2;
}


message AvatarChange {
    string head = 1;
    string torso = 2;

    // technically includes two extra bytes here that will never be used. 
    // theoretically room for improvement but practically I have my doubts.
    fixed32 primary_color = 3;
    fixed32 secondary_color = 4;

    // string head_widget = 5;
    // string torso_widget = 6;
}


// Transforms for the head and hands.
// The only valid number of ints in these repeated fields is 12. Any more or less and the packet is discarded.
message AvatarTransform {
    repeated sint32 head = 1;
    repeated sint32 right_hand = 2;
    repeated sint32 left_hand = 3;
}



message VoipData {
    bytes data = 1;
}