#archived-networking
1 messages · Page 41 of 1
Help guys
Those buttons only show if the NetworkManager is not connected to a server.
The debug log is triggered when connecting to the lobby, but StartClient(currentLobby.Value.Owner.Id); is not.
none of the logs are working here.
That would imply that IsHost is true.
I don't get it
like the player is the host?
StartHost work
The only way that those logs don't fire is if the function returns because IsHost is true.
unless there's an error.
Thanks, I figured out what the problem was, I had the transport hanging on another object:D
I forgot about it and used the getcomponent to get it.
Now I'm faced with the fact that I need to create characters, although I have not even started the game, and I am at the lobby stage.
Do you need to create the characters in the lobby? Or are the characters being automatically created? You can remove the player prefab from the network manager if you don't want them automatically created
okay, ty bro
then I can spawn them when the game starts?
Yes you can spawn them manually
https://docs-multiplayer.unity3d.com/netcode/current/basics/playerobjects/#spawning-playerobjects
PlayerObjects are an optional feature in Netcode for GameObjects that you can use to assign a NetworkObject to a specific client. A client can only have one PlayerObject.
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?
What version of Unity and MPPM are you using? I've not seen missing scripts in the clones.
6000.0.43f1 / 1.3.3
Mppm 1.6 just released. Might try updating
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 ^^
What can cause me to get a kicking error? But the player seems to get kicked normally.
That is just a warning. Looks like it might be trying to remove the player twice for some reason.
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
SteamManager
Ok, so the host has already disconnected the client, you don't have to call Shutdown again
ty i delete NetworkManager.Singleton.DisconnectClient(targetClientId);
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!!
KeyNotFoundException: The given key 'ChatManager' was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key)
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
so basically learn a lot more unity and then later decide what server needs to process and what client needs to do and change the stuff needed?
It really needs to be designed for networking from the start. unless you don't mind completely rewriting whole chunks of your systems
hmm yea fair, the thing is, i have some cool ideas for a game but it also kinda needs to be multiplayer to be fun, i currently have the ideas and motivation which kinda makes me itch to start, which is why i asked :D
how much of a difference is there in code of normal unity and netcode if i may ask?
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
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?
The code itself is not really any different. Its more about designing your systems to be more data driven so things can be sent across the network. Mapping out which clients will own what objects and whatnot
ohh fair fair! thanks for making that clear btw!
hmm, i think im gonna learn a bit more 3d and just code in general and then attempt it, i feel like i need to make some normal stuff first, like i have done some 2d but not that i feel like im standing too steady with it yet, so imma practice it first and then attempt to edit the code/rewrite it!
From a cold start, the server might take a minute or two to fully spin up. But really depends on what error message you are getting
another curiosity i had is how it works when one makes a game with single player and multiplayer like mc
mc = minecraft?
The server isn't giving any error message and the client is timing out after trying to connect for 10 seconds. And then retrying and the same thing happens again.
The sever seems to be fully spun up according to logs.
yep
@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.
alternatively, you could make a thread here
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.
The easiest way would be for single player to be the same as multiplayer just connecting to localhost.
Unable to connect to Server (Matchmaker + Multiplay Hosting dedicated server)
I second this. You can do that first and add server support later. That's what I'm in the process of doing.
so just setting the server limit to 1?
Nah, your computer is the server basically, the computer you are running the code on.
no, it just connects to itself as host
mhm ik, just host and having no-one connect
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.
Anyone know why when "using Unity.Services.Multiplayer" I can't create an object of type "IMultiplaySessionManager" ?
It can only be used on the server so the build platform has to be set to dedicated server.
Or you can add UNITY_SERVER to the compiler defines in the project settings
all the players are ready, how do I start the game with the players?
The host needs to switch scenes with NetworkManager.SceneManager.LoadScene the other clients will automatically sync up
okay, ty bro
What if the host quits during the game? How do I get the player back in the lobby menu?
If the host quits, then all clients will get disconnected. They will fire the OnClientDisconnected callback or the ClientDisconnected Connection Event. When that fires you can use the regular Scene Manager to go back to the menu scene
it's not working for me.
What part is not working? None of the code you posted is changing scenes
Scene change works and the players are thrown, but if the host closes the game, the players are not thrown out of the game in the menu.
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.
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
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
the latest session returned by QuerySessionsAsync will ignore changes u done in ihostsession(or session.asHost())???
After you change session properties, make sure you calling IHostSession.SavePropertiesAsync()
https://docs.unity.com/ugs/en-us/manual/mps-sdk/manual/session-op-host#write-apis
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
You can't pause to wait for an RPC. The easiest way would be to use a NetworkVariable<FixedString> to pass the JSON to the clients. Alternatively you can use the OnNetworkSpawn() on the server to send the string in an RPC
If I do the second one what would the sort of method flowchart look like
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
You can do it this way. I don't know what all PersistenceManager is doing or what the client is doing with the JSON.
If all clients need the json then you could different things than if only the one client needs it
Essentially the JSONs are on the server's filesystema nd the PersistenceManager has the (static) ability to deserialisie a JSON to a Unity object
Every client would need their own JSON
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
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 ?
If you use the OnNetworkSpawn() on the playerobject you can pass the player's ownerclient Id to the PersistenceManager. it can then send an client RPC to that specific client.
You can use RPCs over a LAN connection
is Unity Transport (UTP) will be helpfull?
You dont need to mess with UTP directly. If you know the IP address you can either enter it directly or use something like Network Discovery to find the host IP
@sharp axle Thank you
Right, I'll use that pattern then
Thanks
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.\
It sounds like the clients are not joining the same session
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.
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?
check the example
As far as I know, Animations should still be blending on remote players. There might be issues with animation events though
Isnt this working on coroutine?
If i have many models then wont it hog the main thread and bring down the FPS
Why are you loading glb files specifically during gameplay?
Probably an events thing, i have events for the things I was concerned abt (attacking and jumping)
Im ok with it for players
but is there a better way to avoiid this for server authoritative enemies?
Just trying to load some objects before game starts and less prio items during gameplay in background
the actual implementation of web requests is native and platform specific, i doubt most platforms do the heavy lifting on the main thread
If its just waiting on downloads its not gonna hurt the framrate.
Yeah that should be completely fine when done asynchronously. You might find Addressables easier to use. Can convert those glb files in to ready to use prefabs that can be fetched remotely at runtime.
is there any way to get a real ping to the host? Facepunch
I'm getting fake ping right now.
I think that should work as it's from a generic class
I don't think the Steam Transports implement GetCurrentRTT()
The next best way would be to look into the PingTool
how do I download it?
Easiest way is probably to clone the repo, then copy the PingTool folder from the Examples
you can't get through this?
not with FacePunch
😦
I don't see any downloads here.
You’d have to clone with Git or GitHub. Or there are also websites that will download repos for you.
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.
it won't work with Facepunch?
Nope. I just showed where the the Facepunch Transport will always return 0 from that. There doesn't seem to be a way to get ping through Steamworks.
It's sad, but will what you're throwing in there work?
The PingTool? yea. its using RPCs to get the ping times.
I guess there is this but no clue how or if it works
If you need ping information straight away, wait on this. It will return
immediately if you already have up to date ping data
I only downloaded the tools folder.
did you use it yourself?
I've used it before. if you downloaded the whole example, it would have included the Network Stats Monitor
The Runtime Network Stats Monitor (RNSM) is a configurable component to display various network stats in an on-screen display at runtime, including stats from the Netcode for GameObjects (Netcode) package and custom, user-defined stats.
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.
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
Same as PingLocation.EstimatePingTo, but assumes that one location is the local host.
This is a bit faster, especially if you need to calculate a bunch of
these in a loop to find the fastest one.
I checked with another dude who lives far away, still shows a crooked ping.
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
What library are you using?
Just netcode for gameobjects right now
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.
@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
@ashen meadow you would use this in the SendChatToEveryone function, not the SendToServer one. The way you have it now would just prevent anyone from sending their chat to the server.
But regardless of all that, I wouldn't worry about any of these checks for what you're doing currently.
Are you sure? The chat is working right now
Only the host will be able to send messages.
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.
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
You have two references of SendChatToEveryoneRpc. Where is the second reference?
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.
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!
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
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 🙂
If it's just about relaying data, the pi can probably handle quite a bit. Most of your resource utilization will come from simulations and other server side functions. But just syncing data? Probably it can handle quite a few players.
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 😄
Sure, but it also depends on how you write your server. Running a Unity instance as a server will be a lot more resource intensive than having a barebones server written in Go for instance
ok, can you recommend some ressources for me to research?
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.
alright, thanks, ill look into it 🙂
Here's one of my favorite resources if you're looking into multiplayer networking more broadly
https://github.com/0xFA11/MultiplayerNetworkingResources
damn, thats a lot (to be expected :D)
thank you very much, this ll probably take some time 🙂
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
This might be helpful
https://discussions.unity.com/t/does-netcode-for-gameobjects-have-offline-mode/863780
They talk about switching transports at runtime. Essentially your singleplayer mode would be a local session where your player is the host, and later on if you want to open it up you switch the transport to whichever one you use for networked sessions.
Yea, the easiest way to do single player would be start the game as host connecting to localhost. All spawn logic would remain the same. A new Single Player Transport was recently added to the latest NGO 2.0 version.
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
If you are not seeing the prefab in the hierarchy then its not getting spawned. Are you spawning it manually? or are letting the network manager spawn it automatically?
at first i let the network manager spawn it automaticlly but that didnt work so then i tried manually and that still didnt work
There is no reason for the automatic player spawn to not work. Unless the prefab is disabled.
or the network manager isn't actually connecting
idk whats happening then
throw a network object on a cube and see if the same thing happens
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
[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
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
what are these errors related to?
I would use NetworkObjectReference here. Then on the server reparent the network object after you spawn it. I believe as of the latest NGO version, the owner can reparent the object
Brief explanation on using NetworkObject and NetworkBehaviour in Network for GameObjects
Thanks! I had no idea you could do this, i thought i had to manually search for the network object each time, its very cool than you can actually pass them into server/client rpcs!!!
Also i dont do parenting because the tools have their own networkobjects, so they cannot be children of other networkobjects, in this case the player.
(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
help bro
Network Objects can be reparented after spawning. You just have to call NetworkObject.TrySetParent after spawning
A NetworkObject parenting solution within Netcode for GameObjects (Netcode) to help developers with synchronizing transform parent-child relationships of NetworkObject components.
your networkprefab asset has a null entry if i had to guess, which means theres a missing object
networkprefabs is a thingy in your folder
no clue where those network prefabs are. But unity thinks they are invalid for some reason
double click on the networkprefabs thingy right there
then click minus
Thank you. Why is that? I just updated the engine.
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
It's just, it didn't happen before, it happened after the engine update.
🤷♂️
I didnt think it would even let you add a object there without a network object attached
Who knows how I get +- correct ping to the hoster I use Facepunch
You can use Ping/PongRPC . NetworkManager.LocalTime.Time - NetworkManager.ServerTime.Time should also give you a rough estimate
Okay, thanks. I'll give it a try.
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
A tool for sharing your source code with the world!
nvm i just found that the problem was i was trying to join a session from the same computer
Is there a way to change tick rate through script?
There is NetworkConfig.TickRate but I don't think you can change this after starting the server/host
Yes, I only want to change before starting the host. Thanks I'll use it
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
Are you spawning players directly on the ground's Y level?
Usually helps to provide some buffer between the spawn point Y level and the ground
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 🤷♂️
You could also try disabling your gravity logic until OnNetworkPostSpawn?
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 🤞
Is it better to run one game server (GS) process on one VM, or many GS processes on one VM?
Depends on how you are paying for your VMs
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
Ic. Basically if it’s cheaper to scale horizontally, then 1 GS process per VM makes sense. If it’s cheaper to scale vertically, pack multiple GS processes on same VM. Any nuances to make note of?
Just whether the hosting provider can scale the servers automatically for you or not. And if/how you get charged for sudden usage spikes.
Seems like it’d be more commonly cheaper to pack one VM with many GS processes. Was checking some stats and depending on the game type, you can scale to hundreds or thousands of GS processes. I specifically asked for AWS resources but YMMV.
What hosting service(s) do you have experience with?
I've only used AWS, Multiplay, and Azure Playfab. You are not getting that many Unity servers running on a single VM
Why do you say that?
A Unity Dedicated Server uses a lot of resources, even stripped down to no graphics.
Reran calculations using 60%-70% utilization expectation and found that the more realistic estimation is from dozens of GS processes to the low hundreds of GS processes for common AWS instance types. That was helpful to think through 🫡
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
its fixed lets go
How i can made a central server for my game? Using mirror
You are going to have to be more specific.
Main server
Do u know what is that?
any way i can call PhotonNetwork.Instantiate without using room objects or the resources folder?
I know how to start as a server. But I don't know what you mean by "Main/Central" server
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.
i downloaded PUN2 but when i press open in unity i dont see the asset in the package manager
PUN2 is way out of date. You should probably be using Fusion 2 at this point
ok
moderator already remove post in question
😄
they are like robots
they never talk to us

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.
There are endless ways to do networking in Unity and choosing how to do it almost entirely relies on what your game requires and your personal preference. You should be able to find a handful of popular solutions just by Googling or searching on YouTube.
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?
That would be one of the later steps of doing multiplayer development and again depends on which solution you plan on implementing.
What do you mean by which solution?
here is my own solution my own vps server?
I'm referring to how you would actually implement multiplayer networking in to your game. There are plenty of low-level and high-level frameworks/libraries you can use. They all have their own way of connecting to remote servers.
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?
Most of them are free. People here commonly use Netcode for GameObjects, Mirror, Photon, FishNet and a few others.
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
When using Network Rigidbody, the host/server is the one that handles the physics. If you want physics to be handled locally, you can look into using Distributed Authority.
hi, i develop an rpg and i have no clue at all about networking. whats the best to start with networking for mmorpg?
Ohh I'll check that out
First, you need to drop the massively multiplayer part. You are not making one without a large team and a huge budget.
Second, pick a network library and start some tutorials. I use Netcode for Gameobjects and recommend the CodeMonkey multiplayer course.
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?
all the modern network libraries are broadly similar.
there is Mirror ummorpg which costs a lot. I doubt that any open source networking solutions can reliably handle that many connections at once. I`d look into separating big regions of the map into small ones and having each one a separate server, like Foxhole did, though this will skyrocket server cost.
I meant the modified Mirror of ummorpg, sorry if I worded unclearly
understand, thank u sir.
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?
That is called client prediction. As long as your bullet calculations are deterministic, client and server will have the same results. Ideally, you would handle Rollback on the clients in case of any mispredictions
unity got way way way more choice u can think of , and honestly i do not recommend you to implement ur own backend from scratch unless ur solely learning or really know what to do
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
Thats a good point. I don't think any of the Unity Game Services have servers in China
i think the most difficult part is ensuring all the network routing is fully inside china
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
- u must register/setup a legit company in china
- 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
- 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
I living in Turkey. Do you have any information about whether there is such a rule in Turkey?
why would i lol, i live in hong kong
welp all i can say is u need to do research urself
OMG! Is Hong Kong in China?
I thought it was in Thailand
🤨
lol
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?
Scene objects should not be destroyed. If it need to be dynamically despawned then it should also be dynamically spawned.
Got it, so itd be betterto just make an empty that immediatley spawns my object if I want a despawnable scene object?
If it needs a spawn point, yea
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
You should check out the DOTS Character Controller sample. Its got 1st and 3rd person controllers. it takes a little bit of setup but works really well
Thankyou, appreciate it
Anybody here familiar with Photon Server?
fholm works for Exit Games but I don't think he's involved in Photon Server specifically
I know photon server decently, worked with a fair amount
Has anyone started looking into the new Unity Multiplayer alpha? https://github.com/Unity-Technologies/multiplayer
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.
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?
See https://unity3d.com/partners/google/connectedgames The most visible work done available through the collaboration at the moment is Open Match (https://github.com/GoogleCloudPlatform/open-match).
@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
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 ?
@warm geyser no i'm not, i'm the guy behind photon quantum
ah sorry, I made it wrong, good project anyway, Quantum is also very promising
or well we are a team working on photon quantum, but it's my invention/original code it's based on
but the price to access it is not cheap at all
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
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
@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)
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
also i have no idea what the license for the true sync code is, as I never dealt with that
oh it can be used with PUN plus license normally
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.
@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
oh okay, thank you!
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
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
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?
Seen this one yet @glass bobcat ? https://github.com/MFatihMAR/Awesome-Game-Networking
Yup I have it bookmarked, p sure you sent it to me on the C# server last time :^)
Didn't i send you the Unreal Engine one?
I have a book for that one
i like the framework
it does just about everything for you lol
Didn't i send you this one: http://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf
that's the one I have printed
https://www.oreilly.com/library/view/multiplayer-game-programming/9780134034355/ This one was also pretty nice
i'm building my own lib, I just need pointers on what's "standard" for devs, like the normal patterns and stuff
oooh nice
@glass bobcat low lvl UDP or higher level stuff?
oh hey @graceful zephyr, it's been a while since we talked ^^ I like both as long as it's UDP
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
@glass bobcat This guy has a bunch of great articles on the subject, https://gafferongames.com/
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
look at glen fiedlers repo on github
netcode.io on github
that has a good socket impl
👌
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?
you mean this one? https://github.com/networkprotocol/yojimbo @graceful zephyr
@vital hawk https://github.com/networkprotocol/netcode.io
oh I thought you meant two different things 😄
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.
@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
Alright
Hi! Anyone knows if using an WWW request in a web with https automatically encrypts the data sended/received?
does the new TOS stuff that hurt SpatialOS basically ban any form of unity based dedicated server?
Blog post: https://improbable.io/company/news/2019/01/10/unity-blocks-spatialos
I don't know how many hours I've sunk into these projects and the...
all the TOS language is worryingly vague
"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.
yeah if you take it at face value it seems to imply you couldn't even sell your game on steam
So I guess it also makes sense to decouple your networking / backend as much as possible from Unity.
No it does not basically ban any form of Unity based dedicated server. There will be some public clarifying language later today
Thanks for the update.
@small fulcrum thanks
Will it be posted on social media like Twitter?
I honestly don't know what channels it will be posted through. I expect Twitter. I'll post it here too.
I'll just continue to work on my now multiplayer again game then 🤔
neato
Guess I'll as well 
When we have an update to share with you regarding SpatialOS we will make sure everyone in the Discord knows where to find it.
right now people are panicking so hope this will get clarified soon
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
Our projects are multiplayer games so... we are on the tightrope right now
we were working for years right now on them
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)
I don't think that will be affected because its local
the problem is that the stuff says "over the internet or other network"
"network" is a pretty broad term
ugh
right?
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.
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
Unity didn't make the post. So how can they be held liable for it's verbage?
im referring to the ToS change's verbage, sorry.
They wrote the ToS
I was referring to the blog post and Reddit post that made everyone aware
ToS last updated December 5th
UPDATE: Lazarus is back up.
We're not quite sure what's going on - we were told that access to the servers would be revoked by 2:30pm today but it seems that's not the case.
Until either the servers are forced down or we’re told to turn them off, we’ll keep Lazarus l...
what's the difference between LiteNetLib and libgren
I'm not following the networking threads right now but does Unity just banned every third party multiplayer solution out of nowhere!?
They're working on an update to provide some clarification
@vagrant gazelle no they didnt
@vagrant gazelle that's what people panic it's about
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
people don't really know how Unity meant it to be interpreted
if that ain't the legal system in a nutshell
whats the difference@graceful zephyr
i said
because lidgren is old and outdated, is horribly and overly complex internally, has a very wastefull ack/nack system etc.
think folks misinterpreted your comments as being TOS related
oh TOS?
or atleast I did
I googled it to try and figure out how it could possibly be related
potentially need more coffee over here
Blog linked in #497866432277643275
👍
👌
The blog post 100% contradicts the ToS, problem being the ToS is a binding legal agreement and a blog post is not
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
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 😄
I have no idea what's going on...
i've seen the term Networker a lot in networking libraries, what exactly is a networker?
Like a librerian

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
i get it, but I will need more details :^)
@glass bobcat there's no well defined meaning of that term
@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
I have a idea
Why not use it on the documents
That's what literally everyone wants
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
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
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?
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
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
They simulate at the same pace usually
Usually a fixed tick rate like 60
And they both stick to it
what about low tick rates
does the client really simulate only 20 times per second?
i mean, it might not be that noticeable actually 🤔
Nah that's usually decided in code and fixed for both
But sure it can
If you want variable tick rate
Depends
@glass bobcat generally yes correct
thanks
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.
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
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.
Okay so it's third party or wait for unity to catch up because we no longer believe in p2p
p2p meaning, specifically relay server?
or actual person to person (cos almost nobody does that)
I mean, unity wants us to move away from p2p and into dedicated hosting only?
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
I have no clue what I want I just wanted to see what the process looks like
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)
peaches.
I wouldn't touch UNet though, it's simply not good enough IMHO
thanks for the info hippo
np
Can probably migrate later since PUN is kind of a basic and well known approach
@compact bramble hey fun to see you here o/
hey you too 😃
@compact bramble whats up
been seeing you around on the ecs forums
i dont post super much myself there tho, but read most things
Yo, I'm just developing as usual, same old. how about you?
@compact bramble ditto, networking code as always
working on photon quantum, fiddling with my hobby libs, etc.
the usual 😛
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...
@compact bramble quantum has been/is great, we dont promotive on asset store or to hobbyists really, just focus on studios/aaa
Yeah understandable since you get paid then 😛
its my invention, and we turned into a product together with the photon guys
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
custom physics since physx isn't deterministic?
thats getting addressed at some point, right? 😛
@split crescent not just that, physx doesnt support predict/rollback either
got it
so both need to make it deterministic AND be able to predict/rollback the entire game state
It looks good but does it qualify as a platform? Photon should be talking to Unity in light of the recent SpatialOS fiasco
@compact bramble we only host the relay servers
OK then np there
like we always do
very interesting on quantum - thanks for sharing
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
This seems like an absolutely enormous undertaking creating a networked deterministic physics-based engine, basically
yes, it was :p
what's your target deploy? .net core?
@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 not as gross as mono 😄
So it's definitely a separate product, and not an evolution of PUN?
@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
What does the code look like to get something moving (from the customer developer POV, not yours)
but its not going to replace pn
@compact bramble how do you mean?
like creating a sphere and pushing it around?
yeah!
2 sec, let me bring up github
I'm just vaguely curious how it looks
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
FPVector => fixed point?
ye
hand rolled to the t
cool
full deterministic math lib, all math functions, massively optimized
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
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)
iq has a nice blogpost on rationals if you want to read through it : https://iquilezles.org/www/articles/floatingbar/floatingbar.htm
(and yes it sounds a bit like Unity's ECS but nothing stops you..) 😃
@split crescent no thats just a box collider
got it
big difference vs. unity ecs is that
- 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.)
- our job/threading system is not as good :p
also since agian, its not a generic for any type of game framework
How long have you guys been working on quantum?
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
cool
a lot of weird problems to solve when you're trying to a lot of players in a deterministic predict/rollback environment
yup
Have you (or anyone else) been in touch with Unity as they've been fleshing out V3 of their networking libs?
The alpha is available
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
1024
@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:
- 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
- those that cant use it.... well yeah.
so in above, do you have traditional GameObjects w/ transforms in the view that are observing the underlying model representations?
dont judge the code for that spacegame too much, it was built in 3 days to try to push the limits
or are you taking a diff approach to draw?
@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
It would be creating an ECS world to handle the data from your own ECS implementation
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
ah cool
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)
It will take Unity quite a while to make ECS versions of all their current functionality
I can serialize and dispatch 100k entities out to the network in like 1 ms
which is pretty fucking good lol
not for your internet connection 😄
@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
its usually also a decent amount of hoops to go through for the stuff that you can solve
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
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
@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
ah
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.
yeah that makes sense
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
i dont know, they may put abstraction layers on top for the average user too
yeah
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
"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.
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
I never published to begin with. I knew. I smelled it.
got one just this morning
I mean who better to contact 😛
no wait... its almost 4 years since they bought it lol
may 2015
so yeah
never. again.
Well thing is at least with Quantum they can get both an answer and no answer at all.
We have about 50 studios atm working on games in quantum
some larger studios like ubisoft
wow thats more than I expected
some smaller indie shops
That's a lot, way more than expected. I'm surprised because - it's a lot of trust for something unfinished.
quantum isnt unfinished :p
ECS is not a finished problem 😛
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.
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)
@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
"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
well so the thing is right
because its deterministic
there's no networking code to write 😛
thats the whole selling point
This basically seems like the same thing Unity wants to offer, from what Unity's said publicly so far, under the "by default" thing
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
I think determinism for ECS shouldn't be an issue
@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
but yeah prediction and rollback are a different kind of challenge to shove into something like it
and potentially quite expensive for a traditional approach
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
Well the concept that it basically needs no networking code puts it on the radar for practically any realtime mp game.
@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
No 3D physics is a bit of a blow
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
This is something people should be looking at when they begin the game's development
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
This is a year old but still exciting: https://www.youtube.com/watch?v=b9T-k-R7rKs
This video demonstrates how Photon Quantum's revolutionary deterministic networking engine powers a zero-lag multiplayer online experience. The screen-record...
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.
sweden to brazil is impressive in what looks like no latency
https://steamcdn-a.akamaihd.net/steam/apps/256666769/movie480.webm?t=1468310068 heres the first game they built, in about 2 months
Usually one does not even bother talking about gaming that far apart online
@compact bramble yeah it offers insanely good performance even over high ping scenarios
@compact bramble this is the space game with both players having a ping of 500 ish
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?
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)
@compact bramble ah nice, like third person rpg or top down sort of thing?
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" 😅
We used Photon, and later on, Quantum SDK for our PvP title
You can try it out @haughty vigil
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?
TCP
@midnight tree i don't think you can just "try out" Quantum 😃
yeah it's a noob engine anyway (just kidding @graceful zephyr ) 😃
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
i mean it is technically a noob engine
thats why its so attractive
just make yo game
@haughty vigil https://github.com/Unity-Technologies/multiplayer/blob/master/com.unity.transport/Documentation/TableOfContents.md
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
}
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
i'm honestly not sure yet
would you be sprinkling those all throughout the codebase?
Probably
mm, i'd have to think about that. i guess it depends on how much overlap there is?
I think that for testing better way would be to create a tool that starts a server as soon as you enter play mode
yeah that's probably true
I think that FPS Sample has something like that but in more advanced form
yeah i had taken some of the game loop ideas from it, but the project tools panel was pretty over my head so far
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
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"
yeah, i think i'll have to give it a shot
Try Process.Start(...), that will start an executable (even with parameters if needed) as far as I know
will do, this'll be my first editor extension so gotta read up on the ol' docs
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
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?
I think you need your own server, you can use Steam Cloud or Google Apps
im following this guide here, im not sure how much of this i should be understanding as a week 1 unity user
Simplify your problems with One Calc - simple scientific calculator made with YOU in mind: https://play.google.com/store/apps/details?id=com.resocoder.onecal...
Will Photon Quantum eventually support 3D?
@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
cool - thanks!
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
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
thanks a ton, I'll keep all that in mind
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 🤔
@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
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
Protobuf will generally serialize/deserialize significantly faster than JSON
@graceful zephyr presumably with no height?
@split crescent no height?
sorry, potentially a dumb question - it's a TPS, but presumably not full 3d
i.e. doom, not quake :p
@split crescent no its full 3d
@split crescent don't know if it'll scale to 100 players
got it
@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
cool - appreciate the context. No sweat if you can't 😃
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
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
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
@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.
gotcha, thanks for the input. i will have to start testing all of these out
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
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.
when i stopped worrying and accepting that, started finishing 😄
thanks guys 😄
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!
is it predominantly a co-op experience @stray knoll ?
well in fact is a coop only experience
@stray knoll i'm not sure bolt is a great fit? almost everything about it is optimized for competitive play
one huge downside of Bolt is it ships in precompiled DLL
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
Hmm... you have a point.
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
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?
@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)
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
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
I get it better now. Thanks a lot!
Anyone here ever used https://github.com/RevenantX/LiteNetLib and can answer some nooby questions, mostly in regards to their NAT punch sample?
unity new networking instead of unet this is in alpha right?
unity new networking instead of unet this is in alpha right?
yeap
@weak plinth third party solutions
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
Yeah I guess lol
well there's 800 lines of C# on github if you want 😄
I'll take a look 😛
@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
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 :\
Anyone knows if using UnityWebRequest with HTTPS encripts the communication?
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
Okey, thanks!
Is making your own networking lib a bad idea?
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
what about experience wise?
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
Aight
it's one of those if you have to ask then its a bad idea
@compact bramble lol
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?
maybe fix the logging first and see where that takes you? sounds like whatever indicates that it's saved also has a bug
ugh, sorted it out. it was to do with coroutines executing out of sequence :p
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
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)
I only use em for minor stuff, like when waiting for an async task to load
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 ❤
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
@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.
And by using something someone else made, you have the option to learn about things as you go/the hard way 😛
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?
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.
@glass bobcat I dont know what a 'base' means
There's generally 'three' pieces to a networked game
- Transport (socket library)
- Networking Higher Level API (i.e. Bolt/Forge/Mirror/UNET)
- 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.
aight
sounds good
Also @graceful zephyr if you don't use deterministic lockstep for a first person shooter, what do you use?
@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)
i knew about how CS does it, dunno what eventual consistency is
@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 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
you still have the whole client prediction/server reconciliation thing right?
in rollback/predict? no
