#archived-networking
1 messages · Page 47 of 1
I have very little dunning krueger about me so I prefer not to
sounds like if I just use bolt it'll be taken care of one way or another
Afaik yes, check with stanchion for the latest on all of this in relation to bolt pro, I don't deal with bolt anymore on a day to day basis
Gotta put the kids to sleep now
Back later
thanks
bolt pro sounds like a thing "ask for pricing and we give offer based on your project"
Probably :) I'm not worried about it, Photon needs to be my friend for very obvious reasons and vice versa. I think it's nice being friends.
It's why Sony's stuck with me for half a decade: sometimes its good to have people around who can reach a lot of people and who are not malicious
I don't hide anything including intentions, honesty is best.
@graceful zephyr Some reason I thought you were still developing on bolt, even though I know you've said you sold it many times. The documentation is bad though. It has some examples that say, 'use this to do such and such' and the naming is so obscure it doesn't even make sense. Then when you go look up the method in bolts API there is no information on it what-so-ever. That's what I ran into regularly while trying to research bolt (not long ago).
eg they have custom methods that only call on the master/server, and all these messages do is an 'if owner check' before being called internally.
but there's literally nothing showing if they are run on fixed update, update, lateupdate
just that it magically calls at some point
Oh, the method was "SimulateOwner" which runs on FixedUpdate. The only way I was able to find out though was a direct answer from stanch. It's not in the API anywhere; a lot of stuff isn't.
@indigo current that specific thing is in the docs https://doc.photonengine.com/en-us/bolt/current/in-depth/update-loop but yes your overall point still stands
Networking middleware for Unity 3D and realtime multiplayer games and applications. Get started without having to know the details of networking or write any complex networking code.
Yet if you google "SimulateOwner" that page never comes up, or at least didn't for me.
I was able to find the example page and the API page, neither mentions what it does.
Not really trying to argue here, like I said I have not actively worked on bolt for a few years
I know.
I work on quantum now
Bad documentation is just a huge turn off for me, especially when it's something large as a networking solution.
I don't see bad docs myself but I am working on this from monday so we'll see
Is there anyway to ease this behaviour?
(box collider flickers while moving into another box collider on a NetworkBheaviour from hlapi)
right so Unity's networking - the new one - dots based?
No, Unet
UNET DOTS ?
For anyone using PUN2/UNET/Mirror I have a new beta release of my Transform and Animator sync posted. Anyone who can test it out and give me feedback, I'll give access to the final once its on the store.
Can I try it with Bolt?
Nope, bolt though has all of its own stuff, largely what a lot of this was based on
I learned networking from fholm
Are the bolt transform and animator sync components not cutting it? @fading pawn
Nope just curious what new stuff people are doing
Basically much of what is missing from the other Libs, but Bolt is generally pretty complete.
neat
Which multiplayer solution is a good fit if I want to create a 4 player peer-to-peer co-op game?
Bolt
:D
Honestly though if it's peer to peer then I think MLAPI or Bolt from my research because both have direct connection capability
(both free so try)
LiteNetLib
@jade glacier No source files found..
Not will there be. The release is all there is, but it's all c#
This isn't open source, it's beta.
@indigo current
Oh, meh.
I was curious to see the inner workings.
Have you benched yours against the stock for network cost differences?
No need to bench, it's a fraction by nature
All bipacked, and they share a write per tick
CPU use is likely higher from the bitpacking
So you pack multiple transform data then send it all together to maximize* compression and reduce sends
As well as animator data
The whole NI backs them all in one byte[]
Mobile typing
Can't keep up with this phone bad guesses
To be honest, I don't see the point in debugging someone else's work when it will ultimately become a paid asset.
How much do you plan on selling for? And you mean the paid version will be free to testers?
No clue yet. It sounds like you aren't really a candidate for using it. I would just disregard all of this.
You know how to do this stuff already, just make your own really.
I was asking because I might make a run-through of a networked game being developed (not a tutorial series) and was considering using it. That wouldn't be for at least a month though.
that's not really the reason to buy things in all cases (if you can make it on your own)
you still learn from other solutions or simply save time
Yeah I mean, if it works I'd have no complaints using it. But I want to know what I might be potentially be showing my viewers.
It's there if you are curious... The work involved is literally just dragging two components on to an object
The code is exposed
It's not open source though. So I'm not making a git... Because that says the wrong thing.
I understand.
Does it work with the serialization rates set by photon?
eg if I increase/decrease my serialization rate in photon settings will your script follow the rules of those changes
It currently works on fixed update... Specifically post physx
I'd probably make it work using serializationrate at least when working with PUN
The default rate is every 100ms.
It's tiring to not forget to bad networking practices... Like default rates
Trying
Ok, getting laptop, this phone is hopeless
haha
I wouldn't blow the photon settings out of the water though; that's kind of counter productive
users might intentionally serialize less.
I will be adding in the SendEveryX thing my other libs have, but that is phase two once I get this solid.
Heck, I usually drop mine to every 250ms and use in/exterp
its not a lot of work, but it will take me a week or so.
yeah, its not every going to be time based
I am repulsed by the adhoc time used by UNET/Mirror/Forge and PUN
and no component I make ever again is going to contribute that that
simulations belong as fixed based
net send rates should be a factor of the physics rate, or whatever simulation rate is being used
if youre sending stuff every fixed update i imagine the network is going to take a beating
I'd strongly recommend following the API pattern or at least supporting it
For this test, it is sending at a high rate if your physx tick is high yeah. The final will send every X
never.
Normally I would love the debate, but I have a pile of work on this to two and 2 days to do it
so if I seem short I apologize
but I am very firm on how bad time based networking is, and it works counter to EVERYTHING my core library is working to avoid
Without inspecting your code, I don't fell as though it would be hard to implement.
bool _useFrequency;
float _frequency = 1f / PhotonNetwork.sendRate;
float _nextSend = 0f;
void Update()
{
if (_useFrequency && systemTimeOrWhatever >= _nextSend)
{
_nextSend = whatever;
SendData();
}
}
void FixedUpdate()
{
if (!_useFrequency)
SendData();
}```
Not super hard, just not on my roadmap at all, since the entire thing runs off of a timing singleton
Sending stuff on each fixedupdate is just silly
In my videos I show how to utilize the sendrate to your advantage
If your asset just completely ignores sendrate I believe you're right in that I cannot use it
it is absolutely not for you
Huh, you asked for feedback
You shouldn't even write it for PUN if you arent going to actually support the internal mechanics, to be honest
you say yours is inherently faster because of how it works but you never benched it, and given how frequently you send data I'm not sure that's even true.
poor choice of words on my part. I meant uses less bandwidth.
uses less per tick
right now I don't have the factional tick implemented
I wanted to make sure it works on all edge cases first. That part I have done in NST and reducing it to every X isn't a big deal, its just time spent that has to wait.
It will operate on fixed timings, because the nature of what it is. I don;t have the descriptions up so I would have to type it all here
but its basically putting everything on a unified simualtion based frame buffer
It is geared toward simulations tied to the fixed. I have no plans for making it conform to UNET/Mirror/PUN serialization rates because that will break the very nature of what it is
and will have me coding in core timing logic that I do not condone
I should step back and be clear, I am not making any of this for profit
shrug
I make these assets for my own use on my server auth system. I share them because there is a desperate need for better networking in the Unity world. I only charge for them because I tried free assets on the store and it brings out the worst people.
I like the compression and send at once idea, don't like that the user has no control over how often data sends
I'm not being a dick... just saying... what this is ultimately for isn't for what you are doing
You can pick it apart, and rework it to your timing
the serialization of each component is exposed and very clear
but I cannot and will not support adhoc time based usages because I have no interest in doing that... and because users of photon and unet need to stop doing that and learn what a simulation is.
I know I sound dickish, but this is part of a longer frustrating constant battle in these channels between the right way, and good enough.
Maybe when I get time I will circle around on that, but right now... nope. The next iteration will send every X fixed updates and that is the end of the line probably until fall.
A little janky from the screen cap software, but this is with every 3rd fixed update sending. So a fixedTime of 50 per sec, and a net rate of 16.6 per second.
I still don't get it, why send anything network related on fixedupdate? that sounds like one doesn't understand how fixedupdate loop works.. you can have 1-3 fixedupdates per frame on the same main player loop and the execute within milliseconds of each others, there's no real time between them at all
it sends post physx
of course if you have typical 50Hz physics and 60 fps lock, it's not that bad but it's still silly concept
its tied to whatever the simulation is, and the assumption is anyone networking is using fixed as the simulation timing
like, after all fixedupdates are done and not for each fixedupdate?
the adhoc send rate thing is just a sloppy handling of simulation (or lack of it) by Unet and PUN
serious engines like Bolt and AAA titles DO NOT do that
its all a tick based simulation.
In Unity, the simulation that is built in is PhysX
but any simulation is applicable
if you just alternate between fixedupdates to throttle, you may end up with some frames that don't send any packages at all and then have some (rendered frames) where you send multiple
fixedUpdate is pre-physx
there is no post physx timing, you have to create it yourself
if you are only moving your stuff in Update, then yes you will get some oddball fixed sends
you shouldn;t be running your sim in update though
I don't mean that at all
The entire basis of the library is a tick based simulation
I mean that you are ultimately sending extra packages where it doesn't matter (there's only 1-2ms between fixedupdates that run on same main loop run
so sending packages for each such is just silly
if your networking has no concept of simulation timing... then this isn't really for you
if you try to use this on a simulation-less game that is doing its stuff only in update, then yes... its a mismatch and not the solution you want
you know fixedupdates really don't run at fixed time intervals in realtime?
I get impression you don't get my point here 😄
I know exactly what this is and why, I am saying it is not for you if you don;t; use fixed as your sim
you are asking about a case where you arent using fixed as your simulation timing
and yes, for that ... do not use this.
I know fixedupdate and physics inside and out, it's what I do and have done for years alone
great, then we are on the same page
If you don't use fixed for your simulation... then this is no good for you. We agree.
all I'm saying, there's really no reason to send network updates for things that will get new data within few ms anyway if you only use the latest data received to sync things
its a simulation
you just add traffic for no good reason
this is a state based simulation sync
same as Bolt
only its simplified for client auth
there are deltas in the compression
its not sending full uncompressed garbage, but it does send every tick
even if that something is just a header and a bunch of 1 bit pools saying "nothing has changed"
I get what you are thinking about trying to cull frames because two happened before an update, but that already gets handled by delta reductions if you are using them
the point of a state based is that it sends a very regular stream of updates
It is possible if you expect crappy refresh rates to send flags of merged packets, but that is a lot of work for serializer to deal with.
But yes, it is possible to detect when a post fixed is happening if its going to be followed by another that update... that you could cull the data and mark them as merged or something
but I won't' do that, because this is me sharing code from my server auth
and the serer auth can't have that
states are concrete and not fluid, because they need to be concrete for determinism
Which comes back to again.. if you know how to do this stuff... do it.
I am sharing this for people who have no idea how to do animator or transform syncs
and who find the unet and pun ones to be lacking
You are not the target audience for it
does anyone know why the blocks are spawning twice if i have 2 players? if i have 3 players they will spawn trice and so one
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
public class BlockSpawner : MonoBehaviourPun
{
public Transform[] spawnPoints;
public float TimeBetweenSpawns = 1f;
private float timeToSpawn = 2f;
void Update()
{
if (Time.time >= timeToSpawn)
{
SpawnBlocks();
timeToSpawn = Time.time + TimeBetweenSpawns;
}
}
public void SpawnBlocks()
{
int randomIndex = Random.Range(0, spawnPoints.Length);
for (int i = 0; i < spawnPoints.Length; i++)
{
if (randomIndex != i)
{
PhotonNetwork.Instantiate("RoadBlock", spawnPoints[i].position, Quaternion.identity);
}
}
}
}```
here is the code
yes
oh on an object i mean no
What is block spawner? and why is it a net object?
the blockspawnner is an emptygameobject and it has this script with 5 spawnpoints and the spawnpoints instantiate a block every 4 secs
So why is that a punbehaviour?
I dont see enough to answer your original question, but what I see there is a net object... spawning other net objects... which is a bit odd
so it can spawn the same blocks for each player
it needs to be a networked object for that?
yes if i remove it the blocks are defferent for each player
There is no netcode in that class you posted above
not related to your problem probably, just saying that that seems a bit odd.
i have a thing from the asset store that is called photon and i provided the ability to use the monobehaviourPun
yeah, I know what PUN2 is
just wondering why this script is a punbehaviour, there is nothing going on in it that needs to be networked
it probably is harmless, but indicates you are kind of just guessing here
oooh you mean that thing uhm i am new so idk what i am doing very well
What you probably want to do for what I think I see here, is that when a block is created, it should generate a seed, and use that seed to generate the random stuff
then, when it instantiates, have it sync that seed - so all other clients have the same random seed and create the same randomized road segement
uhm you are talking to me, the biggest noob and i do't really know what you mean with seed 😅
Just some stuff for you to google
I can't explain it all, or I will literally be googling it, and cutting and pasting it here for you
i google it but idk what it means
but for generation of terrain using random, you can just sync with the seed, rather than trying to sync the results of the random generation... way smaller and easier
you googled "Unity Random Seed" ?
or did you just google "seed" ?
oops i google seed im dumb
Hi mates sorry for beeing stupid 😄
im new to networking and i use UMA in my project, everything is fine yet, but if i change the online cloths its just happen on the server, not on the clients, I use cmd for this, should i use ClientRPC?
Command is from client with authority to server. RPC is from server to clients
But RPC will also handled from the server or?
in the unity doc is an example about CMD, its with shooting a bullet, thats why i used cmd i thought it is the right way..... networking is hard at the beginning^^
lot to unpack there
Client player will call a command saying it fired. Server will RPC all letting all know that player fired
ahh
ok so right way is setup the cmd to do the shot on the server, call rpc to getting result (hit, blablabla) to all clients right?
and thanks for your support 😃
if you do a few tutorials it should make sense
Can i use Photon PUNv2 to create a room on the client side and in that room a world which will be saved for weeks, months(until creator removes it) like in minecraft servers. And up to 8 players would be able to join the world.
@fading pawn Would Photon Bolt be able to handle that then?
Well having dedicated servers would make it more straightforward
To make your own “Minecraft realms”
So Bolt would we a better choice.
Or if you’re thinking of something like normal Minecraft where someone hosts and others join, then it doesn’t matter
I was thinking to get the same effect just by being able to save the Room on PUN on photon cloud.
PUN doesn’t have any “save” feature afaik
Host can save it locally, that’s easy
yeah it would be saved locally
Obviously they can modify that data or cheat but that’s how it goes
Would it be the same in bolt cases?
Sure but you have more options with Bolt
The save data and simulation can be completely server side like Minecraft realms
I see now, thank you for your answers.
The software equivalent of the wild west basically.
I have a similar question: What is the current solution for online multiplayer games in Unity right now?
I want to put together a simple multiplayer game, but I do not want to use a WIP solution. I would prefer the ability to host a dedicated server on a cloud infrastructure service such as DigitalOcean or AWS, and have support for both native and WebGL builds.
In the end the most suggestions you will get for now are either something Mirror-based or MLAPI
besides WebGL, Photon Bolt would work fine as it is a proven solution and will work well with dedicated servers
And bolt doesn't cost more money unless one of the players fails to connect directly
Alright, thank you for the help 😃
pun 2:
if i have a server and a client in the same room, and a gameobject with a photon view, a photon transform view, and a photon rigidbody view, shouldn't that be enough to have the position and motion of the gameobject sync across the two games?
you don't have a server in PUN to be clear... just one client gets the "Master" baton to hold is all
Movement is not something you want to be passing through the Master, because it isn't a server... PUN2 is purely a relay environment
@untold quest
why cant i have one """client""" with different code so that it just acts as a server?
and that doesn't pertain to my question
Master is meant to be able to act as the authority over things you want a master for
on the host-client, i can't see the movement im making on the client
Again, you are using server/client speak so I am not sure you are getting what PUN2 is and does
i do
all traffic goes from each clietn, to the relay, to all other clients
i knoooow
im asking whats missing if objects arent syncing
i told you what i have
i think ive done everything from the tutorials i can see except im not doing any ui
You started with that, so wanted to make sure that was clear... there is no server/client.... but yes those components are what you need to sync clients... but you do need to tie them into the PhotonView serialization
if you want i could call you and share my screen so you can poke around in my project
that might interfere with the work I am doing right now just a little bit 😛
<-- not paid tech support, just a user of networking libs here to help others in my spare moments
i have the components i want synced in the photonview, but i dont see them syncing
they're in the same room, same level
You wired the transformview up to the photonview?
No idea then, if the PhotonView is set to serialize them, you should be getting something, unless your movement method is stomping on them and overriding the values.
what's your controller? Is it aware of ownership and such?
The master owns it?
its in the level to start with. no one spawned it
"me" isn't a meaningful term in networking
there is the owner, there is the master, and there are other clients that are neither
the host is in a separate build. im playing the client in the editor. im moving the object in the scene editor
The client you are moving it on has authority over it?
Scene editor means nothing in networking... all that matter is owner, master, client and if the client has authority or not
who has authority over objects that are in the level already?
ok
So which of these clients owns/has authority?
IsMine == true in other words
Scene objects go to the master usually
ok well then the master
on the other client
There you go
well how do i make it so that anyone can influence the object
That will break everything about networking
something has to have authority
or else it will degrade into a hellstorm if two clients try to interact with it
ok well then how do i make it so that my players can pick up and move the gun
i need clients to be able to interact with the scene lol
I would be googling PUN tutorials and cutting and pasting that here...so that part I'll leave for you to find.
But your issue is you are moving things without authority to.
so do you think it would be a good idea to transfer ownership when the player touches it?
Hard to say, people deal with this issue lots of ways - you kind of have to play around and research it a bit to see which will cause you the least problems
i moved the object on the master and it still didnt sync
trying to make an item that more than one player can interact with is one of the more difficult parts of networking... 3x harder in PUN because of the relay and non-server nature
i switched it around so that the build was the normal one and the editor was the master
If its not moving when the server moves it, then somethings wired up wrong yeah
when i moved it in the editor, nothing changed in the build
The editor was the master this time?
i should say the editor created the room and the build joined it
i can write some code to test ismine
then yeah, sounds like it
but yeah, and have it throw you some debug.log info to make sure its getting where you want it to get
actually i dont think the build correctly joined the room so i have another problem somewhere
thanks for the info
cya
if your builds aren't joining, hard code your region in settings
its a common problem for editor and builds to connect to a different region... Tobi I think was unsure why and it may not be resolved
looks like it was indeed a region issue -_-
yeah, very common. You should hopefully get syncing now @untold quest
yeah but it only works one way
i still need to figure out the best way to make the client able to move the object
from some initial research i think it might require RPCs but i dont if im right
if it requires an rpc to update the position, could i just write a generalized function such as
[PunRPC]
public void UpdatePosition(GameObject obj, Transform newTransform)
{
obj.transform.position = newTransform.position;
obj.transform.rotation = newTransform.rotation;
}
Just be aware of the latency involved
Asking the master to move is a hop through the relay, and the applied change is also a hop through the relay.
Then how should I do it? Should I just change the owner based on the location of the player?
Not sure, I haven't tackled that particular problem so I don't have a best practice to share sorry
@untold quest
Just warning you about the pitfalls of what you are doing in an relay environment. Treating the Master as a Server involves a lot of latency since everything has to go through the relay. You likely will have to get very creative with prediction.
Ok. If anyone has any suggestions let me know.
Hey guys, https://assetstore.unity.com/packages/essentials/tutorial-projects/tanks-reference-project-80165 .
Is this project using old Unity UNET multiplayer that will be deprecated or this new Multiplayer that is "coming".
Is this new multiplayer for Unity actually available? On Unity features/multiplayer page in FAQ there's a link to Documentation on multiplayer, but its says that UNET is deprecated, so I'm pretty confused about it.
Basically, I am working on mobile game that needs some simple multiplayer and wanted to use Unity multiplayer but current state of its seems confusing to me as UNET is being deprecated and I'm not sure if that new multiplayer is already ready to use.
It will be on life support for some time, they got a bit over-excited about its demise and forgot that they have no track record of producing networking in a timely fashion, or at all.
so there is no new networking system to use yet?
UNET will be there for at least a couple of years, so if you need to ship it soon(ish), just go with it
Just stick with the 2018 LTS
They are releasing packages for 2019 to keep it alive, you just have to add it, which is just a couple clicks
So the best option for now (if I choose Unity) is to implement my multiplayer in UNET but to have in mind that sometime in 2020/2021 there will be need to change it to their new networking
You can always go for some 3rd party provider like photon
HI!
We are currently using the new transport package, and testing the reliable pipeline.
We are wondering if anyone knows the size of the header added for the reliable packets as compare to the 4 bytes with the unreliable udp?
We think we found it!
Seems to be an additional 12 bytes on the usual 4
Additional question for the reliable pipelines:
Can we set up both a reliable and unreliable pipeline for the same network connection, or would we need 2 connections?
Is there a way to add the High Level API to unity 2019? I have a few projects in 2019 with the HLAPI components, but i just can't remember how to add it to a new project
Ah i found it in the Package Manager
Odd-ball question, not entirely Unity-specific, but I'm working on a client for an existing game protocol and I was wondering if anyone could share some knowledge.
I've been handed a project with every incoming packet defined as a class/struct with each parameter in order (they actually gave offsets but I'm not using them right now, headache) and I want to make a (de)serializer to translate between our binary format, and these objects.
Is there any way to like reflect the class, enumerate each property and it's type and then set that field with the message output? I did one parser by hand in ConfigurationMsg's ctor, but I'd really like to not. That sucked. https://gist.github.com/scottstamp/97e93d27741a78939f1e5d44c9964ab6#file-incominggamemessagestructure-cs-L33-L99
with the UNet deprecated is there a way to create a lan game?
unet is still available for few years
https://forum.unity.com/threads/unet-deprecation-thread.543501/
HLAPI will be released soon as a full-source package, and will be supported according to 2018LTS terms, so critical fixes will be provided until Spring 2021```
@vital hawk but it's on fix-only support
well, has UNet got new features in past years otherwise?
I switched from unet to pun2 and I have it working, but if I change one thing in a different script, it will stop players from entering the same room. Why is this happening.
My guess is it changes the checksum, and some kind of checksum checking is enabled?
@white vigil I can't think of anything in PUN that would cause that.
The only thing that determines what room you're in is what you pass into createorjoin or joinroom
There are other factors such as the room options used when creating a room but that's photon room options and if you aren't changing those specifically no reason other things should change
Ok
im having an issue with this WWW, i replaced it with unitywebrequest it then broke my .test, so i added .downloadHandler.text, now my returnedddd is now red
trying to use the asset Database Control free, im using Unity 2019
can someone please help me 😦
@little tree cause you have it twice
also, remember that UnityWebRequest is an IDisposabe, so you have to dispose it
hrmm, how do i go about that, I commented the extra line
I did that and got another refernce error
NullReferenceException: Object reference not set to an instance of an object
LoginMenu+<sendLoginRequest>d__19.MoveNext () (at Assets/LoginMenu.cs:147)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)
so confused
Anyone dealt with Pun 2?
I am working with pun 2 and I have been able to add both players into the game, but I can only see the other player from the master. How do I fix this?
Is this the proper way to do this?
private const string PLAYER_ID_PREFIX = "Player ";
private static Dictionary<string, Player> players = new Dictionary<string, Player>();
public static void RegisterPlayer (string _netID, Player _player)
{
string _playerID = PLAYER_ID_PREFIX + _netID;
players.Add(_playerID, _player);
_player.transform.name = _playerID;
}
im trying to read a string from accounts to display a nameplate
@white vigil a common problem is the editor connecting to a different region than builds... if this is the problem go into the pun settings and hard enter a region
you'll need to google past that sorry, will never get work done with the quantity of questions I get per hour
Ok
Thank you for the help
@jade glacier Even if I run 2 build and not the editor, you can only see the other car in the master
not sure, just saying that mismatched regions can cause each client to have its own room, may or may not be related
just a common issue
Are they in the same room?
like one sees the other join?
Yes
ah, then its something else
in the master you can see both but in the other one, you can only see it and not the master
What could cause that
anyone here to help pick a server for unity game?
im trying to use Vultr servers
@here
look up Game Dev League
using UnityEngine;
using Photon.Pun;
using UnityEngine.SceneManagement;
using Photon.Realtime;
namespace WildRide
{
public class GameManager : MonoBehaviourPunCallbacks
{
[Header("Game Manager")]
public Player PlayerPrefab;
public GameObject camObject;
[HideInInspector]
public Player LocalPlayer;
void Awake()
{
if (!PhotonNetwork.IsConnected)
{
SceneManager.LoadScene(0);
return;
}
}
void Start()
{
Player.RefreshInstance(ref LocalPlayer, PlayerPrefab);
AddCamera();
}
public override void OnPlayerEnteredRoom(Photon.Realtime.Player newPlayer)
{
base.OnPlayerEnteredRoom(newPlayer);
Player.RefreshInstance(ref LocalPlayer, PlayerPrefab);
AddCamera();
}
void AddCamera()
{
RCC_Camera cam = Instantiate(camObject).GetComponent<RCC_Camera>();
cam.playerCar = LocalPlayer.GetComponent<RCC_CarControllerV3>();
cam.SetTarget(LocalPlayer.gameObject);
Debug.Log("Camera Added");
}
}
}
@zinc ravine
In the unity editor, can you see two player prefabs when two people connect?
@white vigil
so the master/host can see both players?
Yes
when running two games, in the unity editor, go to the two player prefabs and tell me the photon view ID's for both of them.
1002 for the host, and 2001 for the client
okay...well...thats good...
Do you think you know what is causing the problem
so far, no
I suggest this series to look for the bugs. It's what I used https://www.youtube.com/watch?v=02P_mrszvzY&t=504s
Welcome to this new tutorial series on creating multiplayer video games in Unity using the Photon 2 PUN plugin. For this lesson, we will show you how to down...
Ok
I have looked and it doesnt make sense what is happening
Ok
Hey! So I've come to the stage where I want to add some multiplayer functionality on my project. I recon the development time of the project as a will be on the timescale of ~2 years, and hopefully maintenance a few years after that. I'm using a hybrid approach right now and want to transition to pure ECS later, with all of the DOTS stuff. So my question/thought is of what network layer I should add for now with the least amount of hassle of integration that can replaced later on when Unity has some more mature stuff. From what I've seen there is the multiplayer repo with Asteroids example, the FPS sample, or doing some simple implementation for now with free lib. Anyone who've tried out basing your project on the samples and if so the opinion on it?~
Too inexperienced to comment IMHO but I would probably avoid UNet, it's only available as a package to aid existing projects still using it.
Yeah, wasn't thinking of using UNet anyway^^
can someone help me, the server is rejecting the player. No connection could be made because the target machine actively refused it.
Googled? ^^
@white vigil I also have a PUN2 series https://www.youtube.com/watch?v=p8YQpcoaPoU&list=PLkx8oFug638oMagBH2qj1fXOkvBr6nhzt&index=2
@zinc ravine I've worked a lot with PUN 2. I have a series (see link above), what questions did you have?
@indigo current Yeah, I've been having some tough jittering problems between clients. It all works properly, but the rigidbodies on the characters are quite...laggy looking I guess.
Set the rigidbody to kinematic on non-owning clients
Do they jitter without the rigidbody? Are you certain its the rigidbody causing jitter?
I do believe so. Because clients are perfectly fine moving their OWN characters around, so I know it's a network issue.
I am using hingejoints on the player...could that be it? There set to certain limits to not let the characters arm..bend backwards for isntance
what component are you syncing movement with?
and youre using both a transform view as well a rigidbody view?
afaik yes
I use the classic with estimated speed. it tends to be more accurate than the new one. Not sure if it plays nice with rigidbody view
the joint restrictions may be causing issues as you suspect
given the rigid views sync velocity its entirely possible something is overshooting and then resetting
okay, so what should I do? if not client, disable limits?
Id first determine if thats the issue
true
maybe remove limits if not client to start, if that solves your problem then you know what to do
Im heading off, let me know what you find out please
I will
Also, another thing. i'm trying to use RPC's to activate an inventory object. @indigo current But it's not working.. I'll show code in a sec
Anyone interested in GameLift want to try an example of using it in Unity?
hey i know you
o hay
Can anyone help me figure out why my players are jittery in game over clients?
So, Unity has tagged its UNet system as obsolete without first providing a built-in alternative; what's the best alternative for LAN-only networking, aside from using standard C# functions?
Im trying to understand how the UNET system works, anyone got experience with it?
So far from what i understand and have working, i can give GameObjects a NetworkIdentity and make each client have Authority over their GameObject.
This makes each GameObject with a NetworkIdentity live on both the clients and the server.
Now the client can then call Commands on their own GameObject, which will execute on the same GameObject but on the server.
What i can't seem to grasp yet, how can 1 client call a Command on its own GameObject and on the server tell all other clients to move their GameObject to some specific position?
@zinc ravine Did removing joint constraints fix it?
I kind of wonder if it is the rigidbody view
thats what I'm thinking...
Why are you trying to sync rigidbodies anyway?
is it essential that limbs match up?
Write a custom state transfer component that can do prediction/rollback, should solve any issues regarding syncing bodies like that
kind of annoying that there is no documentation on the rigidbody view, specifically about how it works
I'm curious as to why you need to sync up specific rigidbodies anyway. If youre doing things such as IK youd be better off passing on the IK data rather than trying to sync the rigidbodies
eg: if someone is going to grab something sync the grab target position, not the pos/rot of the limbs
then let the IK solver work locally; just an example
@indigo current in the realm of a generic game I'd argue that approach is best
But without context hard to say
yeah
Still doesn't really explain how much you need networked though.
Why do you absolutely need the rigidbody networked?
@zinc ravine
I'll suppose I'll try without it
Does photon transform classic and photon transform work together..?
@indigo current
Cause I can't get the classic without the new transform being there.
no you replace the new one
Yeah, but when adding an observable component, it auto-adds a new transform. @indigo current
?
see where it's circled? If I fill that, it automatically adds a photon transform view
If I delete the photon transform view (new version), it auto removes the observed component as well
yes
...? So how do I keep the classic, remove the new, and add an observed component? @indigo current
np
I've been adding the gameobjects...
but I guess its still be using the items WITHIN the game objeccts
omg
thanks
and should lerping help out?
@indigo current
the transform views already lerp
Hello! I'm using Mirror as my networking solution, it works by client server hosting, like the former uNet.
I want people to be able to connect to other players over the internet, without having to port-forward. I'm not really sure what I'm looking for, anyone got any clue what I'd need/what service I'd need to look for, to achieve that?
you are asking about NAT punch-through
Hole punching (or sometimes punch-through) is a technique in computer networking for establishing a direct connection between two parties in which one or both are behind firewalls or behind routers that use network address translation (NAT). To punch a hole, each client conne...
@daring rain
Alright, thanks!
So my character instantiates an object properly over the network, but sometimes when they put it away, it doesn't get destroyed on other peoples clients.
if (GUI_Tools_slotOn == 1) //Slot 1
{
foreach (Transform child in item_Transform.transform) { //Removes other children first.
PhotonNetwork.Destroy(child.gameObject);
}
var slot_1_Spawn = PhotonNetwork.Instantiate(Path.Combine("Prefabs", item_id_1), new Vector3(item_Transform.transform.position.x, item_Transform.transform.position.y, item_Transform.transform.position.z), Quaternion.Euler(new Vector3(item_Transform.transform.eulerAngles.x, item_Transform.transform.eulerAngles.y, item_Transform.transform.eulerAngles.z + 180)));
slot_1_Spawn.transform.parent = item_Transform.transform;
}```
@zinc ravine What do you mean put it away?
Also, if you have time in the future maybe check out these videos:
https://www.youtube.com/watch?v=nn4I18fdDhM&list=PLkx8oFug638oMagBH2qj1fXOkvBr6nhzt&index=17 and https://www.youtube.com/watch?v=pI3KDGIvKVo&list=PLkx8oFug638oMagBH2qj1fXOkvBr6nhzt&index=18
They show you how to instantiate objects in photon using prefab references rather than having to specify the path.
put away, as in destroy();
I have it instantiate and then destroyed when they 'put their tool in their pocket'
@indigo current
Why are you destroying each child though? How many objects are being destroyed? Why not destroy locally since you're sending as a RPC anyway?
destroying the item is how I hide the tools when they're not in use. And what do you mean locally? They need to be destroyed across all clients to show that the tool was put away. @indigo current
youre calling an RPC which means youre performing the action over the network
why would all clients need access to a tool only 1 client is using?
you dont need to call it as a PunRPC if youre calling PhotnNetwork.destroy
the photonnetwork.destroy will destroy it across all clients
gotcha
@manic solstice they need to see it pop into the players hands.
Well, how does this look?
@indigo current
Either way, it still doesnt destroy ):
Is it spawning the new item?
you shouldn't be instantiating over the photonnetworking if the object doesnt have a photonview on it either
theres not enough context to give good advice
they have photon views on them
and yes, the items are spawning, but not destroying.
@indigo current
dont destroy them on other players
only destroy them on owning player
remove the RPC call
you either spawn over the network ont he owner
or you send an rpc and spawn locally off the network
but logically you shoudl spawn over the network on the owner, not using an RPC
So I figured out out to sync tools properly- but now I'm trying to sync rigidbody kinematics.
As of right now, the masterclient can hit them and they'll collapse,
but other clients cannot make them budge.
Hey I'm a programmer at a major software company so yeah I can code, but I have absolutely no knowledge in networking what so ever
I'm making a game with some of my old mates from university and in our game we wanted a system much like dead by daylights', which was also made in unity, the killer is the host and the 4 survivers are clients, in ours we need 1 player of the party to be the host of the dungeon and the other 4 to play in the dungeon too, is this >extremely< hard to implement using unity?
First rule of networking: it's never easy
whether it'll be hard - that depends on exact plans
actually another thing, I read the docs but I didn't understand
if to implement such a system
we had to pay anything to unity
For small networking use pun setup win server and get free 100ccu
For real server files u need knowing about hard coding
has anyone gotten the new networking layer working in unity 2019 1.4f?
getting an indexoutofrangexception with regards to nativelist
it occurs in the scheduleupdate().complete() method on the client side
nvm was able to fix it false alarm, dumb mistake on my part
can a [HOST+CLIENT ] - CLIENT - CLIENT - CLIENT networking system work outside of a lan ?
[Looking for a mentor]
Area of interest: networking, C#, Unity
I am looking for a person who will help me start well with networking, I use Mirror for this (this is a repaired UNET) so the code is practically the same. I would like the mentor to help me fix the problems that I will encounter.
If you think you could help me please dm me ;>
@fair roost unless you are looking for paid mentor, you'll have better chance of solving your issues if you just bring up the issues at mirror's own discord (or here but I'd imagine people on the Mirror's Discord are more qualified to answer your questions about it)
on Mirrors Discord I have already asked, now I am asking here because Mirror is practically the same as UNET
you are asking if some person is willing to help you one-on-one
unless you pay for it, it's not very likely to happen
it's better to ask publicly on these groups, WHEN you have actual issue you can't solve on your own
I do so too, but maybe in the meantime there will be a person who will want to help them...
I keep mentioning the payment as you can't really expect people to start mentoring others at personal level if there's nothing there for them
that's also not what these groups are about
these groups work best if people help eachothers and people only ask help if they've first tried and can't solve some specific issue
you don't reserve people who jump to help you whenever you feel like it
people are here helping others on their free time, without getting paid for it so kinda have to just take what you get unless you are willing to pay for personal one-on-one mentoring
I did not mean it, I am looking for a mentor who will lead me through the process of learning networking, give me some hints, etc.
well, are you paying for it?
something something read the documentation
if not, then good luck, but don't expect people to volunteer
*read
well, have you tried codediving?
Hueh, I don't mind it, I just lik correcting people
Opening up the source code
and trying to make sense of it
It's a hard but very useful skill to master
never
...well
then you are forced to:
A) pay
B) actually ask on occasion
O, such terrible fate
in this case I choose option C: I will wait for a volunteer
😄
i will ask tho and try to learn "harder"
good luck then 😃
Choosing a third option. How bold
I am afraid the interdimensional switch case statement is not ready for your creativity
?
anyway, this discussion is already way out of scope of this channel now
I was implying a joke like this:
switch(choice)
{
case A: doThis(); break;
case B: doThat(); break;
default: new throw NotImplementedException(); break;
}```
btw, any good tutorial to learn from?
btw, any good tutorial to learn from?
(UNET/Mirror for sure)
I am afraid you have to stick to the documentation
meh
for community driven things, tutorials can be scarce, but you'd think you can find plenty of UNet tutorials
I can't recommend any as I've not watched a single one
I can only echo what had been said on the mirror discord
UNET and Mirror are different enough to each other that UNET tutorials might fail you in actually helping
;-;
does anyone know how to run a dedicated server in unity using their new networking layer?
specifically with multiple clients running at once?
or is there any way to run multiple game instances to test networking code in the unity editor?
nvm symbolic links work like a charm!
using photon pun, right now if a player picks up a gun, i transfer ownership of the gameobject to the player that just picked it up. this allows the other clients to see the gun moving. but, if the player moves another object with the gun, and doesnt directly touch that other object, it doesnt transfer ownership. is there a simpler way to deal with this? my initial thought is to place a script on the gun when touched that causes anything it touches to also transfer ownership, which then propagates even further, etc. like some sort of ownership virus. however, this seems ridiculous. is there a simpler way to make sure that when a client interacts with an object by moving it, the other clients see the movement? new to networking so thanks for the help.
Your question seems a bit of a rabbit hole so I'll try to give you a simple answer which might point you in the right direction.
Ownership is transferred of only 3 ways.
- It's a scene object (placed in scene on build, not instantiated) and current or future master clients receive ownership automatically. Ownership must be set to Fixed on the photonview for this.
- photonView.RequestOwnership() is called, and is automatically granted. Ownership must be set to Takeover for this.
- photonView.RequestOwnership() is called and logic must run in OnOwnershipRequest() to grant ownership. Ownership must be set to Request for this.
- [bonus] Ownership is forcefully taken by directly calling photonView.TransferOwnership(player) with no checks; this is bad, don't do this.
My short video on transferring ownership might help, let me know if you have questions.
https://www.youtube.com/watch?v=W0FnBDODAjI&list=PLkx8oFug638oMagBH2qj1fXOkvBr6nhzt&index=22
Techniques to change ownership of photon views during a game.
i appreciate the information about transferring ownership of objects. so, from my understanding, if i want a player to be able to knock over a stack of boxes, then I need to make sure that the photonview on each box is set to takeover instead of fixed, and make sure that anything that the player is interacting with gets transferred to the player.
problem is i cant think of a way to propagate the ownership correctly. if a player knocks over a stack of something, how do i make sure the player owns the objects?
The relay should do that for you. You just have to decide if you want to predict it on the new owner, or wait for the ownership change.... Though I have not made use of authority change with pun. Not sure what callback of any fire on owner changes.
@untold quest I don't think you should transfer ownership at all
Perform collision on the owning client of boxes, probably the master and have them push the boxes around.
omg im bug dumb
I never used anything like it but I heard there's some steam networking that we could use to implement into our games?
Am I wrong? Can anyone tell me some more about it?
@untold quest i'm assuming we're talking VR here, but even if not glenn fiedler did a big thing on networked physics ownership/authority https://developer.oculus.com/blog/networked-physics-in-virtual-reality-networking-a-stack-of-cubes-with-unity-and-physx/
you could of course do it authoritatively but it won't look great for non-authority people because they won't react immediately, in that article he does a pretty complicated system similar to what your talking about. like an authority virus
So I've been using photon PUN2 to help me with server hosting.
I'm trying to better understand ownership over ID's but I'm not entirely sure how to transfer ownership to another client.
The problem: I have a building system where blocks are placed, but I want ALL players to be able to destroy one another's blocks. My code doesn't do that- obviously. How can I transfer the blocks ownership over to the person trying to destroy it?
Thanks.
@zinc ravine you transfer ownership with PhotonView.TransferOwnership(), but it seems silly for your use case when you could just send an RPC to the owner, and have him called PhotonNetwork.Destroy()
okay, so how would I go about doing that? Sending an RPC to the owner? and having him destroy it? @last hornet thanks.
Ray ray_Build = new Ray(cam_1st.transform.position, cam_1st.transform.forward);
RaycastHit hitInfo;
if (Physics.Raycast(ray_Build, out hitInfo)) {
Debug.Log("Hit = " + hitInfo.collider.gameObject.name);
if (Input.GetMouseButtonDown(1)) { //Right Mouse
Vector3 spawn_Bl_Position = (hitInfo.collider.transform.position) + (hitInfo.normal) * 2; //Grabs item-hit's location. 'hitinfo.normal' is face of cube.
Quaternion spawn_Bl_Rotation = Quaternion.FromToRotation(Vector3.forward, hitInfo.normal); //Fixed rotation.
PhotonNetwork.Instantiate(Path.Combine("Prefabs/Blocks", bl_Holder), spawn_Bl_Position, spawn_Bl_Rotation);
}
if (Input.GetMouseButtonDown(0)) { //Left Mouse
//Destroy(hitInfo.collider.gameObject);
//PV.RequestOwnership();//???????????????
PhotonNetwork.Destroy(hitInfo.collider.gameObject);
}
}
}```
@last hornet thanks but i got that all sorted out >_<
now i've got multiplayer vr players with avatars and its so cool
i just high fived my mom in vr and she's giddy
😃
@zinc ravine i don't think all that should be in an RPC, having those Input checks inside the RPC makes no sense
you should do Input for the local player like in Update() and then send an RPC
I'll rewrite it a bit
assuming your sending that RPC to everyone, then everyone is checking for Input.GetMouseButtonDown() themselves
prettier? @last hornet
so you and i are playing together
and you send me a BlockDestroy() RPC
my cam_1st is probably pointing somewhere different than yours, no?
that is true...
And thats another problem I'm having. I need to define the raycast to obviously allow for that object being SHOT by the raycast, to get destroyed. Yet it shouldn't be in the RPC...
you need to do all that stuff locally and only send the stuff you need in the RPC
how can I do it locally if I need to define what the raycast is as well?
because obv. i cant do this
why does the other player need to know anything about the raycast you used to determine what block you hit?
he only needs to know the block you hit so he can destroy it
well maybe thats my problem: I'm not sure how to go about sending the block- without using the raycast.
@last hornet
you do the raycast, but only for the local player
private void Update()
{
//only process input on the local player
if (photonView.isMine)
{
//mouse down
if (Input.GetMouseButtonDown(0))
{
//cast ray to look for objects tagged block
Ray ray = new Ray(cam.position, cam.forward);
RaycastHit hitInfo;
if (Physics.Raycast(ray, out hitInfo))
{
//hit a block
if (hitInfo.collider.CompareTag("Block"))
{
//tell everyone the photonView of the block we hit
photonView.RPC("DestroyBlock", RpcTarget.All, hitInfo.collider.gameObject.GetComponent<PhotonView>());
}
}
}
}
}
[PunRPC]
void DestroyBlock(PhotonView blockPhotonView)
{
//only the owner can destroy the block
if (blockPhotonView.isMine) PhotonNetwork.Destroy(blockPhotonView);
}
general idea
not tested obvi
i mean i dunon if you had a block tag, I just made that up haha
Yeah I set it up- but it still doesn't work.
ExitGames.Client.Photon.Protocol18.WriteCustomType (ExitGames.Client.Photon.StreamBuffer stream, System.Object value, System.Boolean writeType)...```
any time I try to delete a block.
er- destroy one. @last hornet
ah sry for whatever reason i thought PhotonView was a serializable type
in pun
send the viewID then
photonView.RPC("DestroyBlock", RpcTarget.All, hitInfo.collider.gameObject.GetComponent<PhotonView>().ViewID);
and then you need to find the photonview by the id
[PunRPC]
void DestroyBlock(int viewID)
{
PhotonView blockPhotonView = PhotonNetwork.GetPhotonView(viewID);
//only the owner can destroy the block
if (blockPhotonView.IsMine) PhotonNetwork.Destroy(blockPhotonView);
}
Now that I'm beginning to understand the parameters, how would I go about transfering the position and rotation of the instantiated object to the BUILD RPC?
@last hornet
you don't need to do that with an RPC, PhotonNetwork.Instantiate is basically an RPC itself under the hood
yeah, thats what I thought.... I've heard people say that in forums before
doing it the way you have it would actually spawn as many blocks as you have players, because EVERYONE is calling it themselves whent hey receive the RPC
but why then would photonnetwork.destroy NOT BE?
it is! but only the owner player can call it
gotcha, gotcha
yeah, i guess it has to gather the data rather than 'instantiating' it.
@last hornet thanks for helping. Fully functional now. I need to learn more about parameters that hold data, they've always scared me, lol.
also set it up to help me change materials using a paint tool, thanks for the help @last hornet
no probs!
https://github.com/emotitron/Simple-Network-Sync
Probably my last beta release for anyone who wants in. Try it in a project where you would use NetworkTransform and/or NetworkAnimator... or PhotonAnimatorView or PhotonTransformView. Anyone getting me feedback I'll give free access to the final.
Are you still ignoring the serialization rate? 😛
depending what you call serialization rate, but yes - the one you are talking about about
you can send every X fixed
but it is strongly encouraging doing your simulation on FixedUpdate - as it should be
not even NetworkTransform/Animator go through the send rate
send rate is for syncvars, not RPCs
NetworkAnimator sends using Message base on its own send rate
It's still not for you @indigo current
photon animator and transform does go through serialization rate
theyre just wrappers
PUN runs everything through PhotonView normally yeah
So I've been trying to get my materials to change over the network, but they're still having trouble and I know I'm so close.
@last hornet It's somewhat of the same issue as destroying, I don't know if you want to take a crack at it again, I'd appreciate it.
Hello, I'm trying to serialize NavMeshPaths so I can send it through the network. However, the class doesn't seem to support serialization. Has anyone accomplished this? The reason for this is so I can calculate paths on the Server and merely distribute the paths to the clients who will set their nav agents with the correct paths.
An alternative to this which I am aware of is to instead send the destination to the clients but, I'm pretty sure that there is bound to be some discrepancy in the paths the AIs take. I also would not like to sync their positions because I wish to use root motion for each client (I've heard that root motion and network transform / lerping do not play well together).
I've spent the better part of the month trying to find a solution to this issue. Any help would be greatly appreciated.
Anyone here play with the new addressables at all? I'm struggling to get my .exe file to see Assets/StreamingAssets/com.unity.addressables/[BuildTarget]
@autumn bone You can try my asset above, I am actively trying to find people who can break its ability to sync Animator/Transform.
@jade glacier will do
And let me know how it fares, and even better help me repo it if it does fail. Letting anyone who gets me feedback free access to the final. @autumn bone
Anyone knows if it's possible to reigster handlers for a spawned object on the client?
I have a race game where each character does hops. The hop is auto, player only needs to tap to jump higher instead of hop, to dodge hurdles. What's more, there's a bit of time frame after a hop that u can do a late input to do a "last second" jump.
Offline version works fine. But the online is a disaster. (Client have their own prediction to keep hopping).
Haven't added actual proper prediction, server correction etc. Got a few ideas but just wondering in this kinda race game (hop is auto), how it should be done..
I cant start build on linux...
Some native stacktrace then
mono_gdb_render_native_backtraces not supported on this platform, unable to find gdb or lldb
Does anyone have any idea why when i call this RPC it select the weapon only to the player who picked up the weapon YET the SetParent part just before worked on both views
public void OnInteract(int player)
{
networkObject.SendRpc(RPC_EQUIP_WEAPON, Receivers.All, player);
}
public override void EquipWeapon(RpcArgs args)
{
GameObject target = GameObject.Find("Player " + args.GetNext<int>());
transform.SetParent(target.GetComponent<WeaponManager>().weaponBone);
target.GetComponent<WeaponManager>().SelectWeapon(transform.childCount);
}
Hi guys i am new here i have a problem about a WebGL app and i don't know how to solve it i have the following error : An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
uncaught exception: abort("To use dlopen, you need to use Emscripten's linking support, see https://github.com/kripken/emscripten/wiki/Linking")
I am using Httweb Request, WWW, or Unity web request and the error looks like it comes from request
@proper wave What do you mean by free? 😛
Anyone else having Photon randomly stopping to show avaiable room list for no reason?
It's the 3rd time it's happening to me and I just don't know what to do at this point
Anyone who've tried implementing something with the NetCode of the multiplayer repository?
I like the Bolt shoutout @covert monolith
Documentation
Multiplayer: https://docs-multiplayer.unity3d.com
Relay: https://docs.unity.com/relay
Lobby: https://docs.unity.com/lobby
Resources
https://github.com/MFatihMAR/Game-Networking-Resources
Github
Netcode for GameObjects: https://github.com/Unity-Technologies/com.unity.netcode.gameobjects
Blogs
Unity’s new GameObjects multiplayer networking framework https://blogs.unity3d.com/2020/12/03/accelerating-unitys-new-gameobjects-multiplayer-networking-framework/
Navigating Unity’s multiplayer Netcode transition https://blogs.unity3d.com/2019/06/13/navigating-unitys-multiplayer-netcode-transition/
Forums
Multiplayer https://forum.unity.com/forums/multiplayer.26/
Samples
Small Scale Co-op: https://unity.com/demos/small-scale-coop-sample
Game Lobby: https://github.com/Unity-Technologies/com.unity.services.samples.game-lobby
Gaming Operations: https://github.com/Unity-Technologies/com.unity.services.samples.game-operations
Discords
Unity Multiplayer Networking https://discord.gg/FM8SE9E
Mirror https://discord.gg/N9QVxbM
Photon https://dashboard.photonengine.com/Discord/JoinPhotonEngine
Mirage https://discord.gg/DTBPBYvexy
Normcore https://discord.gg/XvMthZG
Roadmap
https://resources.unity.com/unity-engine-roadmap/multiplayer
Samples
Real-time Multiplayer Alpha Repo: https://github.com/Unity-Technologies/multiplayer
@compact bramble my guess would be no, no it doesn't work with MB projects.
(saw your comment)
that chart tho... they say you should use FPS Sample as basis if you ship soon and need dedicated servers IF you have less than 80 users per session
fairly certain the framework done for FPS Sample does not scale up to 80
or I guess it depends what the clients do but seems quite high for a setup that was designed to run with what, 16 players on one session?
@vital hawk i have no comment on this directly, it just feels like if you need an 8 level deep flow chart to describe the networking situation for you're engine... something is wrong.
well, we all know current situation is bad
also that chart totally leaves out the possiblity to use 3rd party solutions for anything but dedicated
but to be honest, built-in networking situation on Unity has never been good as long as I've used it
so if they get their stuff together ultimately, that's great
@vital hawk just feels like it's one blog post every six months, promising the future thing
which isn't even close to materialized yet
¯_(ツ)_/¯
well, this at least told they have a DOTS netcode framework coming up
@vital hawk they have a preview of it on github, including state sync/etc.
we've always known there are ECS based to extent but this is first time I see them mention something that sounds more general purpose
there's an actual sample that can replicate stuff over the network, etc.
you mean the sample for multiplayer thing?
I thought that was more of embedded in the samples still
here
this contains a full delta snapshot, etc. stuff
not the fps sample
yeah, I'm aware of that 😃
it's mentioned here too https://github.com/Unity-Technologies/multiplayer/blob/master/README.md
but what I mean, if you have tech just emdedded in samples, it's not really nicely put, it should eventually be in some standalone package which then utilize it for the samples
so people can clearly see what's custom to the sample and what is part of reusable framework
which is what I expect from DOTS-Netcode essentially
I'm sure they'll get there eventually
but that's not this year
realistically not next one either if you take into account the speed they've developed any of the recent systems
oh yeah sure
I mean, if you need something production ready
and they seem way to focused on hard core dedicated server games
not counting experimental stuff
which is like what? 0.1% of games being built
maybe because they are after AAA space?
it's also way easier to market dedicated to new users when you have everything setup for people
sure, but the AAA guys already have network engineers that can build this stuff for them specifically for their game
which always is better
ha
that's what they seem to be aiming for anyway as they got all the backend stuff now, just need solid frameworks and integrations for them
but they are getting butchered in the comments on the blog post
and i kinda get it
people are fed up with their buggy networking systems, deprecated stuff, and 'future' promises
sure, future plans always evolve too, can't really bet on those
plus this seems to be DOTS exclusive, so wth happens to everyone not using dots?
if you need multiplayer for Unity today, it's not likely that many would pick any of that charts suggested solutions
i get that, eventually, in 5-6 years, maybe DOTS is the only way you want to build games
but even when this is 'done' next year
DOTS is not going to be ready for prime time
I'm guessing they will make hybrid integration too
for all games
like they do for Unity Physics package right now
you can use it from monobehavior side, that's actually how all their samples work
yeah but that package cant compete with physx
for everything no, but it beats physx in many things already
like?
raw query speed it better at least on smaller scenes, you get access to different solver stages so you can modify the results before they get passes to the next stage etc (https://docs.unity3d.com/Packages/com.unity.physics@0.1/manual/simulation_modification.html)
also you can run it fully off main thread with zero sync points while you run it with your custom physics forces
well, later doesn't work for monobehaviours
but in DOTS side, you can do that
yeah i suppose
also once they get Burst deterministic, well, you know what that means for netcode and physics
but like you said, it's "future promise"
so, take it with a grain of salt
yeah
There's too much focus on future promises right now
I think that's what annoys people (and me)
too much focus on what we will be able to do in 2-3 years, IF they manage to deliver
I'm still totally fine by it
I'd rather know what they are planning to do instead of them keeping us in the dark
latter still happens a lot
for example, people didn't know about that multiplayer repos samples
many probably implemented similar systems on their own as there weren't any ETA for example for that kind of use cases
Hey people. I'm working on polishing a small game which is written with https://github.com/Unity-Technologies/multiplayer
I tried to fix several issues but came to the point where I don't want to work with it anymore. Changing the framework/ library is still an option as this game is very small.
What can you recommend? I saw:
- NetMQ
- Lidgren
- Photon
I'd love to have some lib/framework that elevates c# at its best like using the task library. As always Unity doesn't give a F about idiomatic code
@graceful zephyr what, how would it be possible if tons of games like Minecraft, Gmod, CS:GO, etc have dedicateds?
@mortal ridge i'd recommend LiteNetLib
@undone sigil I meant out of the games being built with Unity
How many high end dedicated server games are being built with Unity
@mortal ridge also, from what i've heard, Tasks are extremly underperforming in Unity
they are very focused on predict/rollback fps networking
@mortal ridge just beware that unity 2018.3 has some bug on linux which causes LiteNetLib to stop receiving/sending messages
@undone sigil I used it in some heavy editor scripts and it was very well performing as far as I can tell
@graceful zephyr I don't really blame Unity for trying this, considering that their biggest competition does this out of the box for character movement and provides tools for the rest
@vital hawk unreal doesn't use the same type of system as unity is implementing
I mean just in general for prediction / reconciliation
their stuff works on dedicated
It's not the same tho, not even close
I don't mean the implementation itself, but the overal concept on being able to do this on remote server and have clients play nice
most devs don't care what happens internally
they just want tools that enable thing x
/shrug
you probably mean the handcrafted nature of current fps sample being totally different from generic replication stuff in unreal, but I doubt fps sample is even meant to be the final form how Unity will ship these things
it's more of a prototyping platform
Re: "nobody's using DOTS" will get fixed with dots visual scripting for a lot of people but networking via visual scripting will have to be in part making some large assumptions
What I am seeing with Unity's new networking is: you're basically on your own if you use monobehaviour based projects or you don't want to pay us for server fees.
Every paid networking solution is less good than it could've been because of the need to monetise everyone.
It pisses me off enough to maybe get off my arse and do it myself.
I don't get the same attitude from API or middleware when it comes to audio, rendering, code in general. Just networking.
@graceful zephyr you called?
dont know what your talking about, im ready, promotion! :^)
@jade wharf huh?
Talk about DOTS vs Dots... He's kidding
Lmao
oh
Hey everyone,
Have an old prototype i wanted to play around with.
Its a little 2d multiplayer fighter (think Towerfall) that I had made to learn UNET at the time.
I'd love to be able to clean it up a bit, as UNET wasn't great for the fast rigidbody movement of the projectiles.
I also know they deprecated UNET.
Ideally i'm looking for a decent solution that i could do a webgl build, and p2p.
Any reccomendations?
WebGL and P2P don't really go together
browser based apps aren't going ever have the permissions needed as far as I know to ever try to connect to other browser based clients directly.
Relay based like PUN2 would be about the closest thing there
But no clue what PUN2 has in the way for webgl support with its transport
Ahh bummer
If I was gonna do server based implementation, and wanted good performance, what should i look into?
First see what networking solutions support WebGL at all, then think about choosing one
hello, how to stress test photon ccu? i have free 100ccu but i want check out my hardware on server
I'v come across a little problem, somehow 2 different versions of websocket are mixing, after importing photon in my project.
http://prntscr.com/o2o5ca
This is because i have substance asset as well, which is pretty important for my project.
If someone have any advice of how do i fix this without giving up on any of assets, would appreciate.
Turn one off
@fading pawn
so i fixed the error with removing this
http://prntscr.com/o2or2m
now the question is, will photon work with no problem with this dll removed?
or should i go with different method of turnig it off?
I would delete the non Photon one
I'd suggest for DarkRift
Already boys
I'm currently working on an open world game
What is your reccomendation
Never done networking before in my life, so wheres a good start
I assume you're going with dedicated server?
Sure @fading pawn
your options are pretty much: Photon Bolt, Forge, Unity FPS, Spatial OS
and you can probably narrow that down
https://github.com/Unity-Technologies/multiplayer is my best bet?
My understanding is that is basically a preview, it isn't quite ready yet
If I focus on my single player for right now
would it be easy to transition over to multiplayer?
Only if you understand networking and have a plan to transition to it, otherwise you may end up needing to rewrite large parts
I don't understand networking
How ever the map will be static, but the npc will not
If that helps
I think I can make the game track players, npcs and bullets only
along with animations
and sound triggers
It doesn't really
I would expect to rewrite the single player mode if you move to mp
I want to know what to deal with
So i can make subsystems in design from now
so when its time
Its not that much of a big deal
@fading pawn SpatialOS can't be used in unity anymore
Its against there terms of services, just thought I would alert you of that
Due to a change in Unity’s terms of service, all existing SpatialOS and Unity games, including production games and in development games of all developers, are now in breach of Unity’s license terms. In this blog post, we explain our understanding of this serious developm...
There was some drama 6 months ago, afaik it is resolved
you wouldn't write single player first and then make multiplayer, especially if you haven't done multiplayer programming before
it's a thing that need to be taken into account from the first steps already
like mentioned, you are likely to rewrite a lot of code if you try to do it like that
but it also sounds like almost certain way to get a ton of weird bugs if you do it as an afterthought
Yeah, adding multiplayer to a project that's already underway is definitely not a good idea, even if you know what you're doing
and multiplayer games are super hard to make compared to sp
the whole "if you know what you are doing" is kinda pointless in the end because if you know what you are doing, you factor it in anyway from the beginning 😄 but in theory, if you know what you need, you can at least take it into account when you design the framework for the game
you just usually can't take everything into consideration in advance which is why the whole waterfall model was a failure in the software development in the first place....
@smoky widget dude they resolved that like the next day https://improbable.io/blog/spatialos-will-support-unity-long-term-and-mobile-coming
We are delighted to confirm that, following Unity’s recent commitment to a permanent open platform, work on the SpatialOS Game Development Kit (GDK) for Unity will continue to be a priority, as we work to support developers looking for a comprehensive multiplayer platform.
@main sage I'm by no means an expert. But thinking in terms of ECS. You want requests to create buildings, that can be multiple? That feels like a buffer, if you're talking about the multipalyer samples, there are already RPC buffers in place you can use I think. If buildings are only used for instanciation, why not use a bitmask for what buildings each player can use? Easy to check against and easy to sync.
I accidentally deleted my post rip. Any help appreciated Thanks. I guess I could solve it a different way. I could have players to be in their own sessions but say a they are only tied together by a map where players practically don't see eachother. Would it be possible to have players in their own rooms under 1 server or 1 server per player?
Uhm, so they are not acting on the world or another player?
Let's say very minimal interaction such as they have their own world in which they build their own but can export/import goods to eachother as simple data values. I guess kind of like how simcity supports multiple players in a world but each player builds in their own city but can still trade amount players.
Well, then I would ask if cheating is a problem for your game. If yes, you need to have some server checking everything the player does in his local world as well right? Else you only need the server for transferring the "import/export goods"
Well any maybe accessing database if that's applicable
I'll disregard cheating for now. So it's possible for a player to host a 'lobby' then inside that lobby is a 'room' for each player to build their world? Is there a term for this kind of design I can look up. I'm pretty new to MP, only done SP games so far
Not sure if there's a term, but what you're proposing is not too far from a singleplayer game anyway. I'm not sure if you're using any 3d party multiplayer API or so? But there might be limitations to them, since they may be built for a specific type of gametype. Further I'm not sure what type of interaction flow you're planning? Can the player put down the game and come back tomorrow? Do the import/exports happen every minute? Each hour?
It's more of a case study for now. I'm trying to mimic simcity. I believe in their system, the world was running 24/7 and players could drop in and out of the lobby/world. If a players city was offline it would run autonomous (do nothing) while a neighboring stil city who's still online would continue to build in their city as they please. There might have been scheduled syncs for the cities visuals whenever somebody logs back in and looks at another players city
Hmm ok, so I would setup a lobby which the clients saves ID/adress etc, depending on your surrounding systems. Depending on how often the import/exports happen, I would have the server on first start tell the client when next import/export happens and its interval, and the client would connect to the server at those intervals and do the exchange. And when the client changes information that is outbound, I would also make a connection to the server and tell it to update stored information for the players outbound (all players outbounds in fact). And then it can tick resources (do import/export enchanges) and assign IDs to them, and when the clients connect it can ask for all resource exchanges from a certain ID to catch up.
can anyone recommend a good video series for photon?
Is anyone knowledgeable with Mirror? (The uNet fork)
Hello guys, I'm having trouble syncing a variable between clients.. I'm kinda new to networkmanager.
If someone could help me that'd be great.
@stray sedge Mirror has it's own discord, if you have questions for it, it's probably the best place to ask them
I can DM the link if needed
@vital hawk that would be great
sent the link
didnt get an answer so just fyi anyone else looking for photon tutorials I found this one and it seems to be updated regularly. been easy to follow so far https://www.youtube.com/watch?v=p8YQpcoaPoU&list=PLkx8oFug638oMagBH2qj1fXOkvBr6nhzt
Heya, I just happened to come up with this question in my mind. Is there any way to prove a game logic is fully deterministic?
I am currently implementing multiplayer synchronization with lockstep. And my game loop seems to be deterministic. As identical frame data from 2 different machines say. But I am not sure if it ‘truely’ is.
@inland timber not really
@inland timber I work on photon quantum, and well.. we do a lot of determinism, and technically there is no way to prove it - we use game state checksums to ensure everyone is in sync, and should the worst happen in a live game and someone desyncs we have a way of recovering (the recovery just exists to give peace of mind, we don't expect it to be needed)
@graceful zephyr Thank you for your reply 😃 yeah I also kind of doubt that there's a "mathematical" way to prove that... To manage desyncs, I am thinking of replicating the whole game's states over players. From super peer to others perhaps. I hope it will work out well...
the checksum will give you a pretty definitive indication of desync, if you do your checksum right
@jade glacier What kind of checksum making algorithm would be good in general? Tbh, I have no idea if my hashing (just mixing internal state values randomly) is great enough. 😂
any typical hashing system I would expect to work
The odds of an out of sync coming up with the same hash are absurdly high. The main thing is to make sure EVERYTHING is included
@inland timber We use CRC64
it's hard create a dedicated server for my own game?
@graceful zephyr Oh thanks 😃 i will think about using that 😃
What networking solution should I look into using with my team for 100+ CCU mmo type game?
@weak plinth maybe atavism
Guys and Gals, are there any RTS lockstep libs out there that work with pure ECS now? I'm aware already of Quantum but was hoping for something open source.
really need client prediction and rewind, the same sort of stuff that Quantum provides, though maybe not so advanced.
that would be no
even for nonECS, you probably wouldn't find anything like that ready made
for a MMO it's good create my own code or use a API?
okay,
first, it is highly encouraged to already have some experience with how networking works or having made some games before you try to tackle an MMO,
depending on your scale, there are assets on the store that demonstrate how a possible architecture for an mmo might look like.
as for the API, you are already using an API by using unity and their provided functions. So I guess the question is, should you use your own solutions or third party libraries and services?
If you are experienced and you want to write your own libraries for everything, that would still take a huge amount of time and resources, you should ask yourself if it is worth it.
Many libraries are open source, so you can benefit from being able to make necessary code changes yourself. Using closed source software you cannot change might be more of a risk in case there is an unexpected bug.
one additional benefit of other libraries and frameworks is that if the community or dev is still active, they are maintained and you don't have to care about it.
as reference, Worlds Adrift was made with SpatialOS, which is not just a library, but a whole service/infrastructure. maintenance costs were pretty high too I would assume. So there is also the possibility to use services, if they fullfill your requirements and if you can afford them.
So,
TL;DR: please use APIs if you don't want to work on the game for 15 or more years
Also, setting a too huge scope for yourself in regards to your skill set will increase the possibility of the project to fail,
many people want to make their dream game as first game, but underestimate the time or skills required, after a while it gets frustrating and they quit. that is not to say it is impossible to make an mmo on your own, it most likely is possible, but it will probably require a lot of time and resources, depending on how the game plays etc.
wondering if anyone has used the Unity.Networking.Transport and can help me with an issue. visual studio thinks it is missing a assembly reference as it can't find Networking in Unity. any idea, my brain already wants it to be Saturday.
ideas**
Hi, i have a question about the limitations of unity's high level multiplayer api. does it support a scenario where on a single server you could have multiple different maps active simultaneously? as in, have player a in map 1, player b in map 2?
I'm trying to make a game that only has 1 server and players automatically join it.
I'm using Mirror as the networking and I want to do a few things:
Make a server (what services would be good for this. It's not a complex game, it's based on The Backrooms creepypasta and players are put into a BIG static maze and have to find their way out)
Make players automatically join the server on opening the game
I don't have much practice with networking so I have no idea how to do any of this.
You're asking how to host a server?
i asked before but maybe i formed my question a bit wrong. what would be the best way to go about writing a multiplayer game where a single server can host multiple maps (i.e. if player a wants to be on map 1, and player b on map 2)? would the new unity high level api support that, or is that a limitation?
If you are talking about scenes, you can dynamically add scenes
so scene1 could be the map 1 and scene2 could be map2
Hey, I'm working on a game that requires people to be able to 1v1 each other. Anyone know any good tutorials for making something like this possible?
I don't know anything about networking yet, but I would love to learn. I'm not really sure where to start.
@obtuse forge I create networking tutorials on youtube using Unity and Nodejs that could help solve your issue DM https://www.youtube.com/channel/UCCtgfN-1fqMKgbSEFD8j9OA
Thanks a ton! I'll look into it. 😄
No problem hope you enjoy the series
Does anyone know anything about using an ec2 to use as a kind-of master server for a unity multiplayer game? I've set one up via aws and now I want to run the game's server on that
I'm using Mirror for the networking (the discord server for it is kinda dead so I thought posting here would be better)
I have no idea what to do from here on out
What do I put here?
What do I put on the ec2 itself? A linux build of my game that only runs the server?
I set an elastic IP so I assume so @weak plinth
set an elastic IP, got a new IPv4(I think), set that as my network address, created a new server build, put it on the ec2 via pscp and client won't connect
When you connect are you trying to connect to that port 7777?
most likely will need to set it to 80
and in the server build use the environment port
that gets assigned
for routing
well after trying to use port 80 I just got a timeout error
I've opened 7777 on my ec2 inbound/outbound rules
but i had done that already
Is your server that is deployed using 127.0.0.1? Might be running into an issue like this one https://askubuntu.com/questions/166068/port-seems-to-be-open-but-connection-refused/166106
got it to work by making it a headless build. thx anyway tho
👍🏻 Glad you were able to get it working
I got my multiplayer game working and now I want to finalize some stuff.
Every time I change something serverside in the code, what I have to do to update the server is:
Build a linux server build
Send it to linux ec2
Run the server build
Is there a way to automate this process?
Might be able to look into something like https://jenkins.io/ to help automate the process or https://www.jetbrains.com/teamcity/
I am currently for my development server utilizing Heroku for the reason it can auto detect github changes on a branch which has helped a ton in doing micro updates. In the future would be swapping out to just ec2 or the gamelift service to cut out the middle man
@rapid tendon can probably do a little power shell script that does this for you
I'll look into that later. I'm probably not going to do any changes server side except for saving player positions so I can just do the process one more time and be done with it for now
Sure would be nice to get at least a little taste of what the new DOTS-Netcode API may look like before its preview in the fall. Anyone have any info on that? The most recent post on Unity pointed us the FPS Sample, but my understanding is that it is using the Low Level Transport, and the only similarities it may have with what to expect in the fall is that it uses ECS.
I at least hope they are piloting the project with current game developers outside Unity, and it won't be this big release and "Blah, here's what we built without asking you" type of thing
@main hill You can watch their progress here https://github.com/Unity-Technologies/multiplayer
What would be the best way to approach saving for my multiplayer game?
it's not a complex game and I won't be storing sensitive data like passwords or anything (ill just be saving player position when they leave the game).
Currently my idea is just:
save player position in a file/playerpref when they leave, in plaintext, on the server (which is an ec2)
But my main issue is somehow identifying each player uniquely and then being able to reference that unique id whenever they rejoin the game
someone said using guid but I couldn't really understand how to use it when looking it up. It seems like UNET did have a specfic way to generate network GUIDs but Mirror (what I'm using) doesn't seem to have it.
Perhaps you can get the mac address from the connection ?
Generally for that you would have a login server that takes your name and pword, and from that generates the token that the game would use to accept the connection, and the master server would pass to the game server your player deets
The gameserver isn't really going to want to start that kind of stuff. Logging in and out should involve a database of some kind outside of the game.
often it is enough to have one or a few instances of matchmaking server that handle that stuff: logging in, authorization.
and for game instances, this can happen on other servers
Hi guys,
Need some help, anyone experience in using Unity Photon Pun? T^T
This is how the things work, where the server is playing on a big screen that actually showcase all the player character walking around (just showcase, nobody is able to control it).
And other computers are run as clients, which audience will interact finish( including screenshot their face and put it on plane ) after that audience will press the button and the screenshot will put it on plane and transfer to the server.
Currently facing a question:-
After screenshot, it does not show on the Big Screen(does not send to Server), but only on Client side are able to preview the screenshot that project on plane.
my problem is exactly same with this link, however no one is able to solve it yet.
https://answers.unity.com/questions/1063470/using-photon-to-send-screenshot-to-other-players.html
@hard bronze : The code in that Unity Answers post is not using the RPC as intended. Caling RPC("method", ...) will just call that method via the network, not pass the image. You can use parameters as part of a RPC call.
If only one client needs the image (as only the big screen shows it to all), you can call the RPC on a particular client (the one on the screen).
https://doc.photonengine.com/en-us/pun/v2/gameplay/rpcsandraiseevent
Photon Unity Networking framework for realtime multiplayer games and applications with no punchthrough issues. Export to all Unity supported platforms, no matter what Unity license you have!
In a p2p model, how are large amounts of things like enemies handled? If im constantly updating position and state, and such for up to 75-100ish enemies, wouldn't this just overload network traffic?
@empty elk No generally not. We have demos with 400+ entities in a confined area all moving and updating pos / rot and bandwidth isn't the choke. CPU falls over before the network does.
Depending on the size of your scene, applying area of interest filters and some compression goes a long way to making it a non issue at 100-ish entities.
Awesome, thanks for the info @gray pond