#archived-networking
1 messages · Page 78 of 1
Without seeing, I would suspect a bug in your code somewhere.
Does that happen for you with any of the tutorial scenes?
@austere kiln
Also would be good to turn up your logging settings for pun2, to see if you get any kind of messages as to why.
I've posted the scripts, will they be enough for checking? Cause I'm really stuck and have no idea what's causing it
@jade glacier
I can only see what I see here (busy working so I can't really dig into your project) - you are going to have to do the usual debugging involved in these things.
Do the demo scenes exhibit this behavior?
you are doing some not-beginner stuff there with scene changes and such, so I would add that code very slowly to a working one scene project and see what breaks it.
I've updated the scripts abit and I'm about to post the same question in Photon Engine Server
Let's continue there
Best to not cross post, I would pick a channel and stick to it there. Many of the networking channels are the same people and it generally is frowned on cross posting like that, and will likely get you ignored.
so i dont know if this is too advanced for multiplayer for me at this moment but basically im making a game where you can switch in between characters with different abilities (Kinda like the lego games) and i dont want more than one player to be the same character. I tried using mirror and it didnt really work the way i did it. Does anyone know any good programs and the gist or any tutorials that know how to do that?
One program i was thinking about using was photon bolt for peer to peer co op
I don't think switching the networking solution is going to help here
Agree with the above
Either of these API/SDKs would work... You need to take your time, understand a bit better what you are doing, etc.
(As a photon engineer, I could be pushing for Bolt) There's nothing particularly wrong with Mirror for what you are trying to do.
hi guys
just wondering
what is the best networking solution for a physics based game?
that uses active ragdolls that will be interacting with one another alot
Quantum really will be your only option. Since what you are describing really doesn't play well with state interpolation, which is what you will be starting with using Pun2, Mirror, or Bolt. @hard badge
If this is your first networking rodeo, I would NOT start with that type of game.
Unless you have funding and can get into Photon Quantum.
alright thank you
I was using mirror and the thing is that the buttons were not able to be pressed. I already have some of my game that was done offline and I have a script for my camera with the 2 lines about cursor.lockstate and cursor is visible which is why it probably doesnt work. All of my scripts written derive from monobehavior and im worried im gonna have to rewrite all my scripts to fit with the server
This is all I have done rn
Any idea on how to achieve peer 2 peer multiplayer hosting? I’m familiar with UNET and Photon, but then I’d need to upgrade photon for more players.
^
Hi guys. Does the Unity's Transport API has some sort of reliable message queue/buffer?
Basically you cannot send more than 32 reliable messages through the pipeline, as it will end you with an error and the message to be not guaranteed to be delivered.
Tho, simple buffering of these messages for later sending (i.e. wait for the queue to get some free space), would probably make it a lot more reliable.
can somebody help me figure out how make a pickup script?
I'm trying to do an healthpack and I want that when the pickup enter in collision with a player, THAT player execute a "GainHealth" function
Be sure to indicate the net library, since answers will vary based on the authority model @cedar cloak
i kinda did it right but photon "crashes"
not sure what crashes in quotes means
Cannot send op: 253 Not connected. PeerState: Disconnected
UnityEngine.Debug:LogError(Object)
this happens few seconds after I interact with the pickup
Sounds like maybe something in your code caused a flood of data that forced a kick maybe? Do yo have a loop that this creates where it calls the same RPC over and over?
I would turn up the pun logging settings to get as much info from the networking layer as possible
private void OnTriggerEnter (Collider other)
{
if(other.attachedRigidbody == null)
{
return;
}
if (other.attachedRigidbody.gameObject.tag == "Player")
{
other.attachedRigidbody.GetComponent<InputController>().UnlockWeapon();
photonView.RPC("Disable", RpcTarget.All);
}
}
this is the script, it's pretty basic
I assume you are connected
I am
And disable has no arguments?
Might want to paste your entire script into hatebin.com
am in dire need for a networking expert to look at my game code and consider how much it gonna cost to add multiplayer function
Basic answer:
- multiplayer is not a function. You create your game from day 1 as multiplayer online
- otherwise, very likely it will NOT work, or will be just BAD
You may find "experts" to fake something for you though...:)
Good developers will pretty much say the same I said (can be done, re-creating the game considering multiplayer this time)
where can i find such developers to hire ?
There a few here... Most already have stable jobs, I assume
It's like any other profession, if you have a good position available, that pays well, you'll get what you pay for.
Here we mostly discuss technical aspects between developers... If you have a clear job description (I already know it's indeed related to Networking/Multiplayer), post the link here... Should be fine.
i have 40mb mobile game btw
so i have this idea where you set the player prefab as an empty game object on a menu like screen where you select an actual character but if the movement scrpts are already active from another player you cant select them and then the camera transitions over to the character you selected. the only thing im worried about is idk how im gonna make it so that it doesnt interfere with cutscenes and stuff like that. does anyone else forsee any probs with this?
using mirror btw
40 Megabytes
i need someone to look at my project scripts and figure how much it will take to add multiplayer to iOS and andriod
i will pay by the hour
40MB have absolutely no meaning here... Have no idea why you said this...:)
It just says you have textures/models that bake as a 40MB build... Unrelated to whatever networking would be...
Hi all. This is for UnityWebRequest
How can i fetch content including what's in the scroll downs? Like facebook wall
??? Are you experienced with web development?
A scroll is normally done with multiple dynamic requests as scrolling is done
You never fetch the whole at once...
It would not be different at all with unity... Do several paged requests resulting in JSON data (or anything else)...
so i have this idea where you set the player prefab as an empty game object on a menu like screen where you select an actual character but if the movement scrpts are already active from another player you cant select them and then the camera transitions over to the character you selected. the only thing im worried about is idk how im gonna make it so that it doesnt interfere with cutscenes and stuff like that. does anyone else forsee any probs with this?
using mirror btw
Hello I have a problem with Photon Networking
This is my scritp that I attached to the player networking prefab
look at line 21
It's supposed to display players nickname above the prefab
Anyone know about Socket.SendTo and memory allocation?
Every once in a while i see 22 allocations happen in my sending thread and the profiler claims it was done by Socket.SendTo. Is this normal?
what would be the best way to create randomly spawning items? would it need its own photonview to sync its position?
Not necessarily the best, but that would be the easiest.
Which engine?
Unet is pretty much dead, so I would first consider switching to Mirror, and joining their forum.
They might have some kind of master server option, which you will need if you want a master list of active games.
Mirror Discord is the place to ask.
You are talking about orchestrating server creation/spinning up (in case of dedicated servers)
This is normally sold as service by providers like amazon Gamelift or Unity's Multiplay...
If you are talking about creating a server with your local computer, then check if mirror offers a relay + punch service somehow (I think they do), so players can host servers in their own PCs
In either case it's not "a button", but rather part of your full solution (several services + code to coordinate this)
Does mirror work just like Unet?
So i was able to get the multiplayer to sync up and now your able to join servers for MIRROR but now i have the problem that the player can still switch to another character. The reason why this is is because i have an if statement that states if the movement script is enabled you cant switch to that character but for some reason on of the players games will say that the script is on and the other will says its off meaning that 2 players can play as one player and essentially possess the other player. Does anyone have a way so that if the script is off for one players game its off in all the other players and vice versa?
i want players to be able to switch between different playable classes like the lego games but for some reason you can have 2 players as one character which creates development console errors that say "null reference: object reference not set to an instance of an object" or something like that
Hey everyone, I'm using a unity implementation of SimpleJSON.
I'm trying to construct an array of two values called Parameters, but it loses the Key value inside the array, any idea what I'm doing wrong?
JSONObject jsonobj = new JSONObject();
jsonobj.Add("name", inputCompanyNameField.text);
jsonobj.Add("type", inputCompanyTypeField.text);
jsonobj.Add("abreviation", inputCompanyAbreviationField.text);
jsonobj.Add("location", inputCompanyAbreviationField.text);
JSONArray parameters = new JSONArray();
parameters.Add("product", "myvariable");
jsonobj.Add("parameters", parameters);
var payload = jsonobj.ToString();```
Returns: ```
{"name":"name","type":"Type","abreviation":"abreviation","location":"abreviation","parameters":["myvariable"]}```
**parameters:[] the key of the array is missing and only showing the value.**
Hello,
I'm trying to get GRPC to work on Unity on HoloLens2.
Current status:
- Manually compiled a windows arm64 version of grpc_csharp_ext.dll (it came out in version 1.29.1). The reason for manually compiling: the grpc binaries do not include a windows arm64 version of grpc_csharp_ext.dll.
- Used this version of unity grpc package: https://packages.grpc.io/archive/2019/10/8853754e8caa0b2ffb3ab0e25514f3f7612ebf7a-d6090f79-7b70-429d-a477-9df736e4941a/index.xml
- this is listed as 2.25.0, which I'm assuming refers to grpc 1.25.0
- Build works in unity, and in the il2cpp project. The current exception on the HoloLens2 is attached.
Trying to resolve this, I have two possible directions:
- Try to make the code find the dll (which is in the same dir as the .exe file),
- Fix the version mismatch between grpc_csharp_ext.dll and the grpc package.
- note: tried using the a more advanced unity package (2.29.0), and it seems to be not working in unity (even before trying to add HoloLens2 into the mix). I did manage to get 1.25.0 working in unity (as well as in HoloLens1)
Any help would be much appreciated.
This is normal. Done by design. The regions are separated from one another.
Use less regions, in doubt.
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!
are PunRPC methods called globally or do I need to specify the script where it is?
globally iirc
so i dont need static?
@cedar cloak It's done relative to the PhotonView you are targeting.
ok I have an issue so ill ask specifically
in a multiplayer match I need to clear objects that players drops by dying during the preparation match at the start of the "real" match
should I send a PunRPC method to all that basically destroy all these objects?
Drops should probably be scene objects, which can just be destroyed by the masterclient
[PunRPC]
public void ClearDrops()
{
GameObject dropGroup = GameObject.Find("Circle/Map/Drops");
foreach (Transform child in dropGroup.transform)
{
GameObject.Destroy(child.gameObject);
}
Debug.Log("Drops Clear");
}
this is my actual script
Ah they don't have photonviews?
Then you should probably use the destroy method in Photon, which should be synced automatically
You would do something like that when the objects don't have photonviews
Yea that should do
ok it solved it
nvm is got fixed only on master side
maybe it isnt owned by the scene
it is, heck
@cedar cloak Again, are you using the destroy method in PhotonNetwork?
with a normal instantiate
oh its PhotonNetwork.Instantiate
i dont even knew that existed
does it instantiate that obj on all connected machines?
Yea. That should integrate a bit better with Photon than plain Instantiate.
Yeah, that is the expected way to spawn things with Photon. You have been trying to manage that process yourself?
Acutally for now I just stopped developing for the day, its 00:10 here and I wasted all day trying to fix that
I know, that happens quite often, I'm just chilling out for now and waiting tomorrow for doing it
Be sure to do the tutorials before trying to get too far. Guessing like you are doing is going to burn a LOT of time.
agree
i actually started with a long tutorial series but that got interrupted and I got the curiosity to try new things by myself
turns out multiplayer is 10 times more complicated than i expected
even because there's no much community around that and so there are few people that can help with these specific probles
Networking games is probably THE hardest part of game dev.
luckily on this discord people always ask ^^
Its time to go for me now, cya guys have a good night. I'll probably back tomorrow for more dumb questions 😄
What’s the limit when it comes to photonviews? How many before it lags the game
how would I handle matchmaking?
How can I setup a skin (material) systyem?
the problem is that iirc it's messy to change prefab color at runtime and I cannot unpack the player obj since it's needed for isntantiation (respawn)
all clients must have the prefabs with the right colors (or possibility to change material sikn colot-tint) - this can also be done with asset bundles, etc
Then, when you instantiate, you include the information about the right skin to be loaded, etc.. (you definitely can switch materials, models, etc)
There are several different ways to setup such system... But it will be hard to find someone to just write one for you for free.
Hi guys.
Does the Unity's Transport API has some sort of reliable message queue/buffer?
Basically you cannot send more than 32 reliable messages through the pipeline, as it will end you with an error and the message to be not guaranteed to be delivered.
Tho, simple buffering of these messages for later sending (i.e. wait for the queue to get some free space), would probably make it a lot more reliable.
They are probably using an Int32 bitmask for ACKing
that's whyt the 32 queued message limit
What are these messages your are sending? At a glance it sounds like you are trying to make Unique packets out of each "message"? Rather than serializing a bunch of stuff into a byte[] and making that one message? @whole granite
I have no idea what the Unity transport does for batching and such.
Yeah, let say that I want to send more than 32 packets over reliable pipeline. It's totally edge case, tho.
That is some 32000+ bytes worth of data if you are making efficient use of your packets
Well, technically you don't have to send that much data over single packet (i.e. <1400bytes).
A single packet for UDP is more going to be in the byte[1200] range to keep it within MTU
I assume that 32 packet cap resets once you flush the transport?
I am not familiar with that restriction, so not sure what it relates to. Typically with transports you just send, and it keeps pushing them out the door. A mask implies that it is batching your writes into datagrams or something. I really have no idea. I avoid the transport layer. That just all sounds a bit odd.
they probably also slide the window
so it keeps shifting the bits as soon as an ack happens, etc
That would make sense.
it can only have 32 reliavble packets 'in flight' at once
which is laughabily small
@jade glacier
I assume that is atypical?
depends on the game, but it makes the library basically useless for reliable sends
If they were going to be lazy, why not back it with a uint64 at the very least?
it's too little tbh, it needs to handle these cases well
just one simple thing
I want to send a map from server to all clients when they join, if the map is larger than 1200 * 32 bytes ... i can't.
That seems pretty fragile yeah
If you want bigger you have to build in some kind of metering method that "feeds" the transport slowly and waits for acks?
yes
weird.
or stream the map with tcp
yes but that's just
then you're adding another complexity
it should handle that easily no problem
but it doesn't
This is the current transport layer of the netcode library?
yes
oh boy.
what would be the easiest way to handle randomly spawning objects?
like events to happen in the map
sorry, i cant find the right words
what im trying to do is spawn an item at a random position on the server side, instead of the players
What is the library?
Yeah, that is why I asked about that queue/buffer thingie. @jade glacier @graceful zephyr
Dunno, but I'll probably make my own "feeding" mechanism. But it would be nice for Unity to support this, tho...
Probably I'll post something on the forums.
So, library is photon
Best way would be, get a random position, network instantiate from the master client, I'd say
If you don't know what that means, than I'm not sure I know how to explainm
i understand that, any help on my error though?
Your code, line 29 of that script is trying to call functions in a null reference
Should be self explanatory
yea but idk what part of https://cdn.discordapp.com/attachments/497874116246896640/733985138530189393/unknown.png is causing the error
that was it, thanks
Guys
Help please?
how i can duplicate a object
properly with PhotonView
private void CloneGameObject(GameObject GameObject)
{
DebugLog("Found A Test GameObject :" + GameObject.name);
var obj = PhotonView.Instantiate(GameObject, CenterOfPlayer() + DistanceVector, Player.field_Internal_Static_PlayerField_0.transform.rotation);
if (obj != null)
{
obj.transform.SetParent(null);
DebugLog("Spawned A Copy Successfully!, cloned " + obj.name);
}
else
{
DebugLog("Failed to clone object, is null!");
}
return;
}
this is how im instantiating the object
but
ArgumentException: An item with the same key has already been added. Key: 55
at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x00000] in <00000000000000000000000000000000>:0
at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <00000000000000000000000000000000>:0
at ̊̊̈̊̈̊̈̊̈̊̊̈̊̊̊̈̊̊̈̈̈̈̊̈̊̊̈̊̊̈̈̈̊̈̈̊̊̊̊̊̈̊̈̈̊̈̈.̊̈̊̈̊̈̊̈̊̊̊̊̊̈̈̈̊̊̈̈̊̊̊̈̊̊̈̈̊̊̈̈̈̈̈̈̊̊̊̈̊̊̈̊̊̈̈ (Photon.Pun.PhotonView ̈̊̊̊̊̈̈̊̊̈̊̊̊̈̊̊̈̊̊̊̈̈̈̈̈̊̊̊̈̈̊̊̈̊̊̊̊̈̊̊̊̈̈̈̈̈̊) [0x00000] in <00000000000000000000000000000000>:0
at Photon.Pun.PhotonView.Awake () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.Object.Instantiate (UnityEngine.Object original, UnityEngine.Vector3 position, UnityEngine.Quaternion rotation) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.Object.Instantiate[T] (T original, UnityEngine.Vector3 position, UnityEngine.Quaternion rotation) [0x00000] in <00000000000000000000000000000000>:0
UnityEngine.Object:Instantiate(Object, Vector3, Quaternion)
UnityEngine.Object:Instantiate(T, Vector3, Quaternion)
there's this error
Instantiate takes the name of the gameobject, and uses that name to find the Prefab in a Resources folder. What you are doing there looks like its trying to do something different. Can't comment on the error, since I can't see the trace of what line in cs is causing that.
the error pops up
when you try to instantiate with UnityEngine.Instantiate
because the cloned object in photonview has the exact same key and it doesn't allow it
soo the object is not grabbable at all
but the original one is it.
You are trying to do something that Instantiate isn't really meant to do is what it looks like at a glance.
By putting the prefab in the resources folder at design time
that way all clients have the exact same prefab to work with
.... is a mod boi, the client has a API that im using
Can't speak to that
but when im grabbing the object
it doesn't let me interact with it
because of that error
Not sure what grabbing the object means, but that is something outside of the Photon networking problem it sounds like.
I wouldn't be trying to "grab" anything while you have a critical error.
is not a critical error if the object shows up
but photonview doesn't allow me to interact with it.
If you have red text in log, you have a problem you are going to want to resolve first
that is a white error, not a red error luckily
but is annoying that i can't interact with it and i want to fix that
if there's a way to convert that object into a prefab throught script i would do that
I mean, yeah - you got some bugs to work out.
You can get into instantiation with your own RPCs
and not use the PhotonNetwork.Instantiate
But you will need to send all info that is required to other clients.
nothing just "replicates", you have to parse out what info is needed that other clients won't know about the object, and send that, and apply it on them manually.
yeah, but RPC doesn't have much
Typically you try to avoid that, and make your prefab that you spawn from standard. Then you only send messages about "variations" to that object.
how im supposed to clone a object with RPC?
by deserializing and serializing whatever needs to be to make that happen. It isn't basic and will require some understanding of object serialization and such.
You generally don't "clone" objects with networking. You typically have a starting prefab, and then you just network changes to that prefab... such as color, mounted weapons etc.
Is your ball a prefab in a resources folder?
Then you are pretty much on your own yeah. That is outside of the MonoB tools that Photon gives you to work with. You will need to write your own serialization and deserializaton probably.
C_C
You can make your own instantiation methods and such, but its all going to be a bit more advanced than PhotonNetwork.CloneMyThing(mything)
Why what?
Because serializing undefined GameObjects is not trivial
If you have produced an object on all clients that you are treating as the gameobject starting point, you can instantiate that and then make variations to it.
But none of this is trivial.
is possible to destroy that object from photonview ?
since that is the only issue with instantiated gameobject, that photonview interferes
I have no idea, I don't know what you have going on. Anything is possible with coding though.
private GameObject RemovePhotonFromObject(GameObject originalobj)
{
var PhotonLessObject = UnityEngine.Object.Instantiate(originalobj);
if (PhotonLessObject != null)
{
PhotonView[] photonViews = PhotonLessObject.GetComponentsInChildren<PhotonView>(true);
if (photonViews != null && photonViews.Length > 0)
{
for (int i = 0; i < photonViews.Length; i++)
{
PhotonView pv;
if ((pv = photonViews[i]) != null)
{
UnityEngine.Object.DestroyImmediate(pv);
}
}
}
return PhotonLessObject;
}
return null;
}
but it doesn't work perfectly
can't say, too much code not in front of me to say if you are on a good path or a bad one.
You are just definitely not doing a standard PN.Instantiate() here.
PhotonView.Instantiate() is not a thing btw
You is just GameObject.Instantiate() ... it is derived from MonoBehavior so you are just seeing the MonoB Instantiate method there.
PhotonNetwork.Instantiate is what you use for network instantiation.
I'm not sure what your question is really sorry.
@jade glacier i got a different error right now
i figured how to set the object's viewid
ApplicationException: NetID disagreement on TOY_BeachBall(Clone)
Hello. What do you prefer to use? Azure or Google Play services to keep data
You probably shouldn't be destroying photonviews from objects. Can't think of a logical reason why this would be something you do
im trying to add different skins into my game, but they're always the same or dont show at all
heres what i have
(in the menu script)
(in the player script)
Hi
I am using addressable in my project
And i am using a bucket on aws to store my updates
I want to ask if i can use my own server
Cause i have a website and 100 gb free space on the web
Can i use that to download updates in my game
@crimson zephyr try making it playable for more then one person at the same time
Hello. My level is being creating by scripts. How can I implement the same scene to my remote player? (Pun2-Photon) I do not know how to google for this topic. Thank you in advence.
cannot resolve symbol NetworkBehaviour, why?
Hi I’m in unity 5.6.0 and I got problem I’m coding a multiplayer game in unity and it’s multiplayer both characters work and can move independently on the client but only the lan host registers on all screens btw it’s C#
how can I just create a "normal offline" room using Photon? I need to create a tutorial scene but since now is all tied up to Photon services it's really hard to do a stardand scene
just remove all the photon stuff related to the room
problem is that the player is linked to photon references too
Isn't there the offline mode?
I remember PUN classic has it
Not sure about PUN2
With Offline mode you can just use the code as it is, it will work the same as a local regular unity game
Maybe @jade glacier or @stiff ridge can chime in...:)
hope so 🤞
I would start by reading about offline mode yeah, see if it's what you are looking for.
Unity 5.6.0 : my problem that I posted about was never solved so I’m going to post again in more detail.
My lan character is registering movement across all connected games I had 3 games open and the lan seemed to be moving on all but when I moved on a client it’s movement only registered on its own screen
Library?
Sorry @gleaming prawn is really new to code meaning player movement which I wrote 2 days ago was my first working piece of code
What is the networking livrary you are using?
There are several different ones...
My lan character is registering movement across all connected games
You must be using some networking solution to have this.. Was it the old, abandoned UNet (the last official attempt from Unity to create a default networking package)?
If it's anything official from Unity, you'll probably not have any help here (UNet is not supported anymore, was never finished... There's an open source project which took the original UNet and moved on - called Mirror)
I suggest you study a bit more, and also: upgrade from 5.6 at least to one of the LTS versions, either 2017.4 or 2018.4
IMHO
Hello. I could not find the solution. Thanks in advance for your responses.
In pun2, In my scene, the game is being creating by script as random. How can I implement exctaly the same room to my remote player? Should I transfer gameobjects to remote client? If it is, how? If there is another solution how? just giving a header to google it is enough for me. Thanks.
Have you done the tutorials for Pun2? (I assume you mean Pun2 when you say Photon).
They demonstrate network instantiation of objects and how you should be doing it.
Have you done the tutorials for Pun2? (I assume you mean Pun2 when you say Photon).
@jade glacier I did not watch tutorials associated with that I think. check it out now.
I wouldn't watch them, that won't really drive home how things work well enough. You really want to complete a few tutorials before trying anything of your own. You won't guess correctly.
@frosty crystal If you mean world generation, you probably wanna use some sort of seed as the base for the randomness. You can then just send the seed and let each client do the generation
At least the static parts
I have a question, I don't know if any of you ever used mirror (multiplayer package), but I'm trying it out right now and I was wondering how do you host a server on your PC using and ip instead of localhost so other people that are not on our network can also join
you should join their own discord
Smart I'll do that right now
But what you are looking for is punch-through + relay fallback options. I think they have this through some third party software
You can also have them connect to your public ip, the host will need to port forward the port you are receiving connections on
port forward, you mean with the router?
Interesting, how would i go about port forwarding, is it hard?
This is not recommended at all for several several reasons, but sure.. If it's just a playground thing
you need to configure in the Router
It's very "nerdy" to do this, as UpNP (a protocol for automating that) is unsafe and almost not supported anymore AFAIK.
Modern method for this is STUN punch through
- relay fallback
It is what Steam networking and Photon Bolt both use...
Port forwarding should be fine for some basic testing.
do you maybe have any video or article on this topic that i can read on so I understand it a bit more because its my first time trying something like this
would u say that port forwarding is easier but unsafe?
if this is first time, I'd not start with it
It's NOT easier... It requires you to configure in your router
SO there's no "google it" that's generic... Each router has it's own user manual
Yeah, for an actual game you wouldnt want to force your users to port forward because it needs to be done on your router, I remmember having to learn how to port forward to make a minecraft server for my friends back in the day. For if you want to skip the fuss for some playground stuff like Erick mentions, then portforwarding will be easier than doing NAT punchthrough
And it will only work IF your ISP gives your router a real IP (some use double nat now, which makes things more complicated)
Easy is relative...:)
For a first timer... Photon is easier... Honestly... Mirror is easy for the LAN case though
But you should join Mirror's Disrcod
Yea did that right now
they might answer you with more details
Looks like for mirror it is not out of the box, you need to do the NAT punchthrough yourself. I bet somebody on the mirror discord already has code you could use though
Thanks ill look around in there discord
@frosty crystal If you mean world generation, you probably wanna use some sort of seed as the base for the randomness. You can then just send the seed and let each client do the generation
@spring crane I see. But ı want to do it randomly. Let me explain. as you see in the picture below, I want to make all the boxes randomly. But I dont know how to do. If I do it randomness how do I do?
When I do it randomly how can I send all the game objects to remote clients. If there is no solution, how can I do with seed without using random.
In the documentation mentions about sending seed and changing custom room properties, so the clients can implement with in their own scene.
You should definitely just send the seed, and generate the same random sequence, hence the map as well, in all clients
Also, Bomberman is a good example of a game that works well only with deterministic predict rollback (aka rollback netcode). Using interpolation in Bomberman is sacrilegious
:)
Trying to sync info about all these boxes is overkill, just use determinism....:) Specially because you should definitely not use physics engines and shit like that for such game, it's grid based, very.clean and straightforward implementation.
FYI, I wrote the core gameplay of this game: https://store.steampowered.com/app/754050/Bomb_Bots_Arena/
Bomb Bots Arena is the ultimate multiplayer bomb brawler experience!Join the fierce online competition and be the last Bomb Bot standing in matches with up to 8 players.Relive the good ol' days of local multiplayer and see the agony in your frenemies' faces when you blast them...
So, I'm more than familiar with the genre/topic.
Try.to find a couple.of friends.ro play with
There are not many players, so chances are you'll only play bots...
Ok. Erick, I have a question, I am kind of new in unity.
After every boxex's instantiation, I will determine the type of the box, and add to a dictionary, Right? After all, to the hashtable...
You need to guarantee your random is deterministic in the first place
If this is your first game, do not try to make it multiplayer
That's the only reasonable advice I can say...
What I said before is valid, but requires a lot of experience
I wrote some basic games, fps etc. I think I it is time to start. Thanks Eric!
I bother you I know but, I could not convert object type to int to iterate. How do you do for it? Thanks
cast to string then use int.tryparse. as an alternative just send int instead of a string
anyone know what the heck a weaver is and why this keeps giving me so many errors related to it? using mirror btw
this screenshot isn't close to being readable. However post the errors you are getting
the weaver is the magical tool that's converting your code such as [SyncVar] into something usable over the network
@weak plinth these are the errors
also i think this is a cleaner screenshot of the code
You'll find better help in the Mirror discord, but I see a few errors. CharacterClasses isn't a mirror-serializable type, [Command] method names have to start with Cmd. Also this is two monobehaviours (NetworkBehaviour derives from) in a single script which I imagine is causing the weaver to flip out
i fixed all the errors listed above im gonna go ask the mirror discord, im still getting weaver issues. Thanks for helping out though appreciate it!
i was told i have to put cmd before all function that are comanded to the server https://cdn.discordapp.com/attachments/497874004401586176/735350431374508042/unknown.png
if thats the case then why arent i getting an error when this runs
Hello. How can I get callback if my local player's process of custom property loading is done?
Pun2
am I wrong or calling a PunRPC from a machine let every machine connected execute that method?
That is what they are for yeah @cedar cloak
strange, I'm trying to make some sort of killfeed so if the player dies it sends to everyone (thorugh an RPC) a method that create a message on the HUD, but doesnt seems working...
are RPC called like this? photonView.RPC("Method", Target, *eventualy variables*);
I never use them, so I would just end up referring to the manual, but that is the concept yeah.
tought to explain but i fixed it 🙂
is there a way to share information with every player in photon pun 2? ping me if you know
Typically with an RPC @lunar sage
yes i am gnna do that, didnt know what it was called
is threre a way to do that with variables @jade glacier
Just through the RPC. I have added syncvars with the SNS extension library for Pun2, but that is still in beta.
It works like the Unet/Mirror Syncvar, only using tick based timings.
Simple Network Sync for PUN2 Networking Component System © 2020 emotitron | Exit Games | Davin Carten Current version of this document online here Contact the author at: davincarten@gmail.com I am also regularly on the PhotonEngine channel of Discord as emotitron if you ha...
What is the best networking to use for a physics based game with 2 - 4 players, where the players are controlled with forces and shoot bullets with physics
@lunar sage what version of photon?
the newest
sigh
just get it on the asset store
pun bolt
sigh
@jaunty burrow what?
yes
truesync?
idk just look it up
w8
ill link u to some stuff
Global cross platform multiplayer game backend as a service (SaaS, Cloud) for synchronous and asynchronous games and applications. SDKs are available for android, iOS, .NET., Mac OS, Unity 3D, Windows, Unreal Engine, HTML5 and others.
i tried using pun but the physics were slow and unresponsive
i dont think it affects the physics
@jaunty burrow definitely photon Quantum
Truesync is a discontinued product (also deterministic predict rollback like quantum, but with a -wrong- MonoBehavior-based architecture, so didn't reach the desired performance),
For physics-based interactions where accuracy is required, there's nothing to really compete with quantum...That's what it is.
@lunar sage PUN2 would not be ideal for physics-based interactions.
Neither bolt.
I'm using a particle system on the guns to make a flash when I shoot, problem is that when I do it all nozzle flashes
I even tried with photonview.isMine check but nothing
any tips?
@gleaming prawn bolt is a visual scripting language, not sure what it has to do witht his
@lunar sage Photon Bolt is a networking library.. Was created LONG before bolt scripting language FYI...:)
I never understood why Unity let the scripting language use that name, as it was taken (Bolt networking was a package in there before)
Bolt (the net library) is a client-server, fully fledged tool... Well praised by people who use it, etc. For the right games (FPS, TPS, Action Adventures, etc), it is possibly the best tool in Unity (subject to opinion, of course).
But for games where the main focus is physics interaction and accuracy is necessary, Quantum is (arguably) the best.
The main thing people should get from all of this is that Bolt and Quantum are you ONLY complete networking stacks.
Pun2, Mirror, Forget, MLAPI and the various transports will require you to get your hands dirty quite a bit more in the business of working out the paradoxes that come with state transfer.
Any Transform/Animator syncs they provide are indicated as "Reference only" and are not particularly good. And none of them are tick/simulation based. So you are on your own to wire that up.
@gleaming prawn is quantum free?
Quantum isn't for hobbyists no. Last I was aware it costs $1000/mo just to be working with it. The target audience is funded studios/projects.
Hello. When I cast number to selection variable. My value is being destroy. Why?
can photon pun 2 be used in cross platform like for example, webgl and download?
I reimported an older version of the same project but now Unity doesnt find the asset in the Rources folder, what can I do?
dont upgrade ur unity version when ur wroking on a project @cedar cloak
I dindnt do it
the project "state" was older
it was a backup cause now i screwed up some code
and I want to return back using a saved project folder
use git next time 🤣
Yeah, stop whatever you are working on. Spend half a day getting git installed and learning the basics.
Programming without a repo is suicide.
you can have physics in games without determinism. Just gets a bit complex
cuz explosions use physics
@terse relic make ur own explosions
w8 @weak plinth what physics things dont work in photon pun 2
It depends what you mean by physics really.
State Transfer involves the authority version running some form of physics or simulation, and then broadcasting that state to the players. Physics themselves aren't networked.
What you likely are asking for, the only library that will make physics appear in perfect agreement between clients is Quantum.
With state transfer libraries (Bolt, Pun2, Mirror, etc) Physics occur on one client or on the server, and the results are replicated to others not as physics, but as transform states.
Someone did an add-on for Bolt with PhysX support: https://github.com/Avatarchik/Bolt-Physics
I haven't used it, but looks like they got something functional
@sonic echo I haven't tried it, but how does PhysX like being rewound/fast forwarded? Is there a large CPU cost to manually reposition many bodies?
Hi. In pun2, when I create room, in OnJoinedLobby, my game scene is being opened. But in the game scene, function the OnJoinedRoom is not working? What may cause it?
"Not working" ?
What messages are you seeing in the log?
Do the example scenes in the photon folder work? Like the Asteroids demo? @frosty crystal
@jade glacier this wont cause much issues in a game with character controller movement right
and do raycasts get affected
Way too vague really for me to even guess at the right answer for you sorry.
like would this affect character controller
@floral turtle this "add on" is super old, and does not even mention that Bolt now has a free version... I doubt it still works, as it didn't get updated since 3 years ago.
You have to clearly define what you mean by "networking physics" before you can answer questions about what can and can't happen
ALso, you can join Bolt's official discord and check the community there, they are very welcoming to newcomers.
I WOULD NOT even think about any of this unless you have a few basic networking games made.
i didnt say "networking physics"
Then I might be confusing conversations, I'm not sure what we re discussing sorry.
i mean would the issues u talked abt earlier affect character controller or no
Everything networking affects character controllers...:)
You can just do a very naive implementation (using PUN2, for example), so you control your local KCC and sync it's movement.
i think im confusing myself
And not do any lag compensation for raycasts
But the more you get into networking you'll see the devil in the details.
And understand why there's a lot more involved into making a good game (that feels good, fast and fair to play)
yeah cuz the thing is like a quarter of a second delayed, even tho both clients were on the same device
or maybe i just have bad internet, i have no idea
For mirror, I suggest you join their own Discord server
im stupid forgot i was in there ty
What messages are you seeing in the log?
@jade glacier I have noticed my issue. why I do not know but, I thought, even after changing scene, the OnJoinRoom is supposed to be run. But it is being called just once in the same scene. Not to the other scenes.
It is a callback, so it will only fire when you join a room, and the callbacks that fire will only be the callbacks you registered.
If any scene objects aren't loaded, they wont have any instances, nor will they have registered any classes.
Hey so... how incredibly hard would it be for me to write server authoritative netcode for VR that actually feeds in 3 rigidbody's vector info as input per client (head + 2 hands) as Vector3 position, Vector3 linearVelocity, Quaternion rotation, Vector3 rotationalVelocity? Is that a lot (too much?) of data to feed from client to server considering generally most games just need a Vector 2 for mouse cursor and like 4 bits for WSAD?
How much should I truncate the Vector 3's by before I will crash everything to the ground? What tick should I be going for?
Like how often should I send input considering the much higher input requirements? And any recommendations on server tick rate? I'm going for multiplayer melee (sword).
Also - has anyone successfully set up Unity with wireless ADB in a way that you can Build and Run wirelessly? I mean, on an Oculus Quest
Help needed. If I have networkid stored as string, how can I find gameobject with that netid? I tried NetworkServer.FindLocalObject() but how do I convert from string back to networkid?
Should we first ask why its a string?
@buoyant carbon I think what @jade glacier is saying is that the return type from FindLocalObject() should be GameObject
From the GameObject itself you should be able to use its own member functions to find out whatever you need about the object you've pulled up, or interact with it
The netId has no real reason to ever be a string, wondering what could have led to that.
so i have a singleton with a script variable which is supposed to only have 1 player play as one character so players can switch between characters so the variable should be global yet i cant get it to be global on all clients yet i can get 2 players on 1 character. Anyone have any fixes? This is in mirror but i am debating if i should just use syncEvents instead tho
That sounds like a job for syncvars.
The netId has no real reason to ever be a string, wondering what could have led to that.
@jade glacier @haughty blade thanks, I backtracked all the old methods to find why it was originally done so, and there really was no reason for it at first place. Just bad code. Thanks for the help.
👍
Hey. I wanted to learn about the network in the unit. can i use local multiplayer for free? and also multiplayer on the network for free if I use p2p? or will you have to write your own implementation of everything?
@safe sand depends what package you use: https://forum.unity.com/threads/what-are-the-pros-and-cons-of-available-network-solutions-assets.609088/
@jade glacier i put a syncVar bool in a singleton and refeerenced it in my scripts that needed to use it but it did not work
Make sure you have read the docs and done any tutorials. And join the mirror channel.
@vapid leaf what do you recommend for a simple 2D game? I want to be able to play locally (by connecting, for example, to one wi-fi network). and via the Internet. And I would like it to be free
For local I'm using mirror and I'm pretty sure you can also use mirror for online p2p connection but I'm not exactly sure how
mirror is free?
If anyone knows how to make online p2p for mirror let us know
Yeah its in The asset store for free
No license either so u can use it commercially worry free
If it works like that, then it's not a problem to create a p2p connection via the network using fierbase and a table inside as matchmaking
I'm not trying to make a competitive multiplayer game just so that you can play with friends for the story mode
Hey, i know UNet has been depricated has anything taken its place? If not what do you sugest if i play to make a multiplayer game?
hi, guys I am making a multiplayer game with parkour and guns and I need someone that good on multiplayer to join(for free). we are working with unity, about the networking: photon 2 and playfab
I would start any networking learning with doing tutorials for some of the main library options like Mirror, Pun2 and Bolt. You won't even know the right questions to ask until you have gotten your hands dirty in the libraries available.
Whats the "Best" language to make a game server in (UDP and/or TCP)
@slim ridge Would you say UDP or TCP is better
UDP for time sensitive information, TCP for everything else
so i should have a mix?
yes
how do i get the length of a htmlnodecollection ?
var web = new HtmlWeb();
var doc = web.Load(url);
HtmlNodeCollection links = doc.DocumentNode.SelectNodes("//a");
Debug.Log(links.Length);
Hey guys sorry to be a bother but I have what I think is a pretty unique question that I don't think is very hard - does anybody have a moment? I am wondering how to use mirror (or any other networking tool I'm not married to mirror) in order to assign control of the same object to two different players.
I have 3 problems 1. my syncVar only applies to clients but not to the host. What im trying to do is have switchable characters but i dont want 2 players on 1 character. 2. My client does not move on the server but can still move as in it doesnt appear to move for any one connected to the server 3. I will send an image cuz idk how to explain it
Hey, new guy here 🙂 So I have a question which is: I am planning to make a video game which eventually to publish using Steam servers or Amazon servers(not sure if those work the same way), which would be way to go?What network language should I go for? I watched quite a lot of videos and read forums and just got more confused. Thanks in advance!
Im finding that I have 'left over' packets in my UDP socket between connections. So, if I connect once, then disconnect, then connect again, any packets I hadnt received in the meantime seem to queue up to be consumed.
Now, from what I've read, a NetworkStream doesnt have a buffer, so Flush on that wont actually do anything, but what I did is this:
if (flush)
{
while (client.Available > 0)
{
client.Receive(ref groupEP);
}
flush = false;
}
Where flush is a bool, client is a UDPClient and groupEP is the IPEndpoint. Is there anything particularly wrong with doing it this way? I am using ReceiveAsync on my other calls, but thats more a structure thing, this is running on a separate thread so it wont block the game thread.
I need huge help, please.
When my Bomberman drops a bomb (RPG method) I can reach bombs script via bombs game object.
If the remote player gets in the room, my remote player can not reach its bombs script via the remote player's bomb game object.
What could cause this?
Hi iam looking forward to make a new multiplayer game. Ive used photon before and was just curious if there are any better options? Ive heard some stuff about unitys own, DOTS but is that available at the moment? i can't seem to find it, much thanks! 🙂
Unity's own is slpha/broken state.
Not close to being usable... Also very tied to a very specific networking model so far (may evolve later, but who knows)
By photon you probably mean PUN, right? There are several options (from photon, like Quantum, Bolt and PUN2) or from others like Mirror (open source followup to unity's deprecated UNet), etc
Hello guys, has anyone here used SmartFoxServer?
or any similar low-budget solution for the network frame
okay, So i'm having a problem that I think this might be the right place to post it... I'm not too sure exactly how to phrase it nor do I know where the problem is in my code, but I'm doing an FPS and have an effect of the current prototyped pistol that allows it to recoil upwards when a shot is taken before then returning to it's initial position that it was held in... THIS works, just not over the 'server' I made with PUN, I've got all the movement and shotting synced apart from this one issue
so now it looks as though the player that has shot has the gun constantly rotation around him hahaha
So if anyone thinks that they might be able to help me, please PM me... I've been struggling for a lot of today on this one issue and don't really understand what to do :/ Thanks in advance! haha
hello guys
there's someone have a knowledge about multiplayer?
and games thats u should connect to the server not to the host?
@thorn kestrel
there's someone have a knowledge about multiplayer?
Yes, several
and games thats u should connect to the server not to the host?
But this question is difficult to even understand.
Please, ask a more specific technical question, then you might get a proper answer
@tidal zealot I'd just trigger an animation for that when I get the information about the shot (on the other clients)
If you want to consider the recoil for the aiming on the next shot, use the bone-animation position/orientation as part of the shot parameters...
It's a bit of a complex topic (to make that influence gameplay), but just showing it should be straightforward with animation
Hi, I made a simple air hockey game for two players, but the positions of players aren't synchronized correctly. I used mirror.
what's the problem
Video doesn't play for me, but what do you mean by synchronized? The internet latency will always make each player live in the future, unless you are doing an extrapolation-based input or state sync (you aren't) @brittle vigil
it plays just nothing happens 🤣
positions are different on host and on client
On google drive video works
Ye @brittle vigil position of the other disk is wrong.
But it's your code, only thing we can say is: yes, it's not right.
Why, being this Mirror, first you should join their discord (there's a bigger community there), second: post more details of the code used to make the movement.
It looks like your non-authority versions of player objects is a non-kinematic physics objects. They typically need to be kinematic on other clients, and they get moved with the NetworkTransform sending updates from the Authority version to all other clients.
If you are using physics, only the one with hasAuthority == true should be affected by physics (set to non-kinematic).
@brittle vigil
@gleaming prawn my question is clear i ask if there's anyone have a knowledge about c# networking and connecting unity clients to a dedicated server
i want the host is server not player
Any one here running on AWS?
I was gonna setup a proto with endels websocket and aws lambda
anyone used UNet, been getting the hang of it, ive built a custom server browser using it and ive also built added an auto search system, can someone help me with the logic atm the program list all the matches or trys to list 200 if there are no matches we create a match, if there are matches then pick a random match from the list and join, these feels to simple to work properly
@thorn kestrel in that case my answer is also clear: yes...:)
@gleaming prawn ok so how to make it u have some yt tutorial or somethin ?
Erick is saying that you need to post specific questions here that are answerable. "Teach me networking" is a bit much, considering it is something that typically takes a few years to get a really good handle on. @thorn kestrel
Try out the public libraries that are an option. Mirror, Pun2 and Bolt are pretty typical starting points.
A server can be for many things, so there are several YouTube videos, yes. But your question is still way too vague, as stated by emotitron.
@jade glacier ok ty man
what happens if I'd skip it?
How can I make photon work with ObjectPool? I know I can instantiate with it, but I want to have my objects preinstatiated to improve performance. (Also, it's a test and I want to impress them)
Also, is there anything special to photonView.IsMine? I can freely move 2 players, but their position isn't updated on other clients.
And when I say this (if statement), it's updating the wrong client...
if I reverse this if(!photonView.IsMine) it works fine
yes, they do have photon view components.
I am also moving them by their transforms, not by physics.
Also, is there anything special to photonView.IsMine? I can freely move 2 players, but their position isn't updated on other clients.
you have the transform views on them yea?
Yep, it's in the screenshot.
I am also moving them by transforms, not by physics, so it should be fine here too.
the code shouldnt matter
how it got to that position shouldnt matter
until u start to precalculate ur movements and stuff
so you only got basic cubes? so far
alrighty i found it
Well' I've got a bit more, the cubes are there just to visualize where players are.
yea thats fine
It's also not really an fps, but the idea is the same.
imma look how i have mine set up
and u can compare that to urs
damn that took a while
and ur players are prefabs that u instantiate in?
sorry just trying to cover the basics first
And you called it from StarT?
i had to type out all the weird syntax when i did mine
it wouldnt work without (Path.Combine("PhotonPrefabs", "NukeBoxPlayer")
Well, it works here.
good good
can I see NetworkPlayerAwake and NBPlayerMove?
thats for enabling only your conrols
nb player move is a big script..
moves a CC using CC.Move();
yea
can I see the relevant part for moving around?
it doesnt have any photon in it
oh ok.
ya
just that
i have photon space but its unused
the real magic is just the transform
you mean...?
ok so you just observe your parent
and the same object as the move script
yea
im not sure if it has anything to do with the move script being on the same object
but the graphics all followed when i do it this way
Any chance I could DM you?
ya you are free to
but i dontknow how much more help i can be
i didnt get very far into the project
@regal badger How would I host an online fps?
have you tried Mirror´s Discord?
Zapnet is also good and designed for programmers - especially if you want to self-host dedicated servers 🙂
never heard of this one... will take a look...:)
That came up in the channel like a half year to year ago, but haven't heard much since then. It looks like it hasn't really progressed much. Is the author of it still active?
@jade glacier kuro is the author!
guys there's a networking system that's is free ?
@thorn kestrel mirror is open source and free... But if you plan to host servers, these will never be free, and also a matchmaking system to list active server, etc, these are services you normally have to pay for
@jade glacier yeah unfortunately the coronavirus pandemic kind of halted our development as we had to shift to focus on paying the bills / jobs and we both got sick 😦
i need help getting my body to instantiate
am i doing something wrong?
also im in VR so that just muddies the water
Lemme pull up my project
lol yea it spawned
I have an old phtoton project
I can send it to you for reference
It's a few years old but yea
Sure thing
I dropped it here just incase
😋
:D
what is null?
photonview?
You can debug it too
IPunObservable seems to only implement the method on line 34
whats wrong with it
yea i think photonview is null
is that not how u use photonView
using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;
using Photon.Pun;
using Photon.Realtime;
public class LocalSync : MonoBehaviourPunCallbacks, IPunObservable
{
public GameObject LeftHand;
public GameObject RightHand;
public GameObject Head;
// Start is called before the first frame update
void Start()
{
PhotonNetwork.SendRate = 30;
PhotonNetwork.SerializationRate = 30;
}
private void Update()
{
if (!photonView.IsMine) return;
Debug.Log(SyncHeadPos.HeadPos);
Head.transform.position = SyncHeadPos.HeadPos + new Vector3(0, 1.5f, 0);
Head.transform.rotation = SyncHeadPos.HeadRot;
LeftHand.transform.position = SyncLeftPos.LeftHandPos;
LeftHand.transform.rotation = SyncLeftPos.LeftHandRot;
RightHand.transform.position = SyncRightPos.RightHandPos;
RightHand.transform.rotation = SyncRightPos.RightHandRot;
}
void IPunObservable.OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.IsWriting)
{
stream.SendNext(Head.transform.position);
stream.SendNext(Head.transform.rotation);
stream.SendNext(LeftHand.transform.position);
stream.SendNext(LeftHand.transform.rotation);
stream.SendNext(RightHand.transform.position);
stream.SendNext(RightHand.transform.rotation);
}
else
{
Head.transform.position = (Vector3)stream.ReceiveNext();
Head.transform.rotation = (Quaternion)stream.ReceiveNext();
LeftHand.transform.position = (Vector3)stream.ReceiveNext();
LeftHand.transform.rotation = (Quaternion)stream.ReceiveNext();
RightHand.transform.position = (Vector3)stream.ReceiveNext();
RightHand.transform.rotation = (Quaternion)stream.ReceiveNext();
}
}
}```
is this object instantiated by photonnetwork.instantiate?
no
im unsure, been too long
how do i make it so that when a player enters a room I get his name in photon pun 2?
ping if you know
does anyone know why my client doesnt move for other players. Im using mirror(yes i did ask the discord and the objects do have network transform) and i have 2 movement scripts that go together for controlling movement. 1 of the scripts uses a derivative of monobehavior so i cant use network behavior on it. anyone have any fixes?
@gleaming prawn oh, so there's no free matchmaking system ?
@thorn kestrel Epic Online Services promises to be "free"
Although these things always come with strings attached...:)
If they offer options for matchmaking, I've not yet tried them.
The one from steam is also free, but it's only useful if you plan to sell the game there (PC only, etc) - which is give-me-30%-of-revenue "free"
Google released a free (very basic and raw) SDK for matchmaking... But you'd need to HOST it somewhere (which is not free, of course) https://github.com/googleforgames/open-match
hey could anyone help me with networking
yes. just ask what you need to know.
lol
i need help using photon
im trying to sync a ball between instances
is this the right way to do it
It's a simple way to do it. if multiple players interact with the physical objects, there will be problems like objects passing through one another.
Balls are one of the bigger challenges in networking, because they expose the latency of the network, and the disagreements between clients timings.
Most ball type games tend to use extrapolation rather than interpolation.
Most of your networking libraries work on state transfer and interpolation, so they are not out of the box good for dealing with players interacting with shared objects or one another.
I would not recommend a game like that as your first networking attempt.
may have just misinterpreted your "sync a ball" then
I see "Grab" in your components, which leads me to believe that players can and will be competing for control of that object though, which is the same general problem.
Hey! What networking solution do you recommend for a game where the client is also the host? I saw photon and I dont really like that I have to use its servers. Also saw that UNet is being deprecated, and that Mirror exists, but what do you recommend?
photon (PUN2)... or photon Bolt.
Mirror has p2p as well, it seems... But I'm not familiar with how to do that. For LAN games, then Mirror should be ok
I mean. I read what you said
Yeah, I have been the last couple of days trying to use mirror, but I dont find really good tutorials (Almost everything is the basic, just connect)
But I would not rule-out tools used by successful games because "you do not like" a certain aspect
Pun2 is the easiest in the sense that you have no concerns about punch-through and such. But Mirror and similar give you a proper server option.
Yeah sorry, I forgot to add that it will use LAN connection, so I cant rely in photon servers
There's a few reasons why the photon products are used...:)
Pun2 is relay, so its easier to deploy, but a little different to develop for.
Yeah, Photon products are not going to be something you want to play with if you are making a lan hobby project. Go Mirror.
Do you recommend any tutorials about Mirror?
The mirror discord is the place to be for all of that.
Okay, then I will try it, thanks guys
I use MLAPI but this seems really unpopular around here
Do you recommend that before Mirror?
I really have not studied the MLAPI much
I mean, I tend to see the most opposite tiers:
high level: fully fledged netcode APIs, like quantum, pun, mirror, bolt, etc
low level: transport layers like steam, photon realtime, etc
I see here it has high level concepts in it...
From a first view it seems to be based on the same concepts as Mirror/Unet...:) Hmm... That does not play on its favor...
@grizzled narwhal does it have scoping, scheduling, client-side-prediction and lag compensated raycasts like Bolt? These are thing it came with since 2015...
I find a bit of a bummer that all attempts to build a networking layer fall short of offering these basics...
No idea what scoping and scheduling is 😅 . Its a mid level api so doesnt really have client side prediction either -> you'd have to build it yourself
hmmm
It has low level and boxed rpc's and synced vars
I mean, I forgot to mention delta compression, etc
Yeah I would have to build that myself
IMHO it's a bit counter productive, if you are trying to build a GAME
If you want to learn how to create a proper networking API, could be fun
Yeah . Atm I just compress pos, velocity, rotation in my custom script and rpc them over with udp
Not the best system ever build but it works ;)
Why would MLAPI be better than Mirror, for example?
Gives more access to lower level stuff? Just that?
Yeah. He also claims that its more memory efficient (everything is pooled) and it doesnt launch 1 thread / user
I would break those layers out a bit more even.
Full stack is Quantum and Bolt
NetEntity message wrappers would be Pun2, Mirror, MLAPI, etc
Transport - messages and connections only
MLAPI and Mirror will get you about the same results, with minor annoyances related to choices either make, but they do the same thing.
Personally I wouldn't touch anything which does 1 thread / user, or TCP as a default, and the last I checked, Mirror did both of those
If you are chasing "efficiency" then any of these libraries should be off the table. Only Bolt and Quantum actually will get you there for that.
That's a good break-down @jade glacier
Yes, I was saying you don't want 1 per user
it depends @jade glacier
I just skimmed the docs of bolt and this entity crearing ui stuff looks a bit weird to me imho
Kylotan is correct, 1 per user is really BAD
And mirror does that
If it's a game for like 4 players, fine
fholm was fighting with that for quite a while, dealing with making use of threads and not getting enough benefit for the potential cost to devs. Not sure how that played out with Quantum @gleaming prawn
But that was for his 100+ connect engine attempt
Quantum is a different beast
In my experience, you can sometimes get some benefit from threads, but in many cases the operating system and the network adapter do a perfectly good job of batching stuff up while you deal with it. You're often better off using your cores elsewhere
yeah, no server requirement @gleaming prawn
So it will take any CPU it can get I am sure
For the game simulation we do run multiple threads (like Unity's job system - we actually hook up to Unity's job system on unity clients)
but it's just the right amount for the target hardware, othjerwise it's useless overhead
is quantum based on ECS or different thing entirely?
This was all about regular state transfer based servers, which is the world Mirror lives in.
its a fixed point engine @weak plinth
Quantum's SDK 2.0 is a sparse-set ECS (like C++ enTT)
The concept of Quantum is full determinism, which makes it not comparable in most ways to discussions about state transfer only engines like Mirror and Pun2
But photon servers @jade glacier , which run the input management and clock sync (optionally simulation) in quantum, uses IO-completion ports (not traditional socket-threads)
That just flew right out of my pay grade 🙂
I think I preffer the flexibility of mlapi
They will get you the same perks and headaches @grizzled narwhal
Mh?
Mirror and MLAPI give you NetEntities with IDs, and ways to wrap messages up with RPCs and Syncvars - but they do not tie into your simulation or simulation timings. So you are pretty much on your own with the sync timing and such.
MLAPI is a bit cleaner, because twoten started from scratch, but its also missing some luxuries... like the weaver in Unet was one of its real perks.
hmmm
But its all time based, and will give you fits in the long run if you don't get some kind of tick manager of your own in place and tie your messaging to your simulation
You mean mlapi's networktime isnt all that great?
ye, neither MLAPI nor UNET nor MIrror have a great timing mechanism build in
Networking with time rather than ticks is usually accompanied by mixing messaging with simulation... which is a no no
For the moment I havent bothered with input prediction/resimulation but thats probably an important step
I have recently been enjoying UE's networking. I hope whatever unity comes up with to replace UNET is as extensive
Messaging <-> State and Input Buffers <-> Simulation is typically how you keep state transfer sane.
I wouldn't wait for Unity's default solution
MLAPI and Mirror both encourage new users to tie messaging directly to Simulation... or WORSE to interpolation.
They are on their 4th attempt, and counting...
I have messaging tied into simulation probably lmao
UE is ok for the typical action/FPS use cases...
was their network code before unet bad? I've never heard anyone complain about it and it seems like the only reason they got rid of it was Raknet which I don't really get
All new networking devs do... its the first big mistake we all make when we first try this stuff. @grizzled narwhal
Although they had a super super bad method for scoping (which gave them a LOT of headaches on Fortnite, and for PUBG)
Networking is about simulation, not about messaging.
Then they cam with the network graph "hack"
Networking is about simulation, not about messaging.
@jade glacier Could you elaborate?
@weak plinth
was their network code before unet bad?
It was so bad that it's the main reason why all the alternatives had a chance
Not as much as you probably would like, its a 5 hour lecture on time in gaming
Unity's original UN (similar in concepts to PUN) just would not work outside of LAN
yea my (limited) experience with UE networking so far is a generic third person which I assume is the perfect fit given Epic
it was a full broadcasts P2P solution, pretty bad
The basic is probably to have the game code to be as networking unaware as possible no?
UE networking has a few very good things in it... proper timing, a lot of stuff like Bolt, etc...
The major issue I saw was the lack of an efficient scoping mechanism for network culling on the server (performance on server for high player count was pretty bad, really bad)
The model to think of for networking is the model for PhysX in Unity. There are two timings.. FixedUpdate is the PreSimulate callback, this is where actual simulation logic goes. All things in a game should be done on a fixed timing like that. Networking should be tied to that timing, not to Update().
Update is just for interpolation and extrapolation based on timeDelta.
FixedUpdate is the slideshow of reality that you don't actually see.
Update is where that slideshow is made pretty for the player
there's also the SpatialOS integration but I haven't gotten that far yet
Then they (Epic) developed the network Graph thing to deal with that (culling performance on server)... It's basic implementation is a damm GRID, but works
Networking likes the slideshow... it should not know about or touch the smoothing of Update
there's also the SpatialOS integration but I haven't gotten that far yet
I have a friend working there... But my expectations are of: you pay 10x more to deal with the overhead... lol
I don't know anything about them besides that Worlds Adrift used it
I haven't seen any clear demos of their tech that felt compelling
It's interesting from the technical perspective (lots of neat stuff done by smart guys)
Worlds Adrift used it
Doesn't count, as it's backed by them AFAIK.
compiling their (fork?) of the engine instead of dropping a library in did catch me off guard
But... Lets see... THat's just my impression...:)
Complexity doesn't make something a great utility unfortunately. But it might be great - it just didn't resonate with me in any demos or explanations as something I cared about or though was the right answer for most people's networking problems.
I work for the company that makes Quantum, but Quantum actually will eventually invalidate all of my work - so I am not biased to promote it.... but Quantum is the kind of innovation networking needs imo.
I liked when I got a full explanation from one of their engineers (from the technical perspective)
But I did not had the chance to ask: how much would it cost for 10000 CCU?
People making wild stacks of stuff to reproduce existing models without as much coding doesn't excite me.
(though I literally make that kind of stuff myself for a living)
As a quantum core developer: I "envy" the technical challenges the guys of SpacialOS face...
lol
different types of challenges...
Does it all come around to being a complete stack of stuff? @gleaming prawn Like do they have a toolkit for Unity that contains all of the drop in components for syncing up player states, anims, transforms, etc?
My doubts are about the business model, technically it's cool stuff IMHO.
I work for the SpatialOS people, by the way. I don't work on SpatialOS itself, however.
I have not followed since a long time, but ye, it would do scoped/culling properly, sync thousands of entities across super big worlds over the clients, scale the world simulation with clustering, etc
The issue I see with a lot of those models is they kind of focus on a certain game type that they draw from... but offer very little for some actual new game types like RocketLeague - but i could be TOTALLY wrong.
I have a friend there @clever silo
Cool. We're a big company these days
ye, you guys got a lot of funding
Not sure if that will translate into profit..:)
funding and profit are definitely different worlds in tech 🙂
Emotitron, the SpacialOS premise is not "wrong" in itself, there's a case for MMO
MMO is also not going anywhere
It will just not be good for the stuff we solve well, for example
MMO is also not going anywhere
I'm not sure
It does seem like most games just opt to not doing a massive world like WoW, and just put everyone into smaller groups
Definitely true to say that SpatialOS isn't a one-size-fits-all solution. I think any game networking expert will tell you that. Same goes for the UE4 model, etc
Now that's really TALKING something cool... I'll drop my opinion (I don' t care if you care, lol)
WoW is actually a pretty badly-networked game - they just cover it up well
yep.-..
here's my take on the trends...
SO far, we've had these techs that try to solve different worlds (coming from different perspectives - I'll mention only 2, but you guys will get the idea):
- quantum starts from small-mid sized games (2, up to 64 players per match), UE struggles to run 100, etc, Apex runs 60, etc
- SPacialOS (and WoW poorly) come from the other end, MMO sizes...
ANd the gameplay PACING is totally different...
You cannot have 3k players interacting ACCURATELY at 60Hz, it's impractical...
So MMO tech is slow and scales
Accurate and fast tech can only deal with smaller numbers
What I THINK we'll see in a few tittles in the next few years, maybe (IF they became successful enough) is getting to the MIDDLE:
- a fast/accurate game (like small scale netcode) with 200+ players...:)
This is certainly MY GOAL... lol
Lets see what will actually happen
It's very hard to do, because the fast/accurate stuff tends to require predict/rewind/replay semantics, which carries a very heavy physics cost, and one that grows for every physics object you control locally
🙂
Whereas MMOs don't attempt to do any of that, so they rarely need any physics interaction
Wait and see then...:)
Good luck 😄
Ye, I mean... We know we can already do
And we know what we can technically do (not with pure determinism, BTW)... For me it's more a question of being a good approach business wise
YOu need to have a market for fast-paced games with 200+ players
Nobody even knows if such market exists...
You can't consider Unicorns the norm...
which came first, the chicken or the egg
ye
Oh, there's totally a market. It's just tricky to do technically, hence why it's not already been solved by people who already know the FPS-style model well, like iD and Epic
It's just tricky to do technically
It's tricky to do efficiently enough to make it feasible in terms of business model...:)
Specially with the current state of affairs with F2P etc
I suspect most companies will just avoid trying to make a 1000 person battle royale.
Well, sure - it's already solved if you're happy to only run 1 physics step per second 😄
No Kylotan
The lanes that work are pretty well defined now, and companies can choose the game type they are making and stick to the limitations of that type.
Not sure what exactly you work with, but I've seen interesting tests...
I think fholm mentioned here
10k players full KCC movement in <2ms on a single 16-core machine...
the big wall fholm slammed into was in the priority engine
What is 'KCC'?
kinematic character controller
the big wall fholm slammed into was in the priority engine
we solved the culling... can't say much though
I don't think any physics engine is capable of rewind and replay of 10K objects in a single step. So, either he's solved physics (which would be great beyond networking) or there is some other corner being cut
not for quantum, this was for his MMO BR experiments @gleaming prawn
A 200 or 500 player game is absolutely feasible...
I don't think any physics engine is capable of rewind and replay of 10K objects in a single step.
You don't, not for 10k
And yes @clever silo we write our own physics engines.
I've worked on games where we had 800 concurrent players on one server, one world. That in itself is not so hard. The hard part is trying to do that and to have a simulation with FPS levels of consistency
That's correct
And with enough efficiency to pay for the server bill
To that regard, a game with 100 players is a lot more efficient than with 6 (considering you run dedicated servers per match/game)
But that if you solve culling/Scoping/priority-scheduled-updates efficiently...
800 with full server authority @clever silo ? and what specs?
I heard Epic runs an avg of 250 ccu per 4-core machine...
Sure, if you do enough area-of-interest stuff you can reduce the physics simulation area down to that similar to an FPS, which is manageable. Then the problem becomes trying to do that at a fast enough network tick rate, because MMOs usually have to send 2 to 5 times less frequently than shooters do
We had 800 on our servers back in 2008. Full server authority. But it wasn't doing physics, or rollback, or any of that stuff. Just standard MMO tech
got it
I can't say much about our numbers unfortunately (on server, but >> 800).
Maybe I'll ask the Albion online guys, who run an MMO on photon servers
full server authority as well
It's not anything magic, you just use what you can... 800 in 2008 with full authority was probably correct/efficient
So, I am using Mirror and Im a little blocked. I dont know if anyone here knows about this, but how can I spawn different prefabs in the local and server? In the local it should be a first person prefab, and in the server it should see a full body prefab.
you should for simplicity sake make it one, and hide/show children based on hasAuthority or isLocalPlayer
So the GameObject should have both? The FirstPerson and what the others user see?
Yea I feel like it would be convenient to have separate server and client models
I was trying [Command] private void CmdSpawnPlayerController() { Instantiate(pf_net_localPlayerController); NetworkServer.Spawn(pf_net_netPlayerController); }
But i get GameObject pf_net_netPlayerController is a prefab, it can't be spawned. This will cause errors in builds. Both of the prefabs are registered
@jade glacier is there any public info on perf with quantum? We don't want to rewrite our logic code for our project, but the core idea fantastic and really want to see how it pans out. I'm curious how well the rollback holds up with lots of physics objects...stuff like GGPO is obvs designed for smaller scale games
I saw a couple games with physics on the showcases, but nothing with tons of stuff (unless I missed it)
GGPO does not implement anything
But first:
- thousands of stuff (like RTS) you would NOT use rollbacks... YOu would run quantum in lockstep mode
- we do what we call prediction culling (only predict/rollback what is closer to camera), running most of the world in "lockstep" with confirmed inputs from the steady server input stream... But still
I can say the numbers for Battlelands Royale
512 raycasts, 400 kinematic bodies, 32 players, 4000 static colliders, etc
per frame
30Hz, mobile
ahh okay, yea something like prediction culling is what I was thinking. That's really cool @gleaming prawn
and yea ggpo ofc doesn't implement physics, but rather the games I know of it being mostly used on are smaller scale (fighting etc)
ye, GGPO also does not have ANY concept of clock sync + input batcjing for 2+ players
is really just for 1v1
Quantum has currently a hard cap at 64 players, and has been battle tested with 32 in several mobile games (battlelands royale being one of them)
@gleaming prawn ok thank you very much
anyone used epics online services with there c# api?
Don’t know whether this is the right channel but I’m trying to create a game with a similar multiplayer to clash of clans. Does anyone know how to setup a server like that, from my understandings I need a centralised structure I think. And finally anyone know what youtuber or documentations I should look at?
Have you made any scrap learning networking projects first? Or completed some tutorials for the available net libraries? I would start there before trying to overthink any particular game type too much.
Im not sure but try this: in the PlayerMotion class definition where it says MonoBehaviour, add a comma and put IPunObservable @tidal zealot
i do not get the option for adding networking component
i m using version 2019.3.13f1 64 bit
pls help me with this
Some info about Coherence: https://github.com/coherence
i'm getting this error for putting this with my class at the top of a script
I believe I need to add the script component on my player to the photon view
but when I try and add it to the observable components in the photon view, I get this error
I feel like I can't do one without doing the other, yet it works both ways and neither work unless one of them does, and I don't understand
you have to implement the interface
@tidal zealot
an easy shortcut is click on IPunObservable, press alt + enter, and implement interface
holy crap, thank you!!! been stuck on this error for a while now, what did that even actually do?
it's not really a networking thing but read up C# interfaces