#archived-networking

1 messages · Page 41 of 1

twin grove
#

When a player connects to the lobby this should be enabled?

twin grove
#

Help guys

tame slate
twin grove
#

none of the logs are working here.

tame slate
twin grove
#

like the player is the host?

#

StartHost work

tame slate
#

unless there's an error.

twin grove
#

I forgot about it and used the getcomponent to get it.

twin grove
sharp axle
twin grove
#

then I can spawn them when the game starts?

sharp axle
burnt ridge
#

Hi all, I'm having an annoying issue with Unity Multiplayer Play Mode. "Pretty often" like once every 10 times, when I start MPPM with 2 clients (host + 1), the client will raise errors like:

The referenced script (Unknown) on this Behaviour is missing!

The host is fine. When it does that, I just kill it and restart it, and then it works for both host and client.
It's like it's not finished syncing the scripts or whatever for both the clients, but it sometimes happens even though I haven't made any changes between 2 starts.

Is this a known issue? Is there a fix?

sharp axle
sharp axle
burnt ridge
#

Did it? can't see anything above 1.3.3 in packags

#

Maybe I need to update unity. Game releases in 2 weeks I'll pass for now ^^

twin grove
#

What can cause me to get a kicking error? But the player seems to get kicked normally.

sharp axle
sharp axle
# twin grove So there's a problem here?

its not really a problem. just the host there is already disconnecting the client. The client RPC is calling SteamLobbyManager I don't know what it does, but might also be trying to disconnect the player

sharp axle
twin grove
bitter vigil
#

hey hi! im kinda new to unity, i got some expirience at this point but not enough for netcode for gameobjects, so was curious, is it a bad idea to code stuff first and work in the networking later? and if it isn't a bad idea, how hard would it be to do it now and to do it later? 👀
I am mostly asking this out of curiosity so pls dont hate me for it!!

elfin field
#

KeyNotFoundException: The given key 'ChatManager' was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key)

runic pivot
# bitter vigil hey hi! im kinda new to unity, i got some expirience at this point but not enoug...

This is kinda... the only way to learn it, in my opinion, but I ended up with so much clutter when I did it. Not knowing how things were going to work on the server side means I designed a lot of my systems poorly, and when I was duplicating code to move functions from client to server side, I ended up with a lot of mess and functions that were only half useful after the fact. If you're just thinking about implementing multiplayer later and won't be moving game systems to cloud code modules, it might not be too bad

bitter vigil
sharp axle
bitter vigil
runic pivot
#

there's just more to know. Learning unity and multiplayer things at the same time is gonna be hard, but if you're dead set on this project, give it your best.

#

but if you're somewhat comfortable in unity already, then I would start with learning the netcode side. There are some youtube tutorials that might help

naive wave
#

Hey all. I'm new to Unity as of about a month ago and I got a fully functioning single player game going. I added some netcode and tested locally and now I'm to the point where I tried to integrate dedicated server support via Unity's Matchmaking + Multiplay Hosting.

My matchmaking works like a charm. I get my response ticket with the IP and Port of the session. My server starts up properly according to my server logging and is waiting for my clients to connect. Then I try to connect with my two clients and..... nothing. Failed to join server. I'm using the IP and Port from the matchmaking response ticket when trying to start the clients. Any ideas what I might be missing here?

sharp axle
bitter vigil
bitter vigil
sharp axle
bitter vigil
#

another curiosity i had is how it works when one makes a game with single player and multiplayer like mc

runic pivot
#

mc = minecraft?

naive wave
#

The sever seems to be fully spun up according to logs.

bitter vigil
naive wave
#

@sharp axle Is it cool if I ask you a few things in a private chat?

#

I might be duplicating some logic that happens automatically in multiplay, unclear.

runic pivot
#

alternatively, you could make a thread here

naive wave
#

oh sweet

#

Didn't know that was a thing

#

found it, ty, making one!

#

sorry taking me a while to make it, adding some additional questions in there.

sharp axle
naive wave
#

Unable to connect to Server (Matchmaker + Multiplay Hosting dedicated server)

naive wave
bitter vigil
naive wave
#

Nah, your computer is the server basically, the computer you are running the code on.

sharp axle
bitter vigil
#

mhm ik, just host and having no-one connect

naive wave
#

you can emulate the connections using multiplayer services, you can have like two players connect in different windows, it's pretty nifty

#

They even have the console in each window so you can see all of your debugging stuff right there.

naive wave
#

Anyone know why when "using Unity.Services.Multiplayer" I can't create an object of type "IMultiplaySessionManager" ?

sharp axle
#

Or you can add UNITY_SERVER to the compiler defines in the project settings

twin grove
#

all the players are ready, how do I start the game with the players?

sharp axle
twin grove
sharp axle
sharp axle
twin grove
naive wave
#

Hm... anyone ever see an issue where your CPU on your dedicated server spikes when the game initializes? This is a 2d 1v1 cardgame with almost no graphics currently.

delicate parrot
#

Can i make a general struct implementing inetworkserializable?

#

eg.

    public struct NetworkValueWithRarity<T> : INetworkSerializable where T : struct, INetworkSerializable
    {
        public T Value;
        public int Rarity;

        public NetworkValueWithRarity(T value, int rarity)
        {
            Value = value;
            Rarity = rarity;
        }

        public void NetworkSerialize<T1>(BufferSerializer<T1> serializer) where T1 : IReaderWriter
        {
            serializer.SerializeValue(ref Rarity);
            Value.NetworkSerialize(serializer);
        }
    }
#

im worried it won't like the lack of definition

green vortex
#

im now implementing privacy settings , where users can change their session visilibility by changing 2 variables + 2 properties inside ISession

#

but i cant

#

it turns out that the session is still didnt change

#

heres how i query the session

-> option:
SessionFilterOption = new QuerySessionsOptions()
{
    Count = option_maxQuery
};

    public async Task UpdateSessions()
    {
        QuerySessionsResults result = await MultiplayerService.Instance.QuerySessionsAsync(SessionFilterOption);
        AllActiveSessions.Clear();
        AllActiveSessions = new(result.Sessions);
    }```
#

heres how i change it

public static void SetPrivacyState(this ISession session, SessionConstants.SessionPrivacy privacy, string password = null)
{
    IHostSession sessionConfig = session.AsHost();

    sessionConfig.IsLocked = privacy is SessionConstants.SessionPrivacy.SinglePlayer;

    sessionConfig.IsPrivate = privacy is SessionConstants.SessionPrivacy.SinglePlayer;

    sessionConfig.UpdateFriendOnlyStatus(privacy is SessionConstants.SessionPrivacy.Public_friend or SessionConstants.SessionPrivacy.AskToJoin_friend);

    sessionConfig.UpdateAskToJoinStatus(privacy is SessionConstants.SessionPrivacy.AskToJoin or SessionConstants.SessionPrivacy.AskToJoin_friend);

    if (privacy is SessionConstants.SessionPrivacy.Private)
    {
        sessionConfig.Password = password;
    }
    else
    {
        sessionConfig.Password = String.Empty;
    }
}```
#

the default privacy option is public

lets say host A changed his room using this function and then B queried, what B saw is still public

green vortex
#

the latest session returned by QuerySessionsAsync will ignore changes u done in ihostsession(or session.asHost())???

green vortex
#

ohhhh

#

ty👍

potent monolith
#

Hi, I'm confused as to how to retrieve a JSON from the server in OnNetworkSpawn for my small game
I'm making a game for just a few friends to embed as a discord activity so I'm storing files on the server as JSONs

I'm ab le to serialise the JSON to and from a PlayerData class, so I thought I would have the client request the JSON string from the server with a ServerRPC

And then OnNetworkSpawn would look like

void LoadData()
{
  PlayerData data = PersistenceManager.LoadData(id);
  // ...
}

public override void OnNetworkSpawn()
{
  LoadData()
}

And PersistenceManager would look like

public static PlayerData LoadPlayer(int id)
{
  string json = instance.LoadJsonFromServerRpc(id);
  // (deserialise)
}

[ServerRpc]
string LoadJsonFromServerRpc(int playerID)
{
        string path = Path.Combine(Application.persistentDataPath, playerID.ToString() + ".json");
        if (!File.Exists(path))
        {
            File.Copy(Path.Combine(Application.persistentDataPath, "default.json"), path);
        }

        return File.ReadAllText(path);
}
#

However, I'm not allowed to return values from a server RPC. Online it says I should have the server call a clientRPC, but I don't get how I would pause during OnNetworkSpawn until the players data has been loaded

#

Also not sure how to link the player object that is requesting the loaded data to the server incase the server has to call a ClientRPC

sharp axle
potent monolith
#

Like, how would it ensure the players data is loaded before they get control

#

And would the RPC be on the Persistencemanager object? If so would it be

Player sends reference to persistencemanager game object in onnetcodespawn
Persistencemanager does serverrpc to get the string
Server invokes a clientrpc on PersistenceManager to send the string to the player?

#

Sorry for capitalisation I'm on phone rn

sharp axle
#

If all clients need the json then you could different things than if only the one client needs it

potent monolith
potent monolith
#

So the server needs to know which client asked for it

#

I thought this could be done by setting a reference to the player gameobject to the PersistenceManager

#

my problem is not being able to await the JSON

#

If I set a NetworkVariable<FixedString>, what if OnNetworkSpawn finishes before the JSON is available?

#

And if I do an RPC, I'm not sure what to do if it isn't called before the player does an action like openiing their inventory

#

I'm also considering doing a POST request to get and save JSONs and host an endpoint for that but I'm not sure if thats a good idea

woven onyx
#

I want to create simple synchronized interactions for the same interactable object across multiple clients. All clients should be able to interact with it, and these interactions must be synchronized over an intranet (local network), without using the internet. How to Achive this ?

sharp axle
sharp axle
woven onyx
sharp axle
woven onyx
#

@sharp axle Thank you

potent monolith
formal atlas
#

I need help setting up online multiplayer. I am using the VRMP template on Unity 6, and I cannot figure it out. (I test with the Multiplayer Center) The rooms show up on both players, but the players or interacting does not.\

sharp axle
heavy ferry
#

Hi Guys,
Does unitywebrequest work like coroutine and on main thread? I have to download 6-7 glbs . Not sure if i should use c# native httpClient or unitywebrequest.
I heard UnityWebRequest is executed mainly on main thread.
Dont want to make the game stutter during the downloading (i dont trust coroutine based behaviour for performance while downloading large files paralley)
If i can offload the download to other threads then all good.

potent monolith
#

Does anyone know if it's possible to do animation blending for Network Animators? I have a client authoritative network animator on my players and animation blending only occurs for the users player, other players in the session play the right animations but don't blend between them. Is there a simple and modular way to synchronise the other parameters or should I manually write a script to synchronise animator parameters as network variables on updates?

sharp axle
heavy ferry
tame slate
potent monolith
#

Im ok with it for players

#

but is there a better way to avoiid this for server authoritative enemies?

heavy ferry
fluid walrus
sharp axle
tame slate
twin grove
#

is there any way to get a real ping to the host? Facepunch

#

I'm getting fake ping right now.

sharp axle
#

The next best way would be to look into the PingTool

sharp axle
sharp axle
twin grove
#

I don't see any downloads here.

tame slate
#

You could try to add it as a package through package manager but I’m not sure if or how that’ll work for this specific repo.

twin grove
#

it won't work with Facepunch?

sharp axle
twin grove
sharp axle
twin grove
#

did you use it yourself?

sharp axle
tame slate
#

It looks like there’s direct references to UnityTransport in there. I don’t think that’ll work for Facepunch either. Not sure how much of a hassle it would be to adapt it.

sharp axle
#

It will list both the GetCurrentRTT() value and the ping through the RPCs. the RTT value would be 0 but ping values would still be valid

twin grove
twin grove
#

I checked with another dude who lives far away, still shows a crooked ping.

ashen meadow
#

Hi everyone, I'm making a chat system right now just to get familiar with coding multiplayer, and I was wondering what the best way would be to make sure an RPC is coming from the server

ashen meadow
#

Just netcode for gameobjects right now

tame slate
#

All RPCs sent to clients are technically from the server.

#

You can explain further if you're trying to do something specific, but if you're using the new Rpc attribute to do client to client RPCs you can put

if (!IsServer) return;

at the top of the function to ensure that only the host/server can send the RPC.

ashen meadow
#

@tame slate I was more concerned with cheaters but I don't know enough about networking to even know if that's a real concern

#

Right now i was just checking if the client id was 0 to see if it was from the server but I have no idea if that was the right idea

tame slate
#

But regardless of all that, I wouldn't worry about any of these checks for what you're doing currently.

ashen meadow
tame slate
ashen meadow
#

My clients can too though?

tame slate
# ashen meadow My clients can too though?

If they call SendToEveryone directly, sure. I meant if they were using SendToServer in order for the chat to be sent to everyone. I am not sure of the specifics of how you set things up.

ashen meadow
#

This is my update function where I read in the chat from the input field

#

It's a host and clients setup

#

Here's the whole thing hopefully that makes it easier to read

tame slate
#

You have two references of SendChatToEveryoneRpc. Where is the second reference?

ashen meadow
#

Just the intro message

tame slate
#

Huh. Yeah any function with if (!IsServer) return; should not be able to run on a client. But anyway, this is kind of irrelevant because you shouldn't need to use that check for what you're doing. What you have is fine without it.

#

I think you're on the right track with checking the sender ID to make sure it's from the server before displaying it, but in all honesty, if someone is already decompiling your game and cheating, they could get around that quite easily, so I wouldn't really worry about it.

#

And I also wouldn't put too much weight on focusing on anti-cheat measures as a beginner. It can be an extremely complex topic and is only really valuable for production level games.

ashen meadow
#

Yeah I was more just interested, thank you for all the talk though it makes me feel better about what I've currently got

#

I'm pretty happy with just checking the sender client id at least

#

It'll probably be like a 4 player steam friends only game anyways if it goes anywhere

#

Tyvm!

haughty river
#

i was wondering if anyone could tell me how to make a queue up button so people coul 1v1 in a arena because i have searched for tutorials and none is giving me what im looking for

jolly tinsel
#

hi there, quick theoretical question. if i were to use a raspberry pi (say pi 3 or older because of cost and availability) as a server for a game, what would be the limit of informations i can handle? like, is real-time-movement without too many delay possible (assuming i have a stable enough internet connection) or is the raspi just too slow
thank you 🙂

bright coral
jolly tinsel
#

so, if i just want to connect 2 players positions and rotations, that would be doable right?

#

if i do the rest client side, ignoring obvious security risks 😄

bright coral
jolly tinsel
#

ok, can you recommend some ressources for me to research?

bright coral
#

On what specifically? I sense maybe you're using NGO or some other framework that expects you to build a server instance from Unity?

#

If you just want to do very simple network syncing, I can highly recommend https://github.com/RevenantX/LiteNetLib
Easy to implement in Unity for your client, and for the server you just create a barebones .net console app.

jolly tinsel
bright coral
jolly tinsel
#

damn, thats a lot (to be expected :D)
thank you very much, this ll probably take some time 🙂

hybrid dew
#

I can't for the life of me think of a clean way where a game can start as singleplayer and then the player create host and allow others to join them

Do I just design everything as if it's a multiplayer game
Just instantiate while it's singleplayer
and when player chooses to host, I just loop over everything in the scene, and call Spawn on them with a nullable check on Network Object?

seems dirty af

bright coral
sharp axle
haughty river
#

im having this problem where it says the player prefab has spawned in the debug logs and everything but nothing is appearing like no prefab in the hiearchy or anywhere

sharp axle
haughty river
sharp axle
#

or the network manager isn't actually connecting

haughty river
#

idk whats happening then

sharp axle
#

throw a network object on a cube and see if the same thing happens

haughty river
#

ok

#

no the cube clones itself

#

i just switched out the cube on the list in the default player prefab

#

so i just tested some stuff out and if i set it all up with the cubes everything works fine but for some reason it wont work with my model

upbeat summit
#
[ServerRpc(RequireOwnership = false)]
public void RegisterToolServerRpc(int index)
{
    if (index < 0 || index >= toolsList.Count) return;
    ToolInfo toolInfo = toolsList[index];
    ToolInfo.ToolData toolData = toolInfo.tool;
    GameObject toolPrefab = toolData.toolPrefab;
    if (IsServer && !registeredTools.ContainsKey(index))
    {
        // SERVER: Spawn tool instance
        GameObject toolInstance = Instantiate(toolPrefab);
        NetworkObject toolNetworkObject = toolInstance.GetComponent<NetworkObject>();
        //hope this is fine, i think i need this check to prevent warnings
        if (!toolNetworkObject.IsSpawned) 
        {
            toolNetworkObject.SpawnWithOwnership(OwnerClientId);
            Debug.Log("Spawned tool "+toolPrefab+" with ownership "+OwnerClientId);
        }
        else
        {
            //Debug.LogWarning($"Tool {toolInstance.name} already spawned!");
        }
        // Save offset data for later placement
        toolInfo = toolInstance.GetComponent<ToolInfo>();
        toolData = toolInfo.tool;
        registeredTools[index] = toolInstance;
        toolInstance.SetActive(false);

        //Debug.Log($"[SERVER] Spawned and registered tool: {toolInstance.name}");
    }
    else
    {
        // CLIENT: Wait for server-spawned object
        //StartCoroutine(WaitForToolSpawn(toolPrefab.name, index));
        NetworkObject netObj = registeredTools[index].GetComponent<NetworkObject>();
        ulong netId = netObj.NetworkObjectId;
        SyncToolToClientRpc(netId, index);
    }
}
#
[ClientRpc]
private void SyncToolToClientRpc(ulong toolNetworkId, int index)
{
    ToolInfo toolInfo = toolsList[index];
    ToolInfo.ToolData toolData = toolInfo.tool;
    GameObject toolInstance = null;
    //TOOL LOOKUP
    if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(toolNetworkId, out NetworkObject netObj))
    {
        toolInstance = netObj.gameObject;
    }
    else
    {
        Debug.LogWarning($"No NetworkObject found with ID {toolNetworkId}");
    }

    Debug.Log("Registered gun "+toolInstance.name+" with owner id "+netObj.OwnerClientId);
    // Check if this is the one assigned to this player
    if (netObj.OwnerClientId == OwnerClientId)
    {
        registeredTools[index] = toolInstance;
        toolInstance.SetActive(false);
        ToolInfo offsetToolInfo = toolData.toolPrefab.GetComponent<ToolInfo>();
        ToolInfo.ToolData offsetToolData = toolInfo.tool;
        // Copy the transform data from the prefab directly, because not doing this was very stupid!!!
        toolData.posOffset = offsetToolData.posOffset;
        toolData.rotOffset = offsetToolData.rotOffset; 
        toolData.ADSposOffset = offsetToolData.ADSposOffset;
        toolData.ADSrotOffset = offsetToolData.ADSrotOffset;
        toolData.toolWeight = toolInstance.GetComponent<Rigidbody>().mass;
        Gun gunScript = toolInstance.GetComponent<Gun>();
        gunScript.OnToolEquipped();
        // Update the tool's position and rotation like in the server code
        toolInstance.transform.position = transform.position + transform.rotation * toolData.posOffset;
        toolInstance.transform.rotation = transform.rotation * Quaternion.Euler(toolData.rotOffset);
    }
}
#

Hello, i am having an issue with networking and i would be very thankful to receive any help, heres the problem in detail

2. server then checks the validity of register tools, and also the client upon joining calls everyones register tools, the server checks if the already registered tool dictionary contains key the client claims it doesnt, and if it does, it will not spawn in a new gameobject, but instead tell the client about the existing one.
- For some inexplicable reason, the client ends up with tool duplicates, the duplicate tools cannot be seen server side and always spawn at 0,0,0 and mess with the game because they can infact shoot.
#

Nowhere else in the code is “instantiate” or “spawn” called

potent monolith
# potent monolith Does anyone know if it's possible to do animation blending for Network Animators...

followup for this, but I have ideas to sync animator parameters now for blending stuff like walking animations based on movement speed: but I'm wondering if anyone knows how to solve the issue of Triggers not blending
For example I have a transition from Idle to Jump with a trigger, and the blending only works for the owner of the object
I'm curious about having server authoritative enemies who do things like attack based on a trigger and how to synchronise their animations to blend smoothly for clients

twin grove
#

what are these errors related to?

sharp axle
upbeat summit
delicate parrot
#

(behind the scenes it just passes over the unique hash on the spawned object because internally ngo keeps a dict of the serializable hash and the non serializable object)

#

it's pretty easy to make equivalent solutions for other non-serializable objects that will have identical dict or list indexing where you just wrap around that

sharp axle
upbeat summit
#

networkprefabs is a thingy in your folder

sharp axle
upbeat summit
#

double click on the networkprefabs thingy right there

upbeat summit
#

then click minus

twin grove
#

Thank you. Why is that? I just updated the engine.

upbeat summit
#

it is because there was a missing entry, with nothing inside of it, and unity netcode doesnt like that

#

you should only add entries when you have a new networkobject that you actually want to add to it

twin grove
#

It's just, it didn't happen before, it happened after the engine update.

upbeat summit
#

🤷‍♂️

sharp axle
#

I didnt think it would even let you add a object there without a network object attached

twin grove
#

Who knows how I get +- correct ping to the hoster I use Facepunch

sharp axle
twin grove
silk bluff
#

Iam currently trying to use the relay system from unity. I have the project connected and everything. My code rn will create the game and give me the code (i can see a player joining on my dashboard) but then when trying to find that connection with the code on another device i get "join code not found"

#

i tried rewriting my script and connecting everything again and no dice

#

nvm i just found that the problem was i was trying to join a session from the same computer

waxen quest
#

Is there a way to change tick rate through script?

sharp axle
waxen quest
tidal hemlock
#

Hey not sure if this is actually a networking issue, but only happens on other clients so 🤷‍♂️

Some connected clients, when they are spawned, fall through the floor:

  • ONLY HAPPENS SOMETIMES (hard to debug)
  • Character Controller (no rigidbody)
  • colliders are not set to trigger
  • only happens on spawn, if they dont fall through floor on spawn the rest is fine
  • custom/simple gravity logic for character controller but i dont think thats the issue

(The image is in paused state, but it just keeps falling)
Any help is appreciated

tame slate
#

Usually helps to provide some buffer between the spawn point Y level and the ground

tidal hemlock
#

Yeah, have at the same level, but its weird that it works sometimes and not other, I'd rather not increase it so players are not falling (even if just a bit) when game loads, but if theres no other option 🤷‍♂️

tame slate
tidal hemlock
#

Didnt even know that was a method 🫠

#

will try that

tidal hemlock
#

did a little more digging, i was spawning my players in onNetworkSpawn, and sometimes on some devices scene takes a few frames longer to load than when onNetworkSpawn gets triggered so those players were falling through, moved the spawning to the scene loaded event and now its working 🤞

old mural
#

Is it better to run one game server (GS) process on one VM, or many GS processes on one VM?

sharp axle
old mural
sharp axle
# old mural What do you mean?

It might cost you more money to have multiple VMs running or it might cost more to have a larger VM that can run multiple servers

old mural
sharp axle
old mural
sharp axle
sharp axle
old mural
haughty river
#

i got a problem so the player prefab spawns when you are host or client but when i click both in the host hierachy only one of them shows but when i do it with cubes both of them show in the hiearchy

haughty river
#

its fixed lets go

hybrid robin
#

How i can made a central server for my game? Using mirror

sharp axle
hybrid robin
#

Do u know what is that?

lyric thunder
#

any way i can call PhotonNetwork.Instantiate without using room objects or the resources folder?

green vortex
#

lol nice we have our own section here

#

i use netcode + unity session

sharp axle
dark umbra
#

what underpaid intern was high on crack when writing this sentence?
Sometimes, you might want to make a simpler prefab instance to be spawned on server version the override for clients.

robust lion
#

i downloaded PUN2 but when i press open in unity i dont see the asset in the package manager

sharp axle
robust lion
#

ok

torpid stream
#

what

#

what you mean

modern ginkgo
torpid stream
#

they are like robots

#

they never talk to us

modern ginkgo
torpid stream
#

Hello, I have been developing games for 6 years, but I have never tried implementing online multiplayer features before. I have a very promising idea in mind, and I need to publish it on Google Play as soon as possible. Could someone please share a detailed article or guide about using Unity Networking and implementing online mechanics? This game is extremely urgent, and it’s the best idea I’ve ever had in my life.

tame slate
torpid stream
#

I couldn't find any decent resources, what I'm looking for is to set up my own dedicated server.

#

I have a hosting company that I own completely, so I don't have any server problems. I just created a high-quality VPS Server for myself.

#

So how do I set up a server and connect to it in the game?

tame slate
torpid stream
#

here is my own solution my own vps server?

tame slate
torpid stream
#

Which ones do you recommend, I have no knowledge of these?

#

What are the cheapest or completely free network connection solutions that would be sufficient for me?

tame slate
#

Most of them are free. People here commonly use Netcode for GameObjects, Mirror, Photon, FishNet and a few others.

torpid stream
#

i think netcode the best choice for me

#

thank you so much

waxen quest
#

Is there a way to detect collision on network objects

#

Like I have a network ball and I have to play sound for all clients when the ball hits other objects

#

The problem is it only detects collision on host and for other clients the ball does not properly collide because it is networked and it changes position early

#

I use Rpc as of now but looking for a better approach

sharp axle
midnight tartan
#

hi, i develop an rpg and i have no clue at all about networking. whats the best to start with networking for mmorpg?

sharp axle
midnight tartan
#

i did the samyam multiplayer snake course. it worked. but i am not sure if that can handle many players and stuff. i did an offline arpg for 2 years so im good with offline games and programming stuff. we start as 4 people and i think its fine, nothing to rush. fishnet and netcode are kinda the same thing?

sharp axle
spring walrus
#

I meant the modified Mirror of ummorpg, sorry if I worded unclearly

midnight tartan
#

understand, thank u sir.

coral stratus
#

Would it be better to handle things like bullet penetration/ricochet and tumbling on the server and replicate it off to clients? Or should I simulate this on the client and hope the server also simulates something identical?

sharp axle
green vortex
#

there are legal issues if you want to publish ur game in china

which is something i need to think of as well

#

one thing is all the packet/data transfer must not go outside of china, like u need to isolate ur game backend by china and places other than china

#

ur game will be flagged for security concern if u dont obey this rule

sharp axle
#

Thats a good point. I don't think any of the Unity Game Services have servers in China

green vortex
#

like if the data transfer route has 0.1% thats outside china, ur game will be rejected

#

there are 3 more rules you need to obey tho

  1. u must register/setup a legit company in china
  2. ur game servers/database must be in china (you can have other servers, but need to have an isolated server in china) , the isolated chinese server must not able to exchange data with other servers
  3. you must give players an option to delete their player data (character and other stuff) , the deletion must be a complete wipe , u need to ensure none of the data is left on ur server/cloud/database...etc
#

they are strict , because chinese players must register games with their ID numbers,address ...etc , they need to be identified

#

its required by law

#

as for why they do that, anti-addiction, to prevent children addicted to games

#

but these are goals after my game are out, no need to think of atm 🤣

#

lets hope i only need to swap out DGS but not netcode as well lol

torpid stream
green vortex
#

welp all i can say is u need to do research urself

torpid stream
#

I thought it was in Thailand

blissful jay
green vortex
#

lol

potent monolith
#

Does NetworkObject.Despawn() not synchronise from server to client if the NetworkObject is in-scene placed?

#

I have a coroutine as an animation event as

public virtual void FinishDeath()
        {
            // Any death events happen here, then two couroutines to despawn the object and animate the death animation
            if (IsServer) StartCoroutine(DespawnCoroutine());
        }

        protected virtual IEnumerator DespawnCoroutine()
        {
            yield return new WaitForSeconds(deathDuration);
            Debug.Log("Despawned!");
            NetworkObject.Despawn(true);
        }
#

I'm using Multiplayer play mode and the enemy is destroyed on the hosts editor, but not on the clients
Is iti because the enemy is not spawned but is placed in the scene?

sharp axle
potent monolith
sharp axle
#

If it needs a spawn point, yea

opal dust
#

When using netcode for entities what's the recommended way to handle a FPS player camera? There doesn't seem to be a lot of examples or documentation out there for this kind of stuff so I've tried a few different things. I've tried having just 1 camera in my sub scene and then attaching that to the network spawned local player entity but the camera isn't positioning itself correctly (in fact inside the entity hierarchy it shows that I have 2 cameras after making it a child), I've also tried making the camera part of the player prefab and then creating a system that enables the camera for the local player but nothing is rendering even though I've added the "main camera" tag to the spawned camera. Would appreciate some help.

Sorry if this isn't the right place to ask because this is a DOTS / networking related question

sharp axle
opal dust
#

Thankyou, appreciate it

weak plinth
#

Anybody here familiar with Photon Server?

vital hawk
#

fholm works for Exit Games but I don't think he's involved in Photon Server specifically

graceful zephyr
#

I know photon server decently, worked with a fair amount

safe coral
amber adder
#

I think the guy from BenchmarkNet github project summed it up pretty well. https://forum.unity.com/threads/jobs-any-way-to-access-static-data-safely.541070/#post-3987865

I have had the most success with the low level libraries such as Forge or LiteNetLib. Photon has a lot of hand holding which can get in the way of clean code and performance.

safe coral
#

Wow, quite the scathing review. Glad to see a Unity dev respond at least.

#

My angle is that I had been using Unity's low level API in prior and currently live projects. My hope was for a continued/expanded support in that area after the prior has been deprecated. I've never been fond of relying on third party support.

#

I was also hoping for a relationship with Google Cloud that benefited the developers but I can only see it being somewhat of an exclusivity deal from my limited perspective. Is there more information somewhere and what they are specifically bringing to the partnership?

small fulcrum
graceful zephyr
#

@safe coral i mean the guy is not wrong, the current 'alpha' of the multiplayer stuff on github is something anyone half decent at network programming could build in a couple of days.

#

And there's been no updates, no information, etc.

#

Other than the constant re-iteration of that they want a jobified network system, should work with the ecs, etc.

#

things we've all heard 50x times now

warm geyser
#

hi @graceful zephyr is that you the guy behind photon true sync ? what a pity such a great project suspended ! do you have any plan to put it back on track yourself ?

graceful zephyr
#

@warm geyser no i'm not, i'm the guy behind photon quantum

warm geyser
#

ah sorry, I made it wrong, good project anyway, Quantum is also very promising

graceful zephyr
#

or well we are a team working on photon quantum, but it's my invention/original code it's based on

warm geyser
#

but the price to access it is not cheap at all

graceful zephyr
#

I'm not solely developing quantum, we're a few guys working on it

#

I'm also the guy behind Photon Bolt, maybe that's where you confused it

warm geyser
#

yeah, Photon Bolt, got it

#

so limited choice today to find a determinism physics networking library in Unity to work with, I just can dig into the last version of true sync, not sure if I have enough brave to apply it for live game, it's deprecated

graceful zephyr
#

@warm geyser yeah we don't have support for true sync in our cloud anymore afaik

#

so you need to reimplement all of that also, i.e. the networking

#

@warm geyser again quantum is also deterministic, but takes a much different approach, and thus performs much much better (orders of magnitudes faster)

warm geyser
#

exactly what I'm also looking for, re-implement the networking part to use any 3rd networking solutions I want

#

quantumn is so expensive, can't afford

graceful zephyr
#

also i have no idea what the license for the true sync code is, as I never dealt with that

warm geyser
#

oh it can be used with PUN plus license normally

lusty crow
#

Oh hello fholm, nice to see you here!
Since there is now the quantum framework, which seems great,
and truesync is discontinued,
I hope it is still okay to use the deterministic physics parts of it, namely the box2d conversion and the q31.32 fixed point type?

#

I tried to make calculations much faster by ignoring overflows and underflows, but I guess this could lead to non deterministic behaviour? that kinda concerns me,
but the old implementation of truesyncs number system was sadly so slow that it is hardly usable for big games.

graceful zephyr
#

@lusty crow I can't answer if it's okey to pull pieces of the true sync code for other things

#

You need to ask via our support email so someone with knowledge about the licensing and such can answer

#

Just a coder, so don't deal with that stuff

lusty crow
#

oh okay, thank you!

graceful zephyr
#

Quantum uses 48.16 as it allows us to do the fast mul and div

#

Gives up decimal accuracy for performance

#

(a lot of performance)

#

As overflowing 48.16 is waaaay harder than 31.32

lusty crow
#

yes, there is one operation, I am not sure if it was multiply or divide, which would overflow 31.32 immediately,
right now I changed a few things in the base number class to have q40.24
this still allows me to have a good lower end precision and my maps are rather small.

#

and I got rid of the - using a BigInt as intermediate register to handle calculations and overlow

TrueSync had like 60 lines of code for performing a simple multiplication between 2 fixed point numbers

glass bobcat
#

Hi! I've been learning networking for a while now and I was wondering if any of you had some good networking books relating to games?

ornate geode
glass bobcat
#

Yup I have it bookmarked, p sure you sent it to me on the C# server last time :^)

ornate geode
#

Didn't i send you the Unreal Engine one?

glass bobcat
#

I have a book for that one

#

i like the framework

#

it does just about everything for you lol

glass bobcat
#

that's the one I have printed

glass bobcat
#

i'm building my own lib, I just need pointers on what's "standard" for devs, like the normal patterns and stuff

#

oooh nice

graceful zephyr
#

@glass bobcat low lvl UDP or higher level stuff?

glass bobcat
#

oh hey @graceful zephyr, it's been a while since we talked ^^ I like both as long as it's UDP

graceful zephyr
#

Hey

#

No I mean what do you need pointers on how to solve

glass bobcat
#

General programming patterns for networking libs

#

Packet serialization, I understand it but I'd like to see a good version to compare to what I wanted to do

#

Ticks too

junior finch
glass bobcat
#

I've been reading his articles

#

They're nice

#

@graceful zephyr i'm trying to create a networking lib so I guess general low level UDP stuff

graceful zephyr
#

look at glen fiedlers repo on github

#

that has a good socket impl

glass bobcat
#

👌

#

Is it bad that I'm trying to abstract a ton of things @graceful zephyr ? I'm basically letting the lib's user either use my implementations or switch them over for his

#

Should I just have a concrete architecture built in, and let the lib's user use methods and hook to events?

vital hawk
graceful zephyr
vital hawk
#

oh I thought you meant two different things 😄

glass bobcat
#
var builder = new ComponentBuilder()
    .WithSocket<UDPSocket>()
    .WithPacketHandler<NetHandler>();

Is this a bad idea? I'm basically letting the dev choose what class to use for each "module" of the lib, and then Build() the lib accordingly.

graceful zephyr
#

@glass bobcat just seems a bit over engineered

#

Just write out a lib that works then first time

#

I'm not much for abstraction for abstractions sake

glass bobcat
#

Alright

celest hamlet
#

Hi! Anyone knows if using an WWW request in a web with https automatically encrypts the data sended/received?

last hornet
#

does the new TOS stuff that hurt SpatialOS basically ban any form of unity based dedicated server?

#

all the TOS language is worryingly vague

errant tulip
#

"You may not use a third party to directly or indirectly distribute or make available, stream, broadcast (through simulation or otherwise) any portion of the Unity Software unless that third party is authorized by Unity to provide such services."

This alone is a bit ... much.

last hornet
#

yeah if you take it at face value it seems to imply you couldn't even sell your game on steam

errant tulip
#

So I guess it also makes sense to decouple your networking / backend as much as possible from Unity.

small fulcrum
#

No it does not basically ban any form of Unity based dedicated server. There will be some public clarifying language later today

errant tulip
#

Thanks for the update.

graceful zephyr
#

@small fulcrum thanks

jagged radish
#

Will it be posted on social media like Twitter?

small fulcrum
#

I honestly don't know what channels it will be posted through. I expect Twitter. I'll post it here too.

vital hawk
#

I'll just continue to work on my now multiplayer again game then 🤔

glass bobcat
#

neato

weak plinth
#

Guess I'll as well thonk

olive coral
#

When we have an update to share with you regarding SpatialOS we will make sure everyone in the Discord knows where to find it.

jagged radish
#

right now people are panicking so hope this will get clarified soon

pure atlas
#

Yeah I have a bunch of dev friends right now working on multiplayer games who are trying to decide whether to just give up their games or transfer over to a different platform

jagged radish
#

Our projects are multiplayer games so... we are on the tightrope right now

#

we were working for years right now on them

pure atlas
#

yeah luckily my current project is singleplayer

#

but i feel for all you guys just having the rug swept out from under them

#

I'm also curious to know how unity will treat stuff like Steam Links

#

since that's technically a streaming service as well (albeit locally)

jagged radish
#

I don't think that will be affected because its local

pure atlas
#

the problem is that the stuff says "over the internet or other network"

#

"network" is a pretty broad term

jagged radish
#

ugh

pure atlas
#

right?

graceful topaz
#

I wouldn't be too worried, I doubt Unity would want to hurt developers on their platforms to showcase how good their platform works, and especially the games that are made from it.

pure atlas
#

the problem is that they already did the damage

#

they already did hurt devs

glass bobcat
#

Just wait for them to clear things up today

#

Might just be badly worded

pure atlas
#

unity is a pretty good engine, but there are other great alternatives and I know a lot of devs will be asking themselves after this "why work with a company who clearly doesn't care enough about the community to even make sure they get their legal jargon correct?"

#

it's not like they're some tiny little indie dev company who doesn't employ any legal team

#

and im sure the legal team they have is incredibly good.

#

this whole situation just leaves an awful taste in my mouth, and i don't want to have to worry about making a game and unity pulling the rug out from under me because of an abrupt ToS change that we weren't expecting

meager dragon
#

Unity didn't make the post. So how can they be held liable for it's verbage?

pure atlas
#

im referring to the ToS change's verbage, sorry.

bright saffron
#

They wrote the ToS

meager dragon
#

I was referring to the blog post and Reddit post that made everyone aware

#

ToS last updated December 5th

half tree
weak plinth
#

what's the difference between LiteNetLib and libgren

vagrant gazelle
#

I'm not following the networking threads right now but does Unity just banned every third party multiplayer solution out of nowhere!?

split crescent
#

They're working on an update to provide some clarification

graceful zephyr
#

@vagrant gazelle no they didnt

vital hawk
#

@vagrant gazelle that's what people panic it's about

graceful zephyr
#

@weak plinth LiteNetLib is good, Lidgren isn't.

#

😄

vital hawk
#

they added extra wording to their ToS that caused some heat as people don't really know how Unity meant it to be interpreted

#

but it'll be cleared out soon

pure atlas
#

people don't really know how Unity meant it to be interpreted

#

if that ain't the legal system in a nutshell

weak plinth
#

whats the difference@graceful zephyr

graceful zephyr
#

i said

weak plinth
#

what i meant is why

#

why is litenet good and lidgren bad

pure atlas
#

because he said so. duh!

#

(in all seriousness, i'd like to know as well)

graceful zephyr
#

because lidgren is old and outdated, is horribly and overly complex internally, has a very wastefull ack/nack system etc.

split crescent
#

think folks misinterpreted your comments as being TOS related

graceful zephyr
#

oh TOS?

split crescent
#

or atleast I did

graceful zephyr
#

nah

#

was talking about lidgren/litenetlib

split crescent
#

I googled it to try and figure out how it could possibly be related

#

potentially need more coffee over here

graceful zephyr
#

lol

#

im a bit scatterbrained today so maybe my sentances dont make much sense

torn sage
split crescent
torn sage
#

👍

jagged radish
#

👌

graceful zephyr
#

The blog post 100% contradicts the ToS, problem being the ToS is a binding legal agreement and a blog post is not

graceful zephyr
#

But epic and improbable now starting some game dev fund of 25 mil USD together seems fishy as fuck, they managed to come together on that deal together in 12h? This seems awfully coordinated on their end

graceful zephyr
#

Honestly from what I've seen i got to say I'm on unity's side here, yes the ToS/EULA need to be cleared up, but it seems like improbable had a year to solve this issue and didn't, and know they cozied up with epic to fling shit at Unity

#

Not that anybody cares about what I think 😄

vagrant gazelle
#

I have no idea what's going on...

glass bobcat
#

i've seen the term Networker a lot in networking libraries, what exactly is a networker?

brazen basin
#

Like a librerian

glass bobcat
gritty sail
#

Librarian*

#

I think he means to say that it’s the part of the library that handles the networking like how a librarian handles the books in a library

#

A fairly loose allegory as any profession could do

glass bobcat
#

i get it, but I will need more details :^)

graceful zephyr
#

@glass bobcat there's no well defined meaning of that term

glass bobcat
#

o

#

okay

mild rampart
#

@graceful zephyr About that TOS stuff, I totally agree with you, that dev grant thing is super fishy. I guess they gotta use that fortnite money for something lol

weak plinth
#

I have a idea

#

Why not use it on the documents

#

That's what literally everyone wants

restive urchin
#

The did use it on back paying asset developers last year. THat was v cool for a few of my mates 😄

#

I think they like throwing money around 🤷

#

They were also giving out a lot of Vives a couple years ago

valid coyote
#

They give out several sizeable grants a year to small developers too

#

They have a lot of money and aren't afraid to use it to try and help developers

glass bobcat
#

Hey, quick question: does the client simulate at the same pace of the server, or can it simulate faster?

#

And how would that work, do I send deltaTime to the server per simulation?

gritty sail
#

Normally a client requests data from the server, so usually the server runs faster

glass bobcat
#

It's more about how many times per second the client should send input to the server

#

i feel like the client would pool as fast as it wants

#

as long as it's at least as much as the server it shouldn't matter

gritty sail
#

Depends on the input i would say, if its something like doing gui that has backend then send it on event, but i guess you are talking about continuous input such as player movement, i would recomend sending that as fast as the server can handle it

graceful zephyr
#

They simulate at the same pace usually

#

Usually a fixed tick rate like 60

#

And they both stick to it

glass bobcat
#

what about low tick rates

#

does the client really simulate only 20 times per second?

#

i mean, it might not be that noticeable actually 🤔

graceful zephyr
#

Low tick rates?

#

Don't mix up simulation tick rate and packet send rates

glass bobcat
#

oh right

#

should the client request the simulation rate from the server?

graceful zephyr
#

Nah that's usually decided in code and fixed for both

#

But sure it can

#

If you want variable tick rate

glass bobcat
#

👌

#

what about packet send rates, same as tick rate or should it vary?

graceful zephyr
#

Depends

glass bobcat
#

packet send rate can be lower than simulation rate right?

#

but not vice versa?

graceful zephyr
#

@glass bobcat generally yes correct

glass bobcat
#

thanks

leaden grove
#

Hello! I'm using a fork of UNet and I'm having a bit of troubles telling a player that has joined late the state of the game. Sending a TargetRpc to the newly joined client doesn't seem to work. I haven't tested having a SyncVar hook because I suspect that clients already in the game could be dragged into the hook because their "started state" wouldn't be set before the hook fires.
Anyone that has any smart ideas how you could go about telling them if the game has started, ended, etc?

EDIT: Apparently it was just as easy as checking the state in Start on the client that just joined.

loud vapor
#

Hey guys. So with Unet being deprecated and if I wanted to play around with networking in unity right this very second - what terms should I google to help me get started?

#

or perhaps a section of the docs I can refer to?

#

even in the 2019.1a version of the docs I believe it's still just talking about the deprecated unet apis

compact bramble
#

I recommend Photon as a stable service that isn't infringing anything, until Unity's new networking comes out of Alpha.

I don't recommend anything else because it's all a wild west.

loud vapor
#

Okay so it's third party or wait for unity to catch up because we no longer believe in p2p

compact bramble
#

p2p meaning, specifically relay server?

#

or actual person to person (cos almost nobody does that)

loud vapor
#

I mean, unity wants us to move away from p2p and into dedicated hosting only?

compact bramble
#

No, they don't.

#

With all of Unity's networking so far, you have never been forced to choose a specific thing.

#

I used to run Unet Peer to Peer just fine.

#

Unity will supply cloud relay (this is where one player is client but sends messages to a server which relays back and forth to other clients) - the reason for this relay (that most games do) is to reliably deal with firewall problems, dropped hosts (migration) and a consistent service.

Is that what you want, or do you want dedicated?

#

Unity will also do the whole dedicated thing but its a way off yet

loud vapor
#

I have no clue what I want I just wanted to see what the process looks like

compact bramble
#

Ah well just get PUN (photon unity networking) - a free one is fine if you can - and this will basically be just a "relay" server, which means one player is also the server, just nobody directly connects to each other (which is a pain without ip addresses and firewalls and nobody deals with that in modern games)

loud vapor
#

peaches.

compact bramble
#

I wouldn't touch UNet though, it's simply not good enough IMHO

loud vapor
#

thanks for the info hippo

compact bramble
#

np

#

Can probably migrate later since PUN is kind of a basic and well known approach

graceful zephyr
#

@compact bramble hey fun to see you here o/

compact bramble
#

hey you too 😃

graceful zephyr
#

@compact bramble whats up

#

been seeing you around on the ecs forums

#

i dont post super much myself there tho, but read most things

compact bramble
#

Yo, I'm just developing as usual, same old. how about you?

graceful zephyr
#

@compact bramble ditto, networking code as always

#

working on photon quantum, fiddling with my hobby libs, etc.

#

the usual 😛

compact bramble
#

Photon Quantum sounds cool. I generally promote photon at the moment, I don't use it but it's by far the best general purpose option I think

#

I will use Photon if Unity's own stuff is not ready by the time I need to implement networking...

graceful zephyr
#

@compact bramble quantum has been/is great, we dont promotive on asset store or to hobbyists really, just focus on studios/aaa

compact bramble
#

Yeah understandable since you get paid then 😛

graceful zephyr
#

its my invention, and we turned into a product together with the photon guys

compact bramble
#

oh tell me about it?

#

Should I be switching to Quantum?

#

(wasn't it Bolt?)

graceful zephyr
#

depends, so quantum is a deterministic gameplay framework

#

its not just a networking system

#

it's a completely custom gameplay loop/framework, all deterministic, made to run inside (and outside of) Unity

#

has support for full predict/rollback of the game on the client

#

so you cant really 'add' quantum to your game

#

it has to be built IN quantum

#

here is a video of the current game im building in it to try to push the boundries

#

so it has a custom physics engine, custom ecs, custom nav mesh, etc. custom everything

#

all hand made to be deterministic

split crescent
#

custom physics since physx isn't deterministic?

#

thats getting addressed at some point, right? 😛

graceful zephyr
#

@split crescent not just that, physx doesnt support predict/rollback either

split crescent
#

got it

graceful zephyr
#

so both need to make it deterministic AND be able to predict/rollback the entire game state

compact bramble
#

It looks good but does it qualify as a platform? Photon should be talking to Unity in light of the recent SpatialOS fiasco

split crescent
#

presumably they're not selling servers running it

#

and just the lib

graceful zephyr
#

@compact bramble we only host the relay servers

compact bramble
#

OK then np there

graceful zephyr
#

like we always do

split crescent
#

very interesting on quantum - thanks for sharing

graceful zephyr
#

you can host the game inside of Photon if you choose to self host photon server

#

so you can get an authoritative result of the game

#

since quantum can run outside of Unity also it can host a quantum instance inside of a photon room

compact bramble
#

This seems like an absolutely enormous undertaking creating a networked deterministic physics-based engine, basically

graceful zephyr
#

yes, it was :p

split crescent
#

what's your target deploy? .net core?

graceful zephyr
#

@split crescent anything that photon runs on, officially atm i thin we only support windows/.net framework

#

but i know theres work being done on other runtime platforms

split crescent
#

gross

#

😄

graceful zephyr
#

@split crescent not as gross as mono 😄

compact bramble
#

So it's definitely a separate product, and not an evolution of PUN?

graceful zephyr
#

@compact bramble correct, it is not

#

it runs ontop of our low level API called Realtime

#

you can use it WITH PUN if you want tho

#

they are compatible

compact bramble
#

What does the code look like to get something moving (from the customer developer POV, not yours)

graceful zephyr
#

but its not going to replace pn

#

@compact bramble how do you mean?

#

like creating a sphere and pushing it around?

compact bramble
#

yeah!

graceful zephyr
#

2 sec, let me bring up github

compact bramble
#

I'm just vaguely curious how it looks

graceful zephyr
#
    const int h = 2;
    const int w = 2;

    public void DropSpheres(Frame f) {
      for (int x = -w / 2; x < w / 2;) {
        for (int y = 6; y < h + 6; y++) {
          var box = f.CreateBox();
          box->DynamicBody.InitDynamic(Core.DynamicShape.CreateBox(new FPVector2(FP._0_50, FP._0_50)), 1);
          box->Transform2D.Position = new FPVector2(x + f.RNG->Next(), y + f.RNG->Next() * 2);
        }
        x += 2;
      }
    }
#

@compact bramble from some random physics test code i had laying around

#

on laptop atm

split crescent
#

FPVector => fixed point?

graceful zephyr
#

ye

split crescent
#

hand rolled or using something like fixed.net?

graceful zephyr
#

hand rolled to the t

split crescent
#

cool

graceful zephyr
#

full deterministic math lib, all math functions, massively optimized

split crescent
#

we're using Fixed.net for project I'm on - kinda wish I just used decimal tbh

graceful zephyr
#

we take about a 30% hit on top of float performance, so its pretty ok

#

some stuff is faster than float, but on avarage its a bit slower

split crescent
#

yeah

graceful zephyr
#

we have zero runtime allocations usually

#

once the game has spun up

#

and created everything

#

its all built with native memory, pointers, linear laid out mem blocks, etc. ( @compact bramble sounds like unity ecs? :p)

compact bramble
split crescent
#

whats a "box" in above snippet?

#

Analog a GO?

compact bramble
#

(and yes it sounds a bit like Unity's ECS but nothing stops you..) 😃

graceful zephyr
#

@split crescent no thats just a box collider

split crescent
#

got it

graceful zephyr
#

big difference vs. unity ecs is that

  1. we expose the pointers to the user, as we dont target this for the avarage unity user but experience teams this works out well (less copying, etc.)
  2. our job/threading system is not as good :p
#

also since agian, its not a generic for any type of game framework

split crescent
#

How long have you guys been working on quantum?

graceful zephyr
#

we've made mode tradeoffs, and we have some more limitations imposed due to needing to support full predict/rollback

#

@split crescent I developed the original code base around 2014-2015, i've been working on it with exit games since early 2016

split crescent
#

cool

graceful zephyr
#

a lot of weird problems to solve when you're trying to a lot of players in a deterministic predict/rollback environment

split crescent
#

yup

#

Have you (or anyone else) been in touch with Unity as they've been fleshing out V3 of their networking libs?

graceful zephyr
#

I've talked to some of the unity networking guys

#

but only on a personal level

split crescent
#

feels very hypothetical atm

#

not sure how far along they are

compact bramble
#

The alpha is available

graceful zephyr
#
    static FPVector3 FindRailgunTarget(Frame f, Ship* ship) {
      using (var hits = f.Scene3D.Raycast(ship->Transform3D.Position, ship->Transform3D.Rotation * FPVector3.Forward, ship->ShipType.RaygunRange)) {

        // sort based on distance
        hits.Sort(ship->Transform3D.Position);

        // find closest hit that is not ourselves
        for (Int32 i = 0; i < hits.Count; ++i) {
          if (hits[i].Entity != null) {
            var entity = (Entity*)hits[i].Entity;
            if (entity->EntityRef == ship->EntityRef) {
              continue;
            } else {

              if (entity->Type == EntityTypes.Ship) {
                var entityShip = Entity.CastToShip(entity);

                // damage ship
                Ship.Damage(f, entityShip, ship->ShipType.RaygunDamage, hits[i].Point);

                // push ship
                entityShip->DynamicBody3D.AddLinearImpulse((entityShip->Transform3D.Position - ship->Transform3D.Position).Normalized * ship->ShipType.RaygunForce);
              }

              return hits[i].Point;
            }
          } else {
            return hits[i].Point;
          }
        }

        // last resort, hit nothing
        return ship->Transform3D.Position + ((ship->Transform3D.Rotation * FPVector3.Forward) * 1024);
      }
    }
#

here is some actual game code

#

from that space game

#

for firing the railgun

split crescent
#

1024

graceful zephyr
#

@compact bramble @split crescent i mean the current alpha is... just a socket lib

#

@split crescent haha, yeah noticed that now... need to pull the correct value from the ship config

#

and im kind of sad to say its not even a good socket lib, its just the bare bones that anyone with half decent networking experience can build in a week

#

not even sure why they released it

#

like, i wish it was better, i could build assets for it on the store that would be awesome, but in its current state

#

it's... i mean, yeah... it boils down to this:

  1. those of us that know enough to use it, can make something better ourselves and not run the risk of having an alpha change API or being pulled
  2. those that cant use it.... well yeah.
split crescent
#

so in above, do you have traditional GameObjects w/ transforms in the view that are observing the underlying model representations?

graceful zephyr
#

dont judge the code for that spacegame too much, it was built in 3 days to try to push the limits

split crescent
#

or are you taking a diff approach to draw?

graceful zephyr
#

@split crescent so the simulation is completely standalone from Unity, COMPLETELY, it doesnt even hold a reference to UnityEngine.dll (this is what lets us run the game on the servers, etc.)

#

(We of course have tooling on the unity side to export stuff into the simulation)

#

Unity has full access to the simulation state as the game is running, how you choose to render the simulation state is up to you

#

Unity basically becomes a rendering front-end for the quantum simulation

split crescent
#

yup

#

got it

compact bramble
#

It would be creating an ECS world to handle the data from your own ECS implementation

graceful zephyr
#

We obviously have some pre built tooling to make it easy to get started, etc.

#

Like we have a custom 'hookup prefab component'

#

and stuff like that

compact bramble
#

ah cool

graceful zephyr
#

but generally the serious games that are built with it

#

do their own thing

#

that fits their game perfectly

#

@compact bramble I've played a decent amount with the Unity ECS, it's getting there but has a long way to go in my opinion

#

I've made networking lib that puts all the game state in the unity ecs, but still lets you build the game using GOs, etc.

#

So dug pretty deep into the ECS, and really used it for something real

#

It's fast, absolutely (especially on my 32 thread cpu :p)

compact bramble
#

It will take Unity quite a while to make ECS versions of all their current functionality

graceful zephyr
#

I can serialize and dispatch 100k entities out to the network in like 1 ms

#

which is pretty fucking good lol

compact bramble
#

yeah lol

#

In most mp games you're spending probably most of the time on setup

split karma
#

not for your internet connection 😄

graceful zephyr
#

@split karma 😛

#

@compact bramble but a lot of problems in the ecs currently, are very hard to solve

#

because some thing are super easy by just doing 'hold a reference to this thing'

#

and in the ecs you end up jumping through infinite hoops to get it done

split karma
#

its usually also a decent amount of hoops to go through for the stuff that you can solve

graceful zephyr
#

I understand WHY its like that, hell we built our own native memory backed ECS for quantum

#

but that doesn't mean its a good experience for the users of the ecs as it is today

split karma
#

ah ok so you have ECS for quantum, but the user pretty much never has to actually touch it unless they want to right?

#

thats basically what Unity is missing tbh

graceful zephyr
#

@split karma no the ecs is baked into quantum, you dont HAVE to use it, but you pretty much should unless you want to build your own determinsitic setup from scratch

split karma
#

ah

graceful zephyr
#

but quantums ecs is not a 'generic gameengine ecs' for any type of game

#

it's specifically targeted at higher end studios, with good programmers, etc.

split karma
#

yeah that makes sense

graceful zephyr
#

that know how to build stuff by hand if need be, etc.

#

and again, i am not complaining over unitys ecs, i think it's great, but it is aiming to be a generic game engine solution for programming all games basically

#

for the avarage unity users

#

which is a much higher bar

split karma
#

i dont know, they may put abstraction layers on top for the average user too

graceful zephyr
#

yeah sure, but that's what i mean

#

it's not there yet

split karma
#

yeah

graceful zephyr
#

they will do that in the end, but the bar is much higher

#

i can expose low level pointers and allow people to fuck with memory by hand

compact bramble
#

"it's specifically targeted at higher end studios, with good programmers, etc." because anyone smart enough to make Quantum is smart enough to avoid even contemplating the depths, the horrors of supporting customers that aren't... or basically 99% of the asset store.

graceful zephyr
#

because the people using quantum know how to do that, and they want that ability/power

#

@compact bramble yeah i did that once with Bolt, never again.

#

never. ever.

#

I still get support emails for BOlt, 3 years after i sold it to exit games

compact bramble
#

I never published to begin with. I knew. I smelled it.

graceful zephyr
#

got one just this morning

split karma
#

I mean who better to contact 😛

graceful zephyr
#

no wait... its almost 4 years since they bought it lol

#

may 2015

#

so yeah

#

never. again.

compact bramble
#

Well thing is at least with Quantum they can get both an answer and no answer at all.

graceful zephyr
#

We have about 50 studios atm working on games in quantum

#

some larger studios like ubisoft

split karma
#

wow thats more than I expected

graceful zephyr
#

some smaller indie shops

compact bramble
#

That's a lot, way more than expected. I'm surprised because - it's a lot of trust for something unfinished.

graceful zephyr
#

quantum isnt unfinished :p

compact bramble
#

ECS is not a finished problem 😛

graceful zephyr
#

true

#

i think thers like 10-15 games launching during 2019 at least

#

built on quantum that is

#

dont quote me on that i dont keep up to date with all the customers schedules, etc.

compact bramble
#

Full SDK-Access per month:
US$ 1,000

Including in-depth instructions by our authorized Quantum engineers

(or just pop in discord and flirt with fholm but don't tell anyone)

graceful zephyr
#

@compact bramble ye, lol :p we have our own locked down discorder server for day to day support

#

its been working out pretty ok

#

its fairly low volume

compact bramble
#

"We are searching for great teams who want to leverage the full potential of Photon Quantum.

Are you one of them?"

I could be but really, this solution actually looks like it needs someone on networking full-time and not a sole-programmer like me who is split between a whole bunch of different jobs

graceful zephyr
#

well so the thing is right

#

because its deterministic

#

there's no networking code to write 😛

#

thats the whole selling point

compact bramble
#

This basically seems like the same thing Unity wants to offer, from what Unity's said publicly so far, under the "by default" thing

graceful zephyr
#

well they are still talking about classic networking tho arent they

#

just that if you write it in a certain way

#

it will network 'easier'

#

you still have the same regular concerns, etc.

#

i doubt they will make the whole engine deterministic with predict/rollback

#

but idk any about their inner workings ofc

split karma
#

I think determinism for ECS shouldn't be an issue

graceful zephyr
#

@split karma oh sure, probably not

#

but predict/rollback determinism for the whole game state is a much much harder problem

#

not saying they wont or cant do it, absolutely, they have way more resources

split karma
#

but yeah prediction and rollback are a different kind of challenge to shove into something like it

compact bramble
#

and potentially quite expensive for a traditional approach

graceful zephyr
#

but it's a weird take to make all games fit in

#

i'll be the first to admit that quantum isnt suitable for all games

#

determinism costs performance, a lot of it, even if they make floats deterministic

compact bramble
#

Well the concept that it basically needs no networking code puts it on the radar for practically any realtime mp game.

graceful zephyr
#

@compact bramble yeah, you write the game as if it was a singleplayer or split screen game

#

and it works in networked online play, singleplayer and split screen automatically

#

the game itself doesnt even know its networked in fact so

compact bramble
#

No 3D physics is a bit of a blow

graceful zephyr
#

we do have a 3d physics engine now, but it's in alpha/rudimentary state

#

thats what im using in the space ship video

#

it does work, and will do fine for something like the space ship game

compact bramble
#

This is something people should be looking at when they begin the game's development

graceful zephyr
#

but if you want to do some full stuff with joints and wheel physics and crap, no it cant do that

#

@compact bramble yeah, we generally only sell to teams starting out development

#

as it's a massive undertaking to port the game

#

some teams have, because they tried some of the demos we have that were similar to their games and played them online

#

and its basically flawless, and you can do so many things which are super difficult when dealing with non deterministic systems so easily in quantum

compact bramble
graceful zephyr
#

so some teams did port their games to quantum, but i'd say 9/10 teams we got in earely

#

@compact bramble that game is one of the first games built on my original code base, made by my brother and his friend in two weeks.

compact bramble
#

sweden to brazil is impressive in what looks like no latency

graceful zephyr
compact bramble
#

Usually one does not even bother talking about gaming that far apart online

graceful zephyr
#

@compact bramble yeah it offers insanely good performance even over high ping scenarios

#

the client im not focusing is a bit jittery, thats just the rendering getting shit on in the non-focused video when the recorder is running

#

heres an even older with around 230 ping or so on both clients

#

you'll see when the ship blows up after the first few seconds how it basically happens at the same time on both screens 😛 despise there being like 300ms of total delay between them

#

@compact bramble but yeah so thats what i've been up to, what game are you working on?

compact bramble
#

that looks really impressive though

#

ignoring any issues

#

(Offtopic - my game is coming along well, but slow because it's self-funded... rpg lite action game with a fair amount of comedy to it, physical toys etc)

graceful zephyr
#

@compact bramble ah nice, like third person rpg or top down sort of thing?

compact bramble
#

3rd

#

and first

haughty vigil
#

Hellooo, can anyone either tell me how, or maybe point me to (with a link) where i find out how to; setup multiplayer in Unity, without using the Network Manager, that apparently is deprecated and going out of "business" 😅

midnight tree
#

We used Photon, and later on, Quantum SDK for our PvP title

#

You can try it out @haughty vigil

flint spade
#

If I were making a LAN based mobile controller thing (you would be able to use your mobile as a controller) which protocol would be better TCP or UDP?

gritty sail
#

TCP

last hornet
#

@midnight tree i don't think you can just "try out" Quantum 😃

compact bramble
#

yeah it's a noob engine anyway (just kidding @graceful zephyr ) 😃

graceful zephyr
#

@compact bramble ;p

#

I think he meant the game

glass bobcat
#

if it's LAN only TCP, and I don't see why you couldn't use UDP in that case

#

UDP would probably work and have less overhead

#

if you plan to make it anything else than LAN go with UDP

last hornet
#

i mean it is technically a noob engine

#

thats why its so attractive

#

just make yo game

weak plinth
weak plinth
#

i was wondering if this is basically how you'd go about separating client / server code and running both for testing:

public class Game : MonoBehaviour
{
    List<IGameLoop> gameLoops = new List<IGameLoop>();

    void Awake()
    {
#if UNITY_EDITOR
        gameLoops.Add(new ServerGameLoop());
        gameLoops.Add(new ClientGameLoop());
#elif UNITY_SERVER
        gameLoops.Add(new ServerGameLoop());
#else
        gameLoops.Add(new ClientGameLoop());
#endif
    }
vagrant gazelle
#

Wouldn't it be easier to just do

#if !UNITY_SERVER
// some code
#endif
#if UNITY_SERVER || UNITY_EDITOR
// some server code
#endif
```It will not require whole IGameLoop logic
weak plinth
#

i'm honestly not sure yet

#

would you be sprinkling those all throughout the codebase?

vagrant gazelle
#

Probably

weak plinth
#

mm, i'd have to think about that. i guess it depends on how much overlap there is?

vagrant gazelle
#

I think that for testing better way would be to create a tool that starts a server as soon as you enter play mode

weak plinth
#

yeah that's probably true

vagrant gazelle
#

I think that FPS Sample has something like that but in more advanced form

weak plinth
#

yeah i had taken some of the game loop ideas from it, but the project tools panel was pretty over my head so far

split crescent
#

I think in general, you should treat forking code like that

IF_SERVER
IF_CLIENT

As a code smell if its doing other than switching out the implementation of a manager or a service

vagrant gazelle
#

I haven't done lot of networking myself but I don't think that doing basic tool for testing would be hard. Something like

if gone to playmode
   run "project/server/server.exe -maybeSomeParameters"
weak plinth
#

yeah, i think i'll have to give it a shot

vagrant gazelle
#

Try Process.Start(...), that will start an executable (even with parameters if needed) as far as I know

weak plinth
#

will do, this'll be my first editor extension so gotta read up on the ol' docs

vagrant gazelle
#

Maybe using Process class itself would be better, that way you will be able to terminate the server when you'll go back to edit mode

weak plinth
#

i dont know if this is networking per se but how do i go about saving game data so its not lost if the user uninstalls or changes devices. does unity offer something like that or do i need to have a service/host my own server?

vagrant gazelle
#

I think you need your own server, you can use Steam Cloud or Google Apps

weak plinth
weak plinth
#

What's the replacement for unity matchmaking system?

#

Dedicated servers?

split crescent
#

Will Photon Quantum eventually support 3D?

vital hawk
#

@graceful zephyr ^

graceful zephyr
#

@split crescent we have a basic 3d physics engine as it is today

#

But it's nowhere near physx or anything like that

#

It's for basic 3d collisions as of now

split crescent
#

cool - thanks!

weak plinth
#

any experience with using Protocol Buffers or MsgPack in Unity? mostly wondering if it worked out well and if there were any issues building to mobile platforms

split crescent
#

We're using protocol buffers fairly extensively

#

for mobile

#

a few things to note (you should be using proto3 and not proto.net btw as the latter is deprecated)

1.) C# libs weren't built with games in mind and can generate a decent amount of GC when parsing. The serialization savings are there which is nice, but it generates a bit more garbage than I'd like
2.) Proto3 does not support deserializing into structs, which is unfortunate
3.) Unlike other languages proto classes in C# are mutable. This can be a pro or a con depending on your use case
4.) C# classes that are spit out are partials, which is fantastic for extending data classes with business logic or convenience methods
5.) Be sure to compress ontop of serialize - the savings are meaningful
6.) Enums can't be keys in maps, (dictionaries) which sucks
7.) Be extremely careful with logging any proto message. If you do IMessage.ToString() you'll trigger an expensive reflection cost that attempts to look at all your proto messages in the current assembly. For us this was an 8s operation on an IPhone 5 and generated 6 mb of garbage.

#

still very recommended

#

didn't seriously consider msgpack, but we probably should have

#

took a look at flatbuffers, recommend avoiding

weak plinth
#

thanks a ton, I'll keep all that in mind

torn sage
#

Do you know if the UNET match making still works (2018.3). I know it is deprecated but it easier for me to use it for my proto.
When I create a match. Few seconds later it is no more joinable 🤔

graceful zephyr
#

@split crescent we are building an tps with the quantum 3d physics, and thats pushing just up to the limit of what it can do

flint spade
#

Would it be a better idea to compress class info with ProtoBuf/ZeroFormatter before sending it over the socket rather than just JsonSerializing/BinaryFormatting it

split crescent
#

Protobuf will generally serialize/deserialize significantly faster than JSON

graceful zephyr
#

@flint spade yeah

#

json/binaryformatter suck

split crescent
#

@graceful zephyr presumably with no height?

graceful zephyr
#

@split crescent no height?

split crescent
#

sorry, potentially a dumb question - it's a TPS, but presumably not full 3d

#

i.e. doom, not quake :p

graceful zephyr
#

@split crescent no its full 3d

split crescent
#

got it

#

would you consider it for a battle royale TPS?

#

(so hot right now)

graceful zephyr
#

@split crescent don't know if it'll scale to 100 players

split crescent
#

got it

graceful zephyr
#

@split crescent it's a hero shooter (overwatch) style sort of thing, i'll see if i can get an OK to record a video and show here

split crescent
#

cool - appreciate the context. No sweat if you can't 😃

weak plinth
#

i've been experimenting with Unity's new multiplayer code + taking hints from the FPSDemo that was released, but i'd be interested to know if anyone uses other network libraries, like ENet, ForgeRemastered, etc. i don't really know what the "gold standard" is and i'd kinda like something that's pretty well tested and has a good community

compact bramble
#

Photon is the most widely-used I think?

#

Networking for me, is about managed reliability, so a service that will not break because I don't have a decade of experience in it

weak plinth
#

right, the more i work through doing this the more i'm realizing i'm not going to be able to make the best networking for my game and then actually get to work on the game in the near future. Photon is definitely something i'm considering

graceful topaz
#

@weak plinth Honestly the best thing to do would be to just test the libraries yourself to figure out which one suites you needs better. As for Forge Networking, I would only recommend it to those who are willing to write some of the networking code themselves to get into the nitty gritty details. It handles some basic functionality out of Unity and holds your hand in that process, but if you want to do complicated networking it would only be a good networking solution if you planned on writing your own one day. Otherwise I would recommend using others out there.

weak plinth
#

gotcha, thanks for the input. i will have to start testing all of these out

compact bramble
#

It's not just a matter of getting computers talking it's also - can you maintain your own relay server? can you do this in the areas your game will be sold? What if the server gets caught in a DDOS?

#

will you be willing to pay those fees?

#

lots of considerations but if it's peer to peer or managed in steam you can get away with your own

graceful topaz
#

Indie games shouldn't worry about those problems as much and should just be focused solely on their game and making it fun. Bigger companies have bigger problems and smaller companies have smaller problems. Although if those are concerns for some people then they should indeed research them. I would play a fun game as long as it had singleplayer as an alternative. If the sole focus is multiplayer then it can indeed be a bigger concern as that is what everyone would mostly play.

compact bramble
#

when i stopped worrying and accepting that, started finishing 😄

weak plinth
#

thanks guys 😄

stray knoll
#

Hye there, I'm currently in the planning stage for our predominantly online game, and I'm revolving around a few concerns...

I'm gonna start by giving some more context about the game: It is a 2-player dungeon crawler, meant to be played either locally (split screen), over LAN, or over the internet. There's no singleplayer mode, so networking can't come as an afterthought. Multiplayer will be session-based and we expect games to last no more than 1 hour. Our primary target platform is PC but we'd like to try and get to Xbox and PlayStation. We're not sure yet if we will have enough funding to support a dedicated server architecture, but at the same time, we don't want to corner ourselves in case that happens.

My first doubt is about architecture. Is it viable to have a server build/project and a client one and use a local connection to make player-hosted servers and couch coop games? (Effectively having 2 unity instances in a machine)

Second, I'm not sure about going with photon bolt or forge remastered. We're not a big team so we may have to rely on Bolt's more out-of-the-box features, but I'm still in doubt.

Third, in case we go with Bolt AND we get to make dedicated servers, does anyone know about the new integration Photon announced with Zeuz? Or maybe you can recommend another provider?

Finally, whatever opinion and/or advice you may have will be very appreciated 😃

Thanks!

last hornet
#

is it predominantly a co-op experience @stray knoll ?

stray knoll
#

well in fact is a coop only experience

last hornet
#

@stray knoll i'm not sure bolt is a great fit? almost everything about it is optimized for competitive play

vital hawk
#

one huge downside of Bolt is it ships in precompiled DLL

last hornet
#

its basically a faithful adaptation of traditional source style shooter networking with hitbox rollback and whatnot for cheat prevention in competitive play, seems like a square peg in a round hole for a co-op dungeon crawler

#

and i say this as a big fan of bolt

stray knoll
#

Hmm... you have a point.

last hornet
#

I'd just go with PUN, especially if its only 2 players. dedicated servers seems excessive; PUN relaying is pretty ideal for your use case

stray knoll
#

I've been looking at both and I'm not quite sure about how they differ in the end. Their comparison page seems outdated as photon advertises bolt as server-first on some places and relayed p2p in others.

#

Do you have experience with both?

last hornet
#

@graceful zephyr could explain better, but i think bolt can be both. PUN is strictly relayed w/ MasterClient, but the way you do things is entirely different (Bolt events, replication etc. vs PUN RPC's, serialization and RaiseEvent)

stray knoll
#

And are those just different means to arrive at the same result, or do those differences get in the way of certain types of games?

#

In your opinion ofc

last hornet
#

well no matter how you use bolt it is aimed at arriving at a specific result (authoritative, valve style tick based networking where clients only forward input and the server verifies, resimulates, rewinds etc), PUN you are just given the tools to send /receive data and need to solve for everything from there

stray knoll
#

I get it better now. Thanks a lot!

warm jungle
weak plinth
#

unity new networking instead of unet this is in alpha right?

worn bramble
#

unity new networking instead of unet this is in alpha right?
yeap

weak plinth
#

what can I use for production?

#

playfab

#

?

#

azure?

graceful zephyr
#

@weak plinth third party solutions

compact bramble
#

playfab and azure are random words that have no relation to unity networking

#

one of them is a backend service for tracking and holding data while the other is a generic cloud that does nothing

#

although I would like a unity version of a game backend so i dont need to go to third party

graceful zephyr
#

@compact bramble 😄

#

gonna have to wait for that lol

compact bramble
#

Yeah I guess lol

graceful zephyr
#

well there's 800 lines of C# on github if you want 😄

compact bramble
#

I'll take a look 😛

weak plinth
#

@weak plinth you could take a look at Photon and Forge Networking Remstered

#

the alpha unity stuff would require you to do all kinds of stuff yourself afaik, like reliability, bitpacking, compressing, security

last hornet
#

anyone ever have an issue in PUN where a match hosted in the Unity editor cannot be found by your builds, by either JoinRandomRoom or listing the rooms?

#

it just randomly started happening today :\

celest hamlet
#

Anyone knows if using UnityWebRequest with HTTPS encripts the communication?

split crescent
#

It does in the way that all SSL does

#

doesn't add any additional encryption ontop of that

#

but generally you're fine - only way to make it better is certificate pinning

celest hamlet
#

Okey, thanks!

glass bobcat
#

Is making your own networking lib a bad idea?

vital hawk
#

generally remaking any bigger library is a bad idea if you can by any means avoid it

#

but sometimes there simply isn't viable alternative that suits you and then you go down that rabbit hole

glass bobcat
#

what about experience wise?

weak plinth
#

i spent probably the last month looking in to making my own, trying things out, etc. wasted a lot of time and finally came to the realization that i would spend more than all the time i wanted to spend on the game making the networking library and in the end it would just be worse than something i could have used out of the box. imo, if you wanna make a game, use an existing lib. if you wanna make a networking lib, go ham, but you'll probably be doing that for a long time

glass bobcat
#

Aight

compact bramble
#

it's one of those if you have to ask then its a bad idea

graceful zephyr
#

@compact bramble lol

fathom fern
#

got a really odd bug happening. I have a node.js REST API hooked up to mongoDB via mongoose. when I send the JSON request via Postman it saves the new entry, but not when I send it by Unity. node.js logs that the new entry was saved successfully, but it's just not in the database...

#

anything obvious to check?

weak plinth
#

maybe fix the logging first and see where that takes you? sounds like whatever indicates that it's saved also has a bug

fathom fern
#

ugh, sorted it out. it was to do with coroutines executing out of sequence :p

compact bramble
#

shudders at the mention of coroutines

#

that's the thing, when you introduce coroutines in your code base, they can and will regularly stealthily sap perf and introduce little out of order bugs.. so convenient tho

#

I guess instead of focusing on making a new kind of allocation-free CR, Unity put their effort into ECS

vital hawk
#

people used to abuse the coroutines heavily on the Unity 4 times (I haven't really followed their current usage)

#

people literally reimplemented Update() with them and other weird stuff

#

I've mainly used them for some one shots or getting your code to run at certain point in the main loop (but now you can do it with custom playerloop too)

stuck void
#

I only use em for minor stuff, like when waiting for an async task to load

glass bobcat
#

you don't have to be precise in answering this question, but how much time would it take to create your own networking lib, for a first person multiplayer game using deterministic lockstep

#

just searching for an average

#

detailed answers are welcome ❤

compact bramble
#

It would take me about four years and I have over 30 years experience in general game programming, This is because the standard I would want it to run at would require me to specialise in it, and the testing alone would absorb at minimum, one of those years.

#

Intelligence wise I'm average, just quite competent and practical, so no genius here. But lots of practical experience.

#

TLDR please don't hurt yourself trying to make a networking library with that feature set

#

the problem here is the deterministic lockstep + FPS

#

And everything else that makes general purpose networking too... I can't imagine

graceful zephyr
#

@glass bobcat A first person game would not use deterministic lockstep for starters

#

@glass bobcat Creating a decent networking library from scratch, without prior experience, for a first person shooter type game... I'd say you'd need around two years maybe

#

It takes me about ~6 months to take a networking library from idea to usable beta, and I have around 8 years experience doing networking for games basically every day.

#

Bolt took me around 1.5-2 years of development time, it was released in 2014 and i started on what would become bolt 2012

#

It also massively depends on if you're making a generic library, or a library to network a specific game. The former is much more complicated.

#

You still need to know the same things for both a generic library or a specific game, but the amount of code and features you need to write is much less when networking a specific game.

spring crane
#

And by using something someone else made, you have the option to learn about things as you go/the hard way 😛

glass bobcat
#

I probably got my knowledge all wrong again great

#

Thanks for the answers! I'll probably go ahead and use an existing solution

#

@graceful zephyr if I were to make a "base" for a networking library and then add on to it to network a specific game, would that be faster?

static maple
#

I would suggest before making a networking library, first make a game or application that uses one? If you haven't already. Maybe make 3 or 4. Think of it like making a game engine.

graceful zephyr
#

@glass bobcat I dont know what a 'base' means

glass bobcat
#

nvm, just thought about it a little more, bad idea

#

thanks

graceful zephyr
#

There's generally 'three' pieces to a networked game

#
  1. Transport (socket library)
  2. Networking Higher Level API (i.e. Bolt/Forge/Mirror/UNET)
  3. Actual integration into the game itself
#

You can of course build 2) in top of someone else 1)

#

Or just build 1) and then keep adding to 2) as you develop the game and need features, etc.

glass bobcat
#

aight

#

sounds good

#

Also @graceful zephyr if you don't use deterministic lockstep for a first person shooter, what do you use?

graceful zephyr
#

@glass bobcat two options generally, straight up delta snapshots (i.e. what counter-strike does) or something more flexible like eventual consistency (which is what halo:reach does)

glass bobcat
#

i knew about how CS does it, dunno what eventual consistency is

graceful zephyr
#

@glass bobcat unitys fps sample uses delta snapshots, so if you want to get a bid of a head start in your knowledge, dig into that code in detail over a few days

glass bobcat
#

👌

graceful zephyr
#

@glass bobcat for reference, deterministic lockstep doesn't work well for FPS games because they require you to have input delay on player input

#

rollback/predict can work for fps, but it's a lot more work than simple lockstep

glass bobcat
#

you still have the whole client prediction/server reconciliation thing right?

graceful zephyr
#

in rollback/predict? no