Daily Post Image from Upsplash

November: 20th

2024

  • 01:37AM

    Meetings

    Two major meetings coming up on Friday and Saturday, so I need to push the code out quickly. Grind is on!

  • 12:40PM

    Contract

    Finished up some of the contract work that was getting in the way! Now I should have some free time to breeze through the networking issues and build something fast. The goals will be two parts for today, the first is to get the base mutliplayer working with moving game objects! Once this is accomplished, we will go ahead and add an auth system integration and make sure that each game room works without any issue.

  • 12:48PM

    Transport

    We will be adding the com.unity.transport to our build, hopefully this route will be easier but I think I will have to still include a manual jslib. I am not too worried about this but I can see it becoming a problem really quickly. After that, I am going to switch over to the kilonet package and start the process of adding in networking. We will be using the KBVE.Kilonet.Networks namespace to hold all our networking. Inside of the namespace, the first file we will create is this:

    
    namespace KBVE.Kilonet.Networks
    {
        public interface INetworkTransport
        {
            void Connect(string serverUri);
            void Send(byte[] data);
            void Send(Stream dataStream);
            void Receive(Action<byte[]> onReceive);
            void Receive(Action<Stream> onReceiveStream);
            void Disconnect();
        }
    }
    

    This will give us a quick roadmap for what we want this package to do for the networking. Forgot to include the System.IO, going to push that up right now. AFter adding in the INetworkTransport, we can add the next item to the setup, the WebSocketTransport.cs. This will be our transport layer for the base networking, oh boi.

    The two main transports again the WebSocketTransport and UDPTransport, both will take some time to build out. When looking at our assembly references, we need to make sure that Unity.Collections are included as well as, uh the Unity.Networking.Transport! Here we go with another round 8 hit xD.

  • 01:57PM

    Conditional

    For the networking, I am going to split the WebGL and Native at the manager level. We should not have any major issues with the data because we can skip the JSON and stick with a protobuf and binary.

  • 03:12PM

    Plan

    Here is the proposed Networks structure that we can try and implement:

    • Managers
      • NetworkManager
    • Networks
      • INetworkTransport
      • WebSocketTransport
      • UDPTransport

    Yet for the Protocols and Utils, I am thinking we can move that out of the Networks folder and into the right areas? I suppose we can keep the Protocols under the Networks folder strucutre but the Utils should definitely be in their own namespace.

    Under the protocols, we will need:

    • IMessageProtocol
    • JsonProtocol
    • ProtobufProtocol

    As for the Utils, we will need:

    • ByteUtils - handling all the byte arrays, bitwise operations, bTree algos.
    • MessageQueue - isolated instance for the queue management, chat, ect…

    This seems like the best way to approach this for now.

  • 03:47PM

    ByteUtils

    To help with the byte management, since we are trying to move away from the strings, we will need a utility class that will make it easier to manage. Eventually we can futher split the base ByteUtils, definitely if we need to include unsafe code, but this should be a solid base to work around. After updating this library, we will go back around and make some adjustments to the UDP/WS transports, ideally making it so that we can knock out all these errors. There are about 20 errors that are still left to resolve with the transport layer, then we can look into the SyncTransform and the different objects, hmm, the protobuf will still be an issue doe. If we can get through these bugs within the next couple hours, then it be safe to start the rust code? The rust server will be very basic, handling the UDP and WS connections and will be deployed through our kubernetes cluster. After it gets deployed through the helm chart, we can start the discord activity build, with our url mapper pointed to the self hosted server. By tomorrow, if we get a discord multiplayer build running, it should make the development process even easier because we can just play test it in the call while building it out.

  • 07:13PM

    Events

    Okay it looks like the UDP and WS Transport layers are okay, seem to be compiling without throwing any errors within the unity editor. For now, we can move forward with a couple more files that we will add? They will be these:

    • NetworkEvent
    • NetworkManager