#archived-networking
1 messages · Page 82 of 1
@crystal glen follow a guide and it will sort it
Hey got a question about RPC's im fairly new to the networking side of things. Let's say I have a shooting mechanic in my game. My PlayerController is what takes the input. The weapon shoots (instantiates) the projectile, and the projectile works out its trajectory. Which part am I putting in an RPC to shoot the projectile
Im going to guess and say I need to do both the instantiation and the projectile trajectory.
*Note the projectile trajectory works every frame (does this cause a problem)
The most basic first usage would be to send the origin position, and direction
Down the line if your are managing your syncs more carefully, you shouldn't need to send the position/rotation since that will be redundant with the players transform update.
If you manage your serialization order, you can send your weapon fire RPC after the transformview, so that the shot applies after the transformview applies.
You will once you get more advanced into this stuff though need to expand on the built in transformview, since you have to deal with whatever buffering and lerping is going on there, and make sure it replicates.
You can also play around with the SNS beta, that handles all of this stuff. But it is beta.
Hi there,
Anyone working on multiplayer games? Me and my friend are working on a platform to help you monetize your multiplayer game. We would like to get feedback and insights into your game and explore how else we can help you.
If you have a multiplayer game please let me know, i would like to chat with you!
Cheers
Guys, I made a multiplayer in photon, It was working fine a week ago ( finding available room and connect) but now two different players are not able to find the room each other, did any body know why? Does photon have anything like a trial period or something like that
did you switch from development mode to release? It sounds like they aren't getting the same region. @lapis vapor
Dev Region lets you set one region that the editor and development builds connect to. Or set the static region while testing.
otherwise there is a chance they connect to different regions, and will never find one another.
does anyone here know of any good chat services that I can integrate?
I only need text chat
@vivid owl Photon Chat
managed, you get the SDK, adds to the game... All the service is on our cloud
Hello! I have a question regarding photon. How I can send across the photon = List<Vector3> ????
Does anyone here use Mirror?
@crude galleon
Some do. Though much more can be found in the Mirror discord.
@humble lantern I believe you have to pass it an array... which will cause an allocation. Does that list change in length?
I don't actually know if the built in serialization recognizes Vectors. You might have to write that as a collection of floats that you reconstruct on the other side.
https://doc.photonengine.com/en-us/realtime/current/reference/serialization-in-photon
The example down the page suggests you have to write each axis of the vector individually.
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 have these 2 lines using photon:
GameObject localPlayer = PhotonNetwork.Instantiate(playerModelName, spawnPoints[index].position, spawnPoints[index].rotation);
players.Add(PhotonNetwork.PlayerList[i].UserId, localPlayer);
and it is giving me an error that the value (localPlayer) cannot be null on that second line, but it spawns in the player object anyway, why is this? Thanks for the help!
this only happens if I make 2 different gameobjects -
for (int i = 0; i < 2; i++)
{
GameObject localPlayer = PhotonNetwork.Instantiate(playerModelName, spawnPoints[index].position, spawnPoints[index].rotation);
players.Add(PhotonNetwork.PlayerList[i].UserId, localPlayer);
}
this gives me an error, but it I put "i < 1" it does not, why is this? Maybe its something small I am missing
For the first thing, your first line completed the instantiate before the next line the an error.
@jade glacier , I'm not sure if I accidently did that so, where can we change it, in the server dashboard?
In my app dashboard it is showing as all regions
@jade glacier , it is showing my region is asia in it. OTher than that there is not option for that
If dev region is set, development builds will all use that.
Have you recently switched to building release builds?
no never touched it after configuring app id
That isn't a photon setting.
Have you changed build settings to not be development build?
No it's not a development build
There you go
Yeah okay so u mean as now it is a release build there is a region mismatch is happening?
release builds are the real thing, so users will all find the region they like best automatically.
Dev Region is added to force a region while you are developing your app.
Okay
Thank u @jade glacier , let me see whether that fix the issue
@jade glacier , that fixed the issue, thanks a lot, I don't when did I switched development mode. May be by accident. You save my day, I'm in dead line of a project😇
awsome
Hey, I'm have a dreadful time trying to work this out so can someone give me the correct way I should go about shooting projectiles. I'm pretty new to the networking side of things so please dumb it down as much as possible. Basically I have two main types of projectiles atm, lasers (fire without effect of gravity) and bullets, I have no idea how I should be moving these on the network (of if I should be moving them at all). I hope this explains my issue thanks
You are describing hitscans vs projectiles
For starting networking - treat both as a deterministic event.
For both, you just need the origin point and direction vector. (typically you are just using the synced player transform for those)... and you just instantiate a projectile using that starting vector.
For hitscans you do a raycast using that, for projectiles you instantiate a projectile object (or pool one) and give its rb a velocity that is the same across the network.
In both cases, you are just triggering the shot... you are not continuously syncing the projectile.
maybe thats where im going wrong then because my projectile doesnt really use a rigidbody
it just moves the transform ever so slightly every update
transform.Translate(Vector3.forward * speed * Time.deltaTime); // laser
// bullet drop
Vector3 point1 = transform.position; // Current Position
float stepSize = 1.0f / predictionStepsPerFrame;
for (float step = 0; step < 1; step += stepSize) {
projectileVelocity += Physics.gravity * stepSize * Time.deltaTime;
Vector3 point2 = point1 + projectileVelocity * stepSize * Time.deltaTime;
point1 = point2;
}
transform.position = point1;
would you say just stick a rigidBody on and let the rigidBody do all the hard work?
As a beginner, start with just giving RBs an initial position, direction and velocity.
Don't try to take on like a bouncing grenade. That will put you deep into the difficulties of lag compensation and how determinism breaks when using client authority, or client prediciton.
okay ill just try and use a rigidbody for now. Thank you
Hi everybody - i`ve no idea where the best place for my questin is - but i want to create a webGl Cloud Build but there is no Option in my Cloud Build Settings for "WebGL" are there any conditions for webGl Cloud Builds?
@spare jasper this channel is about multiplayer networking.
WebGL general issues maybe it's easier to get help in unitytips or general-code maybe?
I´ll give it a try - thanks for your answer
hey guys someone know how to use mirror?
Do you have any particular problem? There are tutorials how to use it.
a few here use mirror, yes... ask the question (although it's normally easier to ask in their own official discord)
@sharp lion Shameless plug, I have a vast tutorial series on Mirror.
I add new content regularly. Here's the trello board: what's done, what's next, pending updates, video previews, and so on. Anything with a PINK label is complete. https://trello.com/c/wMqH190r/39-important-information
thank u
Guys, I'm making a game with two players in a room. When one player creates a room, the next is supposed to join the room. but, when the second plyer tries to join the room, I'm getting a log message as " A game with the specified id already exist.
UnityEngine.Debug:Log(Object, Object) "
Guys, I'm making a game with two players in a room. When one player creates a room, the next is supposed to join the room. but, when the second plyer tries to join the room, I'm getting a log message as " A game with the specified id already exist.
UnityEngine.Debug:Log(Object, Object) "
@lapis vapor I'm using photon
Isn't there a function called CreateOrJoinRoom and if so aren't you using that?
It's been a while since I used photon but I recall something like it
@shut yarrow Yeah yeah there is and my code was worked fine early, yesterday I had an issue like my players were not at all able to detect rooms. So to cross check if it is code error I separately open another instance of an old commit of my project where this process was working fine. still that issue was there and @jade glacier helped me to found that it was because I accidently turned off dev mode. and it started working fine but when I switch back to the newer version. It started showing this error. The funniest thing that happening now is that, an older build and a newer build is actually connecting fine without any issue. A newer and newer is not but just showing this error
When people respawn in online games, do they completely destroy the player character and spawn a new one, or do they just move it's position and reset it's values?
right now i am destroying and spawning a new one but i can imagine it being a huge overhead due to all the scripts and objects attached to the player that have to be reinitialized when respawning
Just enable and disable child game objects @light pollen
@shut yarrow Yeah yeah there is and my code was worked fine early, yesterday I had an issue like my players were not at all able to detect rooms. So to cross check if it is code error I separately open another instance of an old commit of my project where this process was working fine. still that issue was there and @jade glacier helped me to found that it was because I accidently turned off dev mode. and it started working fine but when I switch back to the newer version. It started showing this error. The funniest thing that happening now is that, an older build and a newer build is actually connecting fine without any issue. A newer and newer is not but just showing this error
@lapis vapor Guys, could somebody help?
I don't know what your error is @lapis vapor
Guys, I'm making a game with two players in a room. When one player creates a room, the next is supposed to join the room. but, when the second plyer tries to join the room, I'm getting a log message as " A game with the specified id already exist.
UnityEngine.Debug:Log(Object, Object) "
@lapis vapor I think it's some sort of both trying to create same room
Probably is that then, yeah.
Okay cool
Hey folks!
I was wondering if one of you might have a solution for the problem I posted on unity answers. I'm really struggling with this...
https://answers.unity.com/questions/1767645/unet-moving-a-ball-through-a-maze-together-by-tilt.html
@worn fable Anyone? 😅
You will either need a single authority (server or one of the clients) or to make it deterministic. Deterministic is out, since I assume you are using physX, so pretty much you will have to have a client or server that is the authority. You will have input lag for players. If you try to get rid of that, you will be dealing with some pretty complex missed predictions to clean up - but may be doable if pings are too high.
@worn fable
Being that you are using Unet, then server authority is the most likely answer. The server owns the board, and all players send inputs to the server. The server sends the ball transform state and the board transform state to all players.
@jade glacier Thanks, man! So, I probably have to send a [command] from the client to the server if the client is tilting the platform, right?
I don't ever recommend using RPCs or Syncvars, but that would be one place to start.
Alright. I'll keep that in mind. How else can I send input from client to server?
If you like that workflow Mirror is popular. MLAPI is similar as well, but the guy who makes it just started working for Unity, so not sure how much work will get done on it from now on.
Photon Pun2 and Mirror the two most common starting places for new networking devs.
i really just want something for peer2peer at the moment can pun2 or mirror do those
p2p isn't really a thing, so you might have to specify what you mean by that.
peer to peer
P2P means every client connecting to every other client, which isn't a thing for game networking.
i should probably elaborate
So you either mean player hosting, or relay.
player one hosts the game and then the rest connect to it
That is still server
okay that makes sense i mean i just dont want to have to buy a 1000 server or something
meant to add $ sign
You will have to work out the nat punchthrough and such for server based (Mirror/MLAPI)
and make sure your game is friendly to one player having the huge advantage of hosting.
Hey Guys,
Need some help!
What is the right way to sync selected avatars on other clients.
Player prefab is having the avatars as child objects.
The avatar which is selected in main menu is enabled on Player prefab and that should be instantiated on all clients.
But problem is avatars or selected child object is not getting synced on all clients.
Does anyone know what is right way to do it?
You probably need to indicate what library you are using, and post the code that seems to be going wrong for you. @kind knoll
need to ask, is it really hard to make multiplayer
i know its hard
but how hard
It is definitely quite hard for me to be honest. It seems that even the simpler things get more complex when you add the multiplayer aspect to it. But maybe that's just me 😅
man i shouldnt have decided to make a multiplayer fps now that unet is dead
Unet was the same deal, you would need to host it or come up with a way to punchthrough or use relays
There is no one "basic" networking answer.
thats true
Pun2 gets you the easiest dev setup, but it is not conducive to any games that require server authority. For server authority you need to make server plugins, or relay on the master as the server... which you don't want to do.
@jade glacier I am using PhotonEngine.
I
Pun2? @kind knoll
Yes
The quick and dirty way is to use the PhotonTransformView @kind knoll Have you done the tutorial to start?
I am able to sync the positions of player. But I am not able to sync the child object(avatar) that is enabled on that player prefab.
hey actually would you guys recommend "mirror"
What are your requirements and have you looked into alternatives to see what they offer? Choosing a solution for your networking isn't just something you do because someone recommended something to you without them even knowing what you're looking for exactly
I'd say try to figure out what your requirements and expectations are, do some investigation yourself first, then people can help you much better or else we're gonna write long paragraphs on all different networking libraries and you still won't know which one to choose
Do tutorials for the libraries you have available to you. Networking in Unity isn't about best - it is picking the option that makes sense for what you are making.
what's everyone using for matchmaking right now? Playfab seems to come with a nice rule based setup (pair people up based on latency, skill etc), wondering what else is out there
note that we don't need any hosting for the actual games
@floral turtle if you ask that in our private server you might get more answers from people who are releasing games.
Playfab seems to be a popular choice indeed.
Hey, quick question if i have an RPC in another gameObject can I not use the player photonView to call that RPC? Sorry probably a stupid question
the RPC has to be in the right place, since it is attached to the PhotonView
Without a photonView... that RPC has no "mailing address" for the message it is creating.
You can call the RPC from wherever to trigger it - but the method has to be attached to a photonView.
ahh I see
im trying to add pickups so should I add a photonView to the pickup or just have the RPC in my player controller where im interacting with the object?
For learning, I would stick to making pickups into networked objects yes.
hello, i have a little problem with photon, i am a beginner with it
i've made a lag compensation script, wich i have attach to the photon view, but when i launch two time my game build, if i control the player on one of my game window, i have an error and the other window, same if inverse
the error is that
i have the problem since i've put my lag compensation script in the photon view
and my script
its that but ??
Yeah it's expecting to read a Vector3 I think
You're not reading the Vector3 you put in the stream
Maybe read it in temp variable so you can safely read out the Quaternion on next line
So 1 line above that rb.rotation line put this
Vector3 temp = stream.ReceiveNext();
You don't have to use it, just do it so the stream moves to the correct position to read the Quaternion
aaah okay
if i sent in order : int, vector 3, quat, float
i will receive: int, vector 3, quat, float
You got to read same order too
in the same order
Yes
NP
You pasted a code screenshot, but cropped out the numbers.
Was scrolled up though, looks like someone helped solve it.
Yeah we figured it out 👍
any resources on server-side hit detection rewinding with animation? Thankfully my game only requires a simple check against pawn capsule at a stored position, however I'd like to learn more about animations for educational purposes
If your SIM is tick based, store the animation timing per tick on server, use playables to rewind
ok so im using photon and i made past making lobby and multiplayer but the rotation gets updated but not position
Code shown should do that. So I'm guessing there is a bug in the code not shown?
Debug the rotation value being written. Are you sure there transform is rotating - not a child, or the animation? And is you controller code properly disabled when IsMine is false? Those are the two most common errors people make.
@austere spade
Ill check
Hi me again. I have a problem where im deleting an object but when a new player joins the master client sees the deleted object spawn back in (though for the player joining it seems to be destroyed). Here is the code that destroys the object thanks.
public virtual void Interact (PlayerCharacter playerCharacter)
{
if (playerCharacter.inventory.AddItemToInventory(pickup.itemPrefab))
{
Debug.Log(gameObject.name + " Destroyed");
photonView.RPC("RPC_OnPickedUp", RpcTarget.AllBuffered);
}
}
[PunRPC]
private void RPC_OnPickedUp ()
{
Destroy(gameObject);
}
Make sure you destroy it correctly using the PhotonNetwork.
Otherwise you are destroying the local copy, but you are not telling the relay to remove the buffered instantiations it keeps for late joiners.
ahh okay ill go search how to do that thank you
Er I just did PhotonNetwork.Destroy(gameObject) but still having the same issue where the player joining doesnt see the object but the player already in does see it? Am i doing something wrong (I added it to the RPC as well as tried it without the RPC). Could this be because the buffered RPC is getting destroyed or something?
Maybe this will explain better. On the left is the player that just joined the game. On the right is the player that created the room and picked the Item up before the other joined.
So excuse me for not exactly reading the entire thing, but when you spawn a pickup item, is the RpcTarget like AllBuffered or just All?
at the moment i've just added it to the scene through the hierachy? Do i need to instantiate it ?
And when a player picks up an item it gets destroyed, then isn't it good when a new player joins he won't see it since it's already picked up?
Yeah any object that comes into existence in the world for others to see, need to be instantiated with PhotonNetwork.Instantiate
Unless it's a static object then you can just place it in the hierarchy
And when a player picks up an item it gets destroyed, then isn't it good when a new player joins he won't see it since it's already picked up?
Yes this is good, but the problem is for the player who picked it up (I've only tried this for 2 players and the one that created the game picks it up) the player who picked it up it gets re-instantiated
Wait so when a player picks up an item, the item gets reinstantiated?
it seems that way, when the other player joins
So first it destroys the object, then instantiates it again?
Btw could you do that Debug.Log(gameObject.name + " Destroyed"); inside the RPC?
Before actually calling Destroy
And like emotitron said, you probably should use PhotonNetwork.Destroy so you don't even need to call an RPC to destroy
Then you could call PhotonNetwork.Destroy in the interact function
okay 2 secs I did have it like that but let me try again
That PhotonNetwork.Destroy is basically an RPC, if you call it then it goes through the relay and it triggers for others too
Same with PhotonNetwork.Instantiate
yeah i havent instantiated this because i was testing if the script worked so I just threw the object in the hierachy
Do it with PhotonNetwork.Instantiate then
If you do it the expected way you'll save yourself some issues down the line
Okay so the room creator picks the object up
Because the relay has no clue about the existence of an object if you haven't created it with PhotonNetwork.Instantiate, and if you made a build but that build doesn't have that object, the player in the build won't see it
okay so that would be why
It's kind of annoying I know, but it's important that when you test, your build has exact same code as the editor or you might get confused why things aren't going like you want them to
It's quite time demanding to make builds but it is what it is
but my build has the exact same code though
Alright then just so we're on the same page
So to test, you could instantiate a pickup when you join the room with PhotonNetwork.Instantiate(RpcTargets.AllBuffered) and when you pick it up, call PhotonNetwork.Destroy
If that doesn't work like expected maybe there is something else going on somewhere in your code
should I just add a empty game object into the scene that spawns the pickup?
Ah wait PhotonNetwork.Instantiate doesn't require any targets it just spawns it everywhere so nvm about that
You could do that
because this is what I have right now so I expect this is wrong?
It's been a while since I used Photon so I'm not sure if that object needs to have a PhotonView but I suspect it doesn't to call PhotonNetwork.Instantiate
Yes if an object needs to be interactive, or rather dynamic like it changes position or may be destroyed, then don't just put it in the scene like that
You need to instantiate it with the PhotonNetwork.Instantiate function
yup on the same page now
Just copy the position/rotation and pass that into the instantiate function and make a new build once you've also written the destroy code
yup
By the way take note of this Any prefab must have a PhotonView component.
Also this is an important detail
`By default, GameObjects created with PhotonNetwork.Instantiate exist as long as the creator is in the room. When you swap rooms, objects don't carry over, just like when you switch a scene in Unity.
When a client leaves a room, the remaining players will destroy the GameObjects created by the leaving player. If this doesn't fit your game logic, you can disable this: Set the RoomOptions.CleanupCacheOnLeave to false, when you create a room.`
In case of pickups you might not want to destroy the object when the creator of the room leaves
You can also use PhotonNetwork.InstantiateRoomObject()
yeah now when the player joins the object re spawns
Anyway, there's good info on the photon website and I suggest to read it slowly so you don't run into problems
I was going to do that today but then started just bashing at this lol
I understand you just want to try things to see how far you can come without having to look up things
yeee
PhotonNetwork.Instantiate(samplePickup.name, transform.position, Quaternion.identity, 0); I did this to instantiate
Then in the Interact function you should call PhotonNetwork.Destroy and not some RPC that destroys the object
Interact was called and the object destroyed until the player joined the room
and ye ^^ thats what I did
public virtual void Interact (PlayerCharacter playerCharacter)
{
if (playerCharacter.inventory.AddItemToInventory(pickup.itemPrefab))
{
Debug.Log(gameObject.name + " Destroyed");
PhotonNetwork.Destroy(gameObject);
}
}
Maybe emotitron knows more about this specific issue why it instantiates despite being destroyed because I don't know
Wait I think I know...
private void PickupInteract ()
{
if (!photonView.IsMine) return;
if (currentPickup)
{
currentPickup.Interact(GetComponent<PlayerCharacter>());
}
}
This is how i was calling the Interact function btw
Your client in the build also calls Instantiate when he joins
Then the object comes into existence again
You need a more specific mechanism to spawn objects, like only the masterclient can create pickups
So before instantiating you might want to check if you are the masterclient, and if so, then you can instantiate, if not, then don't do anything
Because you don't want to have all clients make decisions about when something can spawn and when not, it'll become a confusing mess, there should be 1 client being responsible for it and the masterclient seems most logical to me to have that task
When it comes to destroying, if any player picks up an item, then they should be the one to call PhotonNetwork.Destroy
Well I gave some food for thought I think you can get it to work like this
Well I added an
if (PhotonNetwork.IsMasterClient)
{
PhotonNetwork.Instantiate(samplePickup.name, transform.position, Quaternion.identity, 0);
}```
but that hasnt seemed to work
It doesn't instantiate you mean?
no it was just doing the same thing. I've re-built let me just make sure
Also if not sure why nothing is happening, do a Debug.Log inside the if statement just to see if it gets called
okay, thank you for your help ill give it a whirl
Alright I'm going to be away for short time I have to do groceries
okay no worries thank you for all your help
About Photon Chat
Anyone know what the setting to prevent newly subscribed chat user to stop receiving old message? Currently I using this setting but the newly subscribed user still able to receive old messages from the channel
chatClient.Subscribe(channelName, 0, -1, new ChannelCreationOptions(){PublishSubscribers = true, MaxSubscribers = 3});
apparently the doc said the third parameter set to -1 will stop from old message
@frank quiver have you tried our Photon Discord?
Voice's lead dev is there regularly
yap, I posted there as well
haha sure, thanks a lot
What would I need to make a TFPS game with 100 players in one room?
What would I need to make a TFPS game with 100 players in one room?
@azure crown https://blogs.unity3d.com/2020/09/08/choosing-the-right-netcode-for-your-game/
maybe this blog post can help you to get started
We evaluated and researched today’s most popular netcode frameworks for multiplayer games to inform your decision. Every multiplayer game has to account and solve for inherent network-related challenges that impact the game experience, such as latency, packet loss, and scene ...
@frank quiver this blog post is... hmm...:)
You should see the forum posts about it...
Yea the forum posts are pretty funny
anyone here has experience with Photon Server SDK ?
i have a dedicated server and im making a 2D Card game which is time based
how ever, im trying to build a reconnect function.
The problem is that when you put the client (a phone) in airplane mode, the server wont notice the timout event for several seconds
adn for that reason , i cannot queue my packets which have been sent in the time that the client has disconnected
One option is to reduce the "InactivityTimeout" property in the PhotonServer.config, but that means if the client has lag, it causes a time out event
i would have to set the timeout to 500ms, which is not very smart to do..
Anyone knows how to fix this?
This is tricky
You need to make sure you can re-build the game state with this FACT about disconnect-timeout followed by reconnect in mind... It's not a bug, itÄs how things are in the internet (you cannot just decrease the timeout, as it would cause false disconnects)
A couple of ideas (depends on how you structured your SIMULATION - it's always about the simulation).
- if you have a game state on server, you need to transfer whatever is needed for the re-joining client as it's perceived by the SERVER at that time. So following "commands/cards-played" would work.
- if you do not keep an actual game state on server, you must inform (to server, when the client reconnects) what was the last command-sequence the client has, so the server can enqueue the missing ones. This implies the server must keep the command sequence.
That's as much as I can say, as you have a very custom setup and I'm inferring a few things via common sense.
This would be super easy to work our with other options we offer (like quantum - which works great for card/turn-based as well), but I assumed you wanted to stick to what you have.
how can i spawn an object at the start of the game but not when another player joins?
currently im just using a start method in an empty game object to instantiate one of these objects but that seems to not be working
// Start is called before the first frame update
void Start()
{
if (PhotonNetwork.IsMasterClient)
{
PhotonNetwork.Instantiate(samplePickup.name, transform.position, Quaternion.identity, 0);
}
}
InstantiateRoomObject probably is what you want? Use OnJoinedRoom instead of start probably.
@dusk forge
@jade glacier hey
have you seen the video I sent you? Seems like transform is only streamed between on Z -10 to 0
any transform other than that is ignored
There you go
Only on my phone here, so hard to be clear on what is happening.
Which net library are you using?
Photon.
Let me get to my desk so I can see settings.
Sure, thanks
Do you have ShareX or some other screenshotting tool?
Would first want to see the settings on your SyncTransform
@dreamy jewel
Can you accept my friend request on Discord, so i can send you through dm.
I'd rather keep it public, since other users will experience the same issue - so its always good to keep help in the channel to avoid repeats too many times.
yeah, those are the ranges
ranges are how the float crusher works, it has to know your max range and resolution, in order to compress the floats. Either set the compression to halffloat, or change that range to your actual expected max range of motion.
The greater the range, the more data it will use.
Transform Crusher v3.5 © 2019 emotitron Contact the author at: davincarten@gmail.com I am also regularly in #Unity-Dev on Discord with the screenname emotitron if you have questions. https://discord.gg/tGDUxp9 Click here for current documentation Doxygen Documentation C...
That has some info on what is going on behind the scenes with that.
I work for Exit Games now, so SNS has a Pun2 only Beta that has a lot of other components and features (like tick based syncvars with compression) and such - if you are early into this you might want to switch to that. @dreamy jewel But it is Beta - so I am always breaking it.
https://docs.google.com/document/d/1moPBIt8cNe-h1uG01pvaOZQvrIjZfSBfDmVa793X6AQ/edit?usp=sharing
That has links to the discord. But gives a general idea of the types of things being added.
Thank you, I will look into SNS pun2. Appreciate your help 😄
I'll bother you if I come across anything.
Glad that helped, gl
InstantiateRoomObject probably is what you want? Use OnJoinedRoom instead of start probably.
@jade glacier Okay thanks ill give it a whirl
What’s the best way to move a network player? Moving with transform with update makes server client or one with higher frame superior to other. Sometimes each client see itself in front while other see like that as well.
@jade glacier really stuck on this one. Because I am trying to make a game about running to finish line.
For state transfer and extrapolation, the latency can't be reconciled. Players will always see themselves in the future.
That is true with server/client and relay both.
Only exception being if you are doing server auth without any client prediciton....
but no one wants to play that game 🙂
The only way to make what you are talking about work is to make use of extrapolation, or to fake the difference using RTT to try and minimize it.
Other option is if you want to replicate server authority without client prediction, is don't predict - and have players send inputs to the relay, and only apply their own when they get the inputs back from the relay.
But that leads back to input lag, which for many games is not ideal for the player.
What kinds of objects are racing? Humanoids? or vehicles?
Hmm. 3 humanoids racing on a straight 3 way line. I wanted to use speed factor and lower their speed if they bump into some collusion. But like I said this make different pozitions for each client. Another solution I came with is removing speed factor and decrease their transform and fix it on collusion or increase it when speed boost. That way I will control where they are but I really want to develop it with speed variable.
No matter what you do, you will have to solve for how you plan to hide latency.
No asset is going to do that for you outside of Quantum, and even then devs have to make tradeoffs between input lag and the amount of resimulations that will occur due to bad extrapolation guesses.
I’ll check out Quantum. Thank you, I’ll consider how to hide it. Really bugged me out as I finished player movements and see it struggle with network.
you can't really check quantum out, its $1000 a month just to develop with it.
I'm making a card game. Basically something akin to yu gi oh to learn how to make multiplayer games. Do I need to create the server first or can I create the game component and functionality first and then implement my multiplayer aspect
In practice when you're just starting out you'll be working on both because you need to test a lot to see if things work like you want. It's difficult to make an entire game and then start on server and figure out things don't work like you want them to
Just take small steps
idk if anyone here is familiar with mirror(if ur familiar with unet it's basically like that) but I recnently tested out my game in steam by adding it as a non steam game but when the host disconnected they went to the offline scene but when the client disconnected thet stayed in the same scene except the objects with net identities on them were disabled anyone know why
The host is the server. If the host disconnects, the game is over.
A button has this code on it: if(isServer){StopHost();} else if{StopClient();}
Host migration is a large complicated topic, I don't think mirror supports it, and it was always buggy in Unet.
StopHost will fire StopServer and StopClient internally
Host just means that that node is both server and a client to itself.
even when the host disconnects and the client is still online they stay in the scene rather then go to the offline scene as mentioned b4
I'm lost then. If the host disconnects, everyone disconnects.
You might not be cleaning things up correctly, but they should all get a timed out shortly after the server goes offline.
thats why i think its a steam thing maybe
Using steam as a relay?
Not sure how that is wired up, because it goes against the nature of Server/client. You will have to ask the people who made that transport.
Since it will have to have handling for how to elegantly deal with the host shutting down.
The relay will still be there, but the server will time out.
then how come the host can go back to the offline scene but not client
also when the host leaves the game it says transport shutdown so idk.
in the console
Does anyone know the quickest way to make online multiplayer??
Check out Photon
Pun2 would be the quickest to get something actually online, yeah. But by giving up an authoritative server, there are compromises involved. Other option is like Mirror. Quick to develop as well, but you have to sort out hosting.
Hello, i have one question, is it so expensive in terms of bandwith if i connect the player every time he clicks on "Search Room"?
and disconnect him when he goes to the menu scene
and then when he clicks "Search Room" again, connect him to photon again
Not expensive at all, you're talking about a couple of bytes of data
I don't know exact number but it probably isn't even close to 1 kb
If you want to find out, use WireShark
That's actually cheaper...
If you keep them connected you would be paying us for CCU, and if you disconnect you don't.
So that's a good approach, go for ir
It
Thanks @gleaming prawn
Idk if anyone is familiar with steam api and mirror but when the scene transfers through mirror is the lobby destroyed or does that also move to the scene? That might sound confusing lmk if u need me to elaborate
When importing Photon 2 to my project, it gives console errors and it cannot find the server settings file
its like its not getting created..
even i use the wizard to create it it seems not to create
Closing the project and reopening not cure it? Also make sure no other scripts (other assets etc) are producing errors.
Part of the Pun2 install has to run some code to set up, and it can't run with any script errors.
It solved @jade glacier but thanks
FIRST APPROACH
void IPunObservable.OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.IsWriting)
{
if (photonView.IsMine)
{
stream.SendNext(BitConverter.GetBytes(Input.GetAxis("Horizontal")));
stream.SendNext(BitConverter.GetBytes(Input.GetAxis("Vertical")));
}
}
if (stream.IsReading)
{
if (!photonView.IsMine)
{
xInput = BitConverter.ToSingle((byte[])stream.ReceiveNext(), 0);
yInput = BitConverter.ToSingle((byte[])stream.ReceiveNext(), 0);
}
}
}
SECOND APPROACH:
void IPunObservable.OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.IsWriting)
{
if (photonView.IsMine)
{
stream.SendNext(Input.GetAxis("Horizontal"));
stream.SendNext(Input.GetAxis("Vertical"));
}
}
if (stream.IsReading)
{
if (!photonView.IsMine)
{
xInput = (float)stream.ReceiveNext();
yInput = (float)stream.ReceiveNext();
}
}
}
Which approach would be more optimized? Less bandwidth and faster sending data.
why?
The documentation say to send bytes
instead of floats
to optimize the networking
but this method here: BitConverter.GetBytes
Allocates... It will generate GC
Not to do with the networking
ANd how would i send a float in byte
Lets see what @jade glacier suggests
if its not like that
He's been working a lot with PUN2
what does he suggest
Lets wait for him...:)
Ohh yes sure
I think i just found a more optimized way to do that @gleaming prawn
https://codereview.stackexchange.com/questions/111866/float-to-byte-array-serialization-over-network
its here
yes... as long as you do NOT allocate that byte[]
if you still allocate that byte[] every time, it's kind of pointless
if you pre-allocate and reuse, perfect
most byte and bitpackers will write floats uncompressed as 4 bytes
if you want compression you need half-float or range/resolution based
my bitpacker is slated to be part of pun2, welcome to use that.
If Discord allows this...
https://github.com/emotitron/BitpackingTools
https://docs.google.com/document/d/14X8Bmg6UMecx8SlVQzfjrBYBf4ZYRayOLXipgB0BqPU/edit
Those two explain it a bit. You are getting into the deeper end of networking with this stuff though. Not typically needed when people are first learning networking.
C# Safe and Unsafe extensions for bitpacking directly to arrays and primitive types. - emotitron/BitpackingTools
Transform Crusher v3.5 © 2019 emotitron Contact the author at: davincarten@gmail.com I am also regularly in #Unity-Dev on Discord with the screenname emotitron if you have questions. https://discord.gg/tGDUxp9 Click here for current documentation Doxygen Documentation C...
@frozen canopy
So what i did its less optimized than sending the actual whole float? @jade glacier
you just changed its type from a float to 4 bytes I assume - which with Photon will add 2 bytes of length into on top of it.
So I would recommend against byte[] in that case
writing to byte[] later is pro, but only if you are doing a proper serialization write
yes i changed from Float to 4 bytes array
not just converting a primitive into its own byte[]
You are making it larger doing that
since now it is 4 bytes + 2 bytes for length info
So its better to just send the whole float?
yeah, don't try to get fancy like that yet
but bytes navigates better thru the network than floats am i wrong?
when you want to optimize, you will want to learn how to bitpack
before then, just do it the easiest way available.
Follow that write method
it does turn it into byte[]... everything becomes byte[]
but it is written into one giant byte[]... you are just convoluting the process.
Don't even try yet, you aren't going to guess a best practice for this.
I just looked at the doc and im not such experienced in coding to adapt my code
with that
It is interesting when you get there, but you aren't there yet.
definitely avoid trying to get fancy like this then if you are new to C# and networking.
The #1 cause of headaches people have with networking libraries is they immediately try to do crazy things before having a working game.
Again, you won't guess the best practice. Not with the tools available to you.
If you're looking for performance then you could use Buffer.BlockCopy. Nice and simple, and probably about as fast as you'll get in managed code.
a guy says this
"A guy" needs to give context for that statement.
you don't have access to the backing byte[] in that method you are using.
you don't have access to the backing byte[] in that method you are using.
@jade glacier What do you mean
i tried it and it works
I mean that you don't know what I mean... indicates you aren't ready for this yet.
Just make your game, optimize later when you are ready to dig into OpRaiseEvent rather than OnSerializeView
I know im not ready xD, but will be human-noticable the difference between what i did
or just sending the whole float?
You will get there, but you are trying to touch parts of the library that aren't even visible to you there.
So you will just be making garbage. Save it for a later date.
The difference is you just burned some CPU and added and extra 2 bytes per write there.
So you made it worse.
If you want to see what is going on, you can follow that SendNext() method and see where in the library it goes, and what it does to your float.
So by default it will do the same im making?
so im makign it twice?
im making it client-side
and then server-side?
You are just making it less efficient
I don't know what else to tell you. Without you knowing what goes on inside of the serialization methods that that SendNext leads to, it won't have much meaning.
void IPunObservable.OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.IsWriting)
{
if (photonView.IsMine)
{
stream.SendNext(Input.GetAxis("Horizontal"));
stream.SendNext(Input.GetAxis("Vertical"));
}
}
if (stream.IsReading)
{
if (!photonView.IsMine)
{
xInput = (float)stream.ReceiveNext();
yInput = (float)stream.ReceiveNext();
}
}
}```
so like this
it will be alright
That is the best you can do right now.
okeys
With an upcoming release there will be a change to that that removes that boxing
What do you mean by boxing?
{
if (!photonView.IsMine)
{
xInput = stream.ReceiveNext<float>();
yInput = stream.ReceiveNext<float>();
}
}```
This will become an option, once we release the big PR I am working on.
I can't really explain C# basics here sorry. I would literally not get a line of code written offering help at that level.
but isnt it exactly the same as its doing in my code?
Again though, if you don't know what boxing is - you are not at a place yet with coding or networking to be touching any of this stuff. Just do what you did above with the cast.
instead of casting
No. What you did is different.
this way will call a function that returns a float
If you are interesting in the topic, go read up on ref types vs struct types, boxing, and serialization
This is the difference no? I'm just casting EVERYTHING that comes in to float, and you are waiting specifically for floats
Photon largely makes use of casting everything to object[] for its internals... which makes things easy, but also makes a real mess, especially if you don't know the engineering of C#
Will this change have a real impact on players?
The issue is if you send a byte[], it has to give a length as part of its write/read
and on the bandwitdth?
float is a type that is known, so there is an enum header for that write that indicates it is a float
If you pass it as a byte, it just knows its a byte[x]
its prefix enum says "bytearray"
which means it needs to know how big a bytearray
oh
gpType.float = 4 bytes
gpType.array = ? bytes
will this change be noticable in bandwidth and gameplay aspect?
by converting to to byte[], you removed the type that it uses to automatically know the byte count
It will add 2 bytes per write
depends on your definition of noticable
but leads to the question... why convert to byte[]?
it does nothing beneficial and only has downsides
yeah i just did not know xD
I just read it in the photon documentation
That if you can send a byte, send a byte instead of a float
when posible
and i applied it
xD
a byte, emphasis on singular 😄
just send it it, it is getting cast to object
the library figures out the rest for you.
byte = smallest
short = 2 bytes
int/float = 4 bytes
long/double = 8 bytes
so if i can send a short
it will consume less bandwidth
right?
for the user and for the server
👍
yes
Though if you are worried about data, you will need a complete revisit way later
and you will want to bitpack or bytepack all of your serialization
yeah, if my game someday succeed ill have to get helped by a profesional person about networking
xD
Trying to optimize SendNext() is a lot of work for very little gain
im a trash in that field
xD
and im stupid because i try to optimize
and think im optimizing
and then my theories get fucked xD
you will not optimize with your limited knowledge of serialization right now. But if you really want to learn that because it interests you great... but you will need to start with serialization to a byte[] for entire objects.
Not passing values at a time with SendNext()
SendNext() exists for people who don't understand this stuff and just want it to work.
If you outgrow it, you have to step way back.
GL
Appreciate such a helpful community @jade glacier
anyone have anygood tutorials for setting up networks?
You could've searched that yourself and just went through the results
There's no easy way to do networking, you have to take in a lot of information so you at least have a basic understanding of how it works, rather than knowing everything inside and out
When you've actively followed a lot of these tutorials and have tried a lot yourself, you start seeing some patterns and things become more clear. Also important to be able to pinpoint what requirements your game/server has because there are so many options and/or architectures that it's almost impossible to say what the best way is
I picked a networking library called ENet after trying the default unity networking, Photon, and trying to write a server from scratch. I figured that just having a relatively simple library that takes care of the connecting/disconnecting and sending/receiving reliable packets is the most straightforward for me. I can now focus more on my packet structures and on the networkingevents that the server receives encapsulated in these packets, then just handle those events and keep track of the game and state of the clients
The client works almost exactly the same by the way, there's just a couple of basic events it has to handle, and all else is whatever datastructures I have defined that it receives as packets. Don't be too enthusiastic now though as there still is plenty to do to get things to work together nicely, but you can still save a lot of time (and money) by choosing the right library. In my experience something like Photon is nice, but the framework is huge, you'll spend a lot of time figuring out how it works. Also the pricing is so high and since you become so invested in it you have little choice but to go with it and pay exorbitant amounts of money which you could've used to run a retarded powerful VPS.
Hello, I'm trying to send head flip over the network using photon, but I keep getting this error:
RPC method 'HeadFlip()()' not found on object with PhotonView 1001. Implement as non-static. Apply [PunRPC]. Components on children are not found.
Here's how I call it:
this.photonView.RPC("HeadFlip()", RpcTarget.All);
And here's the method:
[PunRPC]
void HeadFlip(GameObject head, Vector2 input)
{
if (m_input.x < 0)
{
Flip = 180;
}
else if (m_input.x > 0)
{
Flip = 0;
}
head.transform.localRotation =
Quaternion.Lerp(head.transform.localRotation,
Quaternion.Euler(0, Flip, 0), 0.3f);
//makes head smoothly transition from it's current rotation to 0, Flip, 0;
//Flip changes accordingly to input
}
PlayerController is on the player game object which has Photon View on it.
Nope, didn't help
you also aren't passing any arguments
When I used "HeadFlip" instead of "HeadFlip()", is said that I used wrong arguments and that I can type "HeadFlip()" instead
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!
photonView.RPC("ChatMessage", RpcTarget.All, "jup", "and jup.");
Well, I'm not sure what arguments should I pass, since when I just type GameObject head, it thrown an error.
that is your reference. Notice the naming convention, and the arguments
You have two arguments
I arleady have done one multiplayer game
I'm working with a friend and I'm in middle of making multiplayer
I just have that one problem
Not sure what else I can say other than writing the code for you. How to call and RPC is documented for you on the reference you are using.
In what form should I pass the arguments?
The form shown on the page there
photonView.RPC("ChatMessage", RpcTarget.All, "jup", "and jup.");
for the rpc:
void ChatMessage(string a, string b, PhotonMessageInfo info)
{
// the photonView.RPC() call is the same as without the info parameter.
// the info.Sender is the player who called the RPC.
Debug.LogFormat("Info: {0} {1} {2}", info.Sender, info.photonView, info.SentServerTime);
}```
But the parameters must be strings?
Why would they have to be strings?
If your args are strings, yours are not
void HeadFlip(GameObject head, Vector2 input)```
That is your RPC
so pass it a gameobject and an input
It gives errors then, that GameObject is a type element and head does not exist in the current context, same with vector2 input
Because you keep typing invalid C#
Okay...
photonView.RPC("HeadFlip", RpcTarget.All, myGO, myVector2);
Sorry but I don't get it. Maybe I should get some sleep
yeah, I literally can't give you any more than that
You might need a break. This isn't a networking question any more, it's basic C#.
Well, thanks for your time
GL
I'm not sure you can pass a game object
These are not the same objects in two machines, are you rlserializing the game object, etc?
Tô pass a game object maybe what you want to pass is the photon view id of it (if it has one), so on the other side you can find the "same" game object
This for RPCs
As a second game object, of course, because the calling object is automatically the receiver normally
If have to check, but pun might just map that right to finding the GOs photon view like unet used to do.
However, I'm guessing that part of his code will be the next problem once he gets his c# valid. @gleaming prawn
Yep, it turns out that I can't pass GOs through RPC
What is it about the go you are trying to send?
I'm trying to send "bullet" GO because I'm working on shooting
But I can do that by photon View ID
@shut yarrow thanks, i just didn't know if anyone knew good ones that they would recomend.
all i need to do is send 1 int from the host to everyone else, have everyone else send an int to the host, and have the host send an int to everyone who sent the right number
HI
I try to connect to Photon Server in Unity, but every time i have error. I checked lots of website and tutorial I really don't know where I did mistake. Could you help me ?
Post your question @weak plinth
No one will answer you if you are asking if you can ask.
i'm not sure if i put this in the right place so i'll just paste it here
hello all
i have a quick question
i'm playing around with the netcube example for netcode
i'm maily trying to turn it into something with first person-esque controls
But i can't get relative movement to work :( Can any of you tell me what i might be doing wrong?
thank you all in advance :)
Hi, some one have any tutorial or guide how about it to work a game multiplayer like fall guys or among us?
How can i limit the FPS without disablikr vsync?
Most straightforward is to have a single normal update function that calls other custom update functions manually every set interval
It means you'd have to avoid using void Update in all those scripts (except the one that controls FPS) that you call and make a different update function in them that Unity doesn't call automatically
Hey. So I'm trying to create a little pause Menu so the player can change his settings in the middle of the game, ... but the problem is I'm getting this error when I activate the menu and when I turn it off the error stops (This error only shows up when I try to use PV.IsMine but I really need to use it and I don't know how to fix this):
This is the place where I'm getting that error:
void Update()
{
if (!PV.IsMine)
return;
//The rest of the code that I have inside the update function
}
Pv is probably undefined
Anyone has an idea how If there is a way to access the custom properties of my local player without a photonview instance
Could try checking the code to see how it's being accessed under the hood
I'm having a pretty major issue with building my project.
When building the headless server version there is a ton of shader/urp errors.
Any idea why this could be? Console output is here:
https://hatebin.com/jqsqwvangm
it was PhotonNetwork.LocalPlayer.CustomProperties for anyone wondering
is it possible to add extra servers to photon pun 2? like ur own servers
Not like you are thinking I suspect, though not sure exactly what you mean.
You can run your own realtime servers
but for Pun2, the "server" is the relay
But yea you should be able to replicate the setup on your own with https://www.photonengine.com/en-us/Server
Out of the box, Photon comes with two distinct application configurations:
LoadBalancing (MyCloud) is the preferred setup and compatible with the Photon Cloud and PUN.Starting LoadBalancing (MyCloud) is the way to go for clients done with PUN, Photon Voice or Photon Realtime (also known as the "LoadBalancing Client API").
howdy yall, im new to unity but not to game design. Me and my friend came up with a great idea and we chose Unity to bring our idea to life. My question now is, how do we make an online multiplayer survival game like Rust or Escape from Tarkov?
photon pun is free
u can also use mirror
which u need to pay for servers
but u can have however many ppl online at once
those two are the best options imo
You will want to do tutorials for some of the basic free libraries before even dreaming about making a title.
Typical starting point is Pun2 and Mirror.
oh, and dont start with networking
make a simple console app in c# to learn some basic programming
They will teach you all kinds of bad practices, but they will get you at least some of the vocabulary needed for networking.
then make some simple unity games until u understand how unity and c# works
And yeah, Learn Unity first. Don't even think of trying networking if you haven't made a Unity game.
alright then, thanks
@jade glacier I have a projectile thats hard for the client to predict so I use interpolation to make it look decently smooth but when the projectile is cast I need to wait for the seconds snapshot to arrive to start interpolating which makes the projectile 'wait in the air' for N ms. Is there any tricky way to get around this?
There are a few, all require deciding where you want to try to hide the paradox
for slower movers in the past I have have the shooter fire a hair late, but trigger the audio/flash immediately, and then leave the gun at a slower than actual rate.
And it uses RTT to predict about where it will be when the server comes with with the confirmation
Then you correct it once you get the actual shot event
Its 10 m/s fast so it looks a bit weird
This is assuming you are doing server authority over the projectile
I do
Your goal being that the projectile matches the opponents time frame to the shooter.
Basically you employ delaying tactics on the shooters prediction, so the correction when the server shot comes isn't too major
You aren't predicting the shot it sounds like, so you will have to hide the delay
if you actually predict the shot, the shooter shoots in realtime, and the server would do some rewinding and rechecking if the player claims a hit.
That would be favoring the shooter.
Its a targetet missle so it takes some time to fly
So I just need to hide this waiting for 1 snapshot
If I predict / extrapolate there will be a lag back?
I don't know the entirety of your simulation, buffering and prediction, so I don't really have an answer sorry.
Yeah np thanks for trying though ;)
The main thing with any kind of lag compensation, is think about the different timeframes that exist. And decide which timeframe you want to see.
Can anyone point me in the right direction for how to configure a subscene to convert entities for a client world vs. server world with the new netcode?
@honest spindle the documentation is useless, i'd reccomend looking at the sample code 😆
I've googled and googled
read the patch notes
finally went back to ConvertToClientServerEntity components in hopes for more sane docs
D:
hopefully that happens before deprecation due date
besides, it'll probably change twice before then anyway 😄
Hey guys, I call an RPC once and catch it twice in the same script on the same object . any ideas if all previously mentionned is true ?
Anyone know how to resolve this issue with unity's NativeWebSocket?
LayoutUtility.cs(128,74): error CS0433: The type 'Func<T, TResult>' exists in both 'WebSocket4Net, Version=0.14.1.0, Culture=neutral, PublicKeyToken=eb4e154b696bf72a' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
void CallRPC()
{
Debug.Log("Called");
Pv.RPC("HitReturn", RpcTarget.All, OwnerID, other.attachedRigidbody.GetComponent<PhotonView>().ViewID, Damage);
}
[PunRPC]
public void HitReturn(int OwnerID, int HitID, int Damage)
{
Debug.Log(this);
GameObject Hit = PhotonView.Find(HitID).gameObject;
}
My Problem is that Called is logged once but the "this" returns twice from the same script, any ideas ?
Hey I have no experience with networking I just want to make a couple of simple games where two people connect and play one is real time and one is turn based, I saw photon but it seems like it's not free for commercial use, what should I use?
So, UNet is deprecated, so how am I supposed to send a message over the network in Unity 2020?
That is the $100000 question isn't it 🙂
Is there just not a way to do networking at all now?
Pun2 and Mirror are the usual starting points for users. If you are doing DOTS the netcode is an option.
use .NET
You're talking to someone who thinks there is no way to do multiplayer if Unity doesn't provide an option -_-
There is what there is. Most released titles are hand rolled or use Pun2/Realtime as far as I know. Hobbyists typically start with Mirror since its a very active community, though hosting will have to be sorted. Netcode... no idea what if any titles have made it to release using that.
I'm not even trying to do multiplayer. I just need to push a string to a network address through a Unity application and I don't know how
If I try to make a Socket myself it doesn't connect
I've tried Sockets, I've tried TCPClient, and every time I get a "Connection has been actively refused" error. I have the other program open and listening on localhost on a port, I just can't connect to it to send a message
The server program is working fine, I can connect to it just fine in Java, but when I try the same thing in Unity it just won't
I've written Java programs that connect to it, but all I can think of is that Unity itself is the problem
doesnt give me any 🤔
have you tried moving your server to a vm?
also are you absolutely sure the ports are right?
you can't listen on the same port as the server is sending on if they are on the same machine for example
For now, I'm just trying to push a message to it. I'll have to figure out listening another time, but I can't even get a message to it.
IPHostEntry host = Dns.GetHostEntry(addressString); //localhost
IPAddress ipAddress = host.AddressList[0];
IPEndPoint remoteEP = new IPEndPoint(ipAddress, port);
Socket sender = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
try
{
sender.Connect(remoteEP);
Debug.Log($"Socket Connected to {sender.RemoteEndPoint.ToString()}");
byte[] msg = Encoding.ASCII.GetBytes("ConnHelo");
sender.Send(msg);
}
At the .Connect line I get No connection could be made because the target machine actively refused it.
So I don't even get the log
Is there some sort of weird obvious thing I'm doing wrong?
TcpClient cli = new TcpClient(this.host, this.port);
cli.Client.NoDelay = true;
using (Stream netStream = cli.GetStream())
{
if (netStream.CanWrite)
{
byte[] bytes = Encoding.ASCII.GetBytes("ConnHelo")
netStream.Write(bytes, 0, bytes.Length);
netStream.Flush();
}
}
I think what's wrong with your code is that host is the address of the server you're trying to connect to. When creating a socket you need to supply an address to send from
Okay, that worked, no errors and I got the message on my server that I connected. How would I supply a "from" address to a socket?
Just to try to understand why the socket thing didn't work
localInAddress = new IPEndPoint(IPAddress.Any, 0);
localOutAddress = new IPEndPoint(IPAddress.Any, 0);
void CallRPC()
{
Debug.Log("Called");
Pv.RPC("HitReturn", RpcTarget.All, OwnerID, other.attachedRigidbody.GetComponent<PhotonView>().ViewID, Damage);
}
[PunRPC]
public void HitReturn(int OwnerID, int HitID, int Damage)
{
Debug.Log(this);
}
My Problem is that Called is logged once but the "this" returns twice from the same script, any ideas ?
I'd guess because you have two different RpcTarget in your scene
@robust cypress it can be your collision being called in both players. which result a 2 rpc call?
something like onTriggerenter being called twice?
@thin kernel you are absolutely right and I figured so before seeing your message, I thought I was only activating the collider for the master client but I forgot to disable it in the prefab
ah glad you fix it then . been awhile from networking 👍
Well you were spot on so good job
thx ^
Now I'm having trouble with destroying the right bullet on all clients since only the masterclient does collision
maybe I should use a server instantiate and keep the collision on master
but I really wanted to avoid that since its called bad practice everywhere
i think you should do if and else way
of the owner
and figure a way somehow
hacking is the way sometimes u know 😉
like apply dmg only when im owner but not if not owner
maybe i'll do the collision on every client
but only master applies damage
yeah exactly
Good luck
thanks u too , looking forward for ur game 🙂
It has mekkas and correctly registering bullets
wooh
kinda like the power rangers
sounds epic
anyone worked with dissonance before? thinking of purchasing it
Is it safe to call Connect again on a ChatClient in PhotonChat once the state changes to Disconnected or do i have to create another instance?
You can connect again.
Hi guys, I wanted to ask a question: I'm developing a unity application for WebGL, I need to import objects (.obj) residing on an http server in run-time, do you have a procedure/documentation to recommend?
guys I already configured the multiplayer more anyway when I add the network in the components nothing happens
Which networking library are you using?
what's these?
What is a networking library?
The library you install, that enables multiplayer game development. Like Mirror, Pun2, Netcode, etc
That isn't part of Unity any longer. They deprecated it.
an
@jade glacier hello , please i need help in how i can logout my discord accounts from where it s opened becz im watching in my mobile that im playing fortnite maybe i forget it opened in some internet cafe
why me?
What’s the best way to include multiplayer and player data and accounts? Dm or ping me
Sorry for this question as I’m sure it’s asked ad nauseam. But we are currently creating a 4 player VR shooter, and neither of us have any networking experience (I know, we really shouldn’t be doing multiplayer).
We are trying to work out the best option to build our prototype with, and hopefully use the same framework for the final product but we can’t work out which one to pick. We are not too fussed on server auth because it’s not going to be popular enough and Quest is our target platform.
PUN2 has by far the most learning resources however it’s seems to be lacking built in lag comp etc. I’ve also heard it’s not great FPS’s
Bolt has a lot of the good stuff, but lacks host migration. We also won’t be running dedicated servers, so no idea how to deal with the advantage the client server gets.
Normcore is relatively simple to setup, is server based and has built in prediction. However it lacks simple stuff like server browser and no clear way to implement Oculus’s account/friendlist api.
Has anyone got an idea on what would work best for a 4 player shooter, no authoritative but pretty precise shooter?
Bolt has a lot of the good stuff, but lacks host migration.
Host migration is an incredibly complicated topic (unless you use Photon QUantum - where it's not an issue by design).
I do not even know a turnkey library that supports that (host migration) when you have traditional server authority.
how to deal with the advantage the client server gets.
That would be an issue with any listen-server solution (because you do not want to run dedicated server - which is a WISE decision money-wise btw).
Normcore is relatively simple to setup, is server based and has built in prediction.
Can't say much, but Normcore is very similar to PUN in architecture (it's server features were very limited, not really application logic, unless they fundamentally changed their SDK and business model)
has built in prediction.
This is probably just "words", as it does same as PUN/PUN2 AFAIK: client has full authority over own object, so that is "prediction"... And thereÄs no server auth there, so there's not prediction error-consolidation (as there's no server authority, at least afaik).
So @dusk cargo it really depends what you want to do:
- Bolt has all the features you need, but indeed the listen server guy would have less lag... the lag compensation does imply others will have "fair" treatment of their shots though.
- PUN2/Normcore are both easy to use, and will have "host migration" (actually, there's no host)... And considering you can make a BIG HIT game with pure client authority like that, these are valid options I'd look more into...
to add to this: a lot of devs start right away thinking about server authority, while they should focus on building a game first... Among Us is a good example that you can build a major hit using a "naive" approach like relaying everything (same as what PUN does).
If you want a more twitchy, tick-accurate physics solution, I'm one of the developers of Photon Quantum, and I personally work on VR shooters with it...
But it always depends on what is your intention, scope, expectations...
PUN2 has an add on library being developed by @jade glacier called SNS
Thank for for the detailed and thorough response. We are very much game focused and have spent the past 6 months building our own physics based movement and interaction system, and detailed weapon handling mechanics. (Don’t worry all the physic stuff only needs to be handled locally haha). So we have the interaction and mechanics down, it’s just getting the 4 players into a room with a somewhat fair experience.
Our scope is not huge, we just don’t want players teleporting all over the place. Shots not being counted etc.
That turns it into a tick-based simulation, adds transform compression and other features... maybe you'd be interested in joining our Photon Discord to learn a bit more about it... He can also chime in here when he logs on
You might want to save that in a doc so you can paste it later... that question comes up a lot. @gleaming prawn
Quantum looks cool but being just two dudes it’s probably way out of our league haha
Don’t worry all the physic stuff only needs to be handled locally haha
That's exactly how it is in quantum as well
Shots not being counted etc.
That part does make things a bit more complicated in the case of state transfer.
Well if you gave the shooter the benefit
Does that make it easier
I’m sure desync will rear it’s head, but hopefully it’s not too often
fast UDP relies an dealing with stuff getting "lost" and not breaking things. If you fire a shot, and that doesn't make it... reconciling that does expose the paradoxes involved with lag compensation and such, and is a slightly more difficult layer of networking.
desync is a big term, but state transfer typically is always in desync to some degree
The fancy coding is for how to hide that, and how to translate objects from one timeframe to another. In state sync though there is always one authority over each object, so as long as you cook in some form of eventual consistency, all will agree.
But moment to moment, clients and server will see the world differently - since with prediction clients see their owned objects as existing in the future.
I think I would have to know what you mean by descync in this case?
You aren't talking about lockstep I don't think here.
By desync I was referring to positional desync. So I shoot player A, I get the hit but on Player A’s screen they had made it behind cover
Yeah haha
Favor the shooter is NOT fair... It's just a way to make the game fun
you will die behind cover
if you predict your players actions, you will be in desync
it is the nature of state transfer
It's not different in determinism
Yeah I’ve heard theory is usually a person knows if they shot someone, but the other doesn’t know if they were actually shot
We also do local prediction
Unless the desync between the two is huge
and there's also the possibility of implementing favor the shooter techniques
The internet has latency, there is no pure magic in how to hide that... just a lot of hard choices.
just a lot of hard choices.
Normally driven by: make the game fun to play
Without favor the shooters, it's virtually impossible to hit a player who constantly moves... so the game is NOT fun, because you do not hit anyone
Yeah. I would go with favouring the shooter. Is say PUN more prone to desync then Bolt
As I would assume there is more latency with PUN
desync has no meaning to me in this context though
Latency then
bolt actually will display more latency, because it has proper buffers
SNS as well, it will induce more latency in order to make all of the tick based stuff happen
Bolt also would have double bounces when using listen server over relay...
I would of thought it would be be PUN as it has to go, client A - relay - client B then back to relay then back to client A
When punching no, it'll be fine
Ah yeah, forgot about the bolt relay fallback - that is a consideration as well.
But the relay fallback means messages go: client->relay->listen-host->relay->client
Pun2 is very fast (latency) inherently - that isn't its weakness.
but ye, it does have built in punch, so in the expected 85% of the cases it will connect to host directly
What’s PUN2 weakness then?
Pun2's weaknesses are that there is no proper simulation server.
just by design it's client authoritative, not designed for tick-based sim
the relay is inherently dumb, and to make it smart you need server plugins.
and server plugins do not exactly fit with PUN's tight integration to Unity data types
So pun messages are not easy to "decode" on a plugin
So If I didn’t care about auth
Pun2 used how it wants to be used, wants client authority everything
PUN/Normcore would be fine
think so
Distributed authority can get a little tricky for some people to get their heads around.
And it is weak against cheating
Remember the lesson:
Among Us is "dumb" relay...
There's nothing about dumb there... It's just quite smart business wise
Haha
yeah, "dumb" just means it has no clue what your game is or anything about your game.
Remember the lesson
ye... I just think we worry too much about cheating...
I’ve just heard its not good for FPS but they probably didn’t know what they are talking about
WYSIWYG projectiles
I’ve just heard its not good for FPS but they probably didn’t know what they are talking about
What is good for FPS is what YOU work well with
Quantum is typically the correct answer for everything, but the barrier there being its price being a wall against hobbyists 🙂
Quantum is typically the correct answer for everything,
Not really... I'd put a big TYPICALLY here... very big
In several use cases it does solve really well... But there are use cases where current quantum is not technically recommended
Good point
It's a nice API to work with, very comfortable from the dev perspective (no network exposed)
For all of the games I want to make personally... it is the correct answer.. but I am not looking to make a fast FPS arena.
I love me some vehicle based games 🙂
I suppose when you work for ExitGames it's pretty simple to use Quantum but for the typical small dev it's just not affordable
It isn't for hobbyists at the moment (or maybe ever, who knows) @shut yarrow
But for any small dev company it is not an issue. The cost of Quantum is less than the cost of a networking specialist that would be required to make a releasable game.
I see that explains it I guess and that's a fair point
Yeah that is a fair point. But don’t you still need someone with networking experience to implement it?
Yes but not a networking specialist so in theory any experienced programmer should be able to do it
I’ve only been programming for a year, and very specialised in VR so no doubt beyond my skill set
There are many options and some of them require more effort to get things going
It looks like PUN/Normcore is my best bet
I like PUN but I'm not on board with Photon's pricing schemes, in my opinion you get little in return for the money you pay. Sure their API is pretty simple to use but after trying other free options I don't see the big win because you still going to need to write code anyway and you'll end up with something that works plus you can still build on
From what I understood Mirror is pretty similar (maybe I'm wrong) but it's free except you need to host your own server (which is still much cheaper than PUN)
Right now I'm using ENet
Has very little meat to it because you only get a basic setup that accepts connections and receives networkmessages but you can easily make your own API on top
It's very lightweight as well and little about the library you actually need to know to be able to use it, it does require some basic understanding of making your own packets to send over the network
Not hating on Photon though, I understand it's a business and they have to be competitive and make money after all. There will always be people who can't afford the time to put in themselves but can pay the money so at least they have options
but it's free except you need to host your own server
It's a lot more work thjan that... But...
Better to check for how many games were released with Mirror so you understand how simple it is (to do the "free" stuff)..:)
Sure, IF you have experience
I know several examples of good developers who roll out their OWN infra...
No idea and never tried Mirror myself so I have no idea what it takes to make something with it.
They would not use Mirror/MLAPI/UNet though
If it's just a toy/hobby project, then should be fine
I only know of 1 game that uses PUN and it's dead right now, but at its peak it was pretty popular. Forgot the name was some first person shooter in the browser using webplayer
Got killed by cheaters -_-
I would imagine setting up and running your own servers would be a huge uphill for someone with no experience
Yes it sure is
I think then taking the price of PUN / Normcore
Will be worth it
Also price only matters if you have a lot of players
So what would be considered a good problem haha
I only know of 1 game that uses PUN
YOu would be surprised by how many are Photon Realtime and/or PUN (and you'll see a lot more quantum ones popping up)
Got killed by cheaters -_-
Someone has not learned the lesson...:)
Probably won't be that surprising seeing how many people want to make multiplayer games and not having any clue where to begin and Photon has done its homework on marketing pretty well 👍
Well they were successful but didn't keep up with times so people didn't want to play that cheater infested game anymore
lesson 1:
- make a successful game
lesson 2: - ye, taking care of cheating is important, but there two ways to tackle it (both are challenging):
a) try to make game cheat proof (ok to certain types of cheats, like we can with quantum, for example), but never perfect
b) design your game around not incentivizing cheating (more difficult, but cheaper in the end)
Also
Well they were successful but didn't keep up with times so people didn't want to play that cheater infested game anymore
There are plenty of successful games done with photon now
Don’t put it on PC haha
ye
Making it cheatproof is difficult on PUN though
Making it cheatproof is difficult on PUN though
So it is with any relay solution
Correct
And I'd LOVE to be the developer of a successful relay-based game like Among Us
Instead of spending money on expensive dedicated server, use money to improve the game content..:)
Instead of spending money on expensive dedicated server, use money to improve the game content..:)
@gleaming prawn this is the most important thing
Well the game I'm talking about probably just blew it all or spend it on another game but surely not on improving their current success
Too many people worrying about cheaters before worrying about player count
yes
That's true indeed
I CARE with cheating myself
Should not be the top priority when making the game
But it is overrated imho
Yeah. If your PUBG or CoD you can worry. If it’s your first multiplayer game, be honoured someone cares enough to cheat and deal with it then
You’ll now have the funds from a successful game to combat it haha
ye
I guess we all hope to get to that place 😛
It's definitely not my top priority either though, first need to make something people care to actually play, other than my friends 😄
yes
Now I remember the game. It was BeGone by NPlay
haven't heard of it
this is PUN as well: https://store.steampowered.com/app/242860/Verdun/
The game takes place on the Western Front between 1914 and 1918, in one of the bloodiest conflicts in world history - inspired by the infamous Battle of Verdun in 1916. Verdun is the first multiplayer FPS set in a realistic World War One setting, the game which started the WW1...
$19.99
25000
70
It's completely down now I think. At its peak they had like 3000+ gamers on at any time of the day which I thought was pretty amazing
We have a lot more high-profile games on mobile
But there are some interesting ones on PC as well
We have titles with 100K+ CCU
It was in the good old webplayer days
3k is a decent game though
Yeah it is, spread out over many different rooms cause it had like max 16 players per room so pretty successful
ye
https://store.steampowered.com/app/700330/SCP_Secret_Laboratory/ This uses Mirror https://store.steampowered.com/app/512900/Streets_of_Rogue/ This uses a variation of uNet https://store.steampowered.com/app/251570/7_Days_to_Die/ This uses uNet
I will admit though PUN is definately better for competitive multiplayeer games while mirror is better for co op and i guess when many people think multiplayer games they think comp shooter but i use mirror for co op like left4dead, borderlands, risk of rain etc
That typically is said the other way around @vapid leaf
Server authority is generally considered better for competitive, and client authority for coop.
all the games i just listed up there are co op
But that is all very general.
for me i was able to integrate steam with mine (it's not on steam) and the steam stuff works fine without bugs just some stuff i need to figure out how to integrate and this is with mirror. I will also admit the net transform is kind of bad but there are ways to make a better one
Has anyone been succesful in using GRPC with SSL inside of Unity? I've been having so much trouble
nope, that sounds like some scary stuff though
I would imagine the trouble would be getting Unity to use the right certificate chain
Dude we're explicitly specifying the certs at this point and it still fails
the order could be a problem. I had this issue once where i had the right certs in the wrong order and i didnt solve it until some obscure blog post stated that this particular server required them in some particular order
no dice :/ good guess tho
This is a question for both networking and physics really - I've currently set up a top down 3d game with multiple players controlled by rigid bodies. Their movement is very simple, and the only real physics interaction involves if they hit each other (they are smacked back and could bounce off a wall or fall down a hole, for example).
My question is - should I be using rigid bodies for this? I've read moving over to networking dealing with rigidbody physics over networking becomes difficult and they may not be deterministic. Any thoughts?
It's a fun party game but should be playable over net and probably needs to be server authoratitive
Anybody here familiar with SocketIO?
I’m wondering if it’s better to use many different events for different purposes to transmit info about the game or if it’s better to just have only a few events and just use one for all back and forth communication
Have a few basic events and when a packet is received figure out what type it is and send it to a function to process it. Doing it like this gives a cleaner overview and you can arbitrarily make more functions to deal with specific cases.
Hey, Im new to networking..and wanted to make a online multiplayer type of game..Just wanted to know what would be the best approach to let users use their devices as servers(not Lan..but real online multiplay)..maybe similar to among us...I appreciate any @ mentions thank you ;)
punchthrough with relay backup
"weird" ?
It is a 3D object that i didn't even add to my game
and i do not know why it creates that object
instead of my "player" object
Your code makes no sense so could be a bunch of things
i learnt it from tutorial
yes
is that red player the only "player" in your entire project?
yes
you are sure?
let me screenshot
you did a search of your resources
to make sure "player" isn't conflicting with like Photon demos or anything else you installed?
there is 1 player in resources and 1 player in hierarchy
Search the project though
i will
let me look now
it worked
@jade glacier THANKS!!!
i changed the name of player
There is another player somewhere in resources it sounds like
@muted sand Unity's 3d physics engine, PhysX, can be guaranteed to be deterministic for same build, same machine (though many of Unity's built in functions are non-determ, like Destroy). In practice I've found it is deterministic on different machines provided they have the same CPU brand. This is less about physics and more about floating point arithmetic inconsistency.
Unfortunately this is not enough to be stable for networking, so it cannot be used for deterministic networking paradigms. You can predict the local physics responses (you guess what kind of response will occur when one player strikes the other) and then reconcile later with the server.
For server authority, it's worthwhile to ask how important it is. For reference, it appears that at launch Fall Guys was non authoritative (I'm not sure if that has changed)...and it's doing pretty okay!
Thanks for the response @floral turtle - yeah, I'm not as much concerned about cheating as most would be as it's just a fun party game - but I am concerned about everyone's characters being in the correct places after being smacked around (due to physics). I assume that I can just run those physics on the server side and let the player know where they end up and run the interpolation locally - that should be mostly OK, right? (Very novice perspective here)
My mental model of how this works could be completely wrong too and I'm worrying over nothing
@muted sand it depends how responsive you want it. You could run the entire game server side, with clients only sending inputs/receiving positions (this is what lockstep determinism games do, like StarCraft—but they don't need to send any game data, since they are determ). The downside is that players would have input delay while they wait for the server to respond.
Otherwise you can give the players local authority, but then only their character would be responsive—so you'd hit another character, wait RTT for the server, then see their character bounce away. To avoid this, you can locally predict stuff. Bolt is a Unity package that does local prediction/reconciliation, but I don't think it has physics support for it (someone did an extension for it, but I think it's very out of date).
There's also options like Quantum, where you write code in their determ game engine, and it does predict/rollback like GGPO (netcode for fighting games)
Got it - I guess the root of my question is - does physics / using rigidbodies for characters massively overcomplicate this? Because the only real physics that happens are the knockback (and gravity, is that physics?), everything else could be controlled with transforms... so I could potentially fake the knockback physics if it would make server side authority much easier
For something like fall guys physics is much more involved so it would make sense to have as much of that client side as possible
it's definitely can be easier, but Unity does have a function to run physics ticks, so you can predict/roll back https://docs.unity3d.com/ScriptReference/Physics.Simulate.html
if you only have a few players it would be fine
Yeah it'd be 8 max
Cool, thanks so much - I'll do some reading into Physics.Simulate 🙂
yeah. I'll wait for someone more knowledgeable about Bolt to step in. In general with netcode it can get very complex fast, so good to use existing packages
There is also the issue that it is not stateless @floral turtle
rewinding phsyx to resim will break determinism.
And that ability is a big part of what people are after with deterministic physics
@jade glacier so long as the server frequently sending state info about the world, the desyncs would likely be small enough to not be noticeable before they are reconciled, right? Re: client-side prediction & reconciliation
but yea if you are just referring to PhysX determ then yes it is not stateless sadly 😦
anybody here using the dots netcode package?
You can predict the local physics responses (you guess what kind of response will occur when one player strikes the other) and then reconcile later with the server.
@floral turtle was there a typo here? You can't do this in a deterministic way using PhysX
every time you query RB transform or set it's transform value, it goes through potentially lossy floating point math in PhysX internals so you can't guarantee the value you read earlier will be same when you rewind to it and resim + you can't control PhysX cache which can alter the simulation in use case like this
in my testing, only way you can get physx to be deterministic is if you use it for some puzzle game where you can always reload the level and always have same starting point for the sim
and even then, it's only guaranteed to be deterministic on the same build
ah, I missed the later comment from emotitron
but yeah, cache is an issue. PhysX itself has "immediate mode" which is actually stateless but it's not exposed in Unity
immediate mode is basically just exposing physx solvers through it's API, it's not like full stateless physics engine but more like a tool that lets you individually compute specific things
You'll have to give a lot more info than that.
void StartRPC()
{
Pv.RPC("End", RpcTarget.All);
}
[PunRPC]
void End()
{
Debug.log("Working");
}
I have done plenty of RPCs in my game that work just fine
but this says that "RPC method 'End()' not found on object with PhotonView"
I did it the same way as every other working one
Pv is GetComponent<PhotonView>() btw
The actual error text?
RPC method 'End()' not found on object with PhotonView 1019. Implement as non-static. Apply [PunRPC]. Components on children are not found.
UnityEngine.Debug:LogErrorFormat(Object, String, Object[])
Photon.Pun.PhotonNetwork:ExecuteRpc(Hashtable, Player) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:627)
Photon.Pun.PhotonNetwork:RPC(PhotonView, String, RpcTarget, Player, Boolean, Object[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1222)
Photon.Pun.PhotonNetwork:RPC(PhotonView, String, RpcTarget, Boolean, Object[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:2812)
Photon.Pun.PhotonView:RPC(String, RpcTarget, Object[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:792)
RoomScript:OnEnable() (at Assets/Scripts/Objects/RoomScript.cs:20)
UnityEngine.GameObject:SetActive(Boolean)
Photon.Pun.PhotonNetwork:NetworkInstantiate(InstantiateParameters, Boolean, Boolean) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:2522)
Photon.Pun.PhotonNetwork:Instantiate(String, Vector3, Quaternion, Byte, Object[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:2354)
TestChamberScript:Start() (at Assets/Scripts/Scene/TestChamberScript.cs:19)
And it's definitely on your Instantiated go? And that script is on the root?
yes
No other methods named end anywhere in your project?
Not sure at a glance
I'm pretty confused too
I don't use rpcs, but that seems correct
I don't get the question sorry. This will spawn a player object that belongs to this player (this runs on each local client once they join a room)
@jade glacier
tempPlayer.transform.GetChild(1).GetChild(0).GetComponent<Text>().text = "User_" + GameObject.FindGameObjectsWithTag("Player").Length.ToString();
Then why doesn't this work?
Nothing networking going on there, so I am probably the wrong one to ask, and probably not the best channel for that.
Photon questions get answered here yeah
Paste a question. Mirror has a discord server of their own that gets quicker answers as well.
I've been reading about PUN, Photon Realtime, tnet3 and UNet and I'm not sure what kind of networking solution would be best, I'm making a pvp type game so an authoritative type server would be good for security, do any of these solutions provide that or are they all p2p and client hosted
I would start with Pun2 and Mirror tutorials before even thinking about networking any actual game.
The tutorials network a game don't they lol 😂
any suggestions for a server authoritative engine ?