#archived-networking

1 messages Β· Page 73 of 1

burnt axle
#

Does pun create sceneobjects (instantiatesceneobject method) locally when done from the master client? Im asking because i want to use the sceneobject right after instantiation from the script that instantiated. Like this: if(PhotonNetwork.isMasterClient) { GameObject GO = PhotonNetwork.InstantiateSceneObject(/*required params*/); GO.dosomething(); }

jade glacier
#

Scene objects are objects with PV that exist in the scene and aren't added at runtime. They automatically become Master owned.

#

If you are instantiation with code... It's just a normal instantiated object.

#

Not sure what that method does, would have to travel into it.

#

My guess is it tells the object that it's ownership should change of the master leaves and a new master is assigned, but just guessing

#

Yeah, as expected.... It will change owners if the master changes. Rather then being destroyed if it's owner leaves.

slim ridge
#

@graceful zephyr I am using a TcpClient doing NetworkStream.Read in a thread. If I call close on the socket from another thread NetworkStream.Read throws an exception about non-blocking. If I only Close the TcpClient i get interrupted exception. I was really hoping there's some way for me to tell that socket to stop blocking and close now.

weak plinth
#

Hello, i have a multiplayer 2d game and you can shoot. My problem is that the bullet is fired instantly for the person who shot it but it takes a bit of time (about 1/3 of a second) to get spawned on the other client which means they get different results. Is there any way to fix this? Im using photon

jade glacier
#

Move closer

#

Networking = dealing with latency and loss

slim ridge
#

I figured out my problem, i needed to use Socket.Poll to avoid blocking forever then letting my thread join back to the main one before quitting πŸ˜„

jade glacier
#

What you are likely running is client authority with state interpolation of remote players... so you will never have all of the clients seeing the same thing. That is where the magic of networking comes in, and why it is not something everyone can do. @weak plinth

weak plinth
#

But won't the space the bullet leaves look weird? Its going to be far away from the barrel

#

@jade glacier

jade glacier
#

Depends how you are writing your code

#

if you are sending the player updates in the same send as the gun fire, they will line up

#

they will just be in a different timeframe

#

You should read up on the networking of CS:GO

weak plinth
#

Is it possible not to have a gap compensating the latency?

jade glacier
#

its where most modern state interpolation with client prediction stem from

#

You can attempt extrapolation, but that generally results in rubber banding

weak plinth
#

Is it possible to make the bullet faster instead to compensate?

#

Idk

#

All i want is smooth motion and the same results. But i will see that cs go stuff

jade glacier
#

if you are doing projectiles, you can use determinism and time squishiness to cheat them to move from one time frame to another over time

#

There is no "real" time

weak plinth
#

Oh

jade glacier
#

so what I think you are after does not exist

weak plinth
#

Ok

jade glacier
#

in state interpolation with client prediction, the player lives in the future.

#

What the player sees, and what the server sees WILL NOT match

#

So it is on you how to reconcile that

weak plinth
#

And this is all possible with photon?

jade glacier
#

PUN2 will be all client prediction

#

So lag compensation becomes pretty meaningless

#

You can play with the SNS extension that is in beta and see how I am handling it with that

#

That tutorial has links to the beta. It is PUN2, and does projectiles and hitscans.

weak plinth
#

Now that i think about it, i think a compensation gap will be enough in my case because my projectiles are slow moving and won't cover much ground by then so its unlikely that another player was so close that they missed the bullet. Even then, i could just use a raycast to make sure if needed

#
  • that would be smoother and simpler
#

This other stuff seems kinda complicated (worth reading though) and my game is not an fps so it shouldn't matter that much

#

It only matters if its desynced and players miss bullets

#

Is this a good solution?

jade glacier
#

Impossible to say. The bulk of game networking once you get over the understanding of how to sync states, simulation and inputs... is working out how to best hide the internet from players.

fair cosmos
#

Can anyone tell me what is HitScan? 1)Cast a raycast on server 2) casting a raycast on server with lag compensation?

gleaming prawn
#

HitScan just means:

  • a weapon that does a long raycast immediately, instead of a projectile that "travels" very fast over time (doing smaller raycasts every tick)
#

The techniques for how to perform hitscans in a multiplayer game vary depending on the multiplayer tech/architecture you use

#

In a predict/rollback deterministic game you "just do it"... In client server ones you do on server (with or without lag compensation), and you might also do on client for prediction, etc

fair cosmos
#

Ok

edgy pelican
#

What would be the recommendation for a server authoritative turn based game?

#

for server and backend I mean

slate gale
#

Hello guys, i'm struggling syncing my players to the server using mirror. Could someone help me please ?

near cairn
#
        [PunRPC]
    void damage(float amount){
        RaycastHit shotHit;
        if (Physics.Raycast (new Ray (aCam.transform.position, aCam.transform.forward), out shotHit, 100)) {
            if (shotHit.collider.gameObject.tag == "Player") {
                print ("is player");
                if (shotHit.collider.gameObject.GetComponent<playerBrain>().chosenTeam != gameObject.GetComponent<playerBrain>().chosenTeam) {
                    print ("is shot");
                    float sh = shotHit.collider.gameObject.GetComponent<life> ().hp -= amount;
                    print (sh);
                }
            } else {
                print ("yes");
                GameObject d = PhotonNetwork.Instantiate (Path.Combine ("prefabs", "bulletDecal"), shotHit.point, transform.rotation, 0);
                d.transform.forward = shotHit.normal * -1;
            }
        }
    }

this is an RPC function meant to either damage it or put a decal on it.
now everything goes through to the very end when i hit a player, and it prints sh as it should be after the player is damaged.

the issue is that from the player's side, they aren't damaged.
here's how the function is executed.

                    currentTime = timeToShoot;
                    pv.RPC ("pAnim", RpcTarget.AllBuffered, "shot");
                    pv.RPC ("damage", RpcTarget.AllBuffered, 1f);
#

@jade glacier im in times of need

#

just dont throw your api at my face again

#

but please

#

help

jade glacier
#

I'm super slammed with work so I can't really do more than scan it

near cairn
#

aww

jade glacier
#

Your RPCs are all getting through as expect?

near cairn
#

for the player damaging

jade glacier
#

Why are you buffering "shots"?

near cairn
#

what do you suggest to do

jade glacier
#

Buffered RPCs have very serious limitations

#

you want to recreate every shot that happened since the game started for players joining late?

near cairn
#

oh

#

no chief

jade glacier
#

Pretty sure that exceeds PUNs capability anyway

near cairn
#

so what do i do

#

inserver?

jade glacier
#

No idea, not sure what the problem is from my first scan of what you typed there

near cairn
#

bruh pun is so random

jade glacier
#

Pun is very simplistic, you might be trying to make it act more like a server than it is meant to be.

#

The whole premise of pun is all players broadcast there stuff almost P2P-like

near cairn
#

sometimes something works but when i make a slight change in the code that isn't even connected with it it stops working

#

it once worked

jade glacier
#

That isn't PUN most likely though, you just have some fragile code because you are kind of hitting it with a stick until it works πŸ™‚

near cairn
#

i did something with the code and it fucked up

#

true

jade glacier
#

Networking is inherently very prone to buggy code

near cairn
#

i am banging rocks together when it comes to pun

jade glacier
#

lots of race conditions, and complex hard to trace paths since you can't debug across the network

#

All I can recommend is start with very clean code, and add one thing at a time and test it

#

Too many new lines of code at once, and you are in debugging hell

near cairn
#

well all other games somehow managed to fix it

jade glacier
#

other games?

#

You mean other network libraries?

near cairn
#

cs go, battle field, tf2

#

i mean cs go and tf2 are basically the same just repainted

#

but you get my point

jade glacier
#

Nothing about writing the networking for those games was easy though

near cairn
#

ofc

#

but they did it

jade glacier
#

Those were some of the highest paid team members, and even then they are still quirky as shit

#

You can't use those architectures as a blueprint for pun though

#

PUN is relay, not server based

near cairn
#

yeah when you have high pings it can make the game ufair for others

jade glacier
#

So totally different animal

near cairn
#

anyway ill keep banging rocks and hope for a fire to appear

jade glacier
#

If you try to make CS:GO with vanilla PUN, you will suffer

near cairn
#

true

#

you gotta make your own api

#

also allbuffed doesnt execute the function for players joining

#

isnt it allbuffedviaserver

jade glacier
#

Its not about the library really, its about the architeture

#

PUN2 is a relay environment

#

You exchange the control you get from a server for the simplicity of hosting and host migration.

#

But without an authoritative server, you cannot do the things that competitive FPS shooters typically do.

#

To make CS:GO - you need an authoritative server

near cairn
#

you mean protected?

#

like the vars are encrypted?

jade glacier
#

you can make plugins for PhotonServer that make the relay "smarter" - but that is likely not the goal

#

not at all what I mean πŸ™‚

near cairn
#

bruh

#

i hate when you do this smiling face

jade glacier
#

Have you read up on how CS:GO's netcode works?

spring crane
#

Buffered stuff will be replayed, otherwise it wouldn't have to be buffered

near cairn
#

nope

jade glacier
#

I get that you are frustrated, but you are basically asking how to swim in the deepest water without knowing the architectures involved.

#

There is no shortcut to it, it takes years of working up from basic owner authority stuff, to being able to write Overwatch.

near cairn
#

by architectures do you mean basic pun or unity

#

or basic networking

jade glacier
#

Architecture being the network architecture

#

What talks to what, what has authority over what, what is replicated, what is extrapolated, and on and on

#

The whole "what is this networking engine doing" thing

near cairn
#

pun does that for me

jade glacier
#

You don't just network... it is a long long checklist of things

#

PUN is a relay evnironment

#

As such, you have no real server

#

So anything that requires a server, you have to make some hard choices

#

PUN for the basic users is just going to be about sending messages from the owner to others.

spring crane
#

And PUN doesn't solve all the things required for high quality netcode. Photon Bolt and Photon Quantum are solving more problems, but they are different beasts too.

jade glacier
#

There is no "architecture" beyond that for the most part.

#

PUN, Mirror, MLAPI and Forge are all messaging layers. They are not going to solve Call Of Duty networking for you.

near cairn
#

i never asked for a call of duty

jade glacier
#

?

near cairn
#

i want a stable and simple server

jade glacier
#

Didn't say you did.

near cairn
#

that will hold my indie game

jade glacier
#

If you want a server, I would start with Mirror

near cairn
#

bruh

#

now mirror

spring crane
#

Stable and simple fits the bill there

near cairn
#

pun is a server too though

jade glacier
#

it does, but not sure its what you want for where you are right now

near cairn
#

literally the first step is to make my server

#

where am i right now lmao

#

at basic raycast shooting mechanics?

jade glacier
#

You are at "just starting" and you need to make a few basic throw away networking attempts to learn the landscape.

#

Mirror for learning the basics will do just fine, it abstracts the stuff you don't want to dick around with and gets you right to the whole "What do I do with my messages" phase of learning.

near cairn
#

but im already in middle of a game

jade glacier
#

Then you are boned really

#

Without networking experience, trying to convert an existing project to networking is not fun/easy/often possible.

#

Make some basic networking throw away game attempts before even thinking about that.

near cairn
#

i did

jade glacier
#

And they worked?

near cairn
#

yes

jade glacier
#

Let me see what you have for that, so I can get a sense of where you are in all of this.

near cairn
#

i started by connecting two players into one room

#

nothing fancy

#

without any models even

#

just text

jade glacier
#

That's just connecting

near cairn
#

yes

jade glacier
#

I mean an actual working multiplayer activity, that forced you to deal with syncing states

spring crane
#

You don't need models for this. Just create some actual gameplay with some game state

#

Have clients drop and join

near cairn
#

did it

#

never quite understood how leaving worked but had something going on

#

i have like 2 projects where i practiced pun

jade glacier
#

I need to get coding here. I would get all the way through some of the tutorials before moving to your own at the VERY least.

#

GL

near cairn
#

and i did watch tutorials

#

ofc

#

how would i know what i knew now lmao

spring crane
#

Did you do damage dealing in one of those projects?

near cairn
#

yes

#

i didn't use raycasting though

#

i used projectiles

#

which is kind of similar

#

just different style

old vapor
#

Is here any Student-Artist who wants to practive in a team? Im a coder, wanna move in my spec
P.S.: im new at this server

stray scroll
#

@old vapor This is network programming, not networking to meet/form teams.

fair cosmos
#

Lol

jaunty thistle
#

Hi, how can i connect to master in PUN manually??? Thanks

lilac creek
#

So from the conversation I just read above lol, do you guys often write the singleplayer first for your game or the multiplayer side?

#

I'm currently writing the singleplayer side first getting main functionality done then I plan on starting a new project with networking

night plover
#

Simple prototypes in singleplayer, implement fully in multiplayer

#

Don't spend more than a few hours (depending on the feature) to prototype

slim ridge
#

write the multiplayer first

#

chances are if you start singleplayer and want multiplayer you'll have to re-write a lot of stuff

burnt axle
#

Multiplayer first then single.

weak plinth
#

Hey guys

#

What route should I go if I want to allow players to host dedicated servers on their own? Should I use Steamworks as ideally I hope to release my game on Steam

#

Or would I use Mirror with Steamworks?

analog fog
#

Regarding multiplayer networked games that are heavy on physics... what’s the best networking solution to use ??

#

I’m developing a multiplayer pinball game but ball is slow on client side

spring crane
#

Don't rely on Steam

analog fog
#

Now using PUN2

weak plinth
#

@spring crane Is there a reason for this?

analog fog
#

Reason for Pun?

burnt axle
#

@analog fog Then you are probably doing something wrong, or something else is causing this (unnessesary overhead (poorly optimized))

analog fog
#

I’m stripping g the game back to Basic primitives

#

grey boxing

spring crane
#

Networking solution that relies on specific software being installed is silly when the rest of your stack has this level of platform support

weak plinth
#

@spring crane But if your game heavily relies on Steam, wouldn't it make sense? I don't plan on releasing the game anywhere else and it's more of a multiplayer game than a singleplayer game

#

I do plan on utilizing things like the Steam Workshop etc

analog fog
#

Note: I should mention that the game is based on player 1 being VR & player 2 being screen based

#

Image the 1st person VR player being inside the pinball table

spring crane
#

I wouldn't swap the networking layer to some platform specific thing. You should still be able to use the other stuff, right?

analog fog
#

Large ball rockets past them

weak plinth
#

@spring crane Yeah I can still use Steam Workshop etc without the rest, hmmm. I just thought using Steam's API for networking would be ideal

#

So would it be best to just use Mirror then?

spring crane
#

Anything cross platform, yea

weak plinth
#

Hmm hopefully it's the ideal route then. Usernames/player names etc will be based on the Steam name

#

@spring crane If I plan on having a list of servers, do you know if I could use Steams system for that?

#

That's one thing I worry about, I don't want to have my own "list server"

analog fog
#

So fast paced physics games are doable in Pun ?

weak plinth
#

Specifically referring to this ^

spring crane
#

I haven't really looked into it

weak plinth
#

I know Mirror offers their own list server, but I'd much prefer to use Steams

cedar cloak
#

I have a problem with Photon when it basically run the OnRoomListUpdate 2 times

unreal acorn
#

I know this question basically gets asked every other day, but anyway...
I am an experienced software developer (not game dev though), started learning Unity a few weeks ago, and I would like to build a multiplayer game to see how it goes.
I'm familiar with low level networking concepts.

So I've done some research, and from what I understand of the current state of networking in Unity, I have 4 options:

  • use a highish level cloud solution with a client library in Unity (i.e. Photon)
    • usually I'm not a huge fan of this type of solution, being very dependent on a third party, especially as I'm only building a hobby/side-project game, I might want to experiment with concepts such as matchmaking etc, and I imagine I would lose a little bit of freedom in the process. Not sure about it, can you use Photon's client library with your own server, free of charge?
    • otherwise, how easy is it to reach the free tier cap?
  • use a mid-level client library, and handle the server myself. Something like Mirror, Forge Networking Remastered, etc
    • this sounds like a good compromise. I'm having trouble understanding which one came first, which one is recent but maintained enough, which one is built on top of something stable, etc
  • use a low-level client library, and handle the server myself. Something like LiteNetLib, ENet, etc
    • this seems a bit silly for a hobby game. I get why, if I needed extreme performance and reliability, I would go this way, but for a first multiplayer, I don't think it's sensible
  • write my own low-level solution.
    • same as above

A little bit more context about my game idea:

  • basically AutoChess/Dota Underlords/Teamfight Tactics
  • 8 players in a game
  • round based, with a synchronised timer
  • each round, you:
    • buy characters from the shop
    • put characters on the board
    • get matched against a random opponent
    • watch your characters auto attack the opponents' characters

Would someone have any insights about how I should go about this?

gray pond
#

@unreal acorn Very doable in Mirror. Mirror was started almost 3 years ago, originally as a fork of UNet when Unity abandoned it. The team has grown to about half a dozen people, has commits almost every day, and monthly releases to the Asset Store (version 13 is currently in review). We've fixed all the bugs that UNet had, and taken it so much further. Most of the public facing components and API is intact, but internally we've nearly rewritten all of it by now. Link to our Discord for very active support is in the Asset Store product page, along with links to docs and such.
https://assetstore.unity.com/packages/tools/network/mirror-129321

unreal acorn
#

cool thanks. So let's say I'd want to build/host a dedicated server. How would that work in Mirror? From what I see, Mirror is isomorphic, as in each instance can be both server and client. So if I wanted a dedicated server, I would just deploy a server build somewhere and be done with it?

#

is that the right way to approach an authoritative server in Mirror? Or is there an "outside unity" server option?

sonic marsh
#

@unreal acorn From the sounds of it your game idea dosnt really have a real time element too it (ive never played any of those example games) could you create a normal WebAPI which runs the calculations (all outside Unity) and returns the results?

#

then the client just "plays" out the battle

unreal acorn
#

hmmmm potentially.
That's an interesting approach, especially because it implies that the result is deterministic by default, since the server decides what the result should be, then sends it.

In one of these games, there's a way to play with a teammate, against other duos, and you can see your teammate reorganising their board live, which I guess would require some sort of real time?

#

not that I know that I want to implement this feature, but since it's more of a learning experience, I would like to do things right πŸ™‚

sonic marsh
#

At its core tho its turnbased, which means you can get away with a delay and no one will see πŸ˜›

#

Yea i get that, plus good to know for the next game

#

So i went the crazy option, somewhere between use a low level library and custom write everything :P
I'm using ENet and Ceras for my data serializer, but long term I'm wanting to use Unity.Transport. I had used ENet before and could get going really quick and currently Transport is painful to use. I've also used mirror and loved it

gray pond
#

cool thanks. So let's say I'd want to build/host a dedicated server. I would just deploy a server build somewhere and be done with it?
@unreal acorn yes. Build Settings window has a Server Build Checkbox. Desktop build with that checked creates a console app you can upload to a VPS and run it. Clients connect and play.

#

That said, Roycon has a point with it being turn based and perhaps a web service could be enough for your needs. It is a request-response model though, so you'll need to be steadily requesting updates from the server to get players' actions, discover a player has dropped out (or just stopped submitting to the web service).

#

sorry for the delayed response...I'm off to bed. πŸ’€

unreal acorn
#

haha that's alright thanks πŸ‘

gray pond
#

It's after 2am - I'll be a lot more helpy in 7 hours πŸ™‚

unreal acorn
#

I'm in Melbourne, it's 4pm here!

gray pond
#

We've got a great Aussie on the team - you can chat with him πŸ™‚

unreal acorn
#

but yeah anyway, I think I'm gonna go the Mirror way, just because it feels like it's a good entry point, being based on the original UNet

jade glacier
#

Just keep the messaging abstracted so cloud is a later option. Making your sim deterministic sounds like your main challenge.

gray pond
sonic marsh
#

@unreal acorn @jade glacier Deterministic is the worst πŸ˜› I'm way not smart enough for that, I went Client Server for my project

lament mason
#

Question Unity folks, what's the best networking solution if you are deploying on consoles (it's a physics movement based game so we might need to implement prediction on clients/server on our base), quantum is out of the question (price prohibitive)

slim ridge
#

photon bolt?

fading pawn
#

Yup

spring crane
#

Reminder that "Unity Physics" (DOTS physics) is designed to be deterministic across platforms.

sonic marsh
#

@spring crane Is it deterministic now tho?

sonic marsh
#

@brisk briar I'm currently using ENet but I don't have a dedicated external server. Instead when I do want dedicated servers they will be a unity instance running in headless with a bunch of stuff stripped out

#

Also I actually plan on swapping to Unity Transport when its a bit more stable, and when i start having performance issues

#

Depends on your goals I think, I'm going to have dedicated servers, but not hosted ones. They will be player hosted. I'll probably need a list/server browser but that can be made in easy web techs

#

But im also using all the new DOTS stuff, so that will hopefully give me a nice performance boost which will outweigh the unity overhead cost

#

I don't understand the need for both TCP and UDP?

#

hmmm, im going to need some auth too... but i was planning on using UDP still.

#

yea i've heard that too. but those librarys you mentioned (and im useing Enet) and they have a reliable packet mode

#

yea with stuff like that ill checksum it

#

PacketFlags.Reliable reliable sequenced, a packet must be received by the target peer and resend attempts should be made until the packet is delivered.

#

copied from the docs

#

yea

#

yea that would be great

#

I wish the same for ECS + supporting packages

#

na replicating my game logic outside of unity will take forever and dosnt seem worth it to me

#

really depends on your game tho, im aiming for a big slow passed RTS with a ton of units and things

#

yea mmo cant be player hosted, and you have to be online 24/7

#

Have you looked at Mirror, they are aiming/claiming MMO scale networking

#

Mirror you can change the transport layer

#

but yea i think your right about needing unity

#

actually i think you might be mixing concerns up. Maybe you need a web server (with standard web tech) for auth + low frequency things, it includes a "region" selector which can direct the player to the non unity (or still unity) connection which is handeling everything in that region

#

I think with mmo scale you really need to dig into how to optmize and break things up. You probably want things like docker containers handling your regions, you can do smart things like turn them off when no one is online in that area. You need a FAST db that can support many regions with lots of reads and writes

#

I would actually suggest some weird techs for your backends πŸ˜› Things like web servers for auth and connection setups, Project Orleans for data persistence (https://dotnet.github.io/orleans/) Docker everywhere and auto scaling build into everything. and then finally a unity instance for a region which does stuff like the simulations (phisics, combact ect) and is a UDP connection

#

and the unity instance is all DOTS magic πŸ™‚

lilac creek
#

mirror has something called apathy

#

I believe would take care of something like that @sonic marsh

#

sorry I mean mirror booster*

#

unless im misunderstanding what you want

sonic marsh
#

Yea that would work

lilac creek
#

It costs a one time payment but I believe it's extremely cheap

cedar cloak
#

Using Photon can somebody tell me how can I check if a player is connected or not to a lobby?

#

does exist something like if "(player.actor isConnected)" ?

timber summit
#

I wanna make a chat program and I don`t know what I need

jade glacier
#

Typically rather than checking for that state, you use the callbacks the trigger your code. Like OnJoinedRoom @cedar cloak

cedar cloak
#

I'm trying to make a Leaderboard and when a specific player disconnect I need to destroy that slot in the board, any help on how could i do it?

jade glacier
#

Callbacks again

#

get familiar with all of the callbacks in PUN

#

and use those liberally

void oak
#

anyone familiar with socket class programming? I'm getting invalid packets occassionally and was hoping someone could help me impliment a byte header or something similar for my send a receive callback

sonic marsh
#

What i plan to do is have the first byte being the message type

#

then that maps to something (giant switch??) which knows how to read the rest of the binary

#

it does limit me to 256 messages,, which might not be enough

#

if i need ill add another byte

void oak
#

is that in repsonce to my question? I'm looking more for a byte header that defines the length of the message

sonic marsh
#

yea it was

#

do you need the length?

#

ill be using a byte stream reader, so as it reads it moves next

#

if i have a list/array ill have to write its size in

void oak
#

maybe not. the issues is if too much coming through the pipe it can get confused.

#

a 2 byte header can be easily converted to ushorts and represent a pretty significant byte[] length. i forget the max

#

but i'm kinda looking for example recieve callbacks to see how they're structured.

sonic marsh
#

ah i havnt built this yet

#

currently im using ENet with Ceras

#

which handles packets and deserializing

#

but eventually ill be replacing that

void oak
#

gotcha, i'm going raw sockets right now. mostly as a learning experiment but i've gotten decently far

sonic marsh
#

sweet

#

i think message type/id (byte or 2) and a message length (ushort)

jade glacier
#

I would tend to bias toward a byte message type. You can always make a special message id of like 0 or 255 for that, that indicates another byte follows with a special case.

sonic marsh
#

yea that makes alot of sense

#

for me im thinking 2 bytes as i need a few extra details, and with the 2nd byte i only need maybe half of it, so can bit steal the rest to increase my max messages if needed

jade glacier
#

Best to come up with a plan for all of the types you are thinking you need, and how common they will be.

#

You can do 2 bytes and have some 30K possible messages, but that says your networking is kind of terrible.

#

Legit networking is all state and input sync, which involves sending a byte[] payload every tick... your transport doesn't need any special msgid for that

#

Typically the message id is for not game related payloads, like connect, disconnect, etc

#

you should not have hundreds of those.

sonic marsh
#

yea

#

the more i think about it the more i think i can squeze it all into 1 bit

jade glacier
#

I would come up with what that list actually is before getting too deep.

sonic marsh
#

depending on if its the server sending to client or client to server

jade glacier
#

You will want to think about what this layer is actually doing

#

And don't start loading it up with msgids that are game specific

sonic marsh
#

its incomming byte array/stream into message structs

jade glacier
#

because that is going to indicate some REALLY bad networking.

#

What kind of messages though?

sonic marsh
#

from the server to client, things like position updates and rotations

jade glacier
#

Outside of connection related messages, that header shouldn't know what the game data is inside of byte[]

#

yeah. that... don't do that

#

if you are sending fragments of game states as their own messages, you are entwining your state sync with your messaging, and that is TERRIBLE

#

Messaging layer <-> State and Input buffers <-> Simulation

sonic marsh
#

yea thats what it will look like

jade glacier
#

Messaging should only be used to transport your state and inputs between machines

#

And those should all be written into one byte[]

#

MsgId.State is all the transport needs to know

#

and that should be followed by a TickID

#

That byte should get passed to deserialization which populates your state buffer for that frame/tick

sonic marsh
#

yea i guess ive got messaging and deserialization tightly connected

jade glacier
#

Your simulation consumes those ticks

#

yeah, that is terrible and the path to hell

#

game networking IS NOT the messaging

#

it is the SIMULATION

sonic marsh
#

yea i currently have messaging a seprate bit

jade glacier
#

The sim runs on ticks.. every tick it consumes an INPUT and applies that to the previous ticks resulting STATE... that produces a new STATE.

#

All you should be networking if you are doing it correctly, is the states from the server to all... and inputs/states from players to the server... all as a byte[] with a tick index.

#

If you start throwing up messages like MsgId.PlayerPosition.... you are going to be in race condition hell, as well as just having bloated messages

#

Step 1) reduce your game to a sim of Inputs/states
Step 2) create serialization for your states and inputs that let you replicate them to other machines in the form of a byte[]

#

Step 3) deal with messaging

sonic marsh
#

makes sense

#

mostly

jade glacier
#

Its how you avoid the trap all first networking attempts fall into

#

the messaging is nothing

#

the simulation is everything

sonic marsh
#

so...

#

i have my network stream. i read that every tick, and split up the incomming bytes into their target arrays, my systems then read those target arrays, deserialzied and applyes the state

#

?

#

no thats still too close

jade glacier
#

you will want to serialize/deserialize your entire state (unless you get tricky and start dealing with priority and eventual consistency stuff) to that byte[]

sonic marsh
#

NETWORK STREAM ==> BYTE ARRAY ==> SPILT ARRAYS BASED ON MESSAGE ==> CONSUMING SYSTEMS

jade glacier
#

State fields -> byte[] -> internet -> byte[] -> deserialize -> State fields.

#

not so much split the array

#

pass the array around

#

You will have net identities most likely

#

every networked object will have an ID number

sonic marsh
#

yup

jade glacier
#

and before their write to the byte[] their id will be written

#

then you pass the byte to that net entity, and it reads its part, then returns control of the byte to the master loop

sonic marsh
#

hmm

jade glacier
#

and that byte goes to the next net entity

sonic marsh
#

makes sense

jade glacier
#

serialization is symmetrical

sonic marsh
#

except i think i have to split

jade glacier
#

for every Write, there is an equal Read

sonic marsh
#

as im deep in ECS and Jobs

jade glacier
#

Ooooh

sonic marsh
#

so pretty sure i can get the final step threaded

jade glacier
#

Then whatever, if you need to copy, copy

#

how you do it doesn't matter

sonic marsh
#

yup

#

πŸ™‚

jade glacier
#

though copying is kind of a waste when you can just pass the byte around

#

you just need to fragment it differently, like have all of the IDS up front and lenghts

sonic marsh
#

yea, pretty sure that those new NativeSlice type is meant to solve all that

jade glacier
#

since a byte[] serializaton is normally going to need to read sequentially

#

You can traverse the byte easily enough

#

since every write is [netid][length][data] [netid][length][data]

sonic marsh
#

yea i will definitly need length if i slice it

jade glacier
#

you can read the first netID, its length.. and send that to a job... read the next netid, since you know where it is now from the last len value... and send that off... etc

#

yeah, just slice it

#

don't copy it

#

The concept is what matters, you aren't sending a zillion messages with message ids

#

you are sending one state and/or input byte[] for a tick

#

You then consume those at the same tick rate on the receiving end, and that allows you to lerp super smooth.

#

Assuming you are doing state transfer and interpolation

#

If you are doing some other architecture, that last bit changes

sonic marsh
#

yea i have all the lerping/smoothing taken care of

jade glacier
#

not sure what you had going then for that if you haven't gotten your state sync in place already, but cool.

sonic marsh
#

currently i have ENet => Ceras (Deserializer) => Messaging => Systems

#

but that was so i could get going quickly, was able to take that from a older project

#

i want lots of performance so will be ripping out ENet and Ceras (and now messaging) and replacing with Unity.Transport

#

but i dont need it yet, so im working on other bits and making sure they are solid before replacing that

potent mural
#

Hi
I'm working on a multiplayer game over LAN and it must be offline at all time. No internet connection.
I was looking for networking solution to help me with this and basically ended up with Mirror.
Any other solution I should try out before making a decision?

gleaming prawn
#

I think mirror is the best option for pure offline LAN if you need a "high level" API

slim ridge
#

can mirror do multicast? If it's pure LAN you can make use of that wonderful feature if your router supports it

jade glacier
#

If you are lan only you won't be fighting with issues of latency and loss

potent mural
#

Thanks guys :)
Moving forward with mirror.

urban bridge
#

Anybody that have time to help a noob on some online multiplayer cloud save data game

vagrant raven
#

@urban bridge yah bro if ur tryna use photon i recommend https://www.youtube.com/watch?v=MAAxL6Q_ElE&list=PL6PsTmPNvw0eZirNDjO8dL0Y6X0ZFGaMt

Brooo, Welton shows us how to setup a scene for a first person shooter and manages to get the motion working...

Over the course of the next couple weeks, Welton will be teaching us how to make our very own first person shooter which will include tutorials on motion, weapon sy...

β–Ά Play video
sacred grail
#

Curious peoples thoughts on implementing a continuous (large) network world with modern unity. I know there is no pre-canned way to do this, but if you were to play around with this using the new unity physics, dots net code, etc.. which method would you use? Floating origin (not sure how this would work with multiplayer), creating a 64bit world layer on top of unity's 32bit physics/render, use multi-scene mapping each scene to a larger 64 bit space, something else?

slim ridge
#

it's not practical (yet)

sonic marsh
#

@sacred grail I would break up and make many server worlds which record data into a core server world, that server world selects and manages the data and sends to the client exactly what they need, the client can do floating origin

#

but thats cause im making a RTS

sacred grail
#

any thoughts on mapping those worlds to multi-scene for seamless transitions?

sonic marsh
#

oh sorry, use DOTS, they support any number of worlds.

#

as for scenes i dont use them sorry

#

DOTS has those new subscenes, pretty sure you can control the loading/unloading of those

#

so you could load them into your world(s) as needed

sacred grail
#

ya I was thinking u could do a 1to1 mapping of scenes to worlds

#

or maybe 4 scenes per world, so u can have more than one loaded as they transition

#

What I am most unclear on is what happens when you have two players interacting on the border of two or more intersecting worlds

sonic marsh
#

what i did when i needed to break up areas in a old project

#

player is in a region, but the server was sending that region and its neighbours

#

so each player actually recieved updates for 9 regions

#

and my regions were much smaller then the world

astral ridge
#

hmmm

#

reliability?

#

seems like it might have to do with reliability

#

did you add any reliability?

#

Idk about enet but I know some libs like it have reliability options

#

I mean you are getting the right length of data, so does it matter?

#

youd have to use wireshark to figure out what the extra packet is

#

yea

#

it has reliability

#

so im guessing

#

even without reliability

#

it sends an extra packet related to it

#

whatever the case

#

ENet hasent thrown an error

#

so its likely intended

#

if it was a random packet ENet didnt understand it would probably error out

#

you can always submit a github issue though πŸ˜„

cedar marlin
#

hello i'm trying to make a php script write data in a database from a unity form

#

but it seems i cant access the data provided

#

i am using a $type = $_POST["type"];

#

and echo $type doesnt print anything

cedar marlin
#

ok i managed to make it work i had several php error and i am now using unity web request instead of WWW

old copper
#

What should I use for multiplayer since unet is dead?

sonic marsh
#

@old copper Whats your skill level?

#

And game type?

main dock
#

Hey Roycon, you're using ENet with DOTS? How's your experience so far? Was it the right decision for your use case? Will you keep using your setup?

old copper
#

@sonic marsh Definitely not a professional game developer. Familiar with unity and C# but not familiar with developing games as whole. I'm attempting to develop and learn the process of making an fps.

sonic marsh
#

@old copper use mirror then i think

old copper
#

Isn't mirror local host only tho?

sonic marsh
#

@old copper pretty sure you can have it dedicated host

#

@main dock Yup, so far it works great, use case is large scale RTS, but i had this setup from a older project.
Is it the right decision??? That i dont know, still far to early
Will i be keeping it?? Maybe, im going to get network stats in early along with mertic exporting (eg fps). and see if it holds up. I did look at unity transport, but thats even lower level then ENet

#

but if I was to swap it would be for performance, and in that case i think Unity Transport would be the only option

main dock
#

Did you try Unity Transport, and did you could achieve better performance on it?

sonic marsh
#

I didnt really try it

#

but i think that its integration into the Job system and with ecs in general i could get better performance

#

but i also have to implement things like reliable packets

#

seemed like too much low level stuff when instead i could use ENet and get going now

main dock
#

I see. That makes a lot of sense.

#

Would you continue using DOTs if your game wasn't a large scale RTS?

sonic marsh
#

πŸ˜› all my ideas are large scale

#

i actually really like DOTs but it is missing like 90% of unity

main dock
#

Lol what if it was small scale like maybe 50 networked things to pay attention to

sonic marsh
#

so if i had something smaller and i wanted to complete it i would not use it

#

yea in that case i wouldnt use DOTs

main dock
#

Besides RTS, what would be situations or large scale ideas that would require DOTS in your opinion?

sonic marsh
#

ummm simulation/tycoon/management games are a good fit. i prototyped a Turn based rpg, but only cause my spells were chaos and had tons of parts

#

but probably didnt need it for the rpg

#

and massive worlds is the other good use case

#

like skyrim but 1000 times bigger

main dock
#

I see. Do you build ENet on a dedicated server?

#

No unity headless?

sonic marsh
#

na my plan is for the player to host

main dock
#

It's a standalone server?

#

Oh

#

I see

sonic marsh
#

but everything is built so i can have a headless mode too

main dock
#

So with Enet-Sharp? Can you also build without Unity?

#

And have it run without it

sonic marsh
#

yea you dont need unity

#

but i have a ton of game logic i dont want to replicate in pure c#

#

so even if i do have dedicated servers they will be with unity instances running headless

main dock
#

I see that makes a lot of sense

jaunty thistle
#

Hello, I am trying to customize the properties of a room in Photon using hashtables. I have looked for several explanations but only the hashtables in localplayer have worked for me but it does not help me since I need those values ​​for the entire room. Any help?

gray pond
#

Isn't mirror local host only tho?
@old copper Quite the opposite...Mirror would be best on a dedicated server. Wish we could get that myth to die.

main dock
#

Does anyone have examples of how much inbound/outbound traffic for certain number of networked objects is healthy for a game to draw some comparison?

#

I've read some things about CCU, but I'm more concerned with network traffic cause it seems that sometimes, that's the other thing that can really hurt you

gleaming prawn
#

@gray pond myths never die...:)

#

Does anyone have examples of how much inbound/outbound traffic for certain number of networked objects is healthy for a game
Depends on:

  • what data you are sending around about each object (your code)
  • if you compress the data or not (compression ratio, etc)
  • how frequently you send the updates
  • if you send from a server to all clients, or (asuming you are using PUN, for example) if you just naively send from on client through relay to all others (exponential bandwidth);
#

The rest is just doing the math.

#

If you ask what is reasonable in terms of bandwidth, from one game client perspective

  • keep the upstream < 5KBps
  • downstream anywhere between 5-50-100 (depends really on how hard you want to push the limits). Check what other common games (in the same genre as yours) create of bandwidth
#

The numbers above are just wild guess

solar garden
#

I'm following Gaffer's implementation with reliable messages but i wonder something, if the clients send messages to the server and the server broadcast these messages to all clients at once, how do you do if you need to send a message that involves only you and the server like connecting ? idealy what you would do is send a connection request, the server challenges you and then send to everyone (this guy connected, add client object with id etc..) but you don't want to send the first two to all clients right ? how do you counter that ?

gleaming prawn
#

Are you trying to implement a network library from scratch?

solar garden
#

yes

#

School project

gleaming prawn
#

1st, what it sounds like is that your are doing a "relay" server (when you say the server broadcasts the messages send by clients).
But, yes, you should make the first two something exclusive between the server and the client

#

It's the connection handshake/authentication etc

#

But HOW, that's your project...:)

main dock
#

Thanks, Erick

solar garden
#

@gleaming prawn What do you mean πŸ˜‚ ?

#

Maybe i'm not thinking this right but its never mentionned how you make it private between server and client

gleaming prawn
#

Maybe i'm not thinking this right but its never mentionned how you make it private between server and client
If you send a message to the client IP it will not reach the others

#

I don't understand the question, really

solar garden
#

oh yeah sorry i mean i do send the messages to each clients specifically, i just loop for all players ip and send to all

#

no "broadcast"

#

i'm trying to do so i don't have to put more info in the packets to specify to who this message is targeted to

#

as no implementation seems to do that

#

I have a setup where messages are "messageId : data" and once its received it points to its target class with a function to execute

#

should i check in the function if it targets me ?

#

it feels not right

cedar cloak
#

Please can somebody help me out to understand how remove a player from a leaderboard?

#

(a match leaderboard, not a global one)

weak plinth
#

What's the recommended way to do networking there days with unet being deprecated? Like I can write my own socket client and server, but I feel like it might not be the right way to do things.

astral ridge
#

@weak plinth

#

probably not

#

idk

#

use that

#

I used it

#

its great

#

you can use UDP but it has reliability for packets involving like logging in or anything

#

it works great on unity

#

I havent used it in a while but with POCO serilization from a seperate lib you are good to go basically

slim ridge
#

mirror, the photon product suite if you want a higher level

keen zinc
slim ridge
#

i'm not a photon expert but i've encountered issues like this with mobile.
When the disconnected player's app comes into focus again remove them from the game properly and have them rejoin properly then implement some features to try and hide this from other users

#

but that definitely sounds like something photon would like to fix πŸ‘€

amber trench
#

@keen zinc mobile devices have a different connectivity model than desktops do, personally i recommend using photon with a timeout equal to your maximum game session length, so you never disconnect, actually, and only transmit inputs over the network

#

this is similar to the way Clash Royale works

#

once a player starts a match on a mobile device, they should remain registered / only in that game until the end of the match, the client should never decide when the game is over or has disconnected (do not give clients the ability to leave, only to disconnect)

#

this only makes sense for hosted network games

#

if you are using local play over a mobile device over wifi, it's best to just pretend it's a desktop device and crash the game if someone disconnects

keen zinc
#

thanks for the feedback @amber trench ! only issue is that despite having a timeout of 2 minutes, the player still gets disconnected temporarily from Photonnetwork if they leave the app. But because they have a TTL of 2 minutes, they can rejoin the game within that time. So, i still have to deal with some sort of temporary disconnect. I think i found the solution though and updated my forum post above

#

was curious about what a good TTL length would be, so that info is helpful

gleaming prawn
#

the disconnect is enforced by the mobile platform, specially iOS

#

This is not a photon "problem"

#

You need to make sure your game code is able to handle a reconnect, joining the same room, and getting the game state in sync again...

#

This is fairly easy to do if you understand what you are doing.

#

In Quantum we also have a full snapshot-based re-join/late-join, so this has been solved several times over... It's a matter of understanding what you are doing.

#

I also do NOT recommend setting super high timeouts (I'm a photon engineer), unless you also understand exactly what which one of them mean (you can ask these in detail sending us a message to the support email)#

#

@keen zinc

keen zinc
#

haha, anything is easy to do if you understand what you're doing. but i clearly I dont, hence why i am asking

#

good to know re: support email. i will try that next time. the forums are a ghost town?

gleaming prawn
#

the forums are a ghost town?
Not really... There's at least one guy dedicated to that every day.

#

But forums are also a place where others answer, not only us

#

why photonviews get destroyed on master vs client and when to recreate them on reconnect
I'm not a PUN expert

#

You'll probably get an answer in the forums. But I expect that to be clearly stated in the docs...

#

AFAIK there's a way to cache instantiations to still be sent for late joiners, etc... But you should not use that for EVERYTHING, etc

#

This is assuming you use PUN...

keen zinc
#

yea, using PUN

gleaming prawn
#

For Photon Bolt or Quantum that's handled differently

#

Friday is not a "good" day for answers...:)

#

If you send an email, you'll get an answer, and my colleagues will at least point you to the specific doc entry for this topic.

keen zinc
#

thanks, erick!

gleaming prawn
#

Just to give a summary:

  • Quantum's ECS can automatically serialize the full "mutable" game state, creating a full snapshot for late-join/reconnect.
  • Bolt (when used with server authority AFAIK) retains ownership of all networked objects on the host (players acquire "control" of their characters, not ownership):
  • (I might be wrong here) in PUN, afaik you do this by "caching" some of these messages on the room/server (like instantiating a player prefab). But you should not cache RPCs, or other messages to avoid flooding late joiners, etc
keen zinc
#

right. I mean im not using Quantum or bolt so that's not really relevant to me. PUN does cache RPCs but it's optional. Im choosing not to cache - instead just syncing the client's state via a state machine making reconnect simpler for my use case

gleaming prawn
#

Just clarifying.

#

I don't remember how it handles an instantiated photon view when someone else joins

#

PUN, I mean

amber trench
#

@keen zinc it really depends on the game, the best user experience for mobile devices is always hosting the game

#

hosted means there is a computer, a normal server, somewhere, that creates and manages the game state, runs the game clock (if it's a realtime game) and is authoritative

#

so like clash royale and hearthstone are hosted games

#

hearthstone is a unity game

#

hearthstone doesn't evaluate the card game rules on the device, except for the purposes of doing a few UX things but not for actually running the game

#

there are few mobile multiplayer games generally, and i think exactly zero of them that anyone actually plays use a device as a host

#

if your game is meant to be played over wifi, setting an android device down on a table

#

for a long session of a realtime game or whatever

#

yeah it's probably fine, but that's a very specific niche

#

anyway i hope i can be of help i can only really advise for stuff that makes sense though, for games and ways of engineering htings that make sense

worldly cypress
#

hey guys, anybody know how I could approach doing a game that incorporates video chat?

#

Using Mirror?

jade wharf
#

not exactly with mirror

#

i mean

#

if you can open up a TCP or UDP connection with it then sure

#

but you need to use another library or use a codec and send it yourself

gray pond
#

This ^ Let Mirror do the game network, and put voice/video on a separate network that just renders into the client.

smoky abyss
#

anyone know what's going on with the Noble Whale discord? it's been quiet for about a month

sacred patrol
#

That sounds disturbing. For reasons, you know...

proven delta
#

Gu

#

Can someone help me to connect firebabse to unity?

#

there is one step im stuck on

#

and got 0 idea how to do

slim ridge
#

without knowing the step how are we supposed to know if we can help you o_O

mellow sapphire
#

Hi, I'm trying out Photon, and I'm using an example as a template

#

Why is this error appearing?

#

I can't use photonView.isMine and neither isWriting

jade glacier
#

Those would be pun1 I think

#

They are uppercase in pun2

mellow sapphire
#

OMG!

#

Hahahahahaaha!

#

Thank you @jade glacier !

proven delta
#

Sorry i was waiting for someone to come first XD

#

im trying to get the Sha-1 key

#

I'm having problems following the tutorials posted from firebase

#

when i run the cmd for the keytool i get issues

#

So i'm wondering if anyone can give me step by step guide to get the Shia-1 code

past wren
#

I've imported Pun 2 to unity and put my app ID but in VS it doesn't see it why? Please help.

oak flower
#

Check if it has assembly definition file blocking it. Edit its references/access

burnt axle
#

How can i know when my current client is receiving values from the observed transformviewclassic component in remote clients? Or must i implement a custom observed script that synces transform values to achieve this?

sage saffron
#

Anyone know what this error means: JoinRandomRoom failed. Client is on MasterServer (must be Master Server for matchmaking) but not ready for operations (State: PeerCreated). Wait for callback: OnJoinedLobby or OnConnectedToMaster.

jade glacier
#

Sounds like you are skipping a step @sage saffron

#

Where are you getting your code from that you are copying?

sage saffron
#

Copying? This is a paid asset. It was working but I was changing things and it messed up, cant figure out what I broke.

jade glacier
#

You bought an asset that does the connections for you?

sage saffron
#

photon addon

jade glacier
#

Revert it back to the way it was in the asset, or check your git

sage saffron
#

I am writing it in my own way, was just looking at that asset script to understand how it worked. I ended up with the error above, and would like to know what it means.

jade glacier
#

That you need to use the callbacks it is listing

spring crane
#

@sage saffron You are essentially trying to join random room before being connected.

sage saffron
#

I need a random room to be created, then the next player that presses the join button to randomly join a room it will spawn them in the room the first player made, but once the room is full I want a new room to be created automatically, and evenly distribute players

#

@spring crane thanks for the tip, I’ll check that

sacred patrol
#

Ay guys, am I right that synchronizing character states (or behavior tree) and executing animations according to synchronized state is inferior to executing character states/behavior locally and synchronizing animator properties ? (Photon, serialization-based sync approach)

#

Those are 2 fundamentally different approaches, I wonder if anyone had experience with one or another.

spring crane
#

I imagine deriving the animation based from state would be superior. Getting closer to just sending inputs seems like the way to go.

#

It's simpler to just sync all the things when starting out though

sacred patrol
#

The complexity is what I'm mostly concerned about. I don't think I'll ever be just sending the inputs. So that kinda answered it.

#

If the thing isn't deterministic since the start - why bother.

burnt axle
#

@sacred patrol Arent you supposed to sync the behavior tree? Your last approach doesnt do this.

sacred patrol
#

This is the exact source of complexity. Syncing behavior trees isn't that simple.

jade glacier
#

Syncing Animators can get really tricky if you want them to be precise because its designed mainly as an Update() based machine

#

For SNS I do it all on fixed, and to make things line up correctly I defer things like weapon fire and such if they are tied to the animator state and normalizedTime... so that they don't happen on the owners side until FixedUpdate(), and all value are captured in Fixed, and on the other clients replicated on the Fixed.

icy ermine
#

Background: I am building a PlayerController Script right now and i am struggling with the decision if i should use Rigidibody and setting the velocity (without AddForce) but using gravity to get my character back to ground. OR if i should use the Character Contoller. I really want to have more manual control.

Question: Is the usage of Physics gonna be a problem for server reconciliation? Is unity physics gonna behave equal on different clients?

jade glacier
#

If your plan is to predict on clients, it will be problematic yes

devout beacon
#

Ich hab da mal eine frage: Ich hab eine Player Connection mit einem Server Programmiert. (Über Sockets) Wenn der Client über den socket daten erhÀlt und diese ein Muster erfüllen führt der Client eine "public void" aus. Aber im Unity Editor Programm macht er dies nicht. Wenn ich das Programm über "Build and Run" ausführe macht er dies. Wie kann ich das machen das er dies auch im Unity Editor Programm macht? Bei weiteren Informationen über das Thema bitte @devout beacon

#

(The text was originally written in German and translated with GoogleTranslater)

#

I have a question: I programmed a player connection with a server. (Via sockets) If the client receives data via the socket and this fulfills a pattern, the client executes a "public void". But he doesn't do this in the Unity Editor program. If I run the program via "Build and Run" he does it. How can I make it do it in the Unity Editor program? For more information on the subject, please @devout beacon

slim ridge
#

Can you show the code?

devout beacon
#

jes

#

but how do you mark that on discord

devout beacon
#

thx

slim ridge
#

have you determined where it stops working in the editor?

#

i would guess it either has to do with everything being static or in the editor you disconnect immediately in the editor because BytesRead is < 1

devout beacon
#

he finds the game object and wants to run the "public void" but he doesn't. But in "Build and Run" he executes the public void (it works) and there is no error

slim ridge
#

restart unity?

devout beacon
#

yes I already have πŸ™‚

ocean galleon
#

any reason to not use photon when learning networking with unity?

jade glacier
#

Photon has 3 libraries, which are all fine for learning - but you do want to be sure to choose the right one for the learning project. @ocean galleon

#

2 really - since Quantum isn't publicly available free.

ocean galleon
#

i was looking at PUN 2, would you recommend that?

jade glacier
#

Depends what you are making. I would before anything do tutorials for a few of your options too get familiar with the basic concepts.

trim quiver
#

Can anyone point me in the right direction of building something like a 3 player quiz style or jeopardy game?

#

doesnt jeed to be realtime, just update each player on turns with onfo. i want to learn simple and small and build up as i go

#

anyone have a good basic unity networking tutorial theu would reccomend?

gleaming prawn
#

Can anyone point me in the right direction of building something like a 3 player quiz style or jeopardy game?
A rest web service...

weak plinth
#

Hello, I'm trying to set up usernames through photon (e.g. type username on main menu, press play then open another scene which is the main level) are there any good tutorials/advice i could get?

stiff ridge
#

There is Nickname property, which syncs the value in rooms.
In PUN, it would be PhotonNetwork.NickName = input...

weak plinth
#

tysm

#

if you set a player name, will it reset if you load another scene

empty quiver
#

Could RPC be used to control if the player should be dead or not?

jade glacier
#

Control isn't the right word, but communicate yes @empty quiver

empty quiver
#

Alright cheers

empty quiver
#

How would I destroy a enemy player with out destroying the player who killed the other player?

quasi tapir
#

Guys I've been running into a bit of issue

#

I'm just checking what server I'm in, and I'm getting the object reference not set to an instance of an object

#

I'm using photon

#

Solved it, it was an oversight from my part. Had a text to display the name of the server to check if it is connecting properly in my mobile, deleted the text today now that I no longer need it and that threw the error.

fickle hazel
#

Not sure if this is the right place to ask this, but... I have a question on architecture.
I'm using a SQLite database in Unity, a remote MySQL db that passes JSON back and forth during the game load to update the local DB, and using Photon for Multiplayer. When you're in a room in Photon, you can see the other user IDs as they're added... and the game then pulls additional info on this user from the local DB. In order to keep the local user DB up to date with every user, my plan was to potentially update the local DB by pulling all users that have been added since the last run. In theory, this would make the game run faster by pulling local data vs over network. But is this the best way to do this? I'm afraid that local DB will get bloated if I'm successful and get a lot of users (probably won't but plan for it, right?) and maybe there's a better approach?

#

Sorry for the long post. Just wanted to provide enough info.

jade glacier
#

You are passing json THROUGH photons servers?

#

Or that is happening outside of Photon doing the normal game stuff?

#

I don't fully get the problem since I just scanned it, but if you are pulling in data about players from a web service outside of the game sync - you might want to hash that data struct and checksum it or something to see if the client in agreement with the players in the game.

slim ridge
#

get information from your remote DB as you need it. Replicating the whole thing locally is not recommended

#

unless photon has it's own db for you to use

fickle hazel
#

@jade glacier it was happening outside of Photon, on my own server. I do have some checks in place - you initially pass your user id to receive a token back from the server, which you then need to pass on each transaction during that session. I was thinking that I would pull all that player data over during the game sync - but my concern was ending up with tons of records on the local.

#

@slim ridge thank you. I will continue to pull remotely for now if syncing local is not recommended.

#

And thanks for your answer as well emotitron, appreciate it

jade glacier
#

Photon's servers are designed for smaller fast realtime game syncing. I would definitely avoid trying to do anything resembling file transfer through the realtime servers.

fickle hazel
#

Yeah I'm using it only for getting the user ID. The ID then makes up the user avatar, pulls season stats, etc. all based on the game side data (right now the remote server that is running the query and spitting back JSON which Unity is then parsing) and Photon is involved in none of that.

slim ridge
#

so far the only way i know how to convert things to bytes is using BitConverter.GetBytes
does anyone know some way that lets me provide the byte array with an offset?

jade glacier
#

Built in there is the MemoryStream class

weak plinth
#

How do I kill an enemy player without destroying the player itself

spring crane
#

How are you killing the player while killing the enemy?

#

Or do you mean like without destroying the network identity/view?

proven delta
#

Hi

#

Im making a mobile game and want to connect it o an online database to create a scoreboard

#

how do i do that in unity

#

without using firebase

#

There are problems integrating firebase to my game

#

Due to some resources the game was built on

kindred tulip
#

Hello, has anyone here ever done anything using Nakama backend solution? Any feedback is appreciated

kindred tulip
#

I've developed a prototype, and all is good for now, but looking info, on how easy it is to extend basic functionality and downside of system, to make a switch while its rather painless

#

I've seen the reddit post, but imho its just salt

stiff ridge
#

This is not a networking question at all. It's basic debugging. You definitely should look up how to make sure which value is null, then find out why.
I would start using string.IsNullOrEmpty(roomname) instead of what you do now...

sacred patrol
#

I'm looking at PhotonAnimatorView atm and it kills me how it requires an animator to be in the same object as the PhotonView, so I have no choice but to put everything related to visuals in the root object.

#

Not sure whether I should mod that thing or go ahead and merge everything into the root.

#

Any suggestions from photon guys please ?

jade glacier
#

I made all the SNS stuff not root-based, but that doesn't help you with the vanilla stuff. Not sure what options there are for that.

#

Can you derive the PhotonAnimatorView and make your own and overload how it finds the Animator?

#

Are you sure it has to be on the root? You can't drag children sync components into the PV list?

sacred patrol
#
{
    this.m_PhotonView = GetComponent<PhotonView>();
    this.m_Animator = GetComponent<Animator>();
}``` Not much I can do here
#

Either wreck it or refactor my stuff

#

Animator is of course private.

sacred patrol
#

I think I'll go with refactoring because I might be using root motion.

weak plinth
#

What networking system/framework would you recommend for a Pokemon type game? (Turn based or with a round system)

jade glacier
#

The PUN2 animator and transform syncs pun calls "reference" code. They didn't put a massive amount of work into them, and they are bare bones yeah.

#

Which is partly whey they hired me and are working to make SNS part of the package.

sacred patrol
jade glacier
#

That is a short list. I've seen far more with pun/mirror. The root requirement makes for big walls.

orchid cairn
#

what is the differences for character controller, character input, and character movment? Couldnt those be quite easily combined (and not have much use being seperated like that), & skeletal mecanim and character animation, character navigation and ai could be combined if used for the same final output

spring valley
#

Whats the current best networking solution for unity?

foggy bough
#

Mirror

#

can anyone here help with a prefab that isn't instantiating?

mellow sapphire
#

I'm trying to understand what stream.IsReading is for using Photon. Because, if you're sending the position of the player to other players using stream.IsWriting, why do you need to read your own position? Because locally you already have your local position, so why send the your current position just to read it afterwards?

#

Isn't stream.IsWriting enough?

#

In this case at least

fair cosmos
#

@foggy bough join the mirror discord there we will help u

foggy bough
#

Sounds good thank you @fair cosmos

jade glacier
#

I don't believe is reading will happen for the owner. @mellow sapphire

ashen otter
#

anyone experience with photon self-hosted SDK?

sacred patrol
#

what is the differences for character controller, character input, and character movment? Couldnt those be quite easily combined (and not have much use being seperated like that), & skeletal mecanim and character animation, character navigation and ai could be combined if used for the same final output
@Sludgybeast#5678 That's called "Separation Of Concerns", my friend. First letter in the "SOLID" design principles, which stands for "Single Responsibility Principle".

#

That's a shame he left though.

stiff ridge
#

@ashen otter, yes. What's the question?

#

@mellow sapphire, the observed scripts are used to sync updates for the networked objects (those with PhotonView). The controlling client gets this call with .IsWriting. This is sent and remote clients will get the provided data with a stream set to .IsReading.
A simple approach to have reading and writing in one method.

ashen otter
#

@stiff ridge thx, i'm just getting started setting up self-hosted SDK. when I see some tutorials and photon moderator comments, i continue hearing of them saying that calling a function called peer.Service() 20x/sec is necessary in the client code to 'dispatch incoming commands', yet I just am not sure the reasoning for this or what that means I guess

#

why do i need peer.Service() and what does it do precisely? is that the only way for a client to receive things like RaiseEvents? i have an RTS game for which the plugin will involve a lockstep system, and i (believe) it is supposed to work: Operations in (to server), RaiseEvents out (or lists of RaiseEvents) to the clients, correct? is that indeed the intended way for a game like this to work?

#

and maybe b) is it ok you think to run a game server and a master server on opposite ends of the country, as in my friend far away runs the game server, and connects to the master server in my area? or would it be better to have them on the same LAN to save confusion. we are both working on the netcode thats the reason i ask this

mellow sapphire
#

@stiff ridge Thanks for the reply bro

#

So, the controlling client would be the owner/host of the server?

#

And the remote clients would be the people joining?

#

What would happen if the game was hosted by servers that the game company provides, such as they do in MMORPG? There wouldn't be an IsWriting method then, correct?

slim ridge
#

you'd be interested in a higher tier of photon product πŸ˜„

#

quantum

ashen otter
#

i wish quantum were much more affordable

slim ridge
#

same, or i wouldnt be here trying to build it myself

ashen otter
#

I go with photon-self-hosted

#

i learned thoroughly how to write a deterministic lock-step engine

#

for lack of any other good commerical option

slim ridge
#

but it's pretty hard to make that affordable, servers/bandwidth aint cheap

ashen otter
#

I know it must be less that the thousands for Quantum

#

my game is 1v1 so per game server should be able to handle like 2000 clients a piece...i'm not worried about running a few servers at my own house

#

or outsourcing if it gets bigger

slim ridge
#

based on my experience with cloud services it's a pretty good price, and they probably have it optimized to get like 30 - 40% profit

ashen otter
#

hmm. $1000/mo seems vastly expensive to me. considering I could instead just run a few PCs at home. seems they are literally just charging to take care of the determinism issue

#

just my own view, maybe i dont understand what im saying, but no way in hell i see it being worth money if i already know how to write my own lockstep engine which works fine

slim ridge
#

i dunno, do they provide the user database too? databases cost a lot

ashen otter
#

the whole product is literally just 'issue-free deterministic multiplayer'. i don't think they are charging you for a single thing else

#

i'm developing my own website with this game i'm working on so i personally am not worried about the user data stuff

jade glacier
#

If you have projects with any kind of funding or that are interesting as tech, Erick is always mentioning that Quantum does have partnering/etc considerations. Not sure if that is still the case or the details.

fading apex
#

What is the best Multiplayer solution for a 2d 1v1 side view fps kind of game
i have used Unet before and I was not very happy with it so maybe there is something else
i have heard of photon but have never used it

#

I have read into mirror a bit
maybe that would be an option

slim ridge
#

"side view fps" πŸ€”

#

ya, mirror is a good place to start

fading apex
#

i meant side view shooter XD
ok ill look into it a bit more thx @slim ridge

jade glacier
#

Just keep in mind with most all libraries discussed here, they are not complete networking stacks and you will have to do the hard work of networking. They are messaging layers, and messaging layers with entity creation/serialization handling - but they do not teach you nor encourage good networking practices.

proven delta
#

Hello all

#

im trying to get data through rest api

#

the one in the unity store

#

when i do a post/put request there are no problems

#

but when i try to use a .get

#

i get nthn

#

this is how i attempt to read it

#

when i debug that i get nothing

#

im trying to create a leaderboard for a game

#

so im trying to retrieve all the objects in it

#

by it im referring to the database ofc

#

any ideas?

mellow sapphire
#

What's the best way to test a multiplayer VR game using Photon? Because whenever I build a VR game and play the build and play the editor, one of them will close, and I believe that is because SteamVR will only run one app

gleaming prawn
#

@ashen otter 1k per month is so you do not have to waste 3 yearsfull time (300k in salary?) Developing it yourself.

jade glacier
#

Seems like more of a steam question, which I think someone else was asking about here the other day?

#

@mellow sapphire

gleaming prawn
#

The 1k does not cover the online CCU, that is just ask access fee....

#

But it's a premium tier product and support... For a game studio it's that or they need to pay a couple of very good developers over 2 years at least...

#

Most do the math...

jade glacier
#

I've been doing some Oculus VR extension stuff for PUN2.. testing is a hassle even without stream.

gleaming prawn
#

We would like at some point to have a free tier,.maybe... If we can have a profitable business model for it...

#

We do not have Chinese money....:)

#

Just a small hard working German company

proven delta
#

anyone who can offer assistance?

jade glacier
#

Question is probably a bit too vague @proven delta

proven delta
#

i tried using the rest API to get a singular value from the database

#

it worked just fine

#

when i attempted to get all objects i nthe database

#

it doesnt work

ashen otter
#

@ashen otter 1k per month is so you do not have to waste 3 yearsfull time (300k in salary?) Developing it yourself.
@gleaming prawn i'm assuming you are talking about the deterministic multiplayer engine taking 3 years and 300k to write? since that's the whole point of Quantum as a product, is it not?

#

But it's a premium tier product and support... For a game studio it's that or they need to pay a couple of very good developers over 2 years at least...
@gleaming prawn I guess it comes down to the fact I am not a 'game studio'. for someone like me sitting at home, paying 1k/mo instead of self-hosting and writing my own lockstep engine for a simple 1v1 RTS game would never make sense. at least it doesnt seem theres any way in hell it would for my personal case. so what if the game i am working on ends up with thousands of CCU eventually? like you said the Quantum fee is just literally for the multiplayer engine

sonic marsh
ashen otter
#

interesting you send me this

#

our game we are making use of a rather similar method, but mechanics are different. basically our game is autochess and we only need to know when and where units are spawned, which means 'turns' can be extrapolated also and replay scrubbed

jade glacier
#

That is quite a bit different from deterministic though.

#

The planetary annihilation thing is more about an alternative to a standard fixed tick system if I remember correctly.

ashen otter
#

im real curious about resulting CPU demand server-side

#

with this

#

i explored some options like that but eventually realized for my game all the unit info would blow server PCs to smitherines

jade glacier
#

The use case being the ability to store a sim a lot more efficiently on clients. The server doesn't do the replays.

#

It's not common because it's a lot of complexity added. There needs to be a problem it is solving to be worth it.

#

Most definitely wouldn't try something like that alone and/or for a first networking attempt.

ashen otter
#

well basically the point of this was to enable server-side simulation in a 'light' sort of way right? unless i misunderstood the article. it said 'clients are dumb and just rendering'

#

this is the sort of thing i wish that i could do something similar to, but i have not figured out how the hell it would work

#

there are 4+ trillion different types of units in my game and they have multiple weapons, which re-target other units literally constantly

#

running all the countless thousands of re-targeting events server-side isn't doable

sonic marsh
#

I'm using the new DOTS stuff which is making it super easy, but its still too early to tell how performance will be, hoping to start some real tests in a next month or 2

#

in my implementation servers are the only one with all the data, clients only get what they can see, the downside is saves/replays are server only at the moment, but im sure i can sync the data when needed

#

@ashen otter Thats a crazy amount of unit types, how would that even run on clients?

ashen otter
#

@sonic marsh the units are customizable by the player in-game, like buildable

#

designable*

#

given all the different parts that will be available, using a permutations calculator to remove redundancies/combos that are duplicates, the result was 4+trillion distinct buildable units

jade glacier
#

They were trying to reap a handdul of benefits, but the game reviews indicate the resulting complexity may not have paid off.

ashen otter
#

@jade glacier if i said i understood how they managed to reduce all that unit info to curves even remotely i'd be lying, seems like rocket science

jade glacier
#

I wouldn't venture down the curves path unless you had really good reason to. @ashen otter

sonic marsh
#

@ashen otter At its core its pretty easy, every server tick record current position and time

#

the tricks are optmizing it, things like not recording if things dont move

ashen otter
#

im guessing the spherical planet is re-mapped to be represented by a 2d graph?

#

so really the sphere just has x/y coordinates?

#

for all possible positions?

#

wait there's air units in this game too. i played this game once ages ago so i wasn't sure

gleaming prawn
#

Air units is super easy to do with 2.5 d layers

#

Have researched enough to have an opinion on the best data structure to represent a broadphase for a planet surface though...

#

Have not*

#

There's probably a couple of good options that trade of distortion Vs memory use

#

Doing RTS with determinism is normally more practical, but it's not necessarily easy

#

I see a lot of developers expecting a regular (even though deterministic) physics engine and navmesh path finding to work for that use case...

#

Scaling (even a server) to simulate 40k Units in Realtime is NOT easy... Unless you want to pay super expensive server for every 4 players you have...

#

If they buy your game for something like 1k a pop, then fine...

#

Just rambling from phone btw...:)

sonic marsh
#

Yea lockstep was a bit over my head, was able to get a prototype of curves working super quickly

#

I'm mainly aiming for player=host type games so that way i dont have to host

#

but will see what happens

gleaming prawn
#

Lockstep in itself is quite easy...

#

It's definitely easier than curves...:)

#

For the gameplay developer at least... Although curves looks nice and it's a concept I wanted to experiment with at some point

#

Predict rollback determinism (which we do in quantum) is another story though... A lot more involved than just plain lockstep

lapis vapor
#

Guys, Unity dashboard is not loading , it simply showing loading for 20 mins, is it server down or something. I was just following my first multiplayer tutorial. That's how I reached the dashboard

gleaming prawn
#

Is this a unity website? There's no unity support person in this discord, sorry

#

At least they never answer in this channel...:)

lapis vapor
#

Okay, like I thought that might be basics that we have to follow when doing multiplayer

#

That's why I asked

gleaming prawn
#

Look on youtube

#

They are probably better than the unity ones....:)

lapis vapor
#

Yeah Let me give it a try

gleaming prawn
#

Unity's track record with official multiplayer solutions is, sorry

#

Discord blocked me from saying...:)

lapis vapor
#

πŸ˜† πŸ˜‚

gleaming prawn
#

If you want something easy to follow and with good guys to help you out, take a look at mirror

#

If you want to see a few commercial options, including free tiers, look at photon (disclaimer, I'm a photon engineer)

#

There are a few other options out there, but these are the most popular

#

The unity ones (the current, non deprecated ones) are half baked and not very versatile

#

Mirror has its own discord server btw

ember zealot
#

Hello, i would like to ask here about something i want to do
I have a level editor in my game and i would like to have a database for the users to upload their levels there and also players download official accepted levels from the database

The problem is that right now i dont know which backend to use, or which web service offers that

what i want to do is make it compatible with steam and other platforms
so they all use the same database

maps are arround 40kb eachone

and i would like to be able to create an algorythm to filter diferent levels in diferent ways

Anyone can tell me where i can start doing this? i have my data serializing in XML Right now

lapis vapor
#

Thank you for saying that @gleaming prawn , I was working on multiplayer project for first time and this project can end up commercially in future. So mistakes can't be tolerated. So thank you so much. Else I could have used Unity itself

jade glacier
#

I would avoid at all cost having your first attempts at making mp games require you to succeed. There is a lot of failure, frustration, and refactoring involved in learning game networking.

ashen otter
#

@gleaming prawn What do you figure is the most reasonable method for authentication for a first release? Using Photon self-hosted custom authentication i'm talking

#

Given that we don't want to throw money at our own website for a product that has no significant playerbase yet

gleaming prawn
#

For no significant player base? Use a free tier of a player profile service, either playfab, etc

#

Steam is also a good candidate (if the game is targetting that platform mostly)

lapis vapor
#

@jade glacier , I'm not new in Unity. What I said is I'm new in Multiplayer only

gleaming prawn
#

Still valid...:)

#

Don't underestimate MP

#

Although you seem to be doing 1 thing right: if it will be MP, start it from day 0 as MP

#

Making a single player game and trying to convert to MP just results in crap

#

And headaches

weak plinth
#

so what fo u guys recommend

#

should i keep trying to use somethi g like litenetlib

#

or switch to a paid thing

#

or should i go back to basics and do sockets myself GWowoHehe

#

or is there any free and good solution that does not require you to get rekt?

gleaming prawn
#

Your question goes all over the place

#

Do you want to build a tool or a game?

#

If a game, just look at the free and paid solutions, like Mirror, Photon, etc

#

If a tool, others can advise you, I'd just advise you against it..::)

slim ridge
#

that documentation is gross, i cant even find the reference for Network.Broadcast

#

my guess is Broadcast doesn't do what you think it does, or you have duplicated your client somehow with another id

fickle hazel
#

Hey guys, got a Photon question

#

I'm using RaiseEvent for a match between 2 players

#

When Player A raises the event, it goes out to ReceiverGroup:All

#

The OnEvent receiver then checks it on both devices, and if your ID matches the passed ID to get attacked, it starts the attack

#

so Player B matches, and it initiates the attack on Player B

#

except it's initiating the attack twice

#

both on Player B

#

Is there something I need to do to tell it to close out on the event listening after it initiates?

#

Solved it, the duplicate of PhotonNetwork.AddCallbackTarget(this) PLUS the PhotonNetwork.NetworkingClient.EventReceived += OnEvent was causing it to fire twice.

vital hawk
#

wonder if people will make transport support for EOS now that Epic released EOS C# SDK πŸ™‚

sonic marsh
#

EOS?

#

Epic Online Services πŸ˜›

weak plinth
#

transport?

#

Download Epic Online Services SDK
The SDK is available for Windows, OSX, Linux, PlayStation, Xbox, and Nintendo. Engine-specific integrations for both Unreal Engine 4 and Unity will become available at a later date.

vital hawk
#

C# SDK is available today

#

UE4 slackers group also has EOS channel which does cover EOS in general

#

basically they give out free crossplatform online system that does matchmaking, p2p, leaderboards, achievements etc and lets you auth users per their own provider (steam, consoles, egs, etc)

#

it's really similar to what steamworks does but it's not bound by steam and they let you ID users from other systems, enabling crossplatform play

weak plinth
#

How to make a real time multiplayer game in unity?

sonic marsh
#

Mirror

subtle sphinx
#

Wow, Mirror looks awesome

#

Good info thanks

charred siren
#

Would Mirror work on the local network too for testing?

sonic marsh
#

@charred siren Yea definitely

#

been ages since i played with it tho

weak plinth
#

wheres my mirror tutorials

#

wait if i use mirror do i have to use the unity game as a server?

gleaming prawn
#

Yes

jade glacier
#

Same model as Unet was, its all Monobehaviour based on both server and clients, yeah.

lapis vapor
#

Guys, I was making a multiplayer game with mirror. In most of the mirror tutorials, it is talking about instantiating a player in the server. Instead , is it possible to establish a connection with a player in client and in server

jade glacier
#

If you are in the mirror discord, they usually are quick with help. @lapis vapor

weak plinth
#

How do you make a server with mirror that runs on a (linux) vps?

#

(no gpu)

lapis vapor
#

@jade glacier , they are not responding

fickle hazel
#

Does mirror address host migration? I watched a tutorial on it and if the server player disconnects, everyone gets kicked out. That was why I went with Photon.

weak plinth
#

it is more of a seperate server thingy like mmos where u do not have host migration

#

I bet you could still do host migration somehow but go ask on their discord

jade glacier
#

MLAPI may have just added host migration. Can't comment on the quality or bullet proofness of it. But a user just submitted it as a PR.

lapis vapor
jade glacier
#

You need to spawn a local player object. Do you have one on all clients? @lapis vapor

#

If the client sees server objects, then it is something else.

lapis vapor
#

Inside the network manager, I'm instantiating player on every OnServerAddPlayerFunction and after that this line,
will do it right?. I mean I don't have much knowledge about that

#

NetworkServer.AddPlayerForConnection(conn, player);

#

@jade glacier

jade glacier
#

Seems right, but I am the wrong person to ask. Mirror has changed a lot since it forked from Unet.

lapis vapor
#

It's fine @jade glacier . If u r getting any clue please do tell me . Because I jut started only a day ago

#

No idea other than documentation

jade glacier
#

Run their tutorials? If they have any.

lapis vapor
#

yeah watched a lot. Mine is a special case may be than the formal examples

#

My game is entirely inside canvas render

spring valley
#

Whats the most suitable networking and backend solution for unity

vital hawk
#

that would totally depend on who you ask that question

#

there's a ton of bias for unity networking solutions as everyone has their eggs on some basket

jade glacier
#

You first need to narrow your question down to the game type, and the architecture you are planning to implement.

#

"What is best in life Conan" will get you some pretty non-answers.

gleaming prawn
#

TΓ΄ avoid bias, do not ask...

#

But commonly, different game genres tend to be solved with different approaches... Try to read about that

#

Maybe you should check games you like that are made with unity, and have multiplayer, and ask the developers what they used for it...

#

So there will be bias, but at least you know you might like the result...:)

main forum
#

If I implement NAT punchthrough could I use a free amazon server to act as the remote relay during initial message exchange? If so which amazon model is best used for this?

weak plinth
#

how do i find out when two players overlap in photon?

weak plinth
#

(this is for 2d btw)

weak plinth
#

if anyone has a solution pls ping me

orchid cairn
#

@weak plinth same way as without networking. Use on collision enter and check the layer, tag, name, component etc of the other gameObject

#

One way is to assign your local player a certain tag, and all other players a different tag or however you want to go about it

jade glacier
#

You need to host a server, or use a relay/cloud service pretty much. By same Internet I assume you mean not on the same lan/wan. @weak plinth

#

Not sure of all of the options, but hosting in some form has to cost you - since its an expense for someone with no benefit.

#

Steam might have some options. Photon has free up to a certain CCU count.

#

I don't understand what you mean by same internet then

#

there is only one internet

#

There are Lan/Wans

#

photon doesn't need players to be on the same Wan

#

They may have been in a different region

#

You can force a region to make sure people in different geographic locations are connecting to the same matchmaking

#

In the settings

#

Set the dev region, or set a fixed region in the settings

#

go into the settings

#

and set them πŸ˜›

#

I am happy to help, but there are limits here.

slim ridge
#

heroku is a good place to host a server for free while you test it

jade glacier
#

Though for testing, just host on your dev machine in that case, and open a port.

#

If you are using a unity build for the server.

weak plinth
#

Using mirror, it works pretty good.

#

@weak plinth you can also use hamachi if u just want it for small group/test

slim ridge
#

oh dang i forgot about hamachi

weak plinth
#

That's how people also play minecwaft and other stuff sometimes together without port forward

jade glacier
#

Not sure Minecraft's architecture, but typically your options are nat punch, and or relay.

lapis vapor
#

Guys, Did someone in here have present experience with Unity - mirror integration?

#

This is my network manager code

    public override void OnServerAddPlayer(NetworkConnection conn)
    {

        switch (numPlayers)
        {
            case 0:
                PlayerAddedToNetwork(conn, spawnPrefabs[0],RedPlayerPositions);
                break;
//////////////////////////////
        }

    }

    private void PlayerAddedToNetwork(NetworkConnection conn,GameObject spawnPrefab, Transform[] PlayerPositions)
    {
        playerPrefab = spawnPrefab;
        for (int i = 0; i < PlayerPositions.Length; i++)
        {
            GameObject player = Instantiate(playerPrefab, PlayerPositions[i].position, PlayerPositions[i].rotation);
            NetworkServer.AddPlayerForConnection(conn, player);
        }
    }
}
#

This is the code in Spawned object

    public override void OnStartClient()
    {
        base.OnStartClient();

        transform.SetParent(GameObject.Find("PlayablePanel").transform);
        transform.localScale = (transform.localScale) * 0.1f;
    }
#

Even if I'm spawning 4 gameobjects among them only one is executing OnStartClient

#

Anybody know why?

weak plinth
#

add a debug line there and see if it is really called only once

#

also i think on start client is only called once per player(connection)

lapis vapor
#

Yeah you are right. Per player only ones. But in my case it is called in only among the 4

#

@weak plinth , I varified it with debug message, it is called only in one among the four

#

Idk why it' snot being called in rest of three

weak plinth
#

You add 4 players on one connection. Of course it will only get called once and the others won't

#

use another callback or something

lapis vapor
#

I tried start function

#

But then it is not being spawned in another clients

#

@weak plinth I'm just asking this. I experimented this but didn't work. I parented 4 of these into a common parent and spawned it. But the children didn't got the authority. Is it possible to transfer authority from parent to children. then I can use that alternative

weak plinth
#

use NetworkServer.Spawn maybe

dim mantle
#

Hello everyone, I have a bit of experience with unity and networking, but I have no experience with networking in unity. A lot of the tutorials are from a few years ago and use uNet, so I was curious how to learn how to network on unity currently. Are there any standard packages?

weak plinth
#

I just started using Mirror

#

seems pretty easy

#

its similiar to unet i think

versed rock
#

Hi, any know example of code for how to manage the position of character in a MMORPG? what is the best idea, send roation and position, or only rotation and speed?

#

for a 3d game

weak plinth
#

use a solution like the one I just mentioned

#

or you can use sockets if u wanna go crazyGWczeAngryCry

jade glacier
#

I would absolutely NOT start your networking journey with an MMORPG

versed rock
#

i know it, but i try to create only the basic behavior for prototype and learn more about the networking

jade glacier
#

I would start though if you are looking into learning how to sync transforms well with a 2-4 player thing

#

using your expected authority model (which I would expect to be player authority over position, with rudimentary sanity checks on the server to prevent blatant cheating)

#

Or you might want server authority over movement with client predication

#

But that is getting a bit more advanced than most people want to deal with for their first attempt at a networked transform

nocturne osprey
#

Does anyone know how to get unity to receive twitch oauth API response? Twitch API requires a redirect url so I see now way of getting the response to unity