#archived-networking

1 messages ยท Page 99 of 1

verbal lodge
#

At which step in the migration are you?

weak plinth
#

At the end I guess catcry

#

Let me try again.. maybe will be fixed as layout problem .. idk

verbal lodge
#

Did you do step 3?

#

Looks like you still have the old MLAPI around somewhere.

weak plinth
#

I did this

#

You gave me it yesterday

#

It was a new project..let me try again

#

No error now, so I guess its fine

inner acorn
#

making an FPS for VR

would you use KCP or ENet, and why?

wide hull
#

So I tried making a simpler list (NetworkList<int>) and it showed the same behaviour of having values only serverside and the client read it like if it was empty

#

Does anyone else had had any problem with NetworkList?

robust sandal
#

Can someone @ me if they know PlayFab? Ive got a very simple issue but I cant find anyone who can help me

weak plinth
#

This is happening when trying to join with another client. To host the server works perfectly.

#

Also, on host client i can see there are 2 players

robust sandal
#

Look in the comments

olive vessel
#

You could join the Mirror discord, there's a PlayFab channel there

#

You might have more luck

weak plinth
#

Any solution for my question ? catcry

umbral hare
#

What would be the best mp solution for unity for a mmo realistic fps I'm new to networking and want to know the best product to use in my category

weak plinth
#

Anyone ever use MLAPI.Relay by TwoTen? Is there something I have to do code-wise to accept a client to connect to a host?

verbal lodge
#

There area few people on the MLAPI discord who have used it. They might be able to help you. Link is in the pinned post.

robust sandal
#

It seems to be very difficult to get answers for networking problems xd

olive vessel
#

I would say if you want faster answers, join the relevant Discords, the Mirror and MLAPI Discords are used frequently

weak plinth
#

I joined

#

But still cant figure out

weak plinth
#

Do you know any tutorial that explains how to port forward to connect 2 clients from different countries which is compatible with MLAPI/UNet transport ?

willow zenith
#

I usually hear mirror when they are making TCG online games, what should I use? was wondering how we could make a TCG game that could be uploaded in googleplay? or as an exe with online battles?

mortal willow
#

Hey guys, does anyone do P2P here? Just wondering what's the best way to send and sync data across all clients if someone picks up an item?

#

Any example or lead on how to do this the right way?

high night
#

@mortal willow Your networking solutions usually give you "RPCS"

#

You call a special method on a networked gameobject
and that same method gets called for the same object with same paramaters on all clients

inner acorn
#

mirror with ignorance or kcp is good

weak plinth
#

Hello ! I can join with 2 clients on my game, but when I try to join from 2 devices on same network it does not work. What is the problem ? Do I have to specify what IP should second device connect to ?

tranquil nest
#

Dose anyone know a video tutorial for epic online services?
I read the documentation but I have a hard time putting some stuff in to use and it would be probably easier seeing an example.

high night
#

@weak plinth you should probably host using your local ip

amber pilot
weak plinth
willow zenith
#

how about epic for unity?

analog shoal
#

Authorization server shooting games
I have some problem with sync shooting and player movement. For example a remote player or bots fire at the different direction, somewhere in past position. The weapon is not aimed at players
Movement inputs (client) and movement states (server) are sent and received in a fixed rate
but shooting input is not.
I want to add it in snapshots as well.
My question is:
Ticks: t1,t2,t3,...
Suppose a remote player shoots at time t (before snapshot t2 and after t1)
Should it be sent to the server at snapshot t2?
How can I create a snapshot for it so that after receiving, other players can play shoot animation for that remote player at the right time?

#

I have another question too.
When consuming a medkit and then cancellation
Suppose players can cancel medkit consumption by pressing a button.
After pressing that button, should the client wait for confirmation from the server to cancel it or immediately, cancel it and then after receiving the data from the server, check the current state with the received state and if they have conflict with each other, update it?
Different actions can cancel the medkit consumption. Shooting, switching weapons, etc. For these situations, I think it is better to handle it completely server side.

dense hedge
#

@analog shoal
If you have a server-authoritative tick-based simulation, make sure everybody shares the same timeline (tick N is tick N for everyone). As part of that, make sure clients rollback and re-simulate from the snapshots they receive.

(I've paraphrased some of your questions)

What can I put in the snapshot so that other players know to play the shooting animation at the right time?
Easiest thing to do is include animation data in your snapshots. If that's too large, see if you can infer animation triggers from the other snapshot data.

I have some problem with sync shooting and player movement. Everybody is shooting at where stuff was in the past.
Relativity always wins. You can either run lag compensation or make everybody extrapolate everything. For lag compensation, make the server store past collider states and have it resolve hits using that.

Should the client wait for confirmation from the server or predict the outcome of doing X?
This is up to you. As a general principle, if you want some code to run exclusively on the server, just remove those lines from the client version. Clients will sort themselves out when they get another snapshot.

weak plinth
#

What port should I forward to allow other IP connect to my host ? (MLAPI/UNet transport)

olive vessel
#

7777

#

You don't have to use that port, it's on the Transport's component

weak plinth
#

Im trying to port forward now

#

Its first time I'm coming this deep into router's settings

#

Step 3: Next, locate the port forwarding settings. Typically this will be under Advanced and then Port Forwarding or Virtual Server.

#

I dont have this ๐Ÿ˜ฆ

olive vessel
#

Huh, that's odd

weak plinth
olive vessel
#

That is port forwarding...

#

That is port forwarding...

weak plinth
#

Really ? ๐Ÿ˜ฎ

olive vessel
#

Well it says forwarding, and it has port numbers and protocol

weak plinth
#

Thats how i though, too xD

#

TCP/UDP protocol ?

olive vessel
#

I believe it is UDP, could be wrong though

weak plinth
#

Required External IPv4 Address:
Required External Port:

#

What are theseee ?

olive vessel
#

Not sure on the first one, you'd have thought the router would know your external IPv4

#

The external port should be the same though, 7777

weak plinth
#

maybe its IPv4, too ?

olive vessel
#

You might have to Google what that means for your router brand

#

Unless you literally put your own IPv4 address in

opal jasper
#

Bolt has Nat Punchthrough. ๐Ÿ™‚

azure crown
#

If youre talking about photon bolt, youre right. But it only has 20ccu for free. After that youre gonna have to pay. And photon are very expensive compared to what you get.

edgy rain
#

hey guys can please some one help me i got a bug in my multiplayer game where the client if jumps the player flying away :S can some one help me ?

weak plinth
#

can anyone help me how to make a cloud gaming server for free

frosty hazel
#

Can anyone share a good way to share item data (name, description, etc) between unity projects in development?

olive vessel
#

I would be surprised if you found any server space worthwhile without throwing any cash at it

rustic wraith
#

I recently decided to implement multiplayer in my game. I am a total noob tho. Shall I go for unity's new solution or for mirror/something else?

haughty heart
#

Mirror or photon for an already existing, time tested solution.

rustic wraith
#

ok thank you man

gentle gulch
#

Hi! I'm new to Multiplayer and followed a tutorial from SRCoder. I did everything what he did in the tutorial and it worked, now i tried to implement it in my game, but if i try to join, the transform doesn't sync. I have the networkTransform object on my player but that has a lot of children. Has that anything to do with it?

echo flower
#

HOW CAN I MAKE A ONLINE GAME WITHOUT SERVERS?

gentle gulch
devout vigil
#

any reasons why downloading MLAPI by git URL would not work?

#

when clicking 'add' i get errors

olive vessel
#

What errors?

devout vigil
devout vigil
olive vessel
#

Install Git

devout vigil
#

oh ok

olive vessel
devout vigil
#

and i need to restart my PC right?

olive vessel
#

If it asks you to, I'd say so

devout vigil
#

I think it worked thanks <33

echo flower
olive vessel
#

Unfortunately I don't speak Italian, but judging by the title that is about P2P

proud snow
#

even p2p uses some servers, to do so-called NAT punch through. But it is much cheaper than a server actually hosting a game instance

weak plinth
#

How can I run a script after host has started ?
Now, my script runs even before I host

weak plinth
teal obsidian
echo flower
#

Ad hock

#

Thre is on Play station P

azure crown
#

Try Peer to peer I guess

#

But even then I think you will need a relay

echo flower
azure crown
#

Your psp?

#

as in, portable playstation?

echo flower
#

play sation p

azure crown
#

What game is that?

echo flower
#

is a console

latent horizon
#

I think you're talking about ad hoc local connections, but that's not really "online" in the usual sense

echo flower
azure crown
# echo flower

If you want actual online without servers, you need to use the P2P network solution. But even then you will need a relay.

echo flower
#

that console have 2gb of ram

#

hmhhmhhmh

#

so much

#

my computer has 4 gb

#

and the ps4 has 8gb

latent horizon
#

ok?

azure crown
#

lmao so?

#

Whats your point?

olive vessel
#

Unity can build for PSP?

azure crown
#

XD

#

I dont think it can

echo flower
latent horizon
#

Even if it ever could, Sony isn't going to give anyone a dev kit anymore

echo flower
#

yes

azure crown
#

Ok so what was your question?

echo flower
#

nothing........

azure crown
#

k

oak flower
#

@echo flower Don't post off-topic media.

echo flower
#

where?

#

the kid

devout vigil
#

hi
NetworkManager.Singleton.StartHost();
and
NetworkManager.Singleton.StartClient();
throw errors that
Assets\Scripts\MenuScript.cs(11,24): error CS0117: 'NetworkManager' does not contain a definition for 'Singleton'
even though i have assigned a player prefab to the network prefabs

#

please help

devout vigil
#

I'm trying to set up UI buttons btw

swift surge
#

ok so I've been looking at ths MLAPI thing and trying to figure out how it actually sends messages, and as far as I can discern from looking through the source code, it uses UNet internally o_O

#

But if UNet is deprecated and that's such a big deal that Unity has warnings about it on every page of the manual saying not to use it, then uhhh

patent fog
#

You should be able to select the Transport you like

swift surge
#

How does MLAPI work then? Are they planning to change it to not use UNet, and if so, what will it use?

#

I can't find a transport system other than UNet anywhere in here.

patent fog
swift surge
#

like, I found the MultiplexTransportAdapter class, but it itself seems to just lead back to UNet when I dig through the references in the code files.

patent fog
swift surge
#

That's what I did. The two options in the list are "UNetTransport" and "MultiplexTransportAdapter"

#

The really crazy thing is that just now I decided to step through the tutorial and it's telling me to select UNetTransport O_o

patent fog
#

I know you can also use com.unity.transport but thats pretty low level you would code yourself

verbal lodge
#

We plan to use our new transport the "Unity Transport Package" in the future to replace the UNetTransport

patent fog
#

I tought you could use third party transports but I'm not sure know ^^

verbal lodge
swift surge
#

Do I just add com.unity.transport as a package via the Git URL thingy?

#

ooooh those look cool

verbal lodge
#

com.unity.transport is not supported yet by MLAPI. Most likely will be with the next version.

devout vigil
swift surge
#

As I mentioned way back last time I brought up this topic, I'm interested in exploring how to bend this concept to my own purposes via code, so it's good to know it may be getting support for new things but for the moment, while I'm poking around, it not supporting something is no problem ^^

patent fog
swift surge
#

This com.unity.transport thing looks like exactly what I want. Thanks~

devout vigil
patent fog
#

yeah try to delete please, might confuse the compiler

devout vigil
#

it worked

#

thanks a lot

patent fog
#

or force namespace with smthg like MLAPI.NetworkManager.Singleton.StartHost();

#

oh great ๐Ÿ‘

devout vigil
# patent fog oh great ๐Ÿ‘

actually the code is compiling but i can't press the buttons. Also when I 'start as host' via the network manager in play mode, the player spawns normally but the camera doesn't change itself to the player camera

#

im kinda confused

swift surge
#

man it sure is nice when sample code actually works >.<
The sample code from the Transport package documentation was completely broken and only just now did I get it to quit throwing errors ^^;

devout vigil
#

Please help xd

swift surge
#

Transport uses DOTS internally -_-

swift surge
grim bramble
#

So i am creating a Multiplayer game using Photon Pun 2.

Right now, the game is pretty simple, a player spawns and can shoot some spears.

I am using everything correct, like photonView, PhotonTransformView, PhotonRigidBodyView, etc. But when the player moves or the spear is trowed, it moves and it goes like a little backward really fast and then continues to move and goes a little back again and so go on. If i am the player or if the spear is mine, the movement goes really smoth, but if it is another player or another spear, the movement goes like i described.

I am using PhotonNetwork.Instantiate but i think i may need to add a PRC function to set the position of the instaciated object in an players view, i am right?

I though doing the same on the bullets, when firing, i instaciate then i set a PRC function to set the position.

Or should i instaciate with a PRC function??

Or should i use the classic photon transform view?

Need help on this, because i am a little desmoralized because this multiplayer lag is kinda ruinning my expectations

teal obsidian
#

So the current way my netcode operates, is every tick, the server just sends each client a list of entities with position/rotation etc and if the client sees that he doesn't have an entity on the list, or has an entity that the server doesnt have, he knows to spawn/delete that entity

#

should I just be doing RPC's instead, to spawn/delete?

stiff ridge
teal obsidian
#

What is raiseevent?

stiff ridge
# grim bramble So i am creating a Multiplayer game using Photon Pun 2. Right now, the game is ...

When you Instantiate a networked object (with PhotonView on it), you don't have to use RPCs to set values on it.
When you throw a spear but use OnPhotonSerializeView or RPCs to "observe" it's position, your local simulation and the updates may assign different locations. This can be smoothed and solved but apparently in your case, there is a delta, which is visible.

Simplified: use OnPhotonSerializeView (TransformView, etc) to sync characters.
You can use RPCs to shoot. As a projectile is easy to simulate, don't update it's position. Calculate this as good as you can (compensate for lag, move smoothly). The shooter or the hit target can detect and signal a hit (if one happens) via RPC.

teal obsidian
#

Oh I don't use photon or any 3rd party libraries

#

I was just using RPC as a general term for sending messages

stiff ridge
#

I see.
Well. Yes, then use a RPC / command / message for it.

teal obsidian
#

alright

dense hedge
#

I think your implicit spawn/delete using set differences works better than having the server send a "Spawn this." RPC if that's what you were asking.

graceful zephyr
#

@dense hedge on point, i agree

weak plinth
#

Hey so ive been struggling for months to get this to work. So bassically when I get 2 players in a scene, it somehow switches and glitches out. At one camera theyre stuck together and moving. And at the other client theyre stuck together and its weird. I dont know how to fix it. If anyone can help thanks. I use C# and Photon Pun

lament bough
#

I'm stumped on a general problem regarding UDP messages: I had a previously working Quest app which listened to UDP packets in order to do server discovery; as I switched over from Quest 1 to Quest 2 the app won't work anymore, it simply won't listen to the network

#

since I'm 100% sure that there's some thread fuckery involved in the background, what would you use for a barebones UDP listener? Keep in mind it's not being used for a multiplayer game, think of it as a remote controller from a desktop app

prime stag
#

(sorry if this is cross posting but I just realized there is a networking section) can anyone help me my question is in general-unity.

crisp prairie
#

do you guys know some good ways to write deterministic simulation code in unity?

gleaming prawn
#

Photon Quantum...

crisp prairie
#

well, something i can use for free ? ๐Ÿ˜„ Quantum is like expensive right? ๐Ÿ˜„

gleaming prawn
#

For now it is, yes

#

Maybe in the near future we'll change that. But not possible yet.

#

Here's the thing:

  • nothing in unity is deterministic.
  • so, technically, you need to build every single system you need (physics, navigation, transforms, every-thing)
#

there are a few open source FixedPoint math libraries around (not super good performance, but valid nonetheless), a couple of physics engines (also not good performance, but perhaps useable)

#

Those are the super basic minimal things you need, besides a way to coordinate your either lockstep OR (better) predict rollback netcode

#

If you are only developing a 1v1 simple game, this last part can be achieved with GGPO over a p2p transport layer... But for anything with more than 2 players, the only solution I know of for Unity is quantum... That's the fact (at least AFAIK)

#

Disclaimer: I'm one of the developers of it...

crisp prairie
#

hmm well i wana do an rts so i was thinking the deterministic lockstep is the way to go.

#

oh rly? well thats cool XD

gleaming prawn
#

ye, for RTS you also need to develop a few bespoke things

crisp prairie
#

but still might be to much for a side project for me to inverst in

gleaming prawn
#

Like group path-finding (probably flow fields)

#

if it's a small scale rts ( a bit like warcraft 3), navmesh pathfinding (like ours in quantum) can be used

#

but for massive numbers, it's generally flow fields

crisp prairie
#

well yeah i looked a bit in flow fields a while ago. Its a very cool aglo for navigation. But before i can go more detailed into that need some math basis to write the simulation. I dont want to write all the vector math myself so i am currently looking for libarays i could use.

gleaming prawn
#

at least the math to replace floats you have a few

#

full Vector, perhaps as well... I just don't search anymore because we have our own.

#

that's the easiest part

crisp prairie
#

well 1k per month ๐Ÿ˜„ maybee when i own a company one day

harsh dew
#

250 if I remember correctly for a single seat

crisp prairie
#

250 per month is still very expensive for a hobby project

#

well but thanks i guess i have to search a bit more for solutions

harsh dew
#

They might give you access if you ask them nicely ๐Ÿ˜‰

crisp prairie
#

XD

weak plinth
#

Hello !
I am trying to make the enemies follow the player when he gets closer. I am using MLAPI. How can I get the transform for everyplayer or how should I make this script ? Any advice, link, or code ?

faint plaza
#

Can you use ONLY steamworks to make multiplayer for an entire game?

#

And if not, would you guys recommend Mirror or Photon for a small fps game? It would be based on player-created lobbies and might go on steam at some point

high night
#

@faint plaza I'd use mirror i were you

#

Mirror supports steam transport

#

You should be able to switch your transport at some point if you want and have your game working on steam

faint plaza
weak nest
#

If you knew what you know today in the beginning of your project, what networking solution would you pick for a 3-5 player coop isometric action rpg?

weak plinth
#

Hello !
I am trying to make the enemies follow the player when he gets closer. I am using MLAPI. How can I get the transform for everyplayer or how should I make this script ? Any advice, link, or code ?

weak plinth
#

Yes ?

olive vessel
#

Nvm, you got a good response in the MLAPI Discord

weak plinth
#

Well, still searching for a solutin ๐Ÿ™‚

olive vessel
#

Luke gave you a great one?

weak plinth
#

Its kinda slow, I am looking for a faster one maybe

olive vessel
#

Well currently you don't even have a solution, and providing you don't have 100 players I don't see why it would be slow?

#

How many players are you gonna have?

weak plinth
#

Its a MMORPG, wothout game sessions, so all players will be checked

olive vessel
#

Sigh You're making an MMORPG...

weak plinth
light pollen
#

hey i'm using a .net Network library called Network. I can't connect with unity with a server on my own pc for some reason. Do i have to do something special in general for it to work?

mortal drift
verbal lodge
#

There is a link in the pinned message of this channel

pulsar oriole
#

Even with the same computer you can be blocked by the port, even if your using the ip 127.0.0.1 as the ip your connecting to.

light pollen
#

i found out that its an error of the network library

#

some versions are not in sync with each other

thin ether
#

Hi
I was actually trying to build my Unity project which had multiple scenes with WebGL and nodejs as backend so that I could also add some data

#

This is the error I got with 3 scenes

MoveMap.loader.js:1 wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'

When I removed the first and last scenes of the game, so that only one remained, it worked quite nicely without any such errors

#

Can anyone please tell what could be a possible solution

patent fog
proven belfry
#

Hi

#

I have two scenes which are lobby and game. I have two buttons which are to host or join a hosted game. So i have made a script for menu and attached codes into buttons to host or join onclick. Just like NetworkManager.Singleton.StartHost();

So it creates default prefab into scene when i press host button. But im stuck here with how it should be. Do I need to load next scene and then Start Host?

#

Or Start Host() in Game scene on Start(); after i press Host Game button to load Game Scene?

weak plinth
#

Hello, so last week I went on a vacation and didn't open Unity for a week or so, and everything in my game worked great, but now all of a sudden when I try to click play in the editor, everything just basically disappears. It seems like at least my awake and start are being called considering I have them do some object initialization, and the objects are there, but everything else is not, and MLAPI says it's trying to destroy object 0, but doesn't exist anymore. I honestly have no idea how to go about this, nor know how to debug something like this (relatively new to Unity). My NetworkManager also does not seem to be instantiating my "player" prefab.

Thanks in advance! Here's some screenshots:
(game is super simple at the moment btw)
before clicking play: https://i.imgur.com/yY32XOu.png
after clicking play: https://i.imgur.com/hR7CzI5.png

#

tl;dr: everything disappears when i click play

slim ridge
#

close unity, delete library folder, open unity

faint plaza
#

What are the differences between MLAPI and something like Mirror? is one better than the other?

olive vessel
#

MLAPI is certainly newer

weak plinth
#

@slim ridge nope same thing :(

pulsar oriole
proven belfry
#

๐Ÿ˜‹

proven belfry
#

Guys iam learning mlapi. I got stuck with a question. I want to create a lobby and list rooms there when people create a new room as a host. So would i need to hire a server to list online rooms which are created by people. Or mlapi has features to list host rooms which are active?

#

And free?

verbal lodge
frozen stump
#

Hi! Any of you has made a websocket server in Unity? I found some libraries but they don't seem very up to date

spring crane
#

@frozen stump Does Mirror count? ๐Ÿ˜„
You probably could borrow the transport to have something that is more likely to be supported and in use.

frozen stump
#

@spring crane well, my best bet is to include a nodejs process and use the console to communicate with it

devout vigil
#

Am i doing aomething wrong?

#

Im copying it into the 'add paclage from git URL'

#

It loads for a second and then nothing happens

quaint hull
#

If any of you have experience with Unreal Engine, which game engine is easier to implement multiplayer?

finite geyser
#

can i ark some question?

olive vessel
#

Of course, ask away

finite geyser
#

I have a problem with culling mask not working in game. but work on camera preview

#

And Collider not work

#

This problem happened after I downloaded 3D game kit

fathom lark
#

Paying someone for help ยฃ$ยฃ$

olive vessel
finite geyser
#

Thank you very much.

faint plaza
#

I'm using this code:

    [Command]
    public void CmdSpawnBullet() {
        GameObject bulletClone = Instantiate(bulletPrefab, bulletExit.transform.position, transform.rotation);
        bulletClone.GetComponent<Rigidbody>().velocity = bulletPrefab.transform.forward * bulletSpeed;
        NetworkServer.Spawn(bulletClone);
    }

to try to spawn a bullet across the network, but for some reason only the client instance can spawn it on both instances (like when I shoot on the host+client instance, it shows on their screen but not on anyone else's, but on the client-only instance it works as intended)

faint plaza
#

If there is a better way of doing this, please ping me and let me know, but I think I fixed it by getting rid of NetworkServer.Spawn() and making the CmdSpawnBullet call a ClientRpc that has all of the old CmdSpawnBullet code pasted into it (except for NetworkServer.Spawn())

grim bramble
teal obsidian
#

So you know how in some games, entities won't update on the client, if he's too far away from that said entity?

#

how does that work? Does the server determine length of vectors and just not send to that client? Or is it the client's job to just not update it to save cpu?

#

because right now I'm running into (not really a big problem yet) where if I'm updating 1,000 entities w/o colliders from server->client, it takes the client around 3/4 of a millisecond just to apply the transform.position to it

#

transform position seems mildly expensive in this case.

dense hedge
# teal obsidian how does that work? Does the server determine length of vectors and just not sen...

The server-side is called interest management (or area of interest). It's basically collision detection. You have some accelerated broad-phase, optionally followed by a simplified narrow-phase.

For example, Fortnite servers use a grids to filter the list of relevant objects down to those in the same grid cell. IIRC they stop there, but you could also iterate those filtered objects and check "Does this object's bounding box intersect a big sphere centered on Player X's avatar?" etc.

teal obsidian
#

If entity is too far away, don't serialize it for the player

dense hedge
#

In any case, you'd probably want to sort by distance so you can prioritize the closest entities, but iterating every entity for every player isn't going to scale.

teal obsidian
#

You're absolutely right about that last part

#

so should I have the client do it instead? Just check distance to see if he's going to update that entity or not?

dense hedge
#

So you can have the clients pause updates, but tbh if setting 1000 transform.positions is slow, you're jumping around in memory too much. Branching might make it worse. I think you should keep similar objects/components packed together.

teal obsidian
#

I have three separate entity types. Players, cars, and generic entities

#

I think diverging any more would be too clunky

#

I'm not sure though

#

You mentioned fortnite doing grid based stuff. Does the server calculate that and then re-serialize the list of entities for all players?

dense hedge
#

So Epic has this "replication graph" arch. where each "node" is a filter that lazily updates its list of matching entities. The lists are incrementally updated once per server tick.

When the server goes to build a packet for each client, it checks what nodes each client is subscribed to and just starts writing entities from the intersection of those nodes' entity lists.

#

The grid cell is just a kind of node for them.

teal obsidian
#

That sounds complicated but alright

#

I still have no clue how I'm gonna solve this problem

#

for half of the problem, I guess I could just check if the rigidbody is sleeping or not, and not include it in the serialization if it is

dense hedge
#

Sure, I was just using them as an example. The grid is still pretty simple. On the client, you could also maybe treat the rigidbodies of entities who didn't get an update as kinematic / put them to sleep.

teal obsidian
#

client doesn't use rigidbodies, only server does

#

client just translates using server data

#

I guess I could just rework my game to focus more on placeable static entities instead of rigidbodies

#

but I'll still need rigidbodies for my bullets ( at least I'd like to ).

teal obsidian
#

Is it possible to get smooth first person gameplay on an authoritative server with prediction with a tickrate of 10-20?

#

You'd need some heavy lerping right?

#

So far I've been unable to get smooth movement with a tickrate below 30hz. It just looks jumpy

dense hedge
#

It's definitely possible. Plenty of CoD games have a 20Hz update rate. I dunno what you mean by heavier interpolation, you just delay it more.

#

If you imagine snapshot interpolation like scrubbing an animation timeline, you want your cursor at least 1 snapshot behind, so you always have something to lerp toward.

#

Lowering the update rate just increases the spacing between snapshots, so the interpolation delay has to increase.

#

You can have the server tick and send updates at different rates btw.

patent fog
#

Like Joy said the basics of Interest Management starts from distance checks. Then there's Halo multiplayer who rates every entities some kind of update framerate score based on how relevant it is for the player client to witness it. There's a GDC talk about that, i could find it if you're interested

#

Actually you said distance and Joy talked about collision-like checks and grids, but that's the same spirit ๐Ÿ™‚

#
GDC

In this 2011 GDC session, Bungie's David Aldridge discusses the programming that drove Halo: Reach's online networking.

Register for GDC: http://ubm.io/2gk5KTU

Join the GDC mailing list: http://www.gdconf.com/subscribe

Follow GDC on Twitter: https://twitter.com/Official_GDC

GDC talks cover a range of developmental topics including game des...

โ–ถ Play video
dense hedge
#

Yeah, proximity or visual salience (how much something occupies your FoV) are usually the best heuristics, but to guarantee eventual consistency you really want all kinds of relevance to feed a per-client "send priority" value.

#

Whether it's distance, putting certain entity types in different frequency buckets, "relevant only to owning player", etc.

#

IMO the most basic filter is "Did this entity change?" Use that to set a non-zero send priority for that entity that then accumulates until sent.

patent fog
#

grid-based + age

#

+ignore the overflow, but I never saw how this part behaves

dense hedge
#

wdym overflow

patent fog
#

Entites that didnt score enough interest don't get updates sent

#

I guess you have to tweak it

#

depending on FOV and such

#

dependig on scale of your game

dense hedge
#

You don't need to do anything special for stuff that doesn't fit in the packet. The age contribution to importance always increases, so the leftover entities will generally be the most important for the next update. Really, everything will be sent long before age saturates.

patent fog
#

"Once a packet is full, the server sends it and the remaining entities are missing from the snapshot. Because the age of the entity influences the importance, it is more likely that the server will include those entities in the next snapshot."

dense hedge
#

Exactly.

patent fog
#

So you would say it's a hard limit regarding hardware anyway, hence the Interest management with any strategy you want to at least smartly pick which one get prioritised

dense hedge
#

A 32-bit integer should be more than enough to hold the priority value. The limit is bandwidth.

patent fog
patent fog
dense hedge
#

Keep in mind that the priority resets to zero when sent to the client. Packet loss is generally far below 1%, so if you're sending updates 20 times a second, almost nothing should have a large age.

stiff ridge
grim bramble
stiff ridge
#

Yes, this is usually a good idea and learning process. It could be a number of smaller/sneaky things that went wrong, so .. hard to say.

left basalt
#

Hi. I have issues establishing a port forwarding and making it work with MLAPI. Has someone already done this?

teal obsidian
#

So, is it viable to reserialize 1,000 entities for 60 players each

#

only serializing entities close to player?

#

assuming you're only serializing entity ID, position, and rotation

dense hedge
#

It's possible, yes, but half the point of doing interest management is so you don't have to send 1k entities all at once. Each packet can only fit ~1200 bytes (1280 byte MTU). ID, position, and rotation is ~32 bytes per entity.
If you were sending "full" snapshots and really clever about compression and not repeating work, you can pack a large number of entities and get away with only serializing a handful of snapshots (most of the time), but mixing interest management and compression is more complicated.

steep gyro
#

Hi all. I am trying to make a matchmaker system for my game using mirror and I need some way to have a list with current matches / status on the server. I need to be able to access and update this list by all three (client, roomserver, matchmaking server). Any ideas what would be the least resource intensive method to use about this? (I would like to avoid having to set up sql on the server if possible). Thanks in advance.

drifting heath
#

i wanna make a multiplayer game in which you can get into a room with an invite, the game is basically: you describe a word with single-syllable words, and people try to guess and rate it

#

the problem is that i didnt work with networking before, and have no idea what to use

quaint hull
#

I'm looking for something reliable, but I understand how much of a pain it is to custom code packet handling

upper mica
#

I'm trying to read the currently connected clients from a client through a MonoBehaviour. I called NetworkManager.Singleton.ConnectedClients.Count to get the count of clients, but it doesn't seem to work... Anyone knows why?

olive vessel
#

Don't you need a ".Singleton" in there after NetworkManager?

upper mica
#

Ah, yes I do that as well. Let me edit my message.
I'm using a linter to make sure my code is following the standards and syntax, so I'm assuming there's something wrong with the logic.

proven belfry
#

Hi guys

im trying to reach UNetTransport script from NetworkManager object via another script that i attached to Network Manager object. But unity says its not found (NullReferenceException.)

GetComponent<UNetTransport>().ConnectAddress;

olive vessel
#

You included the namespace for it?

proven belfry
#

idk

olive vessel
#

Well neither do I, and I can't read your script

proven belfry
#

wait ill send ss

#

it says line 17 has exception

olive vessel
#

Don't you want to be deriving from NetworkBehaviour instead of MonoBehaviour

proven belfry
#

let me try

#

Still exception

olive vessel
#

Presumably, this script is on the object containing the UNetTransport component?

proven belfry
#

Yes and it also has network manager script. I chose unetTransport from networkManager script so it added UNetTrasport script automatically. And i tried to reach this script to take connect address.

olive vessel
#

Move the text setting line below your IF, that will be more useful

proven belfry
#

Ok

#

Unity's invaders tutorial do it like this.

var uNetTransport = (UNetTransport)NetworkManager.Singleton.NetworkConfig.NetworkTransport;

if(uNetTransport) m_HostInput.text = uNetTransport.ConnectAddress;

olive vessel
#

Did you move the IF?

#

Did the console print out that debug?

proven belfry
#

No debug in console

#

Should i reach UNetTransport script via NetworkManager script?

#

im confused

olive vessel
#

So you got the error, but no Debug?

proven belfry
#

Yes as u say

olive vessel
#

That must mean the text is the culprit

#

You [SerializeField] did you drag it on?

proven belfry
#

Yes its there in the slot

#

Let me try with debug

olive vessel
#

In that IF remove the .ConnectAddress

proven belfry
#

why? i need to take this address and text it on scene.

olive vessel
#

I am well aware, but we don't care about the address, we want to see if you can get the component

proven belfry
#

Ok let me try

olive vessel
#

Although, I'm sure you can get the component

proven belfry
#

No debug in console*

olive vessel
#

Then you must be able to get the component

#

Do the same for your Text

proven belfry
#

Ok

#

No debug on console

olive vessel
#

Then unfortunately, I have absolutely no idea

proven belfry
#

Thx for trying to help

nimble ermine
#

anyone here knows if you can do something similar to server select in club penguin with photon?

patent fog
#

When in doubt, always begin with double-checking the docs ๐Ÿ˜„

upper mica
#

@patent fog Yeah, I did! This indicates that it should be readable on the client, and modifiable on the server?

#

At least that's how I interpreted it. What I want is to read the amount of connected clients from a client. :)

proven belfry
#

Dude read it by server then take info into client

upper mica
#

Literually what I did.

proven belfry
#

ok then

#

๐Ÿ‘

patent fog
upper mica
quaint basin
#

Hello, little advice to a noob here please. building an 1v1 online game running on photon (basically one of the two players acts as a host) and was able to hook up Playfab today, great tool, especially the json functions you can run serverside.

#

However, if my game is running on photon, is it even worth it having these functions on the server, not going to make cheating any harder?

#

multiplayer is new to me

broken raven
faint plaza
#

Should each GameObject only have 1 script that extends NetworkBehaviour?

upper mica
#

@faint plaza According to the documentation, a GameObject can have multiple NetworkBehaviours, but only one NetworkObject.

wary lintel
#

Hello Can Somene help me with installing MLAPI. It says i have to install Git in order to download it but i have Git and i can't still install it.

verbal lodge
#

What happens if you try installing it?

wary lintel
#

I get this error

verbal lodge
#

Did you just recently install Git? If yes restart your machine (not just Unity)

verbal lodge
wary lintel
#

It worked thank you for your help ๐Ÿ‘

weak plinth
#

how would I even start networking?

#

like a simple create and join room type stuff.

olive vessel
#

I guess you should follow a tutorial

weak plinth
#

yeah, but a lot had paid solutions

olive vessel
#

I'm sure there are free tutorials?

weak plinth
#

ok

olive vessel
weak plinth
#

ok

hallow halo
#

Hey I have a question

#

Is mirror better than photon or photon better than mirror

olive vessel
#

Depends on your game

patent fog
#

Yup, like asking is a screwdriver better than a hammer ๐Ÿ™‚ Depends if you need to put in place a screw or a nail

olive vessel
#

And to some extent, your money

patent fog
#

True

olive vessel
#

Photon needs payment over a certain CCU limit (10 I think) but Mirror needs either dedi servers or P2P

faint plaza
#

I'm using Mirror and I added a script that extends NetworkBehaviour to a child object of an object with a NetworkIdentity, and it is trying to automatically generate a NetworkIdentity for the child object. Is there a way to not have this happen? Or do I have to just put all the NetworkBehaviour scripts on my parent object?

#

For now I'm just adding a reference to another script that extends NetworkBehaviour and calling methods through that, but I'm sure theres a better way to do it

mortal drift
#

Good day, I'm doing an FPS where the players have to collect bullets, I managed to collect them and add them to the variable but only in the host it adds to that variable and in the client not, and I no longer know how I have to put it so that it is added for each player.

hallow halo
#

what would be better for an fps mirror or photon

haughty heart
#

They're both capable.

hallow halo
#

but whats easier to put together

olive vessel
#

How relevant this table is, I do not know, but I've seen it a few times

#

Don't be fooled by "Free", in those cases you use peer to peer or host dedicated servers

hallow halo
#

peer to peer?

olive vessel
#

Think Minecraft LAN world

hallow halo
#

im new btw

#

ok

#

ok

olive vessel
#

Also Photon does give 10 CCU free I think

hallow halo
#

ccu?

olive vessel
#

Concurrent users

hallow halo
#

concurrent?

olive vessel
#

I'm not your dictionary

hallow halo
#

ok

#

one trip to google later...

#

so a max of 10 users at a time can use it for free?

#

but over ten and it costs you?

olive vessel
#

Yeah, I don't know their exact terms and pricing

#

Oh it's 20 free

haughty heart
#

Don't be encouraged by a 5 star "ease of use". If you're new to this, you're not going to have a fun time.

hallow halo
#

i know a little bit about mirror

teal obsidian
#

Is TCP going to be significantly slower than UDP in terms of CPU usage?

#

can I turn off nagle's algorithm for more speed?

verbal lodge
#

CPU usage is usually not an important factor when choosing between TCP and UDP. CPU performance of TCP is not significantly worse than equivalent RUDP protocols. You can turn off nagle's algorithm but it shouldn't affect CPU too much. Disabling nagle's algorithm will disable batching of your TCP packets which will mean more packets are sent out. This can reduce latency but increases the amount of bandwidth used (because more packets means more packet headers sent) if you send a lot of small packets.

teal obsidian
#

Very informative. Thank you

dense hedge
#

Though no matter what you do, you can't prevent TCP from blocking newer packets when earlier packets are dropped.

teal obsidian
#

I mean if you have a stable internet connection, that shouldn't be much of an issue right?

#

shouldn't be happening all the time, is what I'm trying to say

#

I sort of need reliability for order of packets due to the nature of my netcode. Entities only update when they're modified

#

If packet 4 comes in then packet 3, that's gonna cause some serious problems

dense hedge
#

Packet loss might be rare, but if the server just keeps going, your client still has to deal with being knocked out of its relative alignment by TCP re-transmission (it'll fall behind by at least RTT).
Reliability and ordering are separate. You can track what sequence number you're expecting to arrive next and buffer incoming packets in an array that you sort and dedup.

teal obsidian
#

I'm not sure if there's much to be knocked out of, since my clients just accept info from the server as fast as it's being sent

#

I do use UDP however, to get movement info and such from client to server

#

since that always sends each tick no matter what

#

anyways I need to go to bed, I'll read your messages in the morning

dense hedge
#

Not trying to say TCP is bad, but its weaknesses in real-time stuff can't be ignored. They're worth knowing. TCP (in effect) stops the server from sending newer state data to a client until that client has confirmed receipt of everything older.

client
        |---  ~ RTT/2  ---|
<-+-+-+-|-+-+-+-+-+-+-+-+-|-+-+-+-+-+-> ticks
        ^                 ^
  authoritative       predicted

The main penalty with TCP is that ARQ can add significant delay on top of network latency. If you have packet loss server -> client, predicting clients will desync for longer, which means heavier, more jarring rollbacks when they finally get the data.

If the server just sends movement data uncompressed, the client can just ignore all but the latest update when it recovers from the stall. If the movement updates are delta compressed (changes only), you'd probably want the client to merge the stalled updates, so it can just do one rollback.

If your clients visually interpolate remote entities, you'll want their interpolation delay to be sort of "packet loss-agnostic" so they can fast-forward through the stale visuals, or else they'll fall more and more behind.

dense hedge
#

So "reliable, delta-compressed snapshots" are good if you need the smallest packets possible for a big game (at the expense of higher latency). But if you aren't doing that and you're just going to ignore or skip past updates when they're stale, there is no point in sending them reliably.
(You can do unreliable delta-compression btw, compress against the last acknowledged tick instead of against the previous tick.)

jade glacier
#

Yup, for realtime stuff like syncing transforms... TCP looks fun and easy - until pacektloss comes along.
Then things go of the rails in my experience.

ebon grove
#

Is there anyone with experience using Mirror networking I want to run multiple instances of my game on the Server on diffrent ports which works on one instance but when i start a second the first is still working but i cant connect to the second does anyone know if this is possible or do I have to use multiple independent Servers?

olive vessel
#

Presumably, you also set the connect address of clients using the different port, and not the default port?

mortal drift
#

Hello, Does anyone know how I could show Network variables of each client in a text?

ebon grove
obtuse pumice
#

How do multiplayer games generally handle "match instances" say for example cs go. Would the server launch a new process for each match or is there one process that handle all matches?

#

From my own experience it seems like having one process that handle all matches makes the networking more complex but on the other hand running a process for each match might create too much overhead

frail steppe
#

Hai, does anyone have any idea that aside from building the project for testing multiplayer, is there a way to create two instances of the project for testing/debugging multiplayer?

olive vessel
#

Yes, ParrelSync is what I see quoted most often

slim ridge
#

make a build

#

run the one you want to debug in the editor

frail steppe
#

@olive vessel thanks a lot, the reason im not going for building is because its gonna waste a lot of time if im keep doing that

olive vessel
#

Yeah I keep using builds, but honestly I should set up ParrelSync

slim ridge
#

most of the time you dont actually need to build every iteration

#

you can also build debug features into your server

silk burrow
#

Hey! I'm trying to add online multi-player to my small 2D unity rhythm game. Could someone push me in the right direction please. Maybe a video tutorial? Thank you! :)

olive vessel
timber lava
#

is the unity MLAPI finally in a stable release? theres a whole tutorial and documentation page and i was just wondering if its worthwhile

faint plaza
#

If I want to spawn a bullet, can I just spawn it on the server and it will automatically be spawned on the clients? Right now I'm just calling a command that runs a clientRPC that spawns in a gameobject for a bullet and then when the bullet collides, deal damage (another command to change a syncvar)

#

It seems to be working, but most of the tutorials I'm seeing say to use NetworkServer.SpawnWithClientAuthority, but I don't want to give clients authority and it seems to work fine without this, so is it ok the way it is?

modest current
#

hi ive followed this tutorial https://www.youtube.com/watch?v=v8myO5BaZ-I ive followed it completly but when i run it it doesnt enable the controller, does anyone know why?

๐ŸŒ Get the Mega Bundle worth over $1000 for 90% off at https://assetstore.unity.com/mega-bundles/grow-your-skills?aid=1100l9uzi&utm_source=aff
โค๏ธ Using this Affiliate Link helps support the channel

Join Our Community: https://student.dapper...

โ–ถ Play video
modest current
#

nvm fixed

silent flame
#

hey all, I am trying to build a unity game using tcp communcation. I am trying to simulate lag and tried "clumsy" but the latency isnt working correctly in my local machine
what do you guys do for lag simulation?
I need to make lag simulation to see if i correctly implemented client side prediction
So i need to increase the latency between my client and server but they are both in same machine
with clumsy i set the latency as 20 or 2000 they both get arrived so late (like 10-20 seconds later)

faint plaza
#

If I am trying to spawn a bullet prefab on the server, I can just use Instantiate without any NetworkServer.SpawnWithClientAuthority, right?
Also, does my bullet need a NetworkIdentity and a NetworkTransform, or am I good to not use them?

I'm using mirror, and without the NetworkServer.Spawn... and without NetworkIdentity and NetworkTransform components on the bullet it seems to be working fine, but could this cause problems?

austere yacht
faint plaza
# austere yacht it'll only exist on the server if you use no net-spawning/net-sync/net-id/net-tr...

I figured out what I did wrong, basically when I shot I was calling a Command that called a ClientRpc that spawned the bullet on the client, and then the bullet on the client would call another Command that would deal damage to the player it collides with, but I was getting warnings about sending commands on an object the bullet didn't have authority of, so I ended up putting all the spawning into the Command with NetworkServer.Spawn... and that works

faint plaza
# austere yacht it'll only exist on the server if you use no net-spawning/net-sync/net-id/net-tr...

It seems like I am still getting an error that I am "trying to send command for object without authority" within my bullet script, can I just ignore this? It is happening because I am accessing the TakeDamage command through PlayerControl script on the gameobject (player) that it collides with using
col.gameObject.GetComponent<PlayerControl>().CmdTakeDamage(damage);
and I guess it doesn't like that since it doesn't have authority of the Player GameObject

#

Should I just do something like CmdTakeDamage(gameObject) on the bullet script to fix this?

austere yacht
spring crane
#

@faint plaza I think Mirror added an attribute to properly ignore authority

empty cradle
#

Hello there I have an issue using MLAPI, I was wondering if anyone could help me. It seems to be some sort of bug regarding the class NetworkVariableFloat. I'm only running as a host so I'm positive it's not something weird going on other than this thus far:

I have 2 NetworkVariableFloat variables, CurHealth and MaxHealth.
Whenever I do:

Mathf.Clamp(CurHealth.Value - amount, 0, MaxHealth.Value);```
***both*** CurHealth ***and*** MaxHealth get set to the value I only wanted CurHealth to be set to.
#

amount is just a parameter in a function, this is in a function that is meant to cause the player to take damage.

#

Debug messages before and after this call show that MaxHealth gets set as well, when I do not intend to change its value at all.

#

I only noticed when I happened to reach 0 HP, because it made it so I started dividing 0/0 when getting the normalized amount of health.

slim ridge
#

i dont know anything about MLAPI but if NetworkVariableFloat is a reference type and at some point you did CurHealth = MaxHealth instead of using .Value this would probably happen

empty cradle
#

@slim ridge First Debug shows "200/200", then the second debug shows "160/160"

slim ridge
#

yes, but there must be other places in your code that set the values

empty cradle
#

Nope, I checked

slim ridge
#

how are they initialized then?

#

how do you know what they are before you take damage

empty cradle
#

The SerializeField is redundant, but other than that...

#

I know how they are before I take damage because the first portion of code I have shown is the only way to take damage.

#

So I call Debug right as that function starts to see the values before I apply the damage

#

Then I apply the damage, and call Debug.Log again, only to see MaxHealth got changed unintendedly

#

The last line is the one that told me "hey, error, you are dividing 0/0" (it actually raised an exception telling me I was setting scale to NaN, 1, 1)

slim ridge
#

well the problem is probably that CurHealth and MaxHealth are the same object ๐Ÿคท

empty cradle
#

๐Ÿค”

#

Let me test that theory

#

You are correct and I have no clue how that happened

#

Just changing CurHealth also changes MaxHealth

#

Even in the editor, I try to change the value of CurHealth, it too changes MasHealth... this is bizarre

#

Does anyone who know about MLAPI know why this may be a thing?

#

Alright I found where in my code I set CurHealth = MaxHealth sheepeshly, you were right.

#

It only happened once at the start of the game.

cinder vector
#

QUESTION

I have started using MLAPI for unity. I'm trying to get a simple 2 player fps game setup. I have the editor running a host, and a build on my PC as the client. I can run the host from editor and it works, also joining as a client with the build outside the editor works too. The problem is that when i move the client, the host moves too. If you think this is a simple issue please DM me. I will link the unity tutorial im trying to modify code from.

https://docs-multiplayer.unity3d.com/docs/tutorials/helloworldintro

olive vessel
#

So, on the host, the client's movement script shouldn't be enabled

cinder vector
#

hm

olive vessel
#

Let me show you mine from Mirror

cinder vector
#

In dms?

olive vessel
cinder vector
#

oh ok

olive vessel
#

It's only a small screenshot

#

But yeah, if this is not the local player, I disable those components

cinder vector
#

Do you think you could hop in a call real quick. i just wanna make sure i do it right.

olive vessel
#

I'm a little busy rn sorry, but if you need me ping me here

cinder vector
#

Ah okay, will do.

winged ridge
#

I want to make a very simple game for me to play with my friends (4-6 people). What networking should I use?

olive vessel
#

Photon gives you 20 CCU free, and I've heard it's relatively easy to setup

winged ridge
olive vessel
#

I've watched a few multiplayer ones by DapperDino, usually very good

winged ridge
#

ok thanks

turbid steppe
#

Is this right? I'm trying to make it so if you move the animation wont affect the other person. If it is right can you tell me if I have to write code for this to work?

fossil kernel
#

Hello. Anyone knows a good tutorial for turn-based games using PUN2?

olive vessel
fossil kernel
#

How about for PUN v2?

olive vessel
#

It took me three seconds to search that up

fossil kernel
#

Well thats for an older version of PUN

olive vessel
#

I'll try indexing my searches for you properly next time

cinder vector
#

Hey, im using MLAPI for Unity and i cant get a pickuop script to work.

#

If anyone uses MLAPI plz DM me

ebon vortex
#

Quick show of hands. I am completely new to unity and I am new to network programming. Should I use MLAPI or Mirror? (I am currently using MLAPI, and it's working .. but very early stage, so I want to make the transition asap if it makes sense)

crisp prairie
#

does someone know if the order of execution for rpcs is fixed? Speaking if i call multiple rpcs in a code-block one after another on the server, will the client for sure receive the calls in the exact same order? (MLAPI)

high night
#

@crisp prairie
Reliable RPCs will be received on the remote end in the same order as they are fired but this in-order guarantee only applies to RPCs on the same NetworkObject. Different NetworkObjects might have reliable RPCs called but executed in different order compared to each other. To put more simply, in-order reliable RPC execution is guaranteed per NetworkObject basis only.

crisp prairie
#

ah thanks that helps me a lot

#

i call them all on one object only so it should be fine then

lapis vapor
#

Guys, I'm trying to get an int from photonnetwork.raiseevent, But I'm gettting Invalid cast exception, can someone help?

            else if (obj.Code == OPPONENT_JOINED)
            {
                Debug.Log(" Received request for OPPONENT_JOINED");
                object data = obj.CustomData;
                int dir = (int)data;
                if (dir == 0)
                {
                    Debug.Log("Received request for OPPONENT_JOINED if dir = 0");
                    GlobalGameManager.mInstance.opponentJoined = true;
                    Debug.Log("Received request for OPPONENT_JOINED if hidepopup");
                    FFNotification.Instance.HidePopUp();
                    Debug.Log("Received request for OPPONENT_JOINED new raise event");
                    RaiseEventOptions raiseEventOptions = new RaiseEventOptions { Receivers = ReceiverGroup.Others };
                    Debug.Log("Received request for OPPONENT_JOINED Photonnetwork.raise event");
                    PhotonNetwork.RaiseEvent(OPPONENT_JOINED, GlobalGameManager.gameTimer, raiseEventOptions, SendOptions.SendUnreliable);
                }
normal hemlock
#

Alright

#

So I donโ€™t expect an answer considering the guy before me didnโ€™t get one

#

However Iโ€™m going to try to describe this anyways

#

So basically, when my(online multiplayer fps, using photon and unity 2018) game is run with the editor, the player can die and respawn and such is counted on the scoreboard. However, players that are killed when in the builder version just have a negative health number; and do not die or respawn. Regardless of this, whenever they should die, such is updated in the scoreboard for all players, no matter if the players are on the builded ver or the editor ver, which brings us to the next thing; people playing on the builded ver can kill people playing on the editor ver, but not the other way around. I assume this is due to a build error, but I see none.
So, in summary; the respawn and death system works perfectly for a player using the editor, however not with the builded version; and yes, nobody dies if both players are on the builded ver. Any ideas?

spring crane
#

Make sure you aren't observing masterclient vs .. normal client differences rather than editor vs build differences

faint plaza
#

What is the correct way to spawn a bullet using Mirror? I keep getting warnings about trying to run commands on an object without authority

spring crane
#

Tip: There should be attributes for disabling authority checks

normal hemlock
#

Somehow everything else works from build client to build client but not the respawn event

#

But the death still registers on the scoreboard at the same time that the death event happens

#

So it should happen

#

But it doesnโ€™t

spring crane
#

Build vs editor and masterclient vs client are different issues, so knowing what is happening is important

#

Easy way to figure out is to just try changing which client is the masterclient

#

If the bug follows the masterclient, then you know it's most likely not editor related, which also allows you to more conveniently debug it with editor features

normal hemlock
#

Hm

faint plaza
spring crane
#

Well you might wanna think who is simulating the results of things, while keeping in mind that the server is generally the only part of the loop to be trusted

wraith flax
#

I've never done networking before so I'm not sure where to start exactly... I'm making a simple turn-based strategy game for my friends and I to connect and play from eachother's houses.
(If it's relevant to what networking system or method I should use: The game should have a grid for players to move around in and a couple actions to take during their turn, positional/strategy/pvp game)

#

I've found some tutorials but a lot of them seem a little outdated, and I've got no idea how to build networking code from scratch

olive vessel
#

Maybe start with a system like Mirror, Photon or MLAPI before diving into writing your own networking with sockets

wraith flax
#

I thought Photon had been deprecated. Is it still functional? Hopefully easy to use ๐Ÿ˜…

olive vessel
#

Latest release 13th April 2021

wraith flax
#

oh sweet!

#

I'll look into it, thanks :)

hardy echo
#

Hey guys, I've gone through the fun of writing a multiplayer game in Photon Pun and wanted to try out this newer MLAPI system. So far it's been great and the skill set has transferred really well, however I'm trying to make like a server list or like a lobby list but can't figure out how to get started with this since in pun there's like the overall server and then rooms within it, but from all I can tell MLAPI just conncets you directly to the server and doesn't have subrooms? If anyone has some tips on if / where I should start looking to figure this out that would be great!

TL/DR - How do I setup a room list or server list in MLAPI or where do I go to get started

weak plinth
#

Hi all, i made a Messenger chat system that consist of people entering in a room with id of their choice and being able to chat together, would that be useful ?

wraith flax
thick vigil
#

I'm using Transport. The tutorial shows that I have to set the endpoint of the server to AnyIPv4

#

What if I changed that value, what will happen

olive vessel
#

Isnโ€™t that so you can accept any IPv4 address

thick vigil
#

Ah

verbal island
#

Is there any tutorial out there for setting up a Lobby with MLAPI?

patent fog
# verbal island Is there any tutorial out there for setting up a Lobby with MLAPI?

DapperDino does good ones on Youtube, try this one https://www.youtube.com/watch?v=Pe2LVZGTK20

This Unity Multiplayer tutorial will teach you how to implement connection approval so that clients have to send the correct password to be able to connect to the server. For project files access, check out the repository here: https://github.com/DapperDino/Unity-Multiplayer-Tutorials
-------------------------------------------------------------...

โ–ถ Play video
verbal island
#

ok thanks

thick root
#

I'm not really sure if this is related with networking, but I think so. How can I solve this problem I have when I build my project in Unity?

#

It's firebase but in my editor works correctly and when I build the project this error shows

weak plinth
#

someone knows if that mlapi transport uses new steam networking?

#

because i know steam fixed ip leak but if its that

weak plinth
#

how do I use this?

#

i want it to be set by clients and read everywhere else

#

but thier own client

olive vessel
#

So, write permission should be OwnerOnly then

#

And read perms just everyone

weak plinth
#

yeah but it writes to itself

olive vessel
#

And?

#

The client would know what the value is if it is writing the value itself

weak plinth
#

it doesn't move

olive vessel
#

What?

weak plinth
#

like ruberbanding on hosts to

olive vessel
#

Use a NetworkTransform component...

weak plinth
#

found why it was writing to itself

#

huh

#

guess that's why

#

my first time networking

olive vessel
#

That's reading the network var

teal obsidian
#

is 0% packet loss normal?

#

Or will all clients communicating in realtime to a server over a network experience packet loss to some degree? Like under 1%?

olive vessel
#

I guess there is no guarantee you will drop a packet, so presumably 0% loss can occur

teal obsidian
#

I guess I'm just trying to ask how much packet loss there's supposed to be under "normal" or ideal conditions

#

probably just 0 then I guess

verbal lodge
#

It is quite common for stable connections to not drop any packets at all.

teal obsidian
#

Do residential ISPs count as stable connections?

verbal lodge
#

Depends on the ISP. Some countries have really bad ISPs. Bu even with a great ISP and little network traffic in your area you can still get packet loss depending on how your connection gets routed.

ancient falcon
#

Hey all, I'm looking to hire some quality devs for paid work on a 2D turn-based strategy, just joined the Discord would this be the best place to look for people?

simple urchin
#

Does anyone want to make a 3D or 2d game with me ? i can program a little

#

@ancient falcon i also just joined

ancient falcon
#

Thank you!

#

Hi Void

olive vessel
#

Perhaps "Networking" is a bit confusing

weak plinth
#

i got the game to connect and stuff, now i just need to make it only update other player positions and only take input from your client to control your character.

lapis vapor
#

Guys, I was working on a photon game, I'm using Photonnetwork.raiseevent. It was working perfectly before like when I raise it, it was reflected in the opponent instantaneously before , but now it is having a delay in sending them, it is not the latency of network, what else can be the reason?

#

can somebody help me here?

still laurel
#

Hey guys, I'm trying to use WebRTC to stream my WebCam but it seems that streammable tracks consist on MediaStreams which can be obtained from a Camera game object but I'd like to obtain it from a WebCamTexture, any tips? Thanks

naive prism
#

Hey, I'm thinking about making a game similar to that of We Were Here. Anyone have any recommendations for tutorials/documents to follow for the networking of this? I would prefer anything that would mean the player can just jump in, press "host game", invite their friend via steam and off they go

azure oracle
#

how to make health sync with pun 2 and unity? im making a fps shooter, but health is not synced. On local player health is working, but on remote it isn't

#

im using this code every time im shooting but only if photonView.IsMine

olive vessel
naive prism
#

Oh sick, thank you

weak plinth
#

someone knows how i can use SteamNetworkingSockets in mlapi?

#

i not speaking about steamp2p transport because its old system

olive vessel
#

I think (think) you may have to make a custom transport

#

Steam P2P is a community one as it is

olive vessel
#

You might be better asking in the Photon Discord if they have one, or searching online

azure oracle
#

Does they have a discord?

steady crater
#

@azure oracle try to use lowerCamelCase

azure oracle
steady crater
azure oracle
#

this makes no sense

#

the problem is not that, why do I need it?

steady crater
azure oracle
#

I will still rewrite this code, why do I need it now?

#

stop writing off topic

steady crater
#

your level is lower than intern

azure oracle
#

Okay and?

#

I donโ€™t understand if youโ€™re stupid or your eyesight is bad

steady crater
azure oracle
#

Lmao

primal blade
#

What would be best if I wanted to create a minecraft like multiplayer system? Like you know how over Xbox live you can connect to your friends worlds if theyโ€™re on? Is it possible to do something like that in unity?

#

Iโ€™m asking this because I want to be able to have like a multiplayer connection but have world โ€œsavesโ€ locally on the computer. Idk if this is possible through photon because doesnโ€™t it require joining temporary lobbies?

olive vessel
#

I would assume, that the host (or anybody really) could take a save of the world at that point, most likely saving done by serialisation, and can then load the save and host the world

primal blade
#

I see, so what youโ€™re saying is, when creating the lobbies in photon, there could be an option to choose like a saved world and then after the temporary lobby is created, the application on the clientโ€™s side would access the serialized save basically

olive vessel
#

Idk owt about Photon, but yeah you could run some initialisation to load up a world, then allow others to join

primal blade
#

Ok thatโ€™s awesome. Do you know of any other multiplayer programs that would work better than photon or that are different than photon?

olive vessel
#

There's tried and tested Mirror, or relatively new but Unity backed MLAPI

#

Mirror has a tonne of Transports available, so you might find something really suited to your needs

primal blade
#

Ok I think im gonna look into mirror more just because I think mirror has player side hosting which would be better for the game Iโ€™m working on.

#

Thank you sm

olive vessel
#

One thing to note, players would need to port forward unless you make use of a relay service

#

But you'll be able to find all sorts of stuff in their Discord

primal blade
#

Gotcha

nimble ermine
#

is it common that yesterday my networking code was working and after doing 0 modifications it's now very laggy?

#

like if it could be a photon server issue

high night
#

@nimble ermine you'd know easier if you use github

#

at least you'd know if the issue is with your new version

nimble ermine
#

I use unity collab

#

managed to fix it tho

stiff ridge
#

what happened?

worn ferry
#

Hey i need some serious help with setting each players material color to a custom one they set

#

i have a public color on each player that they all change

#

how do i make them send out that color for everyone else

#

right now it makes everyone the color you picked

copper plaza
#

Yo i got a question. Im using photon for a multiplayer game. The game is a 2d tower defense. Basically im wondering how do i syncronize player stats aka how many lives they have

#

Or how the variables are kept

cyan oyster
#

Is there Discord channel for steamworks? or can I ask steamworks here? ๐Ÿ˜ญ

olive vessel
#

This channel is for Networking in Unity, so yeah I guess so

weak plinth
#

how i can get IP on mlapi litenetlib transport?

#

ip of client

weak plinth
#

Photon is awesome, all i had to Say here ๐Ÿ˜ฌ

craggy cargo
#

Hi. I read some warm discussions here but I still haven't found what I was looking for.
Photon really solves all the problems that need more knowledge of networks and this is too tempting to ignore.
Can anyone tell how to use MLAPI and some other API that allows to put a game in production? I only saw examples with localhost. Maybe SteamNetwork. But how to solve this for other platforms? VMs are really expensive.

bitter needle
#

MLAPI is not officially released and is not recommended for games to be published at this time.

bitter needle
#

Anyone here with good MySQL knowledge, especially using MySql.Data.MySqlClient namespace in C#?

craggy cargo
weak plinth
bitter needle
#

It's faster

#

and it can cluster

manic rune
#

Hey, Is the new MLAPI not worth using?
Im working on a multiplayer fps shooter and cant seem to find my way with MLAPI. Is it better to downgrade to Unet or should i wait for more updates for MLAPI?

verbal lodge
primal blade
#

Unity now suggests not using UNet also. I've read that MLAPI isnt current sufficient enough for games yet since it's relatively new. I would recommend Mirror it's awesome

olive vessel
#

I just noticed the table in "Choosing the right netcode for your game" doesn't actually have any titles for the ratings

dense hedge
#

Just fyi, those ratings are super arbitrary/biased. You won't find any of the library authors agreeing with them.
On the whole, the post/white paper is very misinformative. It could have at least included a list of released games that use each lib.

verbal lodge
# dense hedge Just fyi, those ratings are super arbitrary/biased. You won't find any of the li...

Any suggestions on what we could change to make it less misinformative? We've been working with the library authors to correct the misinformation in that blog post and after an initial round of correction we didn't get any complaints about information which would need to be changed anymore. We hear a lot of just overall negative sentiment about this blog post but it would be awesome if we could get some constructive feedback so that we can improve it or at least not make the same mistakes again in the future.

normal hemlock
#

Anything seemingly wrong with this script?(player movement; for some reason, again, both editor and build players can take damage but only a player on the editor can die and respawn)

dense hedge
# verbal lodge Any suggestions on what we could change to make it less misinformative? We've be...

I read some of the earlier feedback and I believe authors said as much, but I think people were mainly offended by Unity juking the stats and portraying their new but largely unknown/untested acquisition as the best all-around choice. There's an obvious conflict of interest.

Fairly showcasing games made with each library would have been more indicative of their capabilities instead of making guesstimates about performance and scalability, but I suspect this wasn't done because MLAPI didn't/doesn't have nearly as many. The post is also missing Photon Bolt for some reason.

A lot of the criteria seem like apples and oranges. PUN gets 5 stars for "ease-of-use" seemingly on reputation alone, but Quantum making it possible to build a working RTS prototype in a week is only worth 4 stars. MLAPI's section just lists stuff that's missing and it still has 4 stars lol.

The cost information seems entirely aimed at hobbyists. Quantum's subscription fees will be seem expensive to free users but at the small studio level and above: Would any business turn down paying $1000 a month for a fully-functional deterministic engine (that abstracts away the "networking") plus tech support in favor of hiring someone to build and maintain one? If MAU โ‰ˆ 400 * CCU is accurate, only successful games would see "large" CCU costs, but since they've sold well, they can easily afford 50ยข per CCU.

#

IMO the broader problem is that no matter how you reword the article, it doesn't change the reality that none of the free options actually provide much beyond the socket level (virtual connections, rooms, etc.). They all lose in actual utility.

Developers take cues on how their multiplayer should look and feel from the most popular games in the genre, who nearly always have tick-based simulations and local prediction (and lag comp, interest management, etc. if applicable).

AFAICT, none of the free/open-source options were really built with those in mind, so all attempts to implement them later look super clunky and project-specific.

The most important question that's never answered is: What game genres can easily (out of the box) and competently be made with MLAPI? Vs Mirror? Vs Photon products? Etc.

#

Honestly, from what I've seen of/heard about the upcoming Photon Fusion library, this blog post will look even more ridiculous after it's released. If Fusion makes good on even a few of its claims, everything but Quantum would get 1/5 stars in terms of ease-of-use, performance, and scalability.

verbal lodge
#

First all, a lot of great feedback, thanks. I agree on many of your points, we could have probably framed this article in a much better way.

The cost information seems entirely aimed at hobbyists. Quantum's subscription fees will be seem expensive to free users but at the small studio level and above: Would any business turn down paying $1000 a month for a fully-functional deterministic engine (that abstracts away the "networking") plus tech support in favor of hiring someone to build and maintain one? If MAU โ‰ˆ 400 * CCU is accurate, only successful games would see "large" CCU costs, but since they've sold well, they can easily afford 50ยข per CCU.
Would you mind explaining this a bit further. I do not fully understand. We just stated product costs and mentioned that for MLAPI/Mirror/Darkrift 2 you would need to pay for server hosting in addition? We never mentioned anything like Quantum being expensive. We stated for both Quantum and PUN that they are rather cheap in comparison to self hosted servers?

dense hedge
#

I may be looking at an older version of the white paper.

#

Larger teams would probably see a reduced cost since they wouldn't strictly need networking experts on payroll.

verbal lodge
#

I'm not fully familiar with Quantums cost model but based on their website it sounds like you pay 200$ per month per developer seat. I don't see any indication that this would be restricted to 'networking experts'. Any developer on the project would need a seat, at least this is how seat licensing usually works. 2400$ year is still a notable cost, that's more expensive than a Unity Pro subscription. You might be right that it is totally worth because it could allow a team to build a game much faster, with less engineers etc, but we were just focusing on raw product cost and not 'value' there.

dense hedge
#

I guess I can agree that I'm focusing on value? I was just making the assumption that the upfront cost of hiring an experienced networking developer is quite steep, considering it's so niche. Definitely more than $200 per month. And development time does translate to money spent, so idk.

I saw an interview with one studio using Quantum (Bomb Bots Arena) who attested to not having anyone on their team with the expertise. They were able to write a networked game with a sizable player count as if it were local multiplayer without really touching the netcode.

In terms of infrastructure costs, if we really wanted to price it out, I'd want to include the bandwidth costs of all the solutions when using dedicated hosting, projected over like a month/few months/year. Determinism should consume significantly less bandwidth. A handful of bit-fields and some floats to represent hundreds of buttons and several analog joysticks/triggers will be very small compared to non-input traffic.

dense hedge
#

Also, it would help to convey that how to replicate the simulation is mostly decoupled from how the data gets around.
Like deterministic games don't need to be peer-to-peer and authoritative games don't have to be client-server (not that you'd want P2P tho).

gleaming prawn
#

That is what they pay to get direct access to the core development team...

#

So, not ALL developers in the team

verbal lodge
#

Oh I see, that's good to know. Sorry I wasn't aware of that.

gleaming prawn
#

if you want to get only one or two in there, fine...

#

And because you mentioned, does unity pro gives me direct access to the CORE development team of the engine?

#

In a live Discord on a daily basis?

#

If yes, fair enough...

#

If not, it's again Apples to Oranges (I fully apologize if I'm wrong here)

#

Just trying to clarify

verbal lodge
#

Oh I was not trying to compare Quantum to Unity. I mean you pay for very different reasons for a different product. As far as I know we do not have a live Discord but many other forms of customer services.

gleaming prawn
#

2400$ year is still a notable cost, that's more expensive than a Unity Pro subscription

#

Again... That is a comparison...

#

I'm clarifying what you get for the value.

#

On that topic Luke... I always wondered why it is stated only up to 32 players for quantum. where our limit is actually 64 (and we've benchmarked that here several times)

#

I know the super successful mobile games made with quantum are 32 player games, but they had other reasons for that (it's mobile), not that the engine can't be used for 64 player ones...

#

I ask this because MLAPI is mentioned as up to 64, and I don't see where is the exact backing for that

#

I never bothered much though, there are other things of concern in the post (that others have expressed about).

verbal lodge
#

Good question, these numbers are more like rough guidelines and not hard numbers. We have a few customers who were able to run more than 64 players on Mirror/MLAPI as well. The reason why the number we chose was 32 instead of 64 was because based on our evaluation and feedback from other people about Quantum we came to the conclusion that 32 is the better overall number because mobile or certain game genres might not be able to scale to 64 with Quantum. Could very well be that we were off there, you definitely know better then we do.

gleaming prawn
#

Yes, but let me quote you:
"we came to the conclusion that 32 is the better overall number because mobile..."

#

"We have a few customers who were able to run more than 64 players on Mirror/MLAPI as well."
On mobile? Sucessfully launched tittles?

#

emphasis mine

#

You know I'm the first one to state when quantum is NOT a fit for something...

#

But I think what people complain about seems to be a lack of clarify, and a possible conflict of interest in the "evaluation". So it'd be nice to see where these numbers came from.

verbal lodge
#

Yeah that's always a problem with benchmarks and performance comparisons often there is not enough information provided and it's especially bad in this article.

gleaming prawn
#

it is.

stark hazel
#

Hello, nor really sure where to ask this, but this is likely the channel where someone is likely to have encountered this problem. I'm going to work with an http api that uses access tokens and Oauth2. To get the token, I need to send , along with the credentials the user provides, client credentials given to us by the owner of the API. What would be a reasonable way to keep our credentials out of the build so it can't be recovered by a third party? Should I even bother ?

somber sable
#

what does ```csharp
[SyncVar(hook=nameof(Method))]

do basically?
lunar forge
#

how would i connect to computers on a different network using mlapi

olive vessel
#

You must port forward whichever port you use, on the UDP protocol if using UNet Transport

#

Then, your friend connects with your public IPv4 address

somber sable
#

okay thank you

feral star
#

How would I have a component in a synced object that exists in different states between server and client in MLAPI? I have a variable in one of my gameobjects with a component not likely to serialize (an IronPython function), so I would like to not transmit that over the network and instead have the client grab it itself and verify with the server that it's correct

#

well, I suppose the client version of AbilityFunction can just be a hash that it passes to the server and receives info on when it can be activated

#

wait, nvm, that's stupid, the client has access to the ability info

teal obsidian
#

Is delta compression impossible without RUDP?

#

furthermore, is it possible to build your own RUDP protocol off of C#'s udpclient? Is it hard?

teal obsidian
#

Can't be TOO hard right? Just send acknowledgements back to the server for every packet received, and a timeout to re-send it, if Mr. Server doesn't get the ack in time?

#

This is probably a stupid question and the answer is probably hidden somewhere in my brain. But how do you keep track of time like that on a server? Like detect if you haven't received the ack within 200ms?

#

C#'s built-in datetime stuff?

teal obsidian
#

Right now I just do delta with TCP but only for entities, say if I drop a gun on the ground or something. I send the full state every tick with unreliable UDP for every player + every car. So max players is 60, 1 car per player, max 4 doors per car is around 300 entities maximum to process max at every tick. That's without the delta entities that get sent whenever a change is detected (probably not very often since the players can't interact with physx objects by walking into them)

fringe blaze
#

Hey there, I'm having this problem where I'm using the LLAPI for a multiplayer game, and when one of the players pause their game (lose focus on mobile) thus the main thread stops calling NetworkTransport.ReceiveFromHost, soon enough my server get's bogged down trying to send messages to said player and starts failing to send messages to everyone else until that player refocus the game.
To make matters worse I can't disconnect the player immediately.
Any way I can have the NetworkTransport to not use a single queue for all players?

coarse light
#

is there any free game server hosting for testing with the github student developer pack??????

ancient cypress
#

Can anybody tell me how to do this correctly? I made multiplayer game with mirror. When character is animated and after animation cycle I want to move bones I can only do this in LateUpdate() but this is not synced over the network. Example: Character is standing with "idle" animation (moves a tiny little bit) and I want to make the head look around in camera direction.

graceful zephyr
graceful zephyr
teal obsidian
graceful zephyr
#

send last received snapshot id back to server

#

doesnt require any RUDP/TCP

teal obsidian
#

Isn't that basically how rudp operates though? The 'id back to server' is technically just the ack?

graceful zephyr
#

ack != reliable

teal obsidian
#

figuratively speaking

#

it's the acknowledgement

graceful zephyr
#

acking does not mean it's a reliable protocol

teal obsidian
#

what happens if the message back to the server, gets lost in transit?

graceful zephyr
#

nothing really

#

server doesnt know you received it

teal obsidian
#

so server resends?

graceful zephyr
#

it's up to the logic on server side to handle that case

#

no why would it

teal obsidian
#

because it doesn't know you received it? I'm confused

graceful zephyr
#

it can if you are doing a reliable protocol ofc

#

but i generally never use reliable protocols

teal obsidian
#

I thought the whole point of delta compression is to only send the latest changes, not the whole snapshot

graceful zephyr
#

Bolt, Fusion, etc. are done using only unreliable sends

#

Yes

teal obsidian
#

Still confused. You said it doesn't need to be reliable. What if the client doesn't get an entity's last movement from the server then the entity stops moving

#

it's going to be in the wrong place forever then?

graceful zephyr
#

You're correlating reliable socket sends with how the game/higher networking layer itself works and how it deals with loss scenarios etc.

teal obsidian
#

so how would I deal with loss scenarios

graceful zephyr
#

depends on the type of transfer system you use

#

delta snapshots, eventual consistency

#

etc.

teal obsidian
#

so just send the entire snapshot every n seconds?

graceful zephyr
#

No not at all

#

That would be impossible for most games

teal obsidian
#

hmmm

graceful zephyr
#

in delta snapshot mode we never send full snapshots other than for the first one you get when you connect

#

in eventual consistency mode it works different, and never sends a full snapshot ever

teal obsidian
#

So how does eventual consistency work

graceful zephyr
#

that's a large topic

teal obsidian
#

Ok. I think I'll go with building a reliable protocol then, since thats the most familiar to me

teal obsidian
#

so to make rudp, Everytime I send a packet from server, I store a new object that contains the sequence number, byte contents, and the time it was sent. Whenever an ack comes in to server from client, check against stored objects and delete the object containing that sequence number. and also check every n milliseconds to see which packets havent gotten a response in n milliseconds since they were sent, update the timestamp on those objects to present, and resend them?

#

Sound about right?

#

obviously i'd have an object pool so im not allocating memory on each send

#

and for the sequence #, do I just iterate on every sent message?

teal obsidian
#

But then say the client gets the server's message, and sends the ack back, but the server doesn't receive the ack, so the server sends a duplicate message. How far should I store successfully received sequence numbers on the client to prevent processing duplicate messages?

obtuse pumice
#
receiveEventArgs.Completed += new EventHandler<SocketAsyncEventArgs>(ProcessReceive);

private void BeginReceive()
{
  receiveEventArgs.SetBuffer(receiveEventArgs.Offset, 4);

  if (!socket.ReceiveAsync(receiveEventArgs))
    ProcessReceive(null, receiveEventArgs);
}

private void ProcessReceive(object sender, SocketAsyncEventArgs e)
{
  // Handle errors..
  // Make sure the whole packet is read..
  // Do something with the packet..

  BeginReceive();
}
#

This seems to be the way most people use ReceiveAsync but im a bit concerned about ProcessReceive basically calling itself over and over, cant this lead to Stack overflow? Or do we just assume that socket.ReceiveAsync will execute asynchronously most of the time and break the call chain?

obtuse pumice
#

It seems like ReceiveAsync will pretty much always execute asynchronously in a real world scenario, even just adding 1 ms between each send from the client (both server and client running on the same machine) will stop the receive from executing without raising an event. So no risk for stack overflow ๐Ÿ‘

peak walrus
#

anyone worked with photon?

patent fog
peak walrus
patent fog
#

Yeah, just ask you question if you have one ๐Ÿ˜‰

peak walrus
# patent fog Yeah, just ask you question if you have one ๐Ÿ˜‰

well I am making blinding ability system. I instantiate an orb object using RPC which is instantiated for all players in room. Now as the object is instantiated, I want it to call a function of showing flash (that function exists in UI code of player) on screen for every player who is looking at the object. I have made the logic to check if player is looking at orb or not but I want to know how can I make it call the function not just for local player but other players too?
Here's a reference to what I'm trying to make: https://youtu.be/1pL6NwrpoV4?t=135

This is an advanced Yoru abilities guide on the map Bind, and I want to show you guys some flash and tp lineups you can use in high ranked to be the deadliest Yoru main you can be! Valorant's new act brought us some insane outplay potential, and I want to show you how I like to use Yoru to rank up!

Everybody is always asking how to play Yoru on...

โ–ถ Play video
feral star
#

Does MLAPI deserialization work by calling the relevant constructor on the object?

#

I have an object that contains a component that can't serialize (IronPython functions) so I'd like the client to reconstruct it on their end based on what can serialize

#

(even if only to keep things consistent, as those functions are never going to be called on the client's end)

patent fog
normal hemlock
cyan oyster
# normal hemlock

btw what is Photon.MonoBehaviour?

when I tested PUN2
I used MonoBehaviourPunCallbacks (using Photon.PUN)

oh.. if it is spawned in network
I used IPunInstantiateMagicCallback for OnPhotonInstantiate

and also I used every public methods to be called by [PunRPC]

normal hemlock
#

Pun classic

#

Unity 2018

cyan oyster
molten dragon
#

should i use socket or tcp listener for sending the data for multi client user

austere whale
#

Hello!

I have written some C# applications and also been "modding" several games before. Now I decided to take a look programming a game of my own. I consider multiplayer as the most enjoyable game type nowadays but I have got some security related concerns.

For a small scale project it would be reasonable to be able to host a room from the game client/related app so people could just create rooms and play with their friends.

If people made changes to the game or included some plugins or so could they use the connection to the host machine to deliver malware/take control of others' game/machine or something related? Even if the game was only supposed to send/receive player and object status and position data?

What if the host machine or a client was unintentionally infected/under attack, could that infection affect the connected clients or the host it was connected to?

Is there a way to prevent using a modified game or hosting system?
Would windows firewall detect attacks/weird behaviour that was not just wanted player/environment data transfer and break the connection or so?
Could I have "package checking code" in my game or similar methods? Could the unwanted action be just hidden to look like a normal data transfer to the game? Would even checking expose the system to the threat?

I found this for example https://www.youtube.com/watch?v=uh8XaC0Y5MA but is such "make a connection and use it" (as far as I understood it was something like that but there might be more details in other videos) type of approach enough not to leave possibilities for vulnerabilities and exploits?

I hope this was the right channel,
wwwwEPwwww

normal hemlock
#

I do not like your name

#

Change it

jovial fiber
normal hemlock
#

Also

#

That is a bad comeback

#

You need to work on your social skills

oak flower
#

@normal hemlock Please don't spam the channel.

normal hemlock
#

?

oak flower
#

@normal hemlock There's no off-topic. If you don't have anything constructive to say do not spam channels.

austere whale
#

So to simplify my longer thoughts in my previous message:
Is there a way to make a self hosted multiplayer game so there are no or minimal security risks?

olive vessel
#

As in the user hosts and is a client?

austere whale
#

Yes, so that one user can make and host a room on their PC and other players can join (based on some kind of IP or other identification)

olive vessel
#

There are networking solutions like Mirror and MLAPI which do that

#

The user can host as a client, and allow others to join. Or a dedicated server build can be created

austere whale
#

Ok. I read about Mirror and saw it only supports 20 players simultaneously in the free version (I'm not planning to make anything huge but it's still an extra restriction I would like to avoid) but I'm not actually sure if that is as a dedicated one server or for people using it for self hosting (so that they could set up multiple 20 player rooms for the same game individually). How does MLAPI work then? Are there any recommended use cases for each?

olive vessel
#

No, that's not Mirror

#

20 CCU is Photon

austere whale
#

ah that's right

#

so how do these Mirror and MLAPI handle players / rooms then?

olive vessel
#

What I would say, is MLAPI is relatively new, but both have good documentation

#

There are a tonne of transports for Mirror too

austere whale
#

So are those just some hosting apps (with built in security features) or actual dedicated physical server providers?

olive vessel
#

The Transport isn't a server provider

#

So there's a Steam Transport, that uses Steam's P2P services to connect players

#

Really the Transport handles the data transfer

austere whale
#

hmmmm ok (sorry I don't know much about net traffic stuff...)
So is that Steam service free?

olive vessel
#

Well, you need a SteamAPPID, you can use the default 480 for testing but not for release

#

So you'd have to be on the Steam store for that one

austere whale
#

It might be difficult to get something released on Steam I guess!
And if I use Mirror or MLAPI for transporting game data between clients is there a chance of someone using that data traffic for something malicious? Or are those APIs (/their actions) strictly connected to the code I make so it can only handle what I have intended?

olive vessel
#

If you're worried about cheating, you must have a million dollar idea

#

Mirror's docs briefly talk about cheating

austere whale
#

Not necessarily cheating but rather forwarding malware and so... ๐Ÿค”

olive vessel
#

I don't know if that's even possible, a question for the Mirror Discord perhaps

austere whale
#

Ok, it might be that such thing is not possible but I don't know and am just speculating

#

so

dense hedge
#

Usually, you expect packets to be formatted a certain way. A particular length and a particular layout. The socket layer just throws away unrecognized packets.

#

You'd have to be super trusting of incoming data to have a code injection problem.

austere whale
#

aha

#

so is normal reading a received packet not enough? How do I make it recognise the assumed correctly formatted packets or is that all built in the network functions in C# and unity etc?

#

What kind of actions can be made related to the received packets without risks - what is trusting too much? Even something less extreme than "run any exe that I receive"?

dense hedge
#

A packet is just a bunch of raw bits until your application interprets it some way.

Normally packets split into a <header> and <data payload>, where the <header> tells you

  • who it's from
  • what type of packet it is, so you know how to read the payload
  • how old it is
  • a checksum to verify the integrity of the payload and verify matching version info

That's 4 potential reasons to reject a packet alone, all through low-level bit operations. The transport layer doesn't have anything to be tricked into executing malicious code. It's just format checking to filter out garbled junk.

#

Any vulnerabilities to exploit would generally exist in your game code. Like don't have a function that runs an arbitrary .exe based on a string that was sent in the packet.

#

I dunno if Mirror or MLAPI have encryption, but if you're using like Steam's backend lib, then it might also provide that.

austere whale
#

Ok thanks for all answers. It seems like there is some sense in making a multiplayer game then I guess ๐Ÿ˜ƒ (I should have expected that as there are even official ways and documentation etc for it)
I have to start learning more.

#

Encryption for what? Packets?

dense hedge
#

yeah

#

just another form of validation, also helps prevent third parties from reading the contained data

austere whale
#

hmmm there is something related to it in the mlapi documentation (I suppose it is docs-multiplayer.unity3d.com) so I assume such thing can be done somehow....

#

but if some authentication keys are needed are they generated by the host/client or are they something separate, already existing, similar to application signature? ๐Ÿ˜–

dense hedge
#

idk, I'm not super well-versed in authentication/cryptography

austere whale
#

ok
I wish I knew what that means.... "It is strongly suggested that you sign the handshake."

#

But this seems like it is automatically done

dense hedge
#

ยฏ_(ใƒ„)_/ยฏ

austere whale
#

Any suggestions where I should look for help/tutorials to be able to code so everything happens in the server=host, not on clients and packets are handled in a secure way?

dense hedge
#

no, not atm

austere whale
#

ok, thanks, I will continue my research on if coding a game is worth it and secure ๐Ÿ™‚

austere whale
#

Found one tutorial. But if the network connection is just set like that, using some existing fields and checkboxes in the unity editor is it automatically going to make networking so that the host machine handles the events and clients only make simple requests (as was suggested elsewhere to prevent clients modifying what and how they do)?
https://www.youtube.com/watch?v=de4ey4ZM-zA

Dont Forget to LIKE and SUBSCRIBE!!!

-------------------------Unity MLAPI Git link-------------------------
https://docs-multiplayer.unity3d.com/docs/migration/install/index.html

โ–ถ Play video
mortal drift
#

Hello, any one has a idea how to make a leaderboard with network variables?

keen steeple
#

Hello, I'm currently trying to make a massive multiplayer shooter game! I've tried Photon and SmartFoxServers. Photon didn't work at all and SmartFoxServers needs me to host my own server and I can't really do that. I was wondering if anyone had any ideas on what I should use. I own a server that I pay for that I have access to via FileZilla. All and any help is greatly appreciated :D

spring crane
#

I own a server that I pay for that I have access to via FileZilla.
So what was the problem with SmartFoxServers?

keen steeple
spring crane
#

Booting up the application is one of the essential skills required for this sort of thing ๐Ÿ˜„

#

This shouldn't be a blocker considering all the challenges you are going to face to pull your project off.

#

Might wanna look into their remote desktop offering. If they don't have a remote desktop offering, it probably isn't intended for this kind of thing.

bold rampart
#

https://pastebin.com/6k80CM9Z I have a program that requests and sends information via a rest api, and the game is built to WebGL. When running the index.html file locally, the game container merely displays as a black screen. If I upload it to someplace like gamejolt, the same occurs. I've tried adding headers to expand request permissions as per https://docs.unity3d.com/Manual/webgl-networking.html, however the same still occurs.

#

here are the console errors

bold rampart
#

now it correctly displays

bold rampart
#

welp same error, however from all of the changes above it now loads correctly; networking features don't function though

#

how might I do this? none of the above fixes have worked

#

I've been uploading the build to gamejolt if that helps

frosty crystal
#

Hello.

#

Hello. I want to make a food order program when I order a dish, this dish should be seen to the another screen. But what technology should be used here? traditional sql ? or cloud? or firebase or what does it call? I mean it will be simultaneously.

patent fog
#

Firebase is a good solution for synchronising apps in real-time yes. But not the only one.

weak plinth
#

In game design its called "Serialization" lol ill shut up now.

grave ice
#

@frosty crystal @weak plinth serializing your data has nothing to do with the technology you use. You serialize the data to be sent to the cloud regardless of the tech used to send it

#

@frosty crystal sql could work, cloud services like firebase or PlayFab could do that too. Even if you build a REST service you'd need persistance so you'd have to use SQL or a database anyways. Lots of options

frosty crystal
#

thanks!!

steel mist
#

hi guys, gooday! im working with photon and having an issue that 2 players are spawning at the same spot. Already tried follow different tutorials but still doesnt work, ofc the problem is me, if anyone could help.

in a nutshell: the game works fine from the menu, find some match and going to the lobby scene, I think the problem is that when the countdown from the lobby ends, the players spawn exactly at the same time at the game scene, maybe its because of that they doesnt spawn in different locations.
The following script is the NetworkManager from the game scene.

https://pastebin.com/hyiZAmhJ

robust cypress
#

in your array

steel mist
#

yes, in the case, only 2

olive vessel
#

Your random number can only be 0

#

Because the length is 2, you subtract one, and ints are max exclusive in Random.Range

#

However, even if you do fix that random, there is no guarantee they will spawn separately

soft mural
#

help both players have the same cameras

olive vessel
#

In your camera script, check if this is the local player, if not disable the Camera and maybe even the script

soft mural
#

ok

gray merlin
#

how should I handle collissions (with colliders and rigidbody (im on 2d btw)) with mlapi (the server doesnt have to be authorative)?

#

also I made a basic online game where you can move and rotate and on Update() it gets sent to the server and clients update it and the cient lags in the host screen but the host doesn't lag on the client's screen (not as much)

#

if i just try handling the collisions on the client the player bounces into the collider then comes back, it's not instant

frosty crystal
#

Hello.

#

One of my objective is to store some unity bundle assets into cloud and download them in runtime. (in the next version, client will upload their bundles into cloud by using webgl.)

#

but could not decide if I choose realtime cloud of firebase or firestore database

#

what do you think

#

?

normal hemlock
#

Firebase at its simplest is only good for mobile apps

frosty crystal
#

one question more

#

I want to develop a webgl instead of an ios or android

#

Is it possible?

#

because the documentations wants me to make project either ios or android

#

but I can make neither standalone or webgl

normal hemlock
#

If you canโ€™t make webgl, what are you doing

robust cypress
#

Anyone know with Photon if I can call an RPC that is in a class on one object with the photonview of another object

olive vessel
#

Well, I assume you can just call it like a function

tiny ridge
#

anyone know how to use SQLite

idle sandal
#

looking for an mmo/mp rpg framework for unity, was looking at Ativision, but a little worried about if i want to change down the track and losing everything once i stop paying for it. Is there free alternatives anyone can recommend or any insight

rocky bramble
#

Do i understand correctly that the lowest networking api are .net sockets, right?

gleaming prawn
#

you can always go native and bypass .net sockets

#

for example you may want to use IO completion ports for less overhead in certain types of servers

rocky bramble
#

by native you mean using raw sockets from winapi/libc?

gleaming prawn
#

ye

#

IO completion ports on win is a good example

rocky bramble
#

to be honest i think asio will be good enough

gleaming prawn
#

you can get a lot less overhead by using them when managing thousands of inbound connections or datagrams

rocky bramble
#

yeah, i think you are right about it

gleaming prawn
#

but the use cases are specific of course.

rocky bramble
#

Does not engine itself expose any networking/socket apis?

gleaming prawn
#

in regular client-server netcode with a Unity headless instance being a server to typical player count (<200 or so), no need to go deeper than .net sockets I'd say

#

If you are new to Unity... Nothing production-grade... THey are working on a new official package now (after a few old tries that did not succeed). THere are third party libs as well (I work for a company that provides some of these)

rocky bramble
#

Is there any reason to use unity headless client for server instead using seperate c++ asio/raw socket server or just .net core application?

gleaming prawn
#

yes... most typical low player count games use this approach, because from the development perspective you write the same code for both server and client

rocky bramble
#

i can understand this use case for p2p

gleaming prawn
#

Engine as server (unity, UE, etc) It's actually the recommended way to go for competitive FPS, etc

#

this is the RULE, not the exception...

#

You go for separate server code when building a mammoth MMO or so

#

OR when writing a service that will be used to supply "p2p" services (like a relay server). So perhaps the opposite of what you thought

#

P2P in the traditional sense of everyone connected directly to each other is basically not used at all anymore...

rocky bramble
#

are there any other network architectures for games besides client-server?

gleaming prawn
#

yes?

#
  • client authoritative (via relay server)
  • deterministic predict rollback
rocky bramble
#

im just asking, i just started with games network programming,

#

btw, thanks for help mate, You helped me a lot ๐Ÿ™‚

gleaming prawn
#

yw

steel mist
#

gotta copy + paste the details that i posted yesterday:

the game works fine from the menu, find some match and going to the lobby scene, I think the problem is that when the countdown from the lobby ends, the players spawn exactly at the same time at the game scene, maybe its because of that they doesnt spawn in different locations and always at the first position of the array

#

if anyone could help i would appreciate UnityChanStore

junior willow
#

because from the looks of the script, they're all going to spawn at the spawnPoints index of zero

#

Also what's the spawnTotal

steel mist
#

i didnt put, but inside the spawn() there is a playerid++, so when someone enter, the index would be 1

#

but still do not work

slim ridge
#

and looks like all the spawn points are 0,0,0

steel mist
olive vessel
#

Yeah but you seem to overwrite that in your Spawn function?

#

When you create a new array of 2 Vector3s

#

@analog bear Basically, Photon is "free" until you hit 20 CCU. But Mirror and MLAPI require self hosting, player hosted servers or P2P

#

Also with Mirror and MLAPI, if you don't use a relay service, users must port forward to host online

drowsy yoke
#

can anyone familiar with GET requests talk me through doing one in C# ๐Ÿ˜…

final timber