#archived-networking

1 messages · Page 82 of 1

mighty forum
#

Hi, my backend is called with ip ranges from apple and they create users in my backend. I have a rest api and it is only in testflight. Is apple executing these testflight apps?

stray scroll
#

@crystal glen follow a guide and it will sort it

dusk forge
#

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)

jade glacier
#

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.

sweet arch
#

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

lapis vapor
#

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

jade glacier
#

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.

vivid owl
#

does anyone here know of any good chat services that I can integrate?

#

I only need text chat

graceful zephyr
#

@vivid owl Photon Chat

vivid owl
#

is it self-hosted?

#

or managed

#

I can work with either

gleaming prawn
#

managed, you get the SDK, adds to the game... All the service is on our cloud

humble lantern
#

Hello! I have a question regarding photon. How I can send across the photon = List<Vector3> ????

crude galleon
#

Does anyone here use Mirror?

jade glacier
#

@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.

opaque oracle
#

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

jade glacier
#

For the first thing, your first line completed the instantiate before the next line the an error.

lapis vapor
#

@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
#

@lapis vapor in photon settings in Unity.

lapis vapor
#

@jade glacier , it is showing my region is asia in it. OTher than that there is not option for that

jade glacier
#

If dev region is set, development builds will all use that.

#

Have you recently switched to building release builds?

lapis vapor
#

no never touched it after configuring app id

jade glacier
#

That isn't a photon setting.

#

Have you changed build settings to not be development build?

lapis vapor
#

No it's not a development build

jade glacier
#

There you go

lapis vapor
#

Yeah okay so u mean as now it is a release build there is a region mismatch is happening?

jade glacier
#

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.

lapis vapor
#

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😇

jade glacier
#

awsome

dusk forge
#

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

jade glacier
#

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.

dusk forge
#

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?

jade glacier
#

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.

dusk forge
#

okay ill just try and use a rigidbody for now. Thank you

spare jasper
#

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?

gleaming prawn
#

@spare jasper this channel is about multiplayer networking.

#

WebGL general issues maybe it's easier to get help in unitytips or general-code maybe?

spare jasper
#

I´ll give it a try - thanks for your answer

sharp lion
#

hey guys someone know how to use mirror?

oak flower
#

Do you have any particular problem? There are tutorials how to use it.

gleaming prawn
#

a few here use mirror, yes... ask the question (although it's normally easier to ask in their own official discord)

opaque dew
#

@sharp lion Shameless plug, I have a vast tutorial series on Mirror.

sharp lion
#

thank u

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
#

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

shut yarrow
#

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

lapis vapor
#

@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

light pollen
#

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

jade glacier
#

Just enable and disable child game objects @light pollen

lapis vapor
#

@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?

jade glacier
#

I don't know what your error is @lapis vapor

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

jade glacier
#

Probably is that then, yeah.

lapis vapor
#

Okay cool

worn fable
#

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? 😅

jade glacier
#

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.

worn fable
#

@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?

jade glacier
#

I don't ever recommend using RPCs or Syncvars, but that would be one place to start.

worn fable
#

Alright. I'll keep that in mind. How else can I send input from client to server?

daring fractal
#

hey what do you guys use now that unet is dead

#

im totally lost on what to do

jade glacier
#

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.

daring fractal
#

i really just want something for peer2peer at the moment can pun2 or mirror do those

jade glacier
#

p2p isn't really a thing, so you might have to specify what you mean by that.

daring fractal
#

peer to peer

jade glacier
#

P2P means every client connecting to every other client, which isn't a thing for game networking.

daring fractal
#

i should probably elaborate

jade glacier
#

So you either mean player hosting, or relay.

daring fractal
#

player one hosts the game and then the rest connect to it

jade glacier
#

That is still server

daring fractal
#

okay that makes sense i mean i just dont want to have to buy a 1000 server or something

#

meant to add $ sign

jade glacier
#

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.

kind knoll
#

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?

jade glacier
#

You probably need to indicate what library you are using, and post the code that seems to be going wrong for you. @kind knoll

daring fractal
#

need to ask, is it really hard to make multiplayer

#

i know its hard

#

but how hard

worn fable
#

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 😅

daring fractal
#

man i shouldnt have decided to make a multiplayer fps now that unet is dead

jade glacier
#

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.

daring fractal
#

thats true

jade glacier
#

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.

kind knoll
#

@jade glacier I am using PhotonEngine.
I

jade glacier
#

Pun2? @kind knoll

kind knoll
#

Yes

jade glacier
#

The quick and dirty way is to use the PhotonTransformView @kind knoll Have you done the tutorial to start?

kind knoll
#

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.

jade glacier
#

I don't know what you are trying to sync

#

position? rotation? the animator state?

daring fractal
#

hey actually would you guys recommend "mirror"

shut yarrow
#

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

jade glacier
#

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.

floral turtle
#

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

gleaming prawn
#

@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.

dusk forge
#

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

jade glacier
#

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.

dusk forge
#

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?

jade glacier
#

For learning, I would stick to making pickups into networked objects yes.

stable prawn
#

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

shut yarrow
#

It says error on line 54

#

You're casting something and it fails to do so

stable prawn
shut yarrow
#

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

stable prawn
#

aaah okay

#

if i sent in order : int, vector 3, quat, float

#

i will receive: int, vector 3, quat, float

shut yarrow
#

You got to read same order too

stable prawn
#

in the same order

shut yarrow
#

Yes

stable prawn
#

AHHHH

#

okaaay thanks !

shut yarrow
#

NP

jade glacier
#

You pasted a code screenshot, but cropped out the numbers.

#

Was scrolled up though, looks like someone helped solve it.

shut yarrow
#

Yeah we figured it out 👍

weak plinth
#

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

gleaming prawn
#

If your SIM is tick based, store the animation timing per tick on server, use playables to rewind

austere spade
jade glacier
#

Code shown should do that. So I'm guessing there is a bug in the code not shown?

jade glacier
#

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.

jade glacier
#

@austere spade

austere spade
#

Ill check

hardy gust
#

hi

#

Who speak Ru?

dusk forge
#

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);
}
jade glacier
#

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.

dusk forge
#

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.

shut yarrow
#

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?

dusk forge
#

at the moment i've just added it to the scene through the hierachy? Do i need to instantiate it ?

shut yarrow
#

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

dusk forge
#

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

shut yarrow
#

Wait so when a player picks up an item, the item gets reinstantiated?

dusk forge
#

it seems that way, when the other player joins

shut yarrow
#

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

dusk forge
#

okay 2 secs I did have it like that but let me try again

shut yarrow
#

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

dusk forge
#

yeah i havent instantiated this because i was testing if the script worked so I just threw the object in the hierachy

shut yarrow
#

Do it with PhotonNetwork.Instantiate then

#

If you do it the expected way you'll save yourself some issues down the line

dusk forge
shut yarrow
#

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

dusk forge
#

okay so that would be why

shut yarrow
#

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

dusk forge
#

but my build has the exact same code though

shut yarrow
#

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

dusk forge
#

should I just add a empty game object into the scene that spawns the pickup?

shut yarrow
#

Ah wait PhotonNetwork.Instantiate doesn't require any targets it just spawns it everywhere so nvm about that

#

You could do that

dusk forge
#

because this is what I have right now so I expect this is wrong?

shut yarrow
#

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

dusk forge
#

yup on the same page now

shut yarrow
#

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

dusk forge
#

yup

shut yarrow
#

By the way take note of this Any prefab must have a PhotonView component.

dusk forge
#

ah ok

#

building now

shut yarrow
#

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()

dusk forge
#

yeah now when the player joins the object re spawns

shut yarrow
#

Anyway, there's good info on the photon website and I suggest to read it slowly so you don't run into problems

dusk forge
#

I was going to do that today but then started just bashing at this lol

shut yarrow
#

I understand you just want to try things to see how far you can come without having to look up things

dusk forge
#

yeee

#

PhotonNetwork.Instantiate(samplePickup.name, transform.position, Quaternion.identity, 0); I did this to instantiate

shut yarrow
#

Then in the Interact function you should call PhotonNetwork.Destroy and not some RPC that destroys the object

dusk forge
#

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);
    }
    
}
shut yarrow
#

Maybe emotitron knows more about this specific issue why it instantiates despite being destroyed because I don't know

#

Wait I think I know...

dusk forge
#
private void PickupInteract ()
{
    if (!photonView.IsMine) return;
    if (currentPickup)
    {
        currentPickup.Interact(GetComponent<PlayerCharacter>());
    }
}

This is how i was calling the Interact function btw

shut yarrow
#

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

dusk forge
#

Well I added an

if (PhotonNetwork.IsMasterClient)
{
     PhotonNetwork.Instantiate(samplePickup.name, transform.position, Quaternion.identity, 0);
}```
 but that hasnt seemed to work
shut yarrow
#

It doesn't instantiate you mean?

dusk forge
#

no it was just doing the same thing. I've re-built let me just make sure

shut yarrow
#

Also if not sure why nothing is happening, do a Debug.Log inside the if statement just to see if it gets called

dusk forge
#

okay, thank you for your help ill give it a whirl

shut yarrow
#

Alright I'm going to be away for short time I have to do groceries

dusk forge
#

okay no worries thank you for all your help

frank quiver
#

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

gleaming prawn
#

@frank quiver have you tried our Photon Discord?

#

Voice's lead dev is there regularly

frank quiver
#

yap, I posted there as well

gleaming prawn
#

ok, cool

#

Saw it now

#

He's not online yet. I'll poke him when I see him around

frank quiver
#

haha sure, thanks a lot

azure crown
#

What would I need to make a TFPS game with 100 players in one room?

frank quiver
#

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

Unity Technologies Blog

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 ...

gleaming prawn
#

@frank quiver this blog post is... hmm...:)

#

You should see the forum posts about it...

harsh dew
#

Yea the forum posts are pretty funny

verbal sandal
#

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?

gleaming prawn
#

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.

dusk forge
#

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);
    }
}
jade glacier
#

InstantiateRoomObject probably is what you want? Use OnJoinedRoom instead of start probably.

#

@dusk forge

dreamy jewel
#

@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

jade glacier
#

There you go

#

Only on my phone here, so hard to be clear on what is happening.

#

Which net library are you using?

dreamy jewel
#

Photon.

jade glacier
#

Let me get to my desk so I can see settings.

dreamy jewel
#

Sure, thanks

jade glacier
#

Do you have ShareX or some other screenshotting tool?

#

Would first want to see the settings on your SyncTransform

#

@dreamy jewel

dreamy jewel
#

Can you accept my friend request on Discord, so i can send you through dm.

jade glacier
#

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.

dreamy jewel
jade glacier
#

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.

dreamy jewel
#

wow can't believe I missed that.

#

Thanks, let me try it.

jade glacier
#

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.

dreamy jewel
#

Thank you, I will look into SNS pun2. Appreciate your help 😄

#

I'll bother you if I come across anything.

jade glacier
#

Glad that helped, gl

dusk forge
#

InstantiateRoomObject probably is what you want? Use OnJoinedRoom instead of start probably.
@jade glacier Okay thanks ill give it a whirl

dreamy jewel
#

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.

jade glacier
#

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?

dreamy jewel
#

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.

jade glacier
#

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.

dreamy jewel
#

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.

jade glacier
#

you can't really check quantum out, its $1000 a month just to develop with it.

terse relic
#

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

shut yarrow
#

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

vapid leaf
#

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

jade glacier
#

The host is the server. If the host disconnects, the game is over.

vapid leaf
#

A button has this code on it: if(isServer){StopHost();} else if{StopClient();}

jade glacier
#

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.

vapid leaf
#

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

jade glacier
#

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.

vapid leaf
#

thats why i think its a steam thing maybe

jade glacier
#

Using steam as a relay?

vapid leaf
#

yes

#

and steam transport

jade glacier
#

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.

vapid leaf
#

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

chilly charm
#

Does anyone know the quickest way to make online multiplayer??

prime beacon
#

Check out Photon

jade glacier
#

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.

frozen canopy
#

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

shut yarrow
#

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

gleaming prawn
#

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

frozen canopy
#

Thanks @gleaming prawn

vapid leaf
#

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

frozen canopy
#

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

jade glacier
#

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.

frozen canopy
#

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.

gleaming prawn
#

first would allocate

#

AFAIK... THat's bad (if confirmed)

frozen canopy
#

why?

#

The documentation say to send bytes

#

instead of floats

#

to optimize the networking

gleaming prawn
#

but this method here: BitConverter.GetBytes
Allocates... It will generate GC

#

Not to do with the networking

frozen canopy
#

ANd how would i send a float in byte

gleaming prawn
#

Lets see what @jade glacier suggests

frozen canopy
#

if its not like that

gleaming prawn
#

He's been working a lot with PUN2

frozen canopy
#

what does he suggest

gleaming prawn
#

Lets wait for him...:)

frozen canopy
#

Ohh yes sure

gleaming prawn
#

With quantum we have our own non-allocating serializations

#

So...

frozen canopy
#

I think i just found a more optimized way to do that @gleaming prawn

#

its here

gleaming prawn
#

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

jade glacier
#

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.

#

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.

#

@frozen canopy

frozen canopy
#

So what i did its less optimized than sending the actual whole float? @jade glacier

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

frozen canopy
#

yes i changed from Float to 4 bytes array

jade glacier
#

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

frozen canopy
#

So its better to just send the whole float?

jade glacier
#

yeah, don't try to get fancy like that yet

frozen canopy
#

but bytes navigates better thru the network than floats am i wrong?

jade glacier
#

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.

frozen canopy
#

I just looked at the doc and im not such experienced in coding to adapt my code

#

with that

jade glacier
#

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.

frozen canopy
#

But it looks like it is more optimized 😦

#

xD

jade glacier
#

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.

frozen canopy
#

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

jade glacier
#

"A guy" needs to give context for that statement.

frozen canopy
jade glacier
#

you don't have access to the backing byte[] in that method you are using.

frozen canopy
#

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

jade glacier
#

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

frozen canopy
#

I know im not ready xD, but will be human-noticable the difference between what i did

#

or just sending the whole float?

jade glacier
#

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.

frozen canopy
#

So by default it will do the same im making?

#

so im makign it twice?

#

im making it client-side

#

and then server-side?

jade glacier
#

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.

frozen canopy
#
    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

jade glacier
#

That is the best you can do right now.

frozen canopy
#

okeys

jade glacier
#

With an upcoming release there will be a change to that that removes that boxing

frozen canopy
#

What do you mean by boxing?

jade glacier
#
        {
            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.

frozen canopy
#

but isnt it exactly the same as its doing in my code?

jade glacier
#

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.

frozen canopy
#

instead of casting

jade glacier
#

No. What you did is different.

frozen canopy
#

Ah well, im just waiting for everything to come

#

and casting everything to float

slim ridge
#

this way will call a function that returns a float

frozen canopy
#

you are waiting specifically for floats there

#

right?

jade glacier
#

If you are interesting in the topic, go read up on ref types vs struct types, boxing, and serialization

frozen canopy
#

This is the difference no? I'm just casting EVERYTHING that comes in to float, and you are waiting specifically for floats

jade glacier
#

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#

frozen canopy
#

Will this change have a real impact on players?

jade glacier
#

The issue is if you send a byte[], it has to give a length as part of its write/read

frozen canopy
#

and on the bandwitdth?

jade glacier
#

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

frozen canopy
#

oh

jade glacier
#

gpType.float = 4 bytes
gpType.array = ? bytes

frozen canopy
#

will this change be noticable in bandwidth and gameplay aspect?

jade glacier
#

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

frozen canopy
#

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

slim ridge
#

a byte, emphasis on singular 😄

jade glacier
#

just send it it, it is getting cast to object

#

the library figures out the rest for you.

slim ridge
#

byte = smallest
short = 2 bytes
int/float = 4 bytes
long/double = 8 bytes

frozen canopy
#

so if i can send a short

#

it will consume less bandwidth

#

right?

#

for the user and for the server

slim ridge
#

👍

jade glacier
#

yes

slim ridge
#

but you shouldnt bother unless it's a problem.

#

get it working first

jade glacier
#

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

frozen canopy
#

yeah, if my game someday succeed ill have to get helped by a profesional person about networking

#

xD

jade glacier
#

Trying to optimize SendNext() is a lot of work for very little gain

frozen canopy
#

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

jade glacier
#

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.

frozen canopy
#

Yep

#

thanks for all your help

jade glacier
#

GL

frozen canopy
#

Appreciate such a helpful community @jade glacier

harsh lava
#

anyone have anygood tutorials for setting up networks?

shut yarrow
#

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.

uncut bane
#

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.

jade glacier
#

needs to be public?

#

@uncut bane

uncut bane
#

Nope, didn't help

jade glacier
#

you also aren't passing any arguments

uncut bane
#

When I used "HeadFlip" instead of "HeadFlip()", is said that I used wrong arguments and that I can type "HeadFlip()" instead

jade glacier
#

photonView.RPC("ChatMessage", RpcTarget.All, "jup", "and jup.");

uncut bane
#

Well, I'm not sure what arguments should I pass, since when I just type GameObject head, it thrown an error.

jade glacier
#

that is your reference. Notice the naming convention, and the arguments

#

You have two arguments

uncut bane
#

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

jade glacier
#

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.

uncut bane
#

In what form should I pass the arguments?

jade glacier
#

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);
}```
uncut bane
#

But the parameters must be strings?

jade glacier
#

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

uncut bane
#

It gives errors then, that GameObject is a type element and head does not exist in the current context, same with vector2 input

jade glacier
#

Because you keep typing invalid C#

uncut bane
#

Okay...

jade glacier
#

photonView.RPC("HeadFlip", RpcTarget.All, myGO, myVector2);

uncut bane
#

Sorry but I don't get it. Maybe I should get some sleep

jade glacier
#

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#.

uncut bane
#

Well, thanks for your time

jade glacier
#

GL

gleaming prawn
#

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

jade glacier
#

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

uncut bane
#

Yep, it turns out that I can't pass GOs through RPC

jade glacier
#

What is it about the go you are trying to send?

uncut bane
#

I'm trying to send "bullet" GO because I'm working on shooting

#

But I can do that by photon View ID

harsh lava
#

@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

weak plinth
#

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 ?

jade glacier
#

Post your question @weak plinth

#

No one will answer you if you are asking if you can ask.

compact dome
#

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 :)

small birch
#

Hi, some one have any tutorial or guide how about it to work a game multiplayer like fall guys or among us?

frozen canopy
#

How can i limit the FPS without disablikr vsync?

shut yarrow
#

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

golden shuttle
#

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
    }
robust cypress
#

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

spring crane
#

Could try checking the code to see how it's being accessed under the hood

final skiff
#

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

robust cypress
#

it was PhotonNetwork.LocalPlayer.CustomProperties for anyone wondering

lunar sage
#

is it possible to add extra servers to photon pun 2? like ur own servers

jade glacier
#

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

spring crane
smoky star
#

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?

lunar sage
#

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

jade glacier
#

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.

lunar sage
#

oh, and dont start with networking

#

make a simple console app in c# to learn some basic programming

jade glacier
#

They will teach you all kinds of bad practices, but they will get you at least some of the vocabulary needed for networking.

lunar sage
#

then make some simple unity games until u understand how unity and c# works

jade glacier
#

And yeah, Learn Unity first. Don't even think of trying networking if you haven't made a Unity game.

smoky star
#

alright then, thanks

grizzled narwhal
#

@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?

jade glacier
#

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

grizzled narwhal
#

Its 10 m/s fast so it looks a bit weird

jade glacier
#

This is assuming you are doing server authority over the projectile

grizzled narwhal
#

I do

jade glacier
#

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.

grizzled narwhal
#

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?

jade glacier
#

I don't know the entirety of your simulation, buffering and prediction, so I don't really have an answer sorry.

grizzled narwhal
#

Yeah np thanks for trying though ;)

jade glacier
#

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.

honest spindle
#

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?

compact dome
#

@honest spindle the documentation is useless, i'd reccomend looking at the sample code 😆

honest spindle
#

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 😄

robust cypress
#

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 ?

wooden fog
#

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'

robust cypress
#
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 ?

supple drum
#

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?

frank meteor
#

So, UNet is deprecated, so how am I supposed to send a message over the network in Unity 2020?

jade glacier
#

That is the $100000 question isn't it 🙂

frank meteor
#

Is there just not a way to do networking at all now?

jade glacier
#

Pun2 and Mirror are the usual starting points for users. If you are doing DOTS the netcode is an option.

slim ridge
#

use .NET

shut yarrow
#

You're talking to someone who thinks there is no way to do multiplayer if Unity doesn't provide an option -_-

jade glacier
#

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.

frank meteor
#

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

slim ridge
#

try TcpClient

#

or http even

frank meteor
#

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

slim ridge
#

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

frank meteor
#

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?

slim ridge
#
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

frank meteor
#

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

slim ridge
#
localInAddress = new IPEndPoint(IPAddress.Any, 0);
localOutAddress = new IPEndPoint(IPAddress.Any, 0);
robust cypress
#
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 ?

slim ridge
#

I'd guess because you have two different RpcTarget in your scene

thin kernel
#

@robust cypress it can be your collision being called in both players. which result a 2 rpc call?

#

something like onTriggerenter being called twice?

robust cypress
#

@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

thin kernel
#

ah glad you fix it then . been awhile from networking 👍

robust cypress
#

Well you were spot on so good job

thin kernel
#

thx ^

robust cypress
#

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

thin kernel
#

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

robust cypress
#

maybe i'll do the collision on every client

#

but only master applies damage

#

yeah exactly

thin kernel
#

🙂

#

im just waiting dotsnet and netcode to be finished then im getting back in train

robust cypress
#

Good luck

thin kernel
#

thanks u too , looking forward for ur game 🙂

robust cypress
#

It has mekkas and correctly registering bullets

thin kernel
#

what does mekkas mean

#

🤔

robust cypress
#

like big robots

#

and you can get inside them

thin kernel
#

wooh

robust cypress
#

kinda like the power rangers

thin kernel
#

sounds epic

real glen
#

anyone worked with dissonance before? thinking of purchasing it

harsh dew
#

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?

stiff ridge
#

You can connect again.

gleaming mauve
#

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?

weak plinth
#

guys I already configured the multiplayer more anyway when I add the network in the components nothing happens

jade glacier
#

Which networking library are you using?

weak plinth
#

what's these?

jade glacier
#

What is a networking library?

weak plinth
#

yes

#

I don't know...

jade glacier
#

The library you install, that enables multiplayer game development. Like Mirror, Pun2, Netcode, etc

weak plinth
#

aa

#

I don't using a neteorking library...

#

Unet of unity

jade glacier
#

That isn't part of Unity any longer. They deprecated it.

weak plinth
#

an

sharp gulch
#

@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

jade glacier
#

why me?

gleaming prawn
#

because you answer many questions...:)

#

Feel honored

fallow notch
#

What’s the best way to include multiplayer and player data and accounts? Dm or ping me

dusk cargo
#

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?

gleaming prawn
#

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

dusk cargo
#

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.

gleaming prawn
#

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

jade glacier
#

You might want to save that in a doc so you can paste it later... that question comes up a lot. @gleaming prawn

dusk cargo
#

Quantum looks cool but being just two dudes it’s probably way out of our league haha

gleaming prawn
#

Don’t worry all the physic stuff only needs to be handled locally haha
That's exactly how it is in quantum as well

jade glacier
#

Shots not being counted etc.

That part does make things a bit more complicated in the case of state transfer.

dusk cargo
#

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

jade glacier
#

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.

dusk cargo
#

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

gleaming prawn
#

well

#

That's the chicken-egg problem of networked shooters since ever

dusk cargo
#

Yeah haha

gleaming prawn
#

Favor the shooter is NOT fair... It's just a way to make the game fun

#

you will die behind cover

jade glacier
#

if you predict your players actions, you will be in desync

#

it is the nature of state transfer

gleaming prawn
#

It's not different in determinism

dusk cargo
#

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

gleaming prawn
#

We also do local prediction

dusk cargo
#

Unless the desync between the two is huge

gleaming prawn
#

and there's also the possibility of implementing favor the shooter techniques

jade glacier
#

The internet has latency, there is no pure magic in how to hide that... just a lot of hard choices.

gleaming prawn
#

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

dusk cargo
#

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

jade glacier
#

desync has no meaning to me in this context though

dusk cargo
#

Latency then

jade glacier
#

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

gleaming prawn
#

Bolt also would have double bounces when using listen server over relay...

dusk cargo
#

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

gleaming prawn
#

When punching no, it'll be fine

jade glacier
#

Ah yeah, forgot about the bolt relay fallback - that is a consideration as well.

gleaming prawn
#

But the relay fallback means messages go: client->relay->listen-host->relay->client

jade glacier
#

Pun2 is very fast (latency) inherently - that isn't its weakness.

gleaming prawn
#

but ye, it does have built in punch, so in the expected 85% of the cases it will connect to host directly

dusk cargo
#

What’s PUN2 weakness then?

jade glacier
#

Pun2's weaknesses are that there is no proper simulation server.

dusk cargo
#

Ignoring auth stuff

#

Ah ok

gleaming prawn
#

just by design it's client authoritative, not designed for tick-based sim

jade glacier
#

the relay is inherently dumb, and to make it smart you need server plugins.

gleaming prawn
#

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

dusk cargo
#

So If I didn’t care about auth

jade glacier
#

Pun2 used how it wants to be used, wants client authority everything

dusk cargo
#

PUN/Normcore would be fine

gleaming prawn
#

think so

jade glacier
#

Distributed authority can get a little tricky for some people to get their heads around.

#

And it is weak against cheating

gleaming prawn
#

Remember the lesson:
Among Us is "dumb" relay...
There's nothing about dumb there... It's just quite smart business wise

dusk cargo
#

Haha

jade glacier
#

yeah, "dumb" just means it has no clue what your game is or anything about your game.

gleaming prawn
#

Remember the lesson

dusk cargo
#

I’m not worried about cheating

#

VR games tend to be very low on cheaters

gleaming prawn
#

ye... I just think we worry too much about cheating...

jade glacier
#

For VR, Pun2 is very popular

#

For the reasons meantioned

gleaming prawn
#

Although I prefer my Quantum VR nerfgun shooter...:)

#

Lol

dusk cargo
#

I’ve just heard its not good for FPS but they probably didn’t know what they are talking about

gleaming prawn
#

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

jade glacier
#

Quantum is typically the correct answer for everything, but the barrier there being its price being a wall against hobbyists 🙂

gleaming prawn
#

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

jade glacier
#

Good point

gleaming prawn
#

It's a nice API to work with, very comfortable from the dev perspective (no network exposed)

jade glacier
#

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 🙂

shut yarrow
#

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

jade glacier
#

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.

shut yarrow
#

I see that explains it I guess and that's a fair point

dusk cargo
#

Yeah that is a fair point. But don’t you still need someone with networking experience to implement it?

shut yarrow
#

Yes but not a networking specialist so in theory any experienced programmer should be able to do it

dusk cargo
#

I’ve only been programming for a year, and very specialised in VR so no doubt beyond my skill set

shut yarrow
#

There are many options and some of them require more effort to get things going

dusk cargo
#

It looks like PUN/Normcore is my best bet

shut yarrow
#

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

dusk cargo
#

What alternatives have you moved too?

#

Normcore has good pricing and works well

shut yarrow
#

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

gleaming prawn
#

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...

shut yarrow
#

No idea and never tried Mirror myself so I have no idea what it takes to make something with it.

gleaming prawn
#

They would not use Mirror/MLAPI/UNet though

#

If it's just a toy/hobby project, then should be fine

shut yarrow
#

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 -_-

dusk cargo
#

I would imagine setting up and running your own servers would be a huge uphill for someone with no experience

shut yarrow
#

Yes it sure is

dusk cargo
#

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

gleaming prawn
#

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...:)

shut yarrow
#

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 👍

gleaming prawn
#

I think you did not understand what I mean

#

cheat-proof != successful

shut yarrow
#

Well they were successful but didn't keep up with times so people didn't want to play that cheater infested game anymore

gleaming prawn
#

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)
dusk cargo
#

Also

gleaming prawn
#

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

dusk cargo
#

Don’t put it on PC haha

gleaming prawn
#

ye

shut yarrow
#

Making it cheatproof is difficult on PUN though

gleaming prawn
#

Making it cheatproof is difficult on PUN though
So it is with any relay solution

shut yarrow
#

Correct

gleaming prawn
#

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..:)

dusk cargo
#

Instead of spending money on expensive dedicated server, use money to improve the game content..:)
@gleaming prawn this is the most important thing

gleaming prawn
#

But if you look on PC, it's the shittiest market possible

#

In terms of cheating

shut yarrow
#

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

dusk cargo
#

Too many people worrying about cheaters before worrying about player count

gleaming prawn
#

yes

shut yarrow
#

That's true indeed

gleaming prawn
#

I CARE with cheating myself

shut yarrow
#

Should not be the top priority when making the game

gleaming prawn
#

But it is overrated imho

dusk cargo
#

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

gleaming prawn
#

ye

shut yarrow
#

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 😄

gleaming prawn
#

yes

shut yarrow
#

Now I remember the game. It was BeGone by NPlay

gleaming prawn
#

haven't heard of it

#

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...

Price

$19.99

Recommendations

25000

Metacritic

70

▶ Play video
shut yarrow
#

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

gleaming prawn
#

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

shut yarrow
#

It was in the good old webplayer days

gleaming prawn
#

3k is a decent game though

shut yarrow
#

Yeah it is, spread out over many different rooms cause it had like max 16 players per room so pretty successful

gleaming prawn
#

ye

frank quiver
#

oh, I thought pun only support up to 16 peers

#

and he manage to run at 64 players

gleaming prawn
#

yep...

#

clever culling

vapid leaf
#

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

jade glacier
#

That typically is said the other way around @vapid leaf

#

Server authority is generally considered better for competitive, and client authority for coop.

vapid leaf
#

all the games i just listed up there are co op

jade glacier
#

But that is all very general.

vapid leaf
#

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

silver steeple
#

Has anyone been succesful in using GRPC with SSL inside of Unity? I've been having so much trouble

slim ridge
#

nope, that sounds like some scary stuff though

#

I would imagine the trouble would be getting Unity to use the right certificate chain

silver steeple
#

Dude we're explicitly specifying the certs at this point and it still fails

slim ridge
#

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

silver steeple
#

no dice :/ good guess tho

muted sand
#

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

wooden fog
#

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

shut yarrow
#

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.

steel dune
#

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 ;)

weak plinth
#

punchthrough with relay backup

grand skiff
#

It creates a weird object that i do not know why

#

any idea why?

jade glacier
#

"weird" ?

grand skiff
#

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

jade glacier
#

Your code makes no sense so could be a bunch of things

grand skiff
#

i learnt it from tutorial

jade glacier
#

you have a serialized object player

#

but you are instantiating using "player"

grand skiff
#

yes

jade glacier
#

is that red player the only "player" in your entire project?

grand skiff
#

yes

jade glacier
#

you are sure?

grand skiff
#

let me screenshot

jade glacier
#

you did a search of your resources

#

to make sure "player" isn't conflicting with like Photon demos or anything else you installed?

grand skiff
#

there is 1 player in resources and 1 player in hierarchy

jade glacier
#

Search the project though

grand skiff
#

i will

#

let me look now

#

it worked

#

@jade glacier THANKS!!!

#

i changed the name of player

jade glacier
#

There is another player somewhere in resources it sounds like

floral turtle
#

@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!

muted sand
#

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

floral turtle
#

@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)

muted sand
#

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

floral turtle
#

if you only have a few players it would be fine

muted sand
#

Yeah it'd be 8 max

#

Cool, thanks so much - I'll do some reading into Physics.Simulate 🙂

floral turtle
#

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

jade glacier
#

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

floral turtle
#

@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 😦

compact dome
#

anybody here using the dots netcode package?

vital hawk
#

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

grand skiff
#

How to fix the lag problem in photon?

#

is it because it is free?

robust cypress
#

what 'lag problem' ?

#

How high is your ping

jade glacier
#

You'll have to give a lot more info than that.

robust cypress
#
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

jade glacier
#

The actual error text?

robust cypress
#

i put it

#

in quotes

jade glacier
#

The actual text, lines, method names.

#

You left out all the Trace info

robust cypress
#

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)

jade glacier
#

And it's definitely on your Instantiated go? And that script is on the root?

robust cypress
#

yes

jade glacier
#

No other methods named end anywhere in your project?

robust cypress
#

I tried renaming it

#

So i guess not

#

just checked there isnt

jade glacier
#

Not sure at a glance

robust cypress
#

I'm pretty confused too

jade glacier
#

I don't use rpcs, but that seems correct

grand skiff
#

Will tempPlayer be last joined player?

jade glacier
#

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)

grand skiff
#

@jade glacier

#

tempPlayer.transform.GetChild(1).GetChild(0).GetComponent<Text>().text = "User_" + GameObject.FindGameObjectsWithTag("Player").Length.ToString();

#

Then why doesn't this work?

jade glacier
#

Nothing networking going on there, so I am probably the wrong one to ask, and probably not the best channel for that.

grand skiff
#

is this channel for only Unity networking?

#

I thought photon was in here too

jade glacier
#

Photon questions get answered here yeah

real harbor
#

Can I get help with Mirror?

#

please

jade glacier
#

Paste a question. Mirror has a discord server of their own that gets quicker answers as well.

small ivy
#

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

jade glacier
#

I would start with Pun2 and Mirror tutorials before even thinking about networking any actual game.

small ivy
#

The tutorials network a game don't they lol 😂

spring valley
#

any suggestions for a server authoritative engine ?