#archived-networking
1 messages ยท Page 60 of 1
Photon Unity Engine
You can make it with dedi servers, or p2p hosting.
Watch out for p2p hosting, because you can have things like host hacking which is not fun for your playerbase.
So dedi is the safest option, but p2p hosting is the easiest option.
afaik
yeah, but for now we use p2p because dedicated server are to expensive
so for p2p is only need the Photon Engine the PUN services ( https://www.photonengine.com/en-US/PUN )
Photon Unity Networking framework for realtime multiplayer games and applications with no punchthrough issues. Export to all Unity supported platforms, no matter what Unity license you have!
right?
@versed rock you could use PUN, yes, but for these kinds of games Photon Quantum is the recommended solution (we do have a few customers who have exactly that kind of game implemented with Quantum).
Disclaimer: I work at Photon, specifically on the core team who develops Quantum.
You can try this game: https://play.google.com/store/apps/details?id=com.wolffun.herostrike&hl=en
This is made with Quantum, including the AI for the Bots (using our AI SDK, etc)
quantum doesn't have anything free, unless you've signed an agreement with us for a trial
so with Quantum we need Dedicated servers for more "safe" plays?
or still need dedicated server
It uses the photon servers for its authority over player inputs, but determinism puts all of the heavy lifting on the clients. Determinism removes the need for server simulation since it allows all clients to produce identical sim results.
Do you guys have any kind of basic docs up to explain the architecture? @graceful zephyr I am sure I explain my understanding of it badly way too often on discord.
We do, but it's all private
Might be worth making a public FAQ?
ยฏ_(ใ)_/ยฏ
ok, thanks for the help! i'm going to try the PUN service to make the game work with p2p
and maybe think in the future migrate to Quantum (we don't have money for now... so we need gain money first hahaha )
you don't migrate to quantum though. It is a completely different approach, but not for casuals.
migrating to quantum = complete re-write of all game logic
PUN is going to be fully interpolated snapshots in most cases, with lots of owner authority
ok, so for the next project hahaha
thanks
have support for Host migration? between the players?
So its going to be nice and easy for some game types, and just impossible for like fast competitive pvp types
yeah, because of the nature of relay (no authority server, just a client that is picked as the Master) host migration stuff is much easier with PUN
since all clients are essentially the same. There isn't a change of host, just a change of which client is considered "the final word" if you want there to be a final word on anything
but its two relay hops away from other players, so its not a true replacement for a server.
You can though make Server plugins to give the relay some brains
But the relay is not ever going to be running a Unity physx sim or anything. If you want that, you really are going to want to host a server.
If this is just a learning how to make a MP exercise, none of this matters much. Just make whatever. Your first attempts are going to be hot garbage. Just have fun.
hahah yeah, thanks for the advice
for now we're going to try PUN and make little project to work with the online and try to create matchs 3vs3
not focused in the competitive but maybe some arcade plays. We know the p2p problem with the player hacks but well... maybe in the next project use Quantum and fix this problem
I'm going to be dropping some Beta stuff I am doing for Exit that extends PUN2 if you would like to play with that @versed rock
yeah, thats great, of course
@versed rock if you are serious about your game (and you have some prior experience), send us an email to developer@photonengine.com. We can share a deep dive video with you.
We've set some interesting deals with smaller studios. Worth a try...:)
With quantum, "host migration" is not needed at all... And we also support server authority for game results, server snapshots for late joiners, etc...
But of course, you can use PUN/PUN2 at will. Just suggesting that contacting and getting more info doesn't hurt, and it doesn't come with any cost.
ok, thanks @gleaming prawn for all info, we're going to make some test and learn more about photon and yeah, maybe we send u email with our experiencie and all information
https://www.gafferongames.com/
Is a good place to get familiar with some of the concepts and things you will hear about
@jade glacier amazing website, a lot of good content
Are you able to make the problem go away by sending less?
I am not familiar enough with LLAPIs error messages to just say
I am attempting to use the Mapbox Unity plugin with my Magic Leap One device, however I am getting this issue when I try to build and run: 'HTTPRequestThreaded' does not implement interface member 'IAsyncRequest.RequestType'
this is a photon pun project, as you can see in the gif the game works perfectly fine for the host, meaning he joins the room, yet the client cannot join the room(which is a scene) and instead is instantiated in the menu. could someone help please?
you'll need to isolate that down to the likely code block at fault and paste that code
otherwise all we can tell you is "You did something wrong"
alright
there are too many lines ill send the file
i have the script responsible for the actual rooms
public void connectCancelPressed()
{
cancelConnectionButt.SetActive(false);
connectButt.SetActive(true);
PhotonNetwork.LeaveRoom();
}
void createRandomRoom()
{
Debug.Log("the createRandomRoom() has been called");
int randomRoomName = Random.Range(0, 100);
RoomOptions roomOps = new RoomOptions() { IsVisible = true, IsOpen = true, MaxPlayers = 5 };
PhotonNetwork.CreateRoom("Room #" + randomRoomName, roomOps);
}```
and this piece of code in a lobby script that basically is responsible for the menu and getting the player online
?
oh
Asking me what a url is? LOL
Did you get a tutorial working first with PUN/PUN2? Usually best to start with some working demo code and tweaking that.
yes
should i send it here?
How to make a Multiplayer Video Game
Discord: https://discord.gg/UaSVbJJ
Here is the next lesson on how to make a multiplayer game in Unity using the Photon 2 plugin. For this lesson, we will be focusing on player movement and synchronizing the transform across the network ...
The file you linked? Nah, not going to open that. If you have isolated it down to a section of code that you are having trouble with, paste it here if its short, or paste it in a bin if its long
ok sounds fair
That tutorial is what you are trying to follow?
and it was working up until part 7?
that looks pretty boilerplate at a glance
I'm only half here. But I am not sure what you have isolated down to being the problem.
When you hit connect there is some camera weirdness visible in your little gif
but I have no idea what is supposed to happen, vs what happened
well
i explained in the gif
but if you didnt understand what is supposed to happen, both the users should go to the same room which is the room the user on the left was in
in the gif the second user was instantiated in the menu
it is not supposed to happen
I'm not seeing the code in your hatebin that shows how the UI should be getting hidden
LoadLevel?
ill send it here
@near cairn I think your daily quota exhausted
@narrow oriole the fuck is a daily quota
I have a pretty finite amount of time, which is why its best to REALLY isolate down your issues to a part that doesn't make sense to you
otherwise you are asking people who are mid work on their own project to read your entire project and try to guess where its breaking
Others in the chan may be following too
ok ill put only the suspicious parts
@near cairn first step would be to stop swearing
but I'm more useful for things like "why doesn't this method call do what its supposed to do"... less "Why my thing no worky"
@narrow oriole ok sorry if i insulted you
No, you did not insult me. The point is to talk adequately
Anyway, if you can isolate down the actual point of failure, might be able to help
You are getting premium support here for 0$ / hour
post what its supposed to do, what it is doing instead... and where in the execution it goes off the rails
It looks like its supposed to change scenes or something, and is not
Do you need autoSyncScenes or something? I forget the name of the var.
//should make ui go yes and also makes a room, i believe this is the source of fail. probably the createRandomRoom().
public override void OnConnectedToMaster()
{
Debug.Log("user has connected to the photon servers");
statusReport = "user has connected to the photon servers";
connectButt.SetActive(true);
}
public void connectPressed()
{
PhotonNetwork.JoinRandomRoom();
connectButt.SetActive(false);
cancelConnectionButt.SetActive(true);
}
public void connectCancelPressed()
{
cancelConnectionButt.SetActive(false);
connectButt.SetActive(true);
PhotonNetwork.LeaveRoom();
}
void createRandomRoom()
{
Debug.Log("the createRandomRoom() has been called");
int randomRoomName = Random.Range(0, 100);
RoomOptions roomOps = new RoomOptions() { IsVisible = true, IsOpen = true, MaxPlayers = 5 };
PhotonNetwork.CreateRoom("Romm #" + randomRoomName, roomOps);
}
//there is this part in the rooms script too that should laod the player into the next scene which is the onlineScene.
public override void OnJoinedRoom()
{
base.OnJoinedRoom();
Debug.Log("user has joined");
if (!PhotonNetwork.IsMasterClient)
{
return;
}
startGame();
}
void startGame()
{
Debug.Log("loading level");
PhotonNetwork.LoadLevel(onlineScene);
}```
@jade glacier exactly it is supposed to change scenes for both users
yet for the client it diddnt
{
/// this makes sure we can use PhotonNetwork.LoadLevel() on the master client and all clients in the same room sync their level automatically
PhotonNetwork.AutomaticallySyncScene = true;
}```
miss that from the tutorial maybe?
alright
i dont think he had this line in his code
in which script do i put it?
i dont think he had this line in his code
in which script do i put it?
maybe not, something else might be in there to force that
Dunno
Not my set of scripts
Any awake would do it, its all before the networking starts
as long as its on a scene object
heading out, gl
Hey guys, I am trying to poll the state of a physical RGB wifi bulb. I have the code working, but not well. How it works is I send a TCP packet to an IP address which gets a return message about it's on/off state, color, etc. I decrypt this message and update a sprite's color based on the message received.
The problem is any time I try to do this more than 1 time a second, the whole program slows down.
In a command console, I can poll the state of these LED wifi bulbs ~20 times a second with no problem.
But I must be doing something wrong in Unity.
Would anyone like to take a crack at it?
Hello, pretty new to networking & ECS. I'm following the "Getting Started" section for Unity NetCode 0.0.4, and everything appears to connect & show up in the Entity Debugger. The issue is that the mesh isn't being rendered, and input doesn't move the player. Any help would be appreciated.
@weak plinth If you are new to networking, using the new NetCode isn't the way to go, it's basically alpha quality and super early, full of bugs, etc.
@fholm Thanks for the advice. I'll see about finding another solution.
@weak plinth Mesh isn't rendering is most likely that you don't have HybridRendering package installed, or that the position of the rendered object is off screen by your input ^^
Hello, does anyone know of a way to properly run two editors of the same project that are synced for testing multiplayer? I tried googling around but most posts seem to be from before 2013. Constantly building the project to test a few lines of code is very bothersome. Thanks!
There are a couple options for that, but I haven't used them and I am forgetting their names.
I lean pretty heavily on Debug.LogError() to get things to show on builds - to avoid that two editor thing.
@elfin hare Two projects with one having folder junctions to key folders in the other. Depending on which networking package you're using, you may need to be careful which folders are junctioned, e.g. don't go all hamfisted and do one junction of the entire project. Hand pick folders inside Assets that need to stay in sync.
alright, thanks
@elfin hare I describe in detail how to do it here: https://forum.unity.com/threads/official-multiplayer-improvements.390823/page-3#post-3013017
Hey. I'm starting the development of a multiplayer game nowadays. Following the Unity chart on how to decide the networking technology, I came up with Netcode + Transport. Is this anywhere close to be production ready? Shall I look for other solutions such as Photon or SpatialOS? I'm afraid that in the middle of the development Unity will launch Netcode production ready version and my project'll get inmediatly deprecated.
I would give yourself a few weeks to make tutorials on a bunch of the options
Is there anyone that would be willihng to hoop in a call and help me with the basics of unity just to be nice
@vital hawk You serious? So I should go for another external solution? They say that they want it to be prod ready this spring.
@grizzled dagger there are extremely slim chances the new DOTS networking solution is going to be anywhere production ready even in next 1 year , going by current state of released packages and discussions on forums. would love to be surprised though.
Damn... So I'd better go with Photon or similars, right?
@grizzled dagger Where does it say that it will be production ready this spring? From their chart which was released last summer they said you should stick with NetCode if you release 2020 Q3+
Not spring, sorry, I missread. Q3+, yeah.
@grizzled dagger you know that blog post is a PR thing, right?
Yeah, sure. I just expected such an important information (to decide which technology to use on a new project) to be trueish.
Take everything with a grain of salt.
(including whatever I say)
There are several nice devs here in this channel.. you'll get good advice.
Okay, thanks for the advice.
There is a lot to get your head around with game networking before even worrying about the now DOTS stuff. I would give yourself a little time to run tutorials on the 3rd party options just to get your head around the concepts like snap interpolation, determinism, lockstep, server vs client authority, hosting, punchthrough, relays, etc etc.
In the end it is less about picking a library, and more about understanding the different architecture choices you have to make use of.
So, IMHO that blog post is not to be taken seriously... The advice there is just not very correct...:)
That blog post is bizarre at best
I'm being polite...
LOL
We all know that blog post has been subject of very "interesting" debates...
Someone was just tasked with "how do we make all of this seem intentional?"
void Awake()
{
nick = GetComponent<Text>();
nick.text = "User #" + PhotonNetwork.NickName;
}```
i get the error, but i have no idea how to fix it. what i want to happen is the nick.text there will be set to the string and the nickname of the player, i have already set the nickname in another script but for some reason it doesnt work.
is the PhotonNetwork.NickName even the nickname of the user or am i not getting something
What part is null? debug to make sure you actually found 'text'
PhotonNetwork can't be null as far as I know
it's a public i've already set it in the editor
and Nickname returning null should just print nothing
interesting
I would throw a bunch of debugs in before that to isolate the actual null problem
Ok, @jade glacier and @gleaming prawn , thanks.
Is that code appropriate in Awake?
Pretty sure not
Nickname is just a non-unique convenience name for the player... unlikely has any meaning yet during Awake
Following the code path, it leads to LocalPlayer.Nickname
LocalPlayer is never null, but will be invalid if not in a room yet. So as long as your connection is to a room... it should be fine.
ill try putting it in update
Update would happen every screen refresh... Probably not what you want either. Just needs to happen after OnJoinRoom callback happens
not the best option in my case
anyway ill leave nicknames for now i dont really need it
void OnCollisionEnter(Collision collision)
{
Destroy(gameObject);
HealthLogic hpL = collision.gameObject.GetComponent<HealthLogic>();
if(hpL != null)
{
hpL.hp--;
}
}
currently i have a major problem, there is this bullet logic piece of code that i have been trying to get to work, the problem is that the bullet is getting removed while the clients are in the room and everything is amazing, however when new clients join the room almost every single bullet instantiated in the room since the start of the game and well was removed for everyone that was in the room is not removed for them(the new clients that joined the room). so then bullets are just instantiated for the new clients and they get damaged without the other clients seeing that, this unsychronizes the game for the clients and some may see the new clients dead while others see them alive.
i have tried doing PhotonNetwork.Destroy(); istead but it returns identical results
Sounds like you're not handling the damage/death logic on the authoring Client, and that you are buffering the spawn of bullets to be created for other players?
i did not understand a single thing of what you just said.
Anyone knows how to get the jobindex in a ICollisionEventsJob to fill the needs for EntityCommandBuffer.Current
wrong group sorr
y
@stray scroll can you simplify what you said? t
@near cairn If you're checking on all clients for collision between bullet and character, they will mismatch if not everything is run deterministically, which by using normal photon it wont by default. So you'll have to handle all such logic on one client that is "main client".
@stray scroll and how do i do that?
I think it something like checking if PhotonPlayer.isMasterClient
I would advise against making bullets into network objects regardless
Unless these bullets are ai and are going to be doing something super not-deterministic.. treat them just as events
@stray scroll that is really confusing, why would i add that proprety to a bullet
I just opened up the early beta for a library I am making for Exit that does a lot of this stuff for you, if you want to give that a shot @near cairn
Or if anyone else for that matter would like an invite to the discord
what do you mean by "library"
like PUN2 is a library
@near cairn You would check if the localPlayer is the master client, and then allow destruction of net entities. But listen to emotitron, I've not used photon for some years and barely remembers the stuff.
this is MORE PUN2

ill think about it but rn i wanna stick to what i have
also if not adding a network proprety to the bullet what would you suggest eme to do
making them events
deterministic events... just send a message along with the transform sync saying "Fire Weapon X"
If all clients are getting the players transform info along with the fire command... then its basically deterministic. Just make the bullet on non-authority versions cosmetic (it doesn't try to do any damage calcs)
How to use unet? This is what I have
networkManager.matchMaker.CreateMatch(roomName, roomSize, true, "");
What's unet? Unet's dead baby, unet's dead...
Maybe you should take a look at Mirror @wooden swan
That is an open source evolution of unet that is in active development
Would grouping data by predicted and interpolated, or by it's smaller context be a better approach for ECS? I see DotsSample does by the first, but not sure if it's just lazyness x)
what do you mean by smaller context @stray scroll ?
Like for the more specific context, like movementData
using the networking model of unitys dots networking, you will usually have A LOT of interpolated and A FEW predicted entities
for w/e that's worth
So either stack up Components into one PredictedComponent & InterpolatedComponent or keep them seperated as e.g MovementData, AnimationData, TeleportData, ParentData etc
@graceful zephyr Hmm, how come so sure? Wouldn't all data be checked in their network system for changes, so iteration there would be faster?
you'll get better perf by going through each type of data in chunks, instead of trying to go through all data at once
i.e. do all Movement, then all Animation, etc.
instead of doing MovementAnimation at once
Yeah, for all the normal game logic, but for network. Just quickly checked e.g.
public void CopyToSnapshot(ArchetypeChunk chunk, int ent, uint tick, ref CharacterSnapshotData snapshot, GhostSerializerState serializerState)
{
snapshot.tick = tick;
var chunkDataCharacterStateComponentData = chunk.GetNativeArray(ghostCharacterStateComponentDataType);
var chunkDataCharacterParentData = chunk.GetNativeArray(ghostCharacterParentDataType);
var chunkDataClientIdData = chunk.GetNativeArray(ghostClientIdDataType);
var chunkDataRotation = chunk.GetNativeArray(ghostRotationType);
var chunkDataTranslation = chunk.GetNativeArray(ghostTranslationType);
snapshot.SetCharacterStateComponentDataState(chunkDataCharacterStateComponentData[ent].State, serializerState);
snapshot.SetCharacterParentDatashipParentID(chunkDataCharacterParentData[ent].shipParentID, serializerState);
snapshot.SetClientIdDataClientID(chunkDataClientIdData[ent].ClientID, serializerState);
snapshot.SetRotationValue(chunkDataRotation[ent].Value, serializerState);
snapshot.SetTranslationValue(chunkDataTranslation[ent].Value, serializerState);
}
This will cause jumps in memory, if structured as one component for data that is interpolated, this would be linear in memory, but then the normal game logic would suffer some...
@jade glacier sorry for replying just today i got really tired to do all this stuff yesterday
but anyway im really confused
i just recorded what happens when a new client joins the game
it's not all bullets that were instantiated
but some appeared
and i have no idea how to fix it
i have also read what you told me
i dont understand what you mean by "events"
i left the script the same except i replace "Destroy()" with "PhotonNetwork.Destroy()"
If you don't go by events you have to be sure your current running application is the masterClient.
so
if(masterClient && bullet.collided)
// Destroy object
yes exactly that's the thing
the bullet doesnt really belong to anyone
so who am i refering to as the master client
you like that?
if (!PhotonNetwork.IsMasterClient)
{
return;
}```
i tried doing o but the result is the same
Are you sure you're not doing the destroy somewhere else then as well?
I would try do a print/log on PhotonNetwork.IsMasterClient to see that it is different
im doing it in the bullet logic script
there are no more errors but the problem is still there
do
if(PhotonNetwork.IsMasterClient)
Debug.Log("Is master");
else
Debug.Log("Is not master");
alright
same results
i mean obviously it's working
for clients it's saying is not client and for the host im pretty sure it is
not the host the master client
oh hold up
i see what you are doing
nope nevermind
i have an idea though
i could try deleting all the bullet prefabs for the client when he joins
actually no nevermind
Ah, ok, I think it might be that the bullets are spawned by the non master players then?
Anyone used Pun2 to make ranked matchmaking? How did you go about it?
@stray scroll yes exactly the bullets are instantiated for the players that join and for the players that are already in the room everything is fine meaning that the game goes smooth and the bullets are not instantiated from nowhere
@near cairn 1st: what I might be saying is not true since I don't sit with photon anymore , but I think you need to destroy them with the client that spawned them, else you'll get error and it wont despawn on everyone.
2nd; it is better if you let the master client be the one that spawns the bullets and handles the collision logic so people can't cheat,
3d; it is even better to create RPC to spawn bullet locally instead, and still only let master client be allowed to handle collision that affects death
so what you are saying is to let the master client to handle the room?
Depends what you mean by "handle the room"
all the logic
@stray scroll i tried doing the third option using rpc
i've learnt a little but i am dont know how to construct it
Photon Unity Networking framework for realtime multiplayer games and applications with no punchthrough issues. Export to all Unity supported platforms, no matter what Unity license you have!
Need to sort out why my capture is all jacked up first
@near cairn The SNS beta for PUN2 has built in handling for projectiles you might want to look at for ideas, or just use the library itself.
Not sure why my screen capture video plays all jerky here though,.
The SNS lib has a demo scene, but it's not part of PUN2, it's an extension of the pun library. So it can work alongside existing pun2 project code. Ideally though you would move to using its timings and callbacks rather than mix the two.
It's not officially released, but the beta I posted works and is available to use.
I can't post links here, so you need to ping me if you want the discord invite.
@jade glacier i guess i got no other option
for a v simple multiplayer game where a bunch of people just have the ability to move around a map as a beginner project
should i use network manager?
and is this even worth learning since the thing is going to be removed soon?
If you are looking for something similar to UNET
go look at Mirror on github
They even have their own discord for mirror specific questions
Hi, I am looking do do a small real-time Multiplayer game with a dedicated server. Do I need to make a unity project for the server or can I make a .Net Core console app ? I don't know how to make the server authoritative without Unity (collision check, ray-tracing...)
@nova kindle You can in theory run Unity as headless
whats the impact on the performances of having Unity in headless vs a console app ? For a top down isometric shooter
in other words, is unity decently optimized for handling the server side or should I go for something else to check collisions in a 2D environment ?
I am guessing this is the right channel for this. My question is: how would one hook up a completely custom made c# server to unity. I found a tutorial on how to make a server using just c# and looks pretty performant, and because it can be made along side c# form, I can make it really user friendly so any one can set up a server. The problem is I don't know how I would connect something like that to unity. First thing that comes to mind would be a basic system were the server right the needed infomation into a text document then Unity extracts that infomation from that exact same document. Though I am guessing that this system would quite slow and/or low performance. Am I right and how if so, how else would I connect unity to the custom made server? P.S. i am a noob with servers and frankly I don't really know what I am doing, so help would be appreciated
Hey everyone! So, I'm completely new to this side of unity and basically know nothing... I've been trying to connect two mobile devices through wifi, so that I can send data between them. My first thought was that one would create a room and the other could join but I have no clue how to start investigating all of this. Any tips please??
im having this problem with photon. I have a script that gets me into a game or lets me host one all controlled by one button, and it worcks just fine, no errors or anything. but after I relesed a new build of the game both player will create a room insted of joiningeachother. please help.
I would run tutorials for a few of the net libs to get comfortable with the concepts @novel heron
@little talon hard set a region
In settings
ok thx
Editor tends to connect to oddball regions
ok, what value should i put in
Where are you?
North Amarica
us
Canada
us
That did it?
yes
๐
Hi, I want to use UNet just for testing (I know it won't be supported for long anymore). I want to get playerpref position and enable it from the Host. And then sync that position to the other Clients aswell. How would I be able to do this?
how do i use rpc functions to destroy objects? i tried several ways yet everything euther is just not working either returns an error
I have a question about how to design some PUN2 stuff. My game is only 1v1. Right now if I fail to find a open room based on matchmaking parameters I create a new room in OnJoinRandomFailed() but what do I do about lobbies? Right now I create a lobby with a set name when the client connects to master. But do I need to create more lobbies if my game mode does not change or what?
@near cairn In which networking solution?
@wanton scroll : You don't have to use lobbies at all. If you don't define any specific, the default one will be used. You don't even have to join a lobby to use it.
@stable epoch : Photon Bolt (by default) uses the Photon Cloud for matchmaking and as fallback but as soon as clients are in a room / match, they automatically attempt to establish direct connections.
@stiff ridge but I'm using the sql lobby type so that I can have ranked matchmaking.
@wanton scroll : Ok, yes, then you need to define that. But you don't have to distribute rooms into many lobbies for a long long time.
thanks that's what I was asking cause I could not find a room limit on the Pun2 docs ๐
The MaxPlayers setting is in the CreateRoomOptions class. It's just a wrapper for the various parameters that create room needs.
It may also make sense to close and or hide a room, when it's full / being played. Just use the Room properties for that.
direct connections.
@stiff ridge Noob question, but just to clarify this does mean P2P right?
Not exactly Jinxie... What do you mean by P2P (this is a loose definition)
You can say PUN is also P2P in that the LOGIC control is P2P (the server is "just" a relay)
Bolt is "p2P" (most of the time) in that clients connect to another game client (listen server)... BUT
This is only true if you are using Bolt with client-hosted games.... Bolt can also be used by running unity-headless instances as 100% server-authoritative hosts...
Then it's not "p2p" anymore... see?
Also, even the client-to-client connections still rely on the photon servers for:
- matchmaking
- punch through signaling (+ stun servers for reflexive address queries);
- connection fallback (in case punch through fails, which happens in about 10-15% of the cases).
- reliable background communication channel for any custom use.
Which exact networking SDK, PUN classic, PUN2, etc?
I think Tobi didn't follow your previous questions.
All of them, I mean
pun 2
how do i use rpc functions to destroy objects? i tried several ways yet everything euther is just not working either returns an error
In PUN, I would suggest to use PhotonNetwork.Instantiate and PhotonNetwork.Destroy.
Handling object lifetime with RPCs is possible but more manual work.
More in the docs: https://doc.photonengine.com/en-us/pun/v2/gameplay/instantiation
Photon Unity Networking framework for realtime multiplayer games and applications with no punchthrough issues. Export to all Unity supported platforms, no matter what Unity license you have!
@stiff ridge i tried doing so but when new clients.join the object i s instantiated again
like when i shoot a bullet in the room and a new client joins it some bullets i shot are instantiated for the new client but not for me
so then i might take damage for him but for me everything is fine
@stiff ridge do you know how to fix this?
@gleaming prawn I dont mind using servers for matchmaking. But since i am making a fighting game (mobile 2D 1v1) I dont want server between them during battle, I want the connection between the players as fast as possible.
It will always be as fast as POSSIBLE
BUT, for a fighting game, I'd argue that Quantum is the best approach
Which is exactly "rollback-netcode"
Bolt is not really well suited for a fighting game...
@near cairn For bullets, you should send the RPCs with the info "I shot (when, where and in which direction). Such an RPC should spawn bullets temporarily but they should be cleaned up on hit or after a specified time.
Sending a "clean up bullet" RPC as well, is too much work quickly.
Joining users will initially get everyone's hitpoints and then subsequently new shots. No need to show bullets for shots that have been shot a while ago (and neither is there a need for explicit network messages to cleanup).
@gleaming prawn This option looks like primarily dedicated servers
@near cairn it doesn't look like you accepted the photonengine discord invite. You can still grab the SNS beta there that literally handles all of this for you.
@gleaming prawn Plus, holy crap, that service is really expensive
Do you think so? ๐
How much would it cost the salary of a good developer to code a rollback solution for you from scratch?
And no, it's not primarily dedicated servers (although quantum also include the option of running simulation on servers)
I suggest you read a bit about Fighting Game networking... It's a very very deep subject.
@jade glacier i did but i remember getting alot of errors
@stiff ridge how do i make such an rpc? i know how to do the direction, and how do i make an rpc temporeral
With SNS? @near cairn
@gleaming prawn
Tbh a basic rollback system isnt that hard to set up. Ive done it before. I just have no idea how to 2 player P2P on mobile. xD
Honestly youd need to be AAA to even scrape those prices and get a profit. And even if it did, it would be paying waaay cheaper just to get a team again.
@jade glacier i got errors on the demo game
I would be very curious what those were and how you got them.
lmao ill have to download everything again
It's meant to be pretty bullet proof
ill do it in a moment
but you did this extension somehow right?
i want to know how you did that
I make the SNS lib yeah
yes
I am working for Exit to build it
wdym
Exit makes and runs Photon Engine
ok
so you used exit to make a pun2 extension
Not so much used to make... More it extends PUN2
The basis is Simple Network Sync, which is an asset that works with a bunch of HLAPIS @near cairn
@stable epoch if you are familiar with the requirements for determinism + rollback netcode... then I'd argue that the cheapest option (that will guarantee 100% connection) would be to skip Bolt/PUN/Quantum altogether
And just go for Photon Realtime (native version also offers PUNCH)
So you have guaranteed P2P communication (logically speaking), and you can rollout your own rollback on top just fine...
Alternatively, if it was for PC, Steam Network would be enought (but for mobile, guaranteed connections and cheap, photon realtime - starts with free plan)
Yeah the thing with mobile, is the Apple and Android work differently with networking, especially when someone uses data. So i just thought i guess ill use Photon or something.
I found an open source thing which is Photon but free and use your own servers but its got no P2P support.
Photon Realtime C# has no PUNCH through... But it is P2P in the sense that you send messages between the clients
Photon Realtime NATIVE has embedded Punch Through
If you have a rollback solution, you should NOT need punch through though...
Im confused the difference between the different Photon services. Like Bolt seems like the P2P option but it also does dedicated servers and half the other things can do P2P
Bolt is based on the architecture of CS:GO, so it's very much standard server auth with snapshot interpolation at its core
I dont know anything about CSGO
Counter-strike
Best to just ask your question.
I want to make a nameplate. The only problem is, the host is not getting the nameplate of the other players. But the other players are getting all the nameplates from the other players
I'll support this with a screen
Host:
Not just using a syncvar?
i do
Player 2:
playerNameText.text = playerProf.playerName;
[SyncVar] public string playerName = "Name";
2nd one is from my playerprof script
You will need to make use of a hook probably
{
return;
}
playerName = PlayerPrefs.GetString("Name");```
why does the host not update the 2nd player. But the 2nd player does update the host
I would need to see the entire script
ok 1 sec
Without a hook, you need to tell the UI to apply that syncvar value manually after connect
What is the easiest way.
playerNameText.text = playerProf.playerName; seems odd
The misspelling for one
i just made that quick
That you are setting the gui using a preference rather than the sync var
Not sure what it's trying to do, but that all seems very wrong
Just with a synvar with a hook
the hook is for if something changes
but on start it just pulls the name from a playerpref
What does? The player?
the script
Only the server can set them
playerName = PlayerPrefs.GetString("Name");
playerNameText.text = playerProf.playerName;
So you would need to send a command from player to server to set it
Is it?
Yeah
Or is it just pulling the local pref?
Yeah
SyncVar is updating automatically for new client i read
So the name is visible for the client
Clients cannot
but the host doesnt get it
The host has it, it sets it
You may not be executing code to apply the changed syncvar locally to the ui
idk why it doesnt work
Have you debugged it to see where?
If the host changes the name, it appears on the client
but if the client joins the name doesnt appear on host, and neither if client changes it
I simply just want to fix it
You really need to go do more tutorials to get the execution and such
I would use mirror and join their channel
{
if (!isLocalPlayer)
{
return;
}``` that is telling the owner to not do any thing
why would it
It needs to be told to copy the new value to the UI somewhere
it copies the new value to the UI for the Client
the Host is also a localplayer right
No
Host and local player have different meaning
You really need to go read up on Mirror/HLAPI a bit more. You can't guess your way through those apis
Join the mirror Chan
So I figured, the clients only see the name of the host
Prob bec the host sends his SyncVar to the players
Server can set syncvars yeah
This why players need to send a command in OnStartLocalPlayer
'm
Hello, I'm new to unity networking, where can i find a tutorial with the new api?
Dont' think there is much tutorial on the new NetCode, there is a quickstart and sampels here https://github.com/Unity-Technologies/multiplayer. Nor is it close to finished or production ready, and many would discourage you to use it yet : )
If you're not going to use DOTS, I would recommend looking into Mirror or Photon.
Maybe this helps: https://forum.unity.com/threads/what-are-the-pros-and-cons-of-available-network-solutions-assets.609088/
Hi
So I used UNet, im making a nameplate
The nameplate is syncing for all the clients. But the hosts nameplate is not syncing to the clients
private TextMeshProUGUI playerNameText;
[SerializeField]
private PlayerMovementMP playerProf;
// Start is called before the first frame update
void Start()
{
if (!isServer)
CmdSendName(PlayerPrefs.GetString("Name"));
}
// Update is called once per frame
void Update()
{
// Fix this: playerNameText.text = playerProf.playerName;
if (!isServer)
CmdSendName(PlayerPrefs.GetString("Name"));
}
[Command]
void CmdSendName(string name)
{
RpcUpdateName(name);
}
[ClientRpc]
void RpcUpdateName(string name)
{
playerNameText.text = name;
}```
@jade glacier i used command and clientrpc
Have you joined the Mirror server on discord btw
Just goggle Mirror Unet Unity or any combo of that stuff
and they post the discord link all over the place
I can't paste it here
This channel will mute you for trying to post discord links
now i have
You might want to switch to mirror and then you can hit them up with questions
a lot of active users in their channels who might be able to help
I would use OnStartLocalPlayer though
and send the command from that
why?
No need for any isServer or IsLocalPlayer checks
it will fire on the local player
and will fire AFTER the network is started
Send the command from the player in OnStartLocalPlayer, and have the server set the syncvar on the receiving end of that command
Then add a Hook for the syncvar that tells the UI the change
void Update()
{
// Fix this: playerNameText.text = playerProf.playerName;
if (!isServer)
CmdSendName(PlayerPrefs.GetString("Name"));
}``` Like that is abusive. Fine for just testing but you would never want to do that. That is a lot of network spam
- player sends command OnStartLocalPlayer
- server responds to command by setting syncvar
its already doing 2 right
- hook tells all clients how to respond to changes in syncvar
bec of the [command] and [ClientRpc]
No need for ClientRPC
what should i all place in onstartlocalplayer
CmdSendName(PlayerPrefs.GetString("Name"));
this only?
and then leave the command like it is?
that tells the local player to send its preferred name to the server
what do i call in CmdSendName
{
CmdSendName(PlayerPrefs.GetString("Name"));
}
Nothing else to do
now rpcupdatename doesnt exist anymore, so i need to replace it
that will fire on the server
Just set the syncvar IN CmdSendName
That method gets called on the server, where the syncvar is maintained
so this: playerNameText.text = name;
will the players also see the host?
then you use Hook to tell it to apply to the UI
yeah, the host localplayer works the same
But you NEED to add the hook
no hook... nothing telling the UI to change
ah
i read somewhere: SyncVar hooks don't run on initial load despite setting the variable's value.
they don't
[SyncVar(hook = "ApplyToUI"] public string playerName;
{
playerNameText.text = playerName;
}```
you typically need to bootstrap them in OnStartClient or OnStartServer
Also, unless you switch to mirror you need to set the syncvar value there
It acts like a Property in UNET
The hook needs a different signature, not recalling never use this stuff
but you need to look up how to use Hook
i imported mirror
Mirror sets the syncvar before or after running the hook, I forget which.
how do i use mirror
By talking to them LOL
by importing nothing happens i guess
I don't use mirror or UNet
yeah, if you want to switch to Mirror... you have to lean on their docs and their support for that
Or stick with UNet, they will still be helpful since its similar
anyone have a recommendation for a minimalist networking package? Don't need any kind of anticheat (i.e., fully authoritative server) or need to handle a large amount of players. Ideally looking for something that wouldn't be super hard to wrap/replace later on. I have experience with networking, and so far LiteNetLib looks pretty good. Stuff like Quantum is really cool, but anything that would require total rewrites/new physics engine would be too much investment for the near future. Idea is to get a barebones implementation working for netplay between a Quest + other PC device in the same room/nearby. Game is this for reference: https://www.youtube.com/watch?v=74Xla432cpM
Add to your Steam wishlist!
โบ https://store.steampowered.com/app/1116540/Davigo/
Sign up for the upcoming closed beta!
โบ https://roystan.net/davigo
Follow development as it progresses.
โบ https://twitter.com/roystanhonks
DAVIGO is a 2-player game that pits a VR player a...
Looked through this thread
I am doing work on an extension of PUN2 that you are welcome to try. It basically consists of a lot of drop in components that do most of the common tasks of networking for you.
I can PM you the discord server (pasting discord links on this Unity server gets you muted)
@floral turtle
Great game concept in that video
sure that would be great @jade glacier . We're not planning on starting networking in the immediate future, but doing the research ahead of time to make life easy later on
Ok, 2019.3 has just come out of beta and it seems like the new NetCode is available. Considering that the new networking code is so new, where would be the best place to start in terms of tutorials/resources? Thanks in advance!
@night scaffold Look at quickstart, look at their repository with asteroids
Basic question here, I'm trying to implement multiplayer in a basic FPS game.
Should I start with PhotonPun2 or Mirror?
Depends on the architecture you are after
Mirror/MLAPI are based on creating a server that is a Unity instance that you would host. PUN2 is a relay environment where you don't host a server, and all clients talk through a relay server.
Which would be better for a FPS? I'm assuming relay ?
Competitive?
I would try Bolt if so. It is based on CS:GO ans is pretty much the only full stack option with all of the server authority handling built in. It isn't the easiest to get rolling on, but its the most "correct".
Will look into this. Thanks!
i randomly started getting this error and cant get rid of it, dont know what rong. the error says there is nothing ovveride? public override void OnPlayerEnteredRoom(Player newPlayer)
in visual studio it says there are no errors, help im confused
NVM fixed it. my new sript had the name and class Player.
In the future, be sure to indicate what library you are using and talking about @little talon
ok
Im using Photon bolt and the Assets keeps resetting to default (including deleting new ones) is there a way to properly save or something?
You might want to join the Bolt discord if you aren't in there. @stable epoch Few people in here typically can answer Bolt questions.
Thanks!
The server is pretty much silent.
Just dont ask about it's licensing there. Their staff have ultra thin skin there :)
Why so @vital hawk ?
I think the guys (employees) are super nice with the community.
Says an employee
Yes, fully discloaed
Disclosed
Sorry if I value my job and think it is fair to be paid to what I create. (Being clear, not bolt developer myself).:)
Have a family to feed...
This whole story about bolt licensing is just funny...
you've been always cool, it's just some people got immediately pissed off when certain topics arise again and again only because the product licensing didn't tell what exit game staff communicated it to do and they didn't want to have the discussion on what the licensing terms actually said there
it's one of the few places I've gotten banned for and I try to think of myself as a reasonable person
But maybe you should consider that the guys there are not 100% qualified to discuss
but yeah, this is offtopic here
No worries
Can anyone help me with logic or how I have to go about it here using Photon?
I have preferably no players that I want to instantiate. All I have is two player components with the only trackable variable being their health and the kind of attack animation that should be called. If I can sync variables, I can just use that to call the attack animation on the local instance.
Right now, I am instantiating a player object with Photon sync. In my player, I have two variables for player 1 and player 2. When I click a UI button, if the one pressing it is Player 1, the health of the player 2 will be reduced and if it is Player 2, it would be vice versa.
You can implement a component to serialize custom properties on a photon view network update
So you can decide to write the logic to run on either machines...
Am I doing the logic bit right here? Do I need two variables, because when both the players are instantiated, they both have their own player 1 and player 2 int, can I just use one variable and track the local and the non local variable
This is probably on the very first tutorial
You can implement a component to serialize custom properties on a photon view network update
@gleaming prawn I'll give it a try, I was using UNet till now, so I'm trying to use the same logic here, if there is something much more easier, I'll use it
This is probably on the very first tutorial
@gleaming prawn I've been following their documentation and tried using RPC's, I am running into some issues, which is why I wanted to see if the logic was right
What I'm doing is check
โ if (Photon.Network.IsMasterClient) { decrease player 2's health using RPC }โ
There are several ways to do this, IMHO it really depends on the kind of game
If this is a bit like a turn based fight, etc, I'd put the logic on the master client
If you like unet, give a try to Mirror
Oh, this is similar to turn based. This is basically a word game, you form a word from a bunch of random characters, press a button, if the word is right and is formed by player 1, he just reduces the health of the second player. I'm doing everything with UI buttons, so I don't even have a player to spawn.
It's the open source version, still in active development (unet is deprecated)
RPCs with the commands to master client
I'll give Mirror a try, but Photon looks much more flexible for now
Either sync the vars from there or send confirmation responses
Well, I'm a photon employee, so nothing against that
Will do, my only check ismasterclient, which is called properly, but when I try it with RPC's, both the players seem to reduce only both the players variable
Either sync the vars from there or send confirmation responses
@gleaming prawn Ah, that's great, I will look into confirmation responses
Im using Photon bolt and the Assets keeps resetting to default (including deleting new ones) is there a way to properly save or something?
MissingMethodException: UnityEditor.VersionControl.Task UnityEditor.VersionControl.Provider.Checkout(UnityEditor.VersionControl.Asset,UnityEditor.VersionControl.CheckoutMode)
Bolt.Editor.Utils.BackgroundProjectLoader.Save (Bolt.Compiler.Assets.BoltProject project) (at <33a983bf688145d5bed20a021e643dfa>:0)
BoltWindow.Save () (at <33a983bf688145d5bed20a021e643dfa>:0)
BoltProjectWindow.NewAsset (Bolt.Compiler.AssetDefinition def) (at <33a983bf688145d5bed20a021e643dfa>:0)
BoltProjectWindow.<OnGUI>b__9_2 () (at <33a983bf688145d5bed20a021e643dfa>:0)
This is one error i get. I get a few others similar.
@stable epoch you should try to talk to Ramon Melo directly on Bolt's Discord. He's not in this one here (lead Bolt developer).
Hi! I need to make a local multiplayer game for 2-4 people, which API would you recommend? Ideally the server would run on a PC and 2-4 VR devices (Android) would connect to play co-op.
@gleaming prawn
Can you help me with this
"does not implement interface member 'IPunObservable.OnPhotonSerializeView(PhotonStream, PhotonMessageInfo)'
I have 'IPunObservable' on a script in my spawned prefab, when I try to drag and drop this in the observable components, I get this error.
IPunObservable itself is throwing a error in my script
Does the component define it implements IPunObservable? After the classname?
As seen in the PhotonTransformView
public class PhotonTransformView : MonoBehaviour, IPunObservable
Yes
Copy paste the line(s) of code that define the method OnPhotonSerializeView
When I hovoer over to IPunObservable on my script, I'm getting this error.
"Script does not implement interface member 'IPunObservable.OnPhotonSerializeView(PhotonStream, PhotonMessageInfo)'"
I made the most stupidest of mistakes, wrote 'Serialize' as 'Serialise', sorry for troubling you
Does anyone got any answer for my issue? Ive been stuck all day and I only started using the asset. Starting to feel like Photon is just not worth it.
There aren't any Bolt peeps in this chan @stable epoch Wish I could help but my focus is on PUN2. I have only briefly played with Bolt like years ago.
Are you trying this in like 2019.3 and maybe are seeing an incompatibility there?
@jade glacier Is it not compatible with 2019.3?
No clue, I don't use bolt
Just wondering if that is a place to be looking.
Any bleeding edge new release is going to bring some issues with store assets.
im trying to get PUN chat setup, does anyone know a good tutorial/guide for getting it up and running?
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
the first ones are the most popular
i noticed a terrible issue that pun has, the transform view sometimes does less or more than what it should do.
i found the script that is responsible for the rotation and the position and well i have no idea how to make it linear or how some might call it RAW. i tried commenting the SmoothingDelay but it didnt help at all. any ideas?
public void Update()
{
if (!photonView.IsMine)
{
//Update remote player (smooth this, this looks good, at the cost of some accuracy)
transform.position = Vector3.Lerp(transform.position, correctPlayerPos, Time.deltaTime /** this.SmoothingDelay*/);
transform.rotation = Quaternion.Lerp(transform.rotation, correctPlayerRot, Time.deltaTime /** this.SmoothingDelay*/);
}
}
emotitron where are you at these dark times
?
you have to ping me if you want me to know you were looking for me
Time.deltaTime for t ? The fuck is that shit? @near cairn
That is such a hack way of trying to dampen
Is that inside of the SyncTransformView in PUN ??
SNS came from replacing the god awful transform syncs in PUN, HLAPI, Mirror and MLAPI
aww stop with that fucking sns
it is in synctransformview
you know how to fix their mess @jade glacier ?
hmm
SNS is my answer, because its literally why I made it - sorry to sound repetitive.
All of the transform syncs out there terrible, and the lib makers are the first to acknowledge it. They are just there as placeholders.
I am cool with you not wanting to try SNS, but I don't know how else to answer.
I made it to solve the problems people have with this stuff.
I mean, I literally don't know how else to say it LOL. I made SNS to fix that mess.
there must be a way to send the transform through rpc's though
I wouldn't recommend it, because it doesn't solve the issues with tick, deterministic flow, buffering and everything else that makes transform sync and sync in general hard.
RPC is just a way to send a message
hmmm
The problem isn't the messaging, the problem is the timings
?
the delays with the movement you mean?
Latency you can't make go away
yes
But snapshot interpolation is a pretty done and solved problem
just none of the transform syncs do it
https://gafferongames.com/post/snapshot_interpolation
If you want to take a whack at it yourself
Introduction Hi, Iโm Glenn Fiedler and welcome to Networked Physics.
In the previous article we networked a physics simulation using deterministic lockstep. Now, in this article weโre going to network the same simulation with a completely different technique: snapshot int...
Not recognized seems a bit odd. If you are getting errors you it may not getting to the point where it adds the define symbols
are you seeing log errors?
nope
I test the demo scenes that they provide and they work just fine
but when I try to make my own script it won't even recognize "using Photon.Pun;"
all the coding stuff is not available for some reason :/
I can't even get the latest unity to open a new project
what fresh Unity hell is this?
restart pc try again? :^)
sure. why not. "Performance if you can get it to start"
restart kicked off a zillion firewall requests for access, so likely had tried to get firewall access long ago while I was away and the requests timed out
Seems to have done it thanks @weak plinth
@steady kite Just installed the lastest unity, with the current PUN2 and the current SNS for PUN2.... all came up clean
why does it not recognize it in code for me then
yes
it was a 2019.2 project
updated it
and installed photon fresh
it would suck if i had to make a brand new project yikes
I would delete the built folders and let it rebuild before doing that
nuke the vs folder, resources folder and library
So PhysX is deterministic enough to have synced physics over the network. 1 month later and I finally have working client prediction, rollbacks, and state corrections and it seems to be very smooth. https://streamable.com/49l6p
If you are doing state transfers and you resim predictions when they disagree, yeah it can be passable. You will get more resims that a fully deterministic sim - but state transfer with resim is typically pretty resilient. @glacial totem
Though, you seem to have a very small number of objects as part of the sim there.
https://cdn.discordapp.com/attachments/493511492226908181/672835555465363467/2019-04-18_00-29-08.mp4
Just posted this in the Unity Networking chan. An old test where each connection owned 10 objects that it predicted. The lines poke out of objects where there is a resim. That fake invisible wall is on the server only, so its there to force desyncs... so any bounces against that a resim is expected... but they also would go into desync often for no real reason.
But even so... the number of those resims you can see happening are not huge. But they do happen.
Yeah resims are unavoidable because it's impossible to truly predict inputs from remote players
of course, that is the nature of snapshot interp w/ prediction
I have a dedicated authoritative server so that's the source of truth for my simulations
you just want the resims to happen because of bad predicts... not because of messy physics for no reason ๐
Yup ๐
Without any remote players (just my own player and the ball) I don't have any mispredictions
There are only a few sources of legit desync
the big one should be
- Players unpredictable movements
the other being
2) Late/lost packets requiring server to extrapolate inputs (guess)
and if avoidable
3) Physics just being shitty
The game design itself is what bandaids the rest of the problems. You can't have smooth gameplay if objects in the game change speed in a short number of frames/ticks
using that lasso dynamic will help yeah
creative way around the problem
and how people should approach this stuff
By having overall slower relative game speed, you make it so that when a correction is needed, the max amount of distance an object needs to ever be corrected is negligible
I got creative with my hit mechanics too
Too often people make a game and then are like "Ok, game done... how do network now?"
Which is a complete fail of course.
The mechanic is a wind-up that takes .5 seconds and then releases for an impulse
which means that any mispredictions usually happen during the wind up
with that mechanic, you could even remove the prediction no?
and get corrected and synced before the actual impulse happens
So the chargeup might have desync, but the actual shot never does
Sounds like you are doing a hybrid
hybrid what?
what you are doing, hybrid of prediction, and not prediction
is the player position client authority or server authority?
Everything is server authority
So how do you deal with lost packets for the player movement?
I send the last 10 inputs with each packet
That won't help though unless you have a massive buffer
at some point you are going to have an input not arrive in time for the sim
buffer always have 4-10 inputs sitting in it
Ack, might want to rethink that
with enough packet loss that will always happen
that is a LOT of induced latency
just a choice of how much you wanna try to compensate for
Induced latency doesn't matter though if it's by design
Typical handling for that is a smaller buffer (just enough to deal with jitter) and if a packet doesn't arrive in time for sim... the server uses the last input... and that becomes fact. The player then gets a desync when the disagreeing state arrives for its player.... and that forces a resim.
Yeah it's all choice
If you are ok with the latency and your game feels ok... sure. Easier doing it how you are.
But for frames of buffer is a pretty hefty cost
My target buffer size is basically 4 inputs
whats your net tick rate?
and the client is the one responsible for growing or shrinking that buffer
120hz physics and network
I use the Overwatch networking model
you send updates at 120 per sec?
If the input buffer on the server is too small, the client runs extra physics frames, too big and the client skips physics frames
not to question anyone's choices - because its all voodoo... but that rate of sim is usually to make things snappy
but then you are undoing it with a massive buffer
right now I'm using 120 tick for the networking but I've tested with 60 tick too
Yeah, I would just build your system so you can toggle those values and play around when the time comes
Also almost all of these design choices are basically the same as Rocket League
RL uses a 4-10 tick input buffer
RL extrapolates and resims quite a bit
But uses Downstream Throttling
The server in RL controls the input buffer
and grows or shrinks it by skipping inputs or reusing the same ones
yeah, I recall they just consume or repeat frames to size the buffer
Correct
They have since implemented the OW method, you just have to enable it
OW shaves it to 1 tick when possible and only grows it if the internet is being trash
It's really cool that they have both methods working in parallel
I didn't realize RL had such bloated buffers
that is a surprising and somewhat lazy choice
Though their game is also not "snappy", there is a lot of physics weight working toward hiding the latency issues
33ms of extra latency basically with 4 tick buffer
an FPS can't hide that shit
33ms is some people's actual desired ping for competitive games
so that seems small on its own, but its not ideal by any measure
Yeah, that would be 33ms + whatever their actual ping is
But game design is all that matters
How far can the RL ball or player move over 33ms?
add to that interpolation latency, and the various net transmission buffers... it all adds up
33ms when to players are on top of one another fighting for control of a common object (a ball) imo is quite a lot
and it's safe to say, their current experience is basically flawless
that's going to create quite a cone of confusion
They extrapolate and resim
so they hide it in a different way
It works, so can't really knock it
yeah that's what's important
but also, the ball can't get stuck between 2 objects. it pinches out
so those physics "fights" over the same object don't really happen
they happen and are quickly resolved
so once again game design is aiding there
are you sure they have 4-10 sized buffers?
and that is not just the size of the history?
you can debug it all in game
IBuf is what you're looking for
Averages at 3-4
History is probably pretty large
My current physics state history is a 1024 tick buffer
Which comes in handy because I re-use that data for server-side instant replays
Are you extrapolating your ball?
what do you mean?
I don't like calling it extrapolation tbh
It's literally just simulating physics lol
The idea is the same i guess, but once you have the current velocity of an object, simulating physics will keep moving that object along its path
RL extrapolates the ball and players
on the clients, they extrapolate other entities
Extrapolate by what means?
I don't think they extrapolate anything
Unless you are talking about what I just said (simulating physics)
Psyonix Cone - "It is Rocket Science" netcode explanation:
https://youtu.be/ueEmiDM94IE?t=23m33s
Battle(non)sense's Rocket League netcode video:
https://youtu.be/unzRzLKg7Mc
https://www.twitch.tv/dappur
https://clips.twitch.tv/SpeedyVibrantClamBlargNaut
https://clips.twitch...
Oh you mean the other player's inputs?
The ball has no inputs. Nothing to extrapolate
They extrapolate everything, that is how they make it not a complete shit show on client side
They go something more like how determinsm in Quantum works, but not quite since they are still doing it all with state transfers
Still confused what you mean about extrapolation
The ball is treated as deterministic in nature... so once the client knows about say a hit event... it calculates with the latencies involved where the ball will be in the future, and lerps the ball accordingly
The ball and other players don't live in the past like standard snapshot interp
Yeah it's not lerping where it will be in that nature
Clients are actively trying to guess where they will be, and correcting constantly
If client is on tick 100, and it gets the ball state for tick 90, it know where the ball should be on tick 100 based on that data
Because physics
Which is why the whole system relies on players have good pings. Higher pings = more wildly wrong extrapolations
Right of course
because determinsm
unless a player intervenes with the ball, its vector and bouncing is predictable
I mean, that is extrapolation
Yeah i get what you mean because technically it's simulating what will happen in the future
The client is always in the future compared to the server
But the client is not if you extrapolate
the more latency you have, the more in the future your client needs to be
Extrapolating the world puts the client into the same timeframe as the server... just a very 'soft' version of it since its largely made up of guesses
There's no reason not to have the entire client in the future
I think we are speaking different languages about this stuff here
there are just timeframes
no actual past preset or future
Right, but if a tick is a reference to a point in time
So tick 100 on the client is the same point in time as tick 100 on the server
then the client is in the future
clients extrapolate the server states to try and keep the player in something resembling the timeframe they will be in according to the server
Its not a true vision of the timeframe they exist in, but the same timeframe nonetheless
Well for me and RL, the entire client is ticks ahead of the server
Yeah, I think we might be talking past one another here
Sounds like you have a plan and its working, so rock on
i think i get what you're saying
You can keep the client on the same tick as the server, and extrapolate what you need to predict into the future
so when the client gets info for tick 100, the client is now on tick 100, but visually it's ahead of that tick after extrapolation
is that correct?
Not if you are extrapolating the world around you. You are expecting that the server is going to apply your inputs some number of the ticks in the future
and you are extrapolating the world around you to guess what the frame the server is going to apply those to will look like
The tick that arrived is the past, and you use that to check your past predictions for desync
Right, if I want the server to process tick 100, i need to send tick 100 from the client way before the server is on that tick
but if you just got frame 100 ... you likely are now rendering frame like 110
Correct
Which is what I mean
Rendering frame 110 = the client is in the future lol
if the server is authoritative, then that's the source of truth
client in the future refers to when the client sees itself in relation to the world in a timeframe ahead of the objects around him
Counter-strike, the player lives in the future
so a client in the future means that it's ahead of time compared to the server
They shoot what they see, and the server has the REWIND its world to recreate what the player saw
For RL the world state is pushed forward in time with a guess.... so that the player is in the present
g2g, pretty sure we are just using different terms
yeah it's definitely just different terminology and i think we are talking about identical things haha
um
i am trying to use photon to create enemy and sync their position
should i be throwing a photonview on all of them
or is there a better way to do this
Depends if you want to be bleeding edge. I have a beta up for an extension of PUN2 that has improved components for transform syncs. Its an official Exit product, but its in super early beta. @toxic oak But if you want to try it, I can throw you an invite.
With vanilla PUN2 you would use the PhotonTransformView or PhotonTransformViewClassic
i am very new to this so i would like to just stick with the normal stuff
but wouldn't transform view require each object to have a photon view?
i read that its better to not have too many of those
Its actually more work with the vanilla, which is why I am making the extension. But no pressure. And yeah, they need to be networked.
the photonview is the "address" of the byte[]
it is how the serialization knows where it came from and where it is going on the other end
without that, you have to do that yourself with your own netobj id system
i was thinking maybe i can manually id the objects
That seems like a lot of work if you are new to this and just want to get something working
PhotonView does that for you, so not sure the point in making your own parallel ID system
just dont want to exceed the network limit
The CCUs are based on connections
and the data you use won't be affected by it, since its the same data you will have to send for the transform states one way or the other
oh
the SNS stuff bitpacks it, so the data rates are considerably lower
i thought having more photon view will use more
The vanilla components don't compress at all, other than the delta compression (not sending if nothing changed)
If they are doing things
so if i dont write anything in serialize
if there is nothing to be serialized, its not going to be sending much if anything
that makes much more sense
It may send a few bytes still per netobj, but I think not.
I don't use any of, so I am not sure.
ok i was misunderstanding how the cost works
For the SNS stuff it serializes everything into one byte[] - so it really doesn't care
I would focus on first just making something that works
you will cripple yourself trying to outsmart the networking costs
First networked game attempts are usually failures... don't burden yourself with those concerns yet. Just make something to learn how to even do it.

@jade glacier But there is still the message limit, doesn't a transform view behaviour send individual packets?
I am not sure what the pricing model actually is at the moment. LOL I just write code for them - I don't actually involve myself in that side of things. @void burrow
I just know there are a lot of successful games running on all of their services, so if you have a business model, the costs aren't unreasonable. I am not sure though for people making first time zero profit games fit into things. Though I would argue that making casual networked games is an oxymoron. If you want to get into the MP game biz, you better be planning for an income stream, because MP is a bit more cost intensive.
I don't have any opinion at all on the costs/benefit side of things.. so not really the best person to ask.
I'm not at all saying it's unreasonable. Don't get me wrong on that. All I'm saying is that if the transform views are sending individual packets you'll hit that message limit pretty quick with let's say 100 enemies. (Which of course isn't the same in every game). Because besides enemies you also have players to deal with which send loads of packets etc.
What I was wondering is that wouldn't it be better to just group together enemies in this case and then send packets based on a couple of enemies? I'm just trying to understand what would be a good idea in such cases.
And sure for testing everything is fine, also don't get me wrong on that. But I'm just curious about how people would do this in a real project with PUN ๐
No offense taken - I have zero opinion on it.
The transform syncs in vanilla and in my extension set all stop sending if you tell them to not when nothing has changed
Even if you wrap them, you would end up making the same footprint
the standard serialization with PV is going consist of a compressed uint for the PV.Id and then the data
The biggest savings is from compressing the transforms and animators
That's what the SNS stuff is doing, basically what you are saying plus bitpacking and compression
Alright, thank you for the information!
What would be my best bet for creating a multiplayer game that can host 2 player matches for matchmaking but can also host bigger rooms with up to 16 people? I'm new to networking and Unity in general.
Please ping me when you answer!
@mighty wren Considering the how general your question is, it makes it hard to give you any information relating to that. You will first probably want to learn Unity, since networking is its own beast, and then you will want to decide on a networking solution. Many exist, and which one you choose will be based on the game your making, and how you want it to work.
@mighty wren I wouldn't even start there as a new dev to networking. I would make some tutorials with some of the major libs just to get familiar with even the terms and the landscape, as well as the challenges of networking. LONG before even trying to come up with a real game concept.
Make a demo with like Bolt, Mirror, PUN2, Forge etc
They are all mid to high level apis
all very different
yeah, before I develop a multiplayer game I think I'm going to try and develop a simple rhythm game first lol
A really good way to learn the difficulties of networking is to try and just make 2 player Pong.
Doesn't matter which library
Then, a lot of these articles will start to make sense.
when i call a command function
and that runs on the server
will the server automatically send the updates that happen to the clients
nope
command is localplayer -> server
to go the other way you need to RPC or SyncVar
@toxic lintel
alright
so if i were to send a command to walk one step to the server
it would run on the server
but none of the clients would see me walk
can't speak to any of the code that command is initiating, but the message is only going one way
command is localplayer -> server
to go the other way you need to RPC or SyncVar
Anyone know what the transport layer from unity is based upon? Is it RUDP or is it UDP?
You mean the old LLAPI or the new netcode stuff?
answer to both I believe would be rudp (though the R part is an option)
Question, is it possible to create a deterministic networked 3D game with Unity? I've read posts about people saying PhysX isn't deterministic, while others say it is ๐ค
I really am getting the impression you are going to keep reasking that until you get the answer you are hoping for
PhysX is not deterministic enough for an actual deterministic game. Full deterministic meaning you never need to correct with state transfers. All clients will get the same results from the same inputs.
Oh awesome emo ๐ Do you happen to know if messages are sent via RUDP by default?
Seems like I can only interact with Send in one way
Which lib are you talking about though?
The new transport, my bad
No clue, never touched it and don't plan to until DOTS is not terrible.
Where are you seeing someone saying that PhysX is somehow fully deterministic? @void burrow
I really am getting the impression you are going to keep reasking that until you get the answer you are hoping for
Sorry, but when did I ask this? I've indeed asked other questions about deterministic systems and I've also asked a lot of other questions trying to understand networking in general. But I'm not hoping an answer to fit any kind of answer I 'expect to get'. If PhysX isn't deterministic enough then that's totally fine as an answer for me :)
Where are you seeing someone saying that PhysX is somehow fully deterministic?
Let me see if I can find it again, it was however me looking at night at things. So I might have remembered something wrong I had read.
Sorry, might be confusing you with the person I was talking to repeatedly yesterday about it @void burrow
it can be made somewhat locally determinstic
but not deterministic in the sense that you can have multiple machines safely try to recreate a simulation - which is typically the requirement for multiplayer determinism.
fholm spent a massive amount of time making a fixed point physics engine for Quantum because there are no easy physics drop in solutions that are properly deterministic
Unity's physics system is 100% deterministic.
https://answers.unity.com/questions/1421193/deterministic-physics-options.html
The new one they were trying to claim WOULD be... but all of us in the networking channel were like "um... say what now?"
floating point != deterministic in any actual use case known to any of us
That person is wrong, or just limiting their answer to local resimulation
not networking across different machines with different CPUs
Good to know ๐
Not exactly the voice of authority there
Unless you trust Bunny83 who is "as far as he can tell"
Yeah, but it still got me confused about whether or not it was possible.
Its not
If it were, you would see even one game doing determinism with it. All deterministic engines that I know of resort to fixed point
Not trying to be rude or anything, just tying to save you the time of endless hopeful searching
floating point operations break determinism across different machines
Not sounding rude at all, I appreciate honesty xD
Now if you are like making an XBox game and all the consoles have identical FP processors... maybe?
But even then, trying to carefully manage lifecycles with PhysX in Unity would be a nightmare
like if an object gets destroyed or added, that all has to happen exactly the same
So you're basically screwed if you want to make a RTS / competitive FPS game with Unity.
In any library
