#archived-networking
1 messages ยท Page 79 of 1
I have this problem where if another player shoots in the server, the gun's recoil a little into the air, but never returns to it's original position still... (this is something that works fine client side and it's only when you're watching another player shoot) I know it'll be some way around the photonView.IsMine command lines in the code, but can't seem to figure it out myself
this is the shoot function:
and this is where it gets called in the Update function:
There is no "server" in pun other than the relay - so I assume you mean the master? If you are trying to code with Pun2 treating the master as a server, you will have some difficulties and latencies to deal with. Probably unrelated to your questions, but sounds like you are already down a bad path there. @tidal zealot
Your shoot at a glance is an RPC and is also doing some random spread generation - that is going to not be deterministic unless you are RPCing a seed value as an argument for your random.
Are you trying to synchronize your guns random spray pattern? Your questions isn't super clear.
sorry, I'm not too sure how to phrase it so clearly 'server' was incorrect, but I'm not building it as though it is a server, don't worry! haha
At the bottom of the Shoot function I have the gun move up and back slightly to make it definitely appear as if 'shooting' is taking place
in the game, If I watch another player shoot, the gun just goes up and up and up rotates around the player, rather than going up for whatever fraction of a second before returning back to it's original position at the hip of the player
Ooh i think that observable classes require the void OnSerializeView and there it has something to observe,and recoil being just a visual thing im not that sure if it should be visible on other players but if you want that just ignore photonView.isMine for reducing the recoil
yeah, I either want to remove the recoil being observable (for the time being at least) or have it so that the recoil works the same way it does for the player when shooting his own weapon
I just don't entirely understand why the recoil is observed at all, yet the return of the weapons rotation isn't, when the recoil is dealt with in the Shoot function, but it's only called if the 'photonView.IsMine = true'
Hey, I have a question about running a game server in headless mode on a Linux machine, is there any way to give input to control the server like the way a minecraft server works?
I know I can redirect the log output to show in the console, does this work the other way around?
Is there a way to use Mirror that allows me to choose between UDP and TCP depending on what it is I'm sending information about?
I've seen that there are different transport layers but I can't seem to figure out if I will be allowed to do this or not. It seems base Mirror is TCP only and then some of the transport layers are UDP only.
Can I have multiple transport layers?
You should not need to worry about which IF they give you a reliable send even over UDP.
UDP should be the choice anyway
Mirror has an ENet transport, you should be completely fine with that for your reliable/unreliable needs
does anyone know how to prevent a game object from being disabled from the hierarchy once a client leaves the server and has authority over the game object? This is for mirror i asked the mirror discord also
Can someone help me out with setting up networking
Unity has depreciated the LLAPI and the HLAPI right? and most libraries I've seen like mirror and photon use that or are paid. So are there any up to date alternatives or am I mistaken?
Does anyone remember that FPS blog gamasutra(?) ? I'm specifically looking for how to handle grenade throws, when to take client side look direction and the spawn pos at release etc
@coarse flare Mirror and Photon does not rely on UNet, if that is what you meant by "use that".
that is what I meant. Thanks for letting me know.
Hello fellas !
I am kinda lost on this one, again. I want to store a score (int) and an email (string) to a MySQL DB. Simple as that. I read many things, some working, some other out of my reach in term of comprehension.
It seems that this : https://stackoverflow.com/questions/39140068/how-to-connect-to-database-from-unity would resolve my issue but I don't know what to do concerning the MD5 / Secret key stuff. Where am I supposed to put the MD5 ? Shall I create an entry in DB ? I am working on a localhost, for a webGL build, for what it worth
Anybody has some tips on Developing with Unity and Photon?
Like, how do I avoid having to create a new game, building the game, and all that, just for testing if moveSpeed is set correctly.
RPC method 'RPC_RPC_GetPlayerTeam0(String)' not found on object with PhotonView 1. Implement as non-static. Apply [PunRPC]. Components on children are not found.
UnityEngine.Debug:LogErrorFormat(Object, String, Object[])
why am i getting this error message?
I don't suppose anyone here know anyone/anything about what Fall Guys is using for networking (it uses Unity)? It plays pretty smooth, and based on this it looks like it's not full server authority: https://clips.twitch.tv/CheerfulSmoggyDurianSeemsGood
Really interested if they rolled their own package/physics or are using anything publicly available/built in
looks like a rigidbody controller with local authority
How can I make my multiplayer game playble by anyone, I now use localhost for testing, but what I need to do to let "for example my friend join too?"
port forwarding
so is unity's unet replacement still being made? or is it basically not a thing now
I remember around 2 years ago they announced it and deprecated UNET. Fast forward to today and it's not even in a preview state and to my knowledge tied to DOTS
The next generation of connected games needs scalability and performance at its core, including a multi-threaded and data-oriented approach to networking. Learn about Unity's new foundational networking layer, including how it works and how the architecture is optimized for ga...
not sure the current state
That chart really says a lot about UNET, oh my
'Our only available networking solution for the last 6 years is a good option if: you're targeting less than 25 concurrent players, you don't care about cheating, and you're okay with over 1 second latency'
You guys know these unity blog posts about netcode are a bit of a joke in the network community, right?
the flowchart always confused me. I never took anything to production with UNET, but what was stopping you from running a dedicated server with it? And why is the latency 1 second? It was pretty bottom barrel but I don't recall it having anything built in that forced it to that level. UNET was also a messaging layer at best, there's no reason you couldn't write something fully server authoritative with it, right?
and why is latency implicitly tied to whether you have a dedicated server? If your server is in china trying to connect to US east it will be slower than two US people running P2P, right?
Let me use an analogy
Say you know the math to solve a second degree equation... It requires the 3 params for you to solve it....
That post is saying the answer is 3 or 4, depending if A is larger than zero...
That's the best I can describe it...:)
poor unet
thank god. It would be miserable with its existence
hey, could someone help me with some unet/hlapi (ik, im stuck with it) stuff. i tried following a tutorial for it but i need to use a charactercontroller with it and it doesnt see it as being active when the object is spawned on the server
@ me or dm if you can help, any help would be appreciated
ty
First you should switch to mirror, as it derived the same API
Should not be too complex to replace it
Then it will be easier to get help
Nobody here really works with unet, it's a dead API, and has several bugs
Yea curious to know why you are stuck with UNet since you seem to be working on the basics. External requirement?
does mirror require any installation. im stuck with this as i will need to be able to work on it in school, preferably on their computers... which is gonna be a whole other set of issues cos of admin stuffs
??
All of these networking APIs are just added to your Unity project, not the unity installation
You are not stuck to Unet at all...
You can use anything like Mirror, Photon, etc
The worst thing you can do, hnestly, is to use UNet
@low coral If you do go to Mirror I'd like to plug my series (the largest Mirror tutorial(and assets) collection available currently) https://www.youtube.com/playlist?list=PLkx8oFug638oBYF5EOwsSS-gOVBXj1dkP Most of it is for my supporters but there's some really useful free things as well.
Are there any tutorials for setting up a LAN system that explain networking in simple terms? I'm trying to find one but all the ones I've seen start throwing out lots of complex words that might as well be Klingon for how well I understand them ;_;
Have you released a single player game before?
If not, do not start with a multiplayer one... that's the best you do to yourself...:)
Im not making a game, I'm putting together an AR learning environment for my PhD
But I need to set up LAN support so I can parse controls from a different machine
If you don't understand what these tutorials say (they are for begginers BTW), then you should not get into this now
Dont really have much choice
Unfortunately not, I'm a character artist
hmm
oof
I'm not afraid to admit that I'm in WAY over my head but I'm way too late into this to back out now ๐
I mean, not doubting abilities, you are as capable as anyone in the end
But there's a long road if you are not a programmer
It's like this:
- you are asking "how do I play hockey?"
- I'm asking if you know how to skate... and you do not...
For what its worth
I've managed to get the entire augmented reality part working and programmed all the interactions myself
I assume you are able to put together some code for the AR stuff you do at least, right?
yeah
maybe you can get it done with mirror
Not much I can say apart from this
I'm under no assumptions that this is gonna be easy
Ye, mirror would be the most friendly option
How much time do you have?
And given the use case should be simple, I'd go for it
About 4 months
It's not even anything absurd that I need doing. I just need to be able to move gameobjects on one client, and have them also move in the HoloLens client
All you need is the object moving visually?
(TLDR I'm trying to use a leap motion but theres no way of connecting it to the HoloLens, so I need to instead connect it to a different machine and have the interactions parsed over)
LAN networking is the only way I can think of to make that happen ๐ฆ
4 months plenty of time
I wish I had 4 months for any job I do.. ๐
Can someone help me with a VERY annoying pun issue?
ok
You can't connect the HoloLens to the Leap, even if you could theres no way of running the leap drivers on it. My compromise was to get a micro pc instead (it fits in a backpack with a power supply quite easily) so you can still walk around and maintain all your mobility without being tethered to a desktop
@dapper lily Have you looked into using PUN2 for the Hololens
mico pc is the server or client?
Client, HoloLens is the server
I'm making a team death match but adding score to one of the teams when someone gets a kill isn't working even though i think it should be
not sure if Mirror works on hololens, I guess yes
And apparently PUN2 only works on the HoloLens 2?
I have the original model
Trying to convince my university to buy the new one but unsuccessful so far ๐
Does it need to run on a LAN?
Is there a different way of parsing inputs that I dont know about?
If the MicroPC had enough graphical power I'd skip the networking entirely and just run the build from editor mode in Unity on the MicroPC, but unfortunately it chugs a bit heavily
I'm making a team death match but adding score to one of the teams when someone gets a kill isn't working even though i think it should be
Ask a more specific question
The devices should possibly be able to open a listening socket. That makes the device a server you can connect to.
Can someone help me fix kills not adding to the total score of their team pun2?
is that specific
The answer to the question ABOVE is:
yes, maybe
maybe someone can help you
If you ask a technical question
Just being straight
yes
[PunRPC]
private void RPC_Shooting(Player player)
{
RaycastHit hit;
if (Physics.Raycast(rayOrigin.position, rayOrigin.TransformDirection(Vector3.forward), out hit, 1000))
{
Debug.Log($"Hit: {hit.transform.name}");
if (hit.transform.tag == "Avatar")
{
int enemyHealth = hit.transform.gameObject.GetComponent<AvatarSetup>().playerHealth -= avatarSetup.playerDamage;
hit.transform.gameObject.GetComponent<AvatarSetup>().playerHealth = enemyHealth;
if (enemyHealth <= 0)
{
Debug.Log("I killed someone.");
pv.RPC("RPC_AddPoint", RpcTarget.AllBuffered, player);
}
}
}
else
{
Debug.Log("Did not hit.");
}
}
[PunRPC]
public void RPC_AddPoint(Player player)
{
if (player.GetTeam() == PunTeams.Team.red)
{
GameSetup.gs.teamRedScore += 1;
}
if (player.GetTeam() == PunTeams.Team.blue)
{
GameSetup.gs.teamBlueScore += 1;
}
}
the the addPoint function does get run but it doesn't add any "score" to any of the teams
Start by logging/debugging the values you have
for player.GetTeam(), log that the method is called
etc
I tried looking up a listening socket for the Leap and I found something called a Websocket? Is that the same thing?
no
wish i knew more about holo lens
what can you run on it? or what runs on it? maybe you do need a websocket :S
whats your debug say before and after you add it?
it should only be running once cus its on button down
the HoloLens is basically running win10. Any UWP programs can run on it
adds two points to the team rather than 1
You are probably triggering it twice
Maybe from two different clients...
I suggest the "calling" of the RPCs be done from the master client only...
this: pv.RPC("RPC_AddPoint", RpcTarget.AllBuffered, player);
yeah
wrap it with an if to only trigger this from the MC
https://docs.unity3d.com/Manual/UNetDiscovery.html Would this not work? Like if I create the LAN with UNET, HoloLens hosts the server, MicroPC is responsible for translating objects and triggering animations, would that work?
Like actually unusable?
it's abandoned...
@dapper lily You're gonna wanna look at Mirror instead
Use Mirror, which is the open source, still maintained version of it
game setup is a singleton in the team death match scene, does that mean that if just the master client updated it, it would update for everyone else automatically?
When you call an RPC, it's called on all clients (assuming you set the target to all, like you did)
BUT, what you are doing is:
- every client calls RPC
- each one of the calls gets called on EVERY machine
man all the tutorials on this subject are awful
As I said:
- call pv.RPC("RPC_AddPoint", RpcTarget.AllBuffered, player); ONLY from MC
The actual AddPoint will be called on all clients (like you requested in the param)
really you can use almost any UNET tutorial and apply it to mirror
This is pretty much how RPCs work by definition
oki ill take a look
"Network Transform to sync position, rotation, and scale with interpolation" so that means if I make a translation from the client side, it wont instantly pop to its new transformations on the server side, right?
right
Just making a backup of my project files, then I'll try adding the Mirror assets
Mirror has a pretty active discord too if you need further help
Thanks!
Im speculating right now but I think your mirror suggestion may have saved my phd
i guess this is more networky
multiplayer fps, when someone's health is <= 0 this DOES run and it DOES reset the health, but it DOESN'T teleport the player back to one of their own spawn points, any help?
public void respawn()
{
if (pv.IsMine)
{
playerHealth = 100;
if (PhotonNetwork.LocalPlayer.GetTeam() == PunTeams.Team.blue)
{
int spawnPicker = Random.Range(0, GameSetup.gs.spawnPointsTeamBlue.Length);
if (pv.IsMine)
{
transform.position = GameSetup.gs.spawnPointsTeamBlue[spawnPicker].position;
transform.rotation = GameSetup.gs.spawnPointsTeamBlue[spawnPicker].rotation;
}
}
if (PhotonNetwork.LocalPlayer.GetTeam() == PunTeams.Team.red)
{
int spawnPicker = Random.Range(0, GameSetup.gs.spawnPointsTeamRed.Length);
if (pv.IsMine)
{
transform.position = GameSetup.gs.spawnPointsTeamRed[spawnPicker].position;
transform.rotation = GameSetup.gs.spawnPointsTeamRed[spawnPicker].rotation;
}
}
}
}
first: why are you checking pv.IsMine in 3 places?
You only need the outer one, rest is redundant
because i coppied the transform.position... if statements from a different class, forgot to remove them
i do have to add
when this runs
that it is not eleporting the player may mean you are controlling this from another script as well?
it looks like it teleports the player, but then it instantly teleports back
well... looks like there's another script that is controlling this
no other script taking control tho
like a character controller or so?
that would teleport it back?
well, depends on how it's implemented
private void PlayerMove()
{
float x = Input.GetAxis("Horizontal");
float z = Input.GetAxis("Vertical");
Vector3 move = transform.right * x + transform.forward * z;
controller.Move(move * movementSpeed * Time.deltaTime);
if (Input.GetKey(KeyCode.LeftShift))
{
movementSpeed = Mathf.Lerp(movementSpeed, runSpeed, runBuildUpSpeed * Time.deltaTime);
}
else
{
movementSpeed = Mathf.Lerp(movementSpeed, walkSpeed, runBuildUpSpeed * Time.deltaTime);
}
if (Input.GetKeyDown(KeyCode.Space) && !isJumping)
{
isJumping = true;
StartCoroutine(jumpEvent());
}
velocity.y += gravity * Time.deltaTime;
controller.Move(velocity * Time.deltaTime);
}
Assuming that pv.IsMine means this object is controlled locally.
that's the first thing to do always
also, this aint got anything to do with untity, but why the heq is the warzone update downloading at 1 byte per second for me
again now magically it works
but
when adding a point it is very random because sometimes it hads 1 somtimes it adds 0.5
also sometimes people are 1 shot 1 kill
well, these are probably things about the RNG function
or the way you compute damage
Not really a network API issue
k
Anyone able to help my team with some Matchmaking?
We are using U Net Mirror (updated version)
hi everyone
does someone know how to make webrequest api calls github -> iotaledger/goshimmer/wiki/Client-Lib:-Interaction-with-layers
for this lib
PLEASE!
Anyone able to help my team with some Matchmaking?
We are using U Net Mirror (updated version)
Does anyone know of an offical PUN discord or is this channel as close as it gets?
Are there any standards when it comes to designing your replicating game objects? how do I decide what I need to replicate within the class and how to design my game objects? does anyone know any resources?
Not sure what you mean, also what network library are you using?
Mirror
Its hard to explain I guess. But I'm just looking for standards that I should know when programming multiplayer games.
@coarse flare there are a lot of best practices. I'd say the most important thing is to send as little across the network as you can, even if it means a compromise. It would help to know what you're targeting. Also, there is a Mirror discord if you are not in it already.
Which I apparently cannot post a link to
Okay, I'm just curious in general as I've tried to tackle networking a few times but always flake out. But lifes changin' for me!
When I'm changing code it seems like I have to build every time to test the multiplayer aspects which takes a minute or two... every code change with URP... is there a better way?
@coarse flare you can have two instances of a Unity project open with the following: https://forum.unity.com/threads/official-multiplayer-improvements.390823/page-3#post-3013017
thanks... seems janky but alright...
Something about doing that breaks something in mirror. so RIP that solution. tried both hard & soft links. Guess I'm just SOL.
I just build a lot
We use the softlinks a lot with quantum, works perfectly
@coarse flare symlinks work with mirror
Packages, assets & projectsettings is the folders you need
Why does this work in unity but not in standalone? ``` public void InitWallet()
{
Process process = new Process();
process.StartInfo.FileName = "Assets/dll/cli-wallet.exe";
process.StartInfo.Arguments = "init";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.Start();
//* Read the output (or the error)
string output = process.StandardOutput.ReadToEnd();
print(output);
responseText.text = output;
string err = process.StandardError.ReadToEnd();
Console.WriteLine(err);
process.WaitForExit();
}```
I'm not sure this related to Networking...
So, it'd be difficult to find help in this channel
You need to check on more general channel (or ask Unity support) to see if they strip out system process classes from build, etc)
it's about networking
IMHO, this could be better done with native lib integration than to try to run a process
it's about networking
No, you are running a local process and reading the output of it...
the thing is the lib is not avaiable
This has nothing to do with communicating in between game clients for multiplayer games.
the thing is the lib is not avaiable
Well, maybe the unity build is stripping out the file, etc
I want to implement IOTA. Which is a DAG
Nice acronyms...
which is for multiplayer ๐ at least for me later ๐
The particular issue you are asking for help has nothing to do with MP
I know what you are trying to do... But what I can say is:
- IMHO, I'd go for a different approach (run a native lib, not a process)
- Ask the question in the general programming channels
is that a lib?
I do not know... It's a lib/program you are using
I have no idea what it is... Just saying running an exe process from the unity client has not strictly to do with networking
Ask in the #๐ปโcode-beginner channel if someone has a suggestion
This is related to: running native libs/processes
@west loom are you using il2cpp? if yes, Process is not implemented there
I was on mono and switched now to il2cp ๐
@undone sigil I will change back than : D thx
i still don't recommend launching a process though, always better to use a dll
he needs it on Android... This approach would not work at all
first google hit for IOTA C#:
there are others, etc
you need a .Net implementation, that's it... Anything else you are wasting time.
this I have already implemented. but will not work soon
that's why I'm looking for other solutions
Let me try that again without a picture of a cat on my clipboard ๐คฆโโ๏ธ
I've set up a cube in the scene that can be moved around and I've tried to make it a network object thingy using Mirror. It appears on the host but not on the client, have I configured this incorrectly? https://gyazo.com/b0a089523991eb8045f1080f0d493ccb
Wait hold up, even if I've registered this cube as a spawnable prefab, do I still have to instantiate it manually in the code?
Hey everyone! I'm new to Unity's networking system. I'm currently exploring using Mirror to make a game that can either be played in single player or with friends. For the single player side, do I need to code game mechanics twice, essentially? One for single player and another for the Network manager? Or can single player run on the Mirror components in offline mode? If you guys could help me understand networking a little more, I would be so grateful!
You can use Mirror and code your game in a player-is-listen-server setup
In that case, single player would run as normal. The player is just a 'server' that is instantly processing its own input
Then for online, if using a dedicated server, just don't spawn a player for the server
oh great! So single player is basically just a local host processing commands to the only player in the game which is also the host? I hope I'm understanding properly since I'm very new.
yep. You don't even need a connection or anything it's all done in the same process
amazing! I was worried I'd need a bunch of scripts just for single player, or constantly check a bool for every game mechanic. This is sweet haha
Thanks so much Nate!
Hi, I was wondering what best way to implement an authorization key in code so that it's difficult get a hold of.
I would consider the value of the string and why it needs to be protected, possible attack vectors etc
whats this about?
UNET (the default network stack that comes with Unity) is abandoned and buggy. It is recommended to use third-party networking such as Photon and Mirror
ugh
so i have to do everything over again?
Mirror is designed to be a near-seamless transition from UNET
so go with mirror and keep my code?
yes most if not all of your code should transfer over
aight cool
dang its mmo scale its perfect
... open in unity ain't working
oh finally got it
i had to go to package manager
Hey, i am trying to use play-games-plugin's Nearby functionality. I wanted to know if it still works ? I tried the sample, but it doesn't discover any rooms. It says that I dont need to configure a play console for Nearby, so I havent, but is that true or do I need to configure it ?
Weapon has "isServer" true, but the bullet has "isServer" false. (Mirror Networking)
I'm spawning the bullet from a script attached to the weapon. Am I missing something? ๐ค
is the bullet spawned with network instantiate? Regardless I believe there's a static call to check is server. Something like NetworkServer.active
It's first Instantiated on server and then NetworkServer.Spawned
I've figured out the issue, I'm spawning an object that has children, so the parent's "isServer" is true but children are not having neither their "isServer" or "isClient" true.
Is there a quick fix or I'll have to unparent them, spawn them seperately, and then parent them again?
Nested networkidentities are not supported afaik
If you wanna treat these objects as separate network identities, I would consider just replicating the parented behavior manually
Which probably means just managing the transform
Hello all. Using PUN and, conceptually, I need some simple help. I'm struggling with how (mechanically) to make two players that have been loaded into the same scene see different things. For example, lets keep it simple and I say I want players to see a message that's "You are PlayerX" (where X = PhotonNetwork.Player.PlayerID).
My initial thought is that I could instantiate a text box (with a PhotonView component) for each player and set the Text.text field to something like
("Player" + TextBoxObject.PhotonView.Owner.PlayerID.ToString())
This would definitely create what I need, but how do I hide the boxes (from the perspective of a given player) that the given player doesn't have ownership of? I know I could normally do something like
Update()
{If PhotonView.IsMine == false... SetActive.False}
but my concern there is that I'm not explicitly setting the "Active" field relative to a player so I feel like each player's Update component would just be in a war setting an unsetting things to active. Any help would be great!
Why don't you run UI just locally
UNET is no longer in use, but are there any networking packages for 2020.1 yet?
Mirror looks like it's only updated for 2019 versions.
I noticed there's a preview netcode package from Unity for the latest versions, using ECS. I'm not sure if that's worth looking into?
@fervent flower most of them work anyway, did you try?
@fervent flower there are some low level networking packages, nothing too fancy like mirror/photon/etc
@gleaming prawn how do you run a UI "just locally" ?
both in preview
Hi guys, I want to ask if someone knows how to see if a player is enters to a room in photon 2 unity
@tropic creek, you can do an override of OnPlayerEnteredRoom(Player newPlayer) to include a debug
so something like...
public override void OnPlayerEnteredRoom(Player newPlayer)
{
Debug.Log(newPlayer.ToString() + "has entered the room")
}
Thanks
im using photon and im having problems
i want a way to debug everythign
is there a way to get the "id" of a lobby?
ID being a custom number assigned uniquely to each lobby created
hello , have someone a good tutorial for using mysql as a database ?
Hey I am new to networking, which sort of platform would you recommend me, I want to make a simple third person shooter? I think Photon would be good, but Photon has like 5 versions?
Hey, everyone! I have a nodejs udp server based on dgram. My question is how to efficiently store types of client-server messages, So I don't need to have 2 code bases in typescript and c# of the same things...
you could compile it into a plugin so it's all in one place
nothing wrong with having them in both places though. that way you can optimize it for the language.
If the number of msgs becomes unmanageable you need to rethink your protocol anyways
@slim ridge compile what into plugin ?
I already have message types written in typescript
your messages and their serialize/deserialize
Do you mean make a dll that would serialize/deserialize messages and use it both in unity and nodejs ?
yea
dll would not be a cross-platform solution ๐ฆ
@rigid heron PUN is the easiest one. Is peer to peer over relay.
Mirror is quite nice if you are looking for the classic server <-> client setup. Strong community.
Photon Bolt would be one the strongest out of the box solutions for more serious shooters.
Ok thank you ๐
is there a way to check if your ip (and/or hardware) has two clients in the same photon room?
IPs are not exposed at all
This is privacy information, from a room it's not possible to obtain the IPs of others (photon)
You can use photon's custom authention hooks though, so to prevent the same user to connect twice from different locations simultaneously, efc
@dark ether it certainly is, it just means you have to build a lib for each platform.
I'm just getting started with unity and networking. Looking at Mirror - does anyone know if it is compatible with Unity 2019 LTS or only 2018 LTS?
both
what things should I look into for webgl and mobile networking?
I currently have my own networking system with system.net.sockets but apparently that doesn't work with webgl. idk if it does for mobile either
Hey guys! I have a weird problem with the editor, I'm trying to write my own networking with TCPClient and TCPListener, but when I try running a client from the editor and a server from a build the editor does not connect to the server. If I run the server from the editor and client from build it works. It also works if I run both client and server from builds. Anyone knows what causes this?
@weak plinth webgl can only use websockets or webrtc
AFAIK you need to use a library that implements hooks to those features from the web-browser
That's what we do with the Photon client library on WebGL builds...
[Mirror] I have a cube that has a network identity and network transform component on it. It is set to client authority. If I move it on the client, the movement does not happen on the server and I'm not sure why
I tried googling it and im not finding any straight forward answers, but I am seeing a lot of discussions about rigid bodies? Does my cube need a rigid body component for the network transform to work?
I just want to be able to move objects on the client and have them move on the server too why is this so hard ๐ญ
update: tried doing it the other way around and it works. For my project, running the server on my micropc instead of the hololens is totally fine
I am happy now
hello everybody im coding in bolt i have a problem in which the error says that the axis arent set up properly i have no idea how to fix it i fixed something like this before but im not sure what the hell did it
how can I debug webGL networked clients? I can't place breakpoints?
use logs
makes sense
hello everybody im coding in bolt i have a problem in which the error says that the axis arent set up properly i have no idea how to fix it i fixed something like this before but im not sure what the hell did it please help me
@round shadow please ask in the bolt discord server
Hello. In network game Should every player have their own gamemanager or just one which network object
What do you do when you hold score in network. Do you use single gameobject which has photonview? or you doing other way
fixed ma problem the axis were inverted
cool then
anyone here know how to integrate steam works to create a lobby to invite ur friends?
I Want to make a co op experiance like risk of rain or borderlands
anyone here that has implemented a https server + unity game? I'mm trying to figure out how to get my app to connect to a https server
what does error say?
Hey, im new to using Photon, has anyone had any experience with this error before ?
Assets\Client.cs(4,14): error CS0234: The type or namespace name 'Pun' does not exist in the namespace 'Photon' (are you missing an assembly reference?)
Hello. I created a map with randomize in PUN2. How can I send my dictionary which holds the vector3 to remote player? I get error. Primitive type is needed, it says
Please there is nothing information about sending Dictionary<Vector3,GameObject> through the photon2 on the internet
I am going to die ๐
your dictionary is using Vector3 as keys?
your dictionary is using Vector3 as keys?
@weak plinth yes that is right
according to these values, my remote player's scene will be created with nested for loop
My goal is to send the data of randomize created map to remote client. there is 2 daha that I have to send. One is Vector3 which is the coordinate of the cube, second is the type of the cube.
game was made of kind of cubic world.
sounds like you want a struct instead
I would read this article, particularly where they demonstrate registering custom classes and serialization/deserialization: https://doc.photonengine.com/en-us/pun/current/reference/serialization-in-photon
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!
yes, I tried to send vector3 bur it supposed to be primative value of variable for sending with RaseEvent
I could not figure it out after that.
Hi. I can not send data of the map creation seed which are consist of keys are vector3, values are gameobject.
How can I send through the clients who get in the same room, will take the seed to create the map
Pun2
you can NOT send a game object itself
a full game object is not something you can serialize
Hi guys I am using pun 2 and I want friends to be able to join each other party, I have the friend list already, but how can I do that if you press on your friend it will join his room?
Can anybody tell me why my network system works in editor, and doesn't work in built version?
Only the client that runs on editor can receive certain messages from the server, while the built version doesn't...
I really don't know what i'm doing wrong...
Is it a Unity Bug or some intentional feature?
no idea what you're doing so how can we tell u what the problem is?
@silent zinc These things are hard to figure out without debugger, you'll probably need to debug the build version to see whats up
how can i do that?
i used to debug my C programs with gdb
visual studio has debugger and you can connect it to debug the build
ok, what should i look for?
@silent zinc you build the project with these options enabled:
-development build
-script debugging
-wait for managed debugger (if you have it)
and then vs debugger will see the game in the dropdown menu, you'Ll be able to select it to debug
if you dont have that last option, you just gotta be fast to connect the debugger before you miss the error
your error probably occurs after connecting to server or hosting so you probably dont even need it
you can connect the debugger just before you host/join
@high night can u help me pls? I've done all the steps u said, i have a debugger session, i can even attach vsd with Unity Editor, but i don't know where and how to look for...
i mean, is there a way to see all the functions called in real time while the game plays?
you can NOT send a game object itself
@gleaming prawn then can I sent Hashtable<Vector3, int> then?
these are serializable structs AFAIK
@frosty crystal i don't clearly know ur problem, but i would suggest u to use json to send gameobjects, and to convert that Vector3 to an array of 3 elements, and do the conversion on the other endpoint
So, not sure if just like that as a Shashtable, but definitely the types can be sent
Please, do NOT use JSON
๐
Way tooo slow... Not really for realtime.
We#re talking about realtime, possibly alloc free data transfers
Raw Bin is NOT cross platform
PUN has build in serialization for most of these types...
I'm just not one of PUN devs (I am one of Photon Quantum core devs)
But I'm sure there examples in the docs and tutorials about sending serializable objects and structs
@gleaming prawn so what does Minecraft use? :\
I know you can send them via RPC even
so what does Minecraft use? :
I guess it's a custom system by their own.
I'm not a minecraft dev...
and varint and varlong
oh, ok... but it's a custom binary protocol that uses these types
Could be anything, I do no know...
Just saying .net bin serialization is NOT cross platform
cause it's .net, obviously you can't hope to have a code that works in all devices/OS.
well
That's what WE do
you can't hope to have a code that works in all devices/OS.
This
But serialization is code-generated for every type
and we only use memory aligned structs with explicit layout, etc
Side problem idk if i should recieve / send in while loops with Task.Delay(1);...
@silent zinc debugger is for stopping execution of the code at your brakepoints
just place some brakepoints around suspicios areas
or
try to find issue like you do a binary search if you know what i mean
๐
place brwlakepoint as line 100 for example
if errs has occured there, next brakepoint on line 50
if not, next brakepoint on line 150
.
i mean you can do this if error is a logical error that doesnt print out and console errors
some values are wrong for example
How can I send my Dictionary<Vector3,int> as adding to object array? I could not convert it. Sorry it may seems very basic bur, I am dieing ๐
My dictionary holds these values. But PhotonNetwork.RaiseEvent is accepting just object type of data.
I could not cast it. how to cast.
Very appreciated for your help!
the keys and values are both object
send Keys then Values
I can send but I can not cast it properly when I receive.
how Can I convert object[] array to a dictionary
I tried to cast but it says InvalidCastException: Specified cast is not valid.
Why send as <object, object> when Vector3 and int are serializable types?
I believe you can simply use Photon's own Hashtable. However I feel like there is a much better solution than using Vector3 as keys
It seems like you're just trying to send vector3 and int as a data pair. if that's the case then you should create a serializable class
Why send as <object, object> when Vector3 and int are serializable types?
@weak plinth I can send data, but when I receive data as object, i have not been casting them to proper variable. For example, I receiving photonEvent.CustomData as object. What should I to cast it as a new Dictionary for example? I am sending a dictionary which is Dictionary<Vector3,int> and receiving object. But I can not cast object to new dictionary
I am assuming it doesn't know how to deserialize your Dictionary<Vector3, int> so it's just handing you a byte array
can you try just sending your keys and values as two separate arrays, and creating a new dictionary from that?
there's also Hashtable which I mentioned earlier but I haven't used PUN in years
that is possible but, I am storing data where is being created by nested for loop as Vector3. It is hard to iterate the timer of the array.
I use hashtable now. My problem when I receive. I can not cast hashtables also. 10 sec send a picture.
Hashtables belongs to Pun.
Pun2 and most of the core Photon libraries cast all things to objects to make it easy for less experienced devs to serialize all sorts of things. But its not a good practice for anything heavy duty.
If you want to avoid the garbage creation and just have more control, you will want to write your own data to a byte array and send that. If you want zero allocations then you will want to use the NonAllocByteArray that is part of Pun2 now.
Yes, I will have to learn that. But I have lost 2 days to figure it out and I have to do something appear for my project. No one read codes
The object[] are there for less experienced devs who just need things to work - you can use those yeah.
Thank you all of you. Ill try again.
Hey guys, I am working with photon and when two players load into a server their cameras and movement controls are switched, so for example player 1 can be controlled on player 2's screen and vice versa. https://pastebin.com/Pd3cY5NZ Heres my player controller script
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I am not sure why they switch, and also it seems that the first players movement gets slowed for some reason
Sure your objects are switched? And you don't have the wrong cameras being made active?
hm, my ipad 2 with ios 9 is connecting to my server online but not my iphone 11 on ios 13.
Strange thing is, If I download my app from the app store on my iphone 11... it does work.
Each player will have their own camera, am I able to just have each player prefab have a camera attached to it and spawn it in?
I typically include cameras with my player prefabs, and use code to enable/disable them.
Usually in the form of a camera manager
Since you may want things like death cams and such, but no idea what you have going on so there is no one answer for that.
I have no plans for any other cameras, just one for each player. But yeah when I load in two players their controls get mixed up
The IsMine usage looks correct, so that makes me think something else is just making you think they are backwards, when you are actually controlling the correct one.
As a note in the console it is constantly saying there are 2 audio listeners. I assume this is due to the 2 cameras but I don't think this should cause any issues
Also this is how I spawn the player, maybe this could help
private void CreatePlayer()
{
Debug.Log("Creating Player");
PhotonNetwork.Instantiate(Path.Combine("Player"), Vector3.zero, Quaternion.identity);
}
It sounds like you have the right player under control, and your camera code is missing
Yeah it could be that the cameras are switching, could using [SerializeField] to declare the Camera object cause issues?
The camera object will typically be a static, and gets assigned at runtime
so that does sound suspect
Ideally you would have a basic camera manager, that starts with the scene camera as the active, and when a player joins, its camera should have a component that registers itself with the manager, letting it know there is an active player camera now and the manager should disable the scene camera.
And when the player camera gets removed, the manager should re-enable the scene camera, or the other players camera... or whatever it is you want to happen.
Alright I played around with it a little more and I am 90% sure it is because the cameras are switching. I tried setting Camera by using GetComponentInChildren but I get the same result. I am kind of lost right now
Also I am switching scenes from the menu to the game, so I wouldn't have to disable the scene camera
Yeah I am not sure what to do anymore. If anyone has the time to help feel free to message or ping me, going to take a short break. To summarize, after instantiating the player it seems like the cameras are being switched resulting in player 1 viewing player 2 and vice versa. https://pastebin.com/dPePMxSV Here is my playercontroller where I initialize the cameras.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
im using photon and im having problems with instantiate
do you have to be the host to do PhotonNetwork.instantiate
There is no actual host in Pun2. There is just the relay and clients. There is one client that is given the Master Client role, but that role mostly is up to the dev to make use of.
Be aware that any client that uses .Instantiate will become the creator of that object. When they leave the game, that object will get destroyed with them by default. Typically any objects you want to stick around even if the person who called that instantiate leaves - you will want to use InstantiateRoomObject
Is there a specific way you have to use raycasts to detect an instantiated object? When I place the object in the scene my raycast can detect it, however if I instantiate it, it won't work.
GameObject block = PhotonNetwork.InstantiateRoomObject("DiamondBlock", new Vector3(0, -1, 5), Quaternion.identity);
Typically you use GetComponent<PhotonView>
@frosty crystal you are trying to send images through photon?
That's not what it is made for... If you send too much data you will get.into the bandwidth caps (or pay a shot ton of money)
All these networking techs are for sending small realtime data (fast), like positions of objects, inputs, etc....
For sending content like video, images, etc, you should be looking for other types of tech like CDNs...
I'm saying this because you said 10s to send a picture...
@frosty crystal you are trying to send images through photon?
@gleaming prawn No Eric. I am trying to send data Vector3 and value of the element. You are right.
LOL; I read again
apologies... YOu said send-picture because you would send a screenshot... My mistake
And I have another afterlife question for you ๐ How Can I get custom room properties to my local dictionary withouth using trygetvalue
apologies... YOu said send-picture because you would send a screenshot... My mistake
@gleaming prawn ๐
I still have no idea why you want to send a dictionary where a vector is the key... totally boggles me
You could technically save in player properties, ye
Depends on how BIG this is
How many entries
BUt as I said, I do not work with PUN, so I'm not the person to ask..
In bomberman game, when master client creates room, all the data stores inside of an dictionary which keys are vector3 (position), values are type of box.
so the remote client can create his game according to master's creation.
I still have no idea why you want to send a dictionary where a vector is the key... totally boggles me
@gleaming prawn not much at most 20x20 map =400 500 vector3 and int values
yes that is right
This looks like the totally wrong way of building such game...:)
But...
Are you using vector as the grid coordinate?
yes.
You can use an Int16
it's a grid
UInt16
that's it...
Vector is a HUGE waste of data
hmm. Ok. Ill change it now.
And also... you do NOT need to exchange the whole map at all
Just send an RND seed
and make all clients build the same grid based on that... Simple
You just need to send ONE int
that's it... Save it in the room properties
I do not know how to rnd seed being send will check it now than.
but. am I right? My master client creates a dictionary which hold the box locations and types and sends it to the PhotonServer. All the clients comes, takes and builds their game (what we called seed is the data that master send right?)
yeah, please don't ever use a float as a key
yeah, please don't ever use a float as a key
@jade glacier ok ๐
Is your grid size fixed?
yes. master client selects with slider
And seed is pretty basic, you set the seed right before doing your random map generation stuff.
And you just set that exact same seed right before the exact same generation code on clients
And if you did it right, you will get the same results.
In networking you are ALWAYS looking for determinism where you can find it, because sending results is expensive vs sending causes.
yes I hold the seed in dictionary and send it with setcustomroomproperties in a hashtable
but, in creatiation process, I can not take the custom room property
because I do not know how to cast it
Trying to get it from string back to an int you mean?
no I want the seed inside of Dictionary<Vector3, int>
Like that. Clone works but I could not cast it to in a dictionary
I am not sure why the seed would be in a dictionary of any kind - rather than just a single room property
What is that dictionary of?
according to dictionary, all client will create their maps
That looks all very very wrong
because it holds location of box and type of box
The vector3 key right out of the gate is trouble
But aside from that, the seed doesn't need to be part of any dictionary, its just a single value that is used prior to random generation
hmm. I do not know than what is a seed
I suspect you probably don't want to be doing networking or multiplayer just yet. This is going to be VERY difficult if you haven't gotten a solid handle on Unity and C# already.
Have you finished a single player game of a similar type to this MP game you are trying to make?
Yes I got some courses. and made fps kinda counter game in pun2.
but every game have different approach.
You'll want to read up on seed and random
I am lack of kinda experience
Because what you are after is a way to recreate the entire generation using a single seed.
You'll want to read up on seed and random
@jade glacier I am starting to have a look now. Thanks!
Anyone know how I can do an authentication system with Mirror?
so like sending and checking username and password then saving and loading data to server
Anyone know how I can do an authentication system with Mirror?
Is there any? Honest question
I think maybe.
@gleaming prawn nop not a built in one
Does photon have one?
I was about to check out PUN
I'm getting tired of all this networking hassle
I already wrote my own system that works perfectly fine
only problem is that it's limited in it's own way
Photon can hook up to external Auth services, including custom ones
Because photon itself does not offer.player profile storage services, there is no point in having a "built.in" Auth...
What is built in is the ability to hook to external authentication services...
i need help
in PUN2
so i want to make my child animator component observable
how do i do that
Do you have the latest version?
I have changed observables recently, but not sure if its in the current store version.
But the new changes should allow for you to put animator and transform views on children
Can you screenshot your photonview?
Either you haven't updated to the most current Pun2, or its not in there yet.
wait
Get the latest. If it has that option, set it to Auto
And it should find your AnimatorViews
If it doesn't have that option, then its not in the release yet.
excellnt
Pretty sure they will all work correctly. It was recently added and I didn't test it all that heavily.
@jade glacier I am starting to have a look now. Thanks!
@frosty crystal Oh my gosh. How easy was it. I am keep forcing myself hard all the time. All the time, I think differently and that causes problems. I do not know if I become a good programmer
just 4 line code and it is ok. I spend 2 days, days and nights!
Hello
I'm going to make a online game with matchmaking, any tips on what framework to use?
MLAPI and Mirror looks like doest not supports matchmaker
Yea those types of services tend to work separately from the actual gameplay server networking solution
In theory you can just register bunch of game server with your matchmaking server and then the client requests a server from the matchmaking server
This might be helpful: https://github.com/aevien/master-server-framework. The site has more information
Is this the place to talk about netcode?
#archived-dots for the new unity netcode
Guys, i'm in desperate need of help for my new game network system, it's a 2D shooter game, i'm having trouble synchronizing the players positions, and also i don't know how to properly register bullet collision ( loss of health ), i know that it must be done all server-side, in order to accomplish this. For now, it's all client-side, the client send a status object (with player's X and Y coords, and other values that represents what the player is doing ) to the server, and the server forwards it to the other client. The result is messy, there is lag in the opponent movement, sometimes the events don't get caught, and other buggy stuff... What is the correct way of doing this? Could you link me some online resources that i can read in order to understand what i need to do? I would really appreciate that : ) Thank you in advance!
Guys, i'm in desperate need of help for my new game network system, it's a 2D shooter game, i'm having trouble synchronizing the players positions, and also i don't know how to properly register bullet collision ( loss of health ), i know that it must be done all server-side, in order to accomplish this. For now, it's all client-side, the client send a status object (with player's X and Y coords, and other values that represents what the player is doing ) to the server, and the server forwards it to the other client. The result is messy, there is lag in the opponent movement, sometimes the events don't get caught, and other buggy stuff... What is the correct way of doing this? Could you link me some online resources that i can read in order to understand what i need to do? I would really appreciate that : ) Thank you in advance!
@silent zinc Ufuk Demirbas The photon lectures are avaliable on Udemy
My question is :
My game manager is networked object in photon scene. I want both of the clients (remote and master)to get referance. Is it possible to get two referances on to an object?
Thank you!
I have a question.... why does my RPC not work?
I want to register when every player have chosen their team and when everyone's ready, send an RPC from the master client that starts the countdown
it doesn't matter how many players choose their team, it only shows that 1 player (local) is ready out of e.g. 3
Question: When Unity will solve the complication around the security issue of reading a JSON file with a WebGl Build ?
only Firefox allow to open webGl with a localhost but not reading data as JSON.
at least post a workaround it or the right way to build the WebGl that include json files so people will know...
Hi all! I am new to networking. Am working on Photon for multiplayer integration. I want to instatiate two players like each facing another player. For that I need to change one of the players x scale or I should flip the sprite. How can I make it show across network.
Should servers really disable Animators in players?
Is this a significant optimization?
I would just disable renderers and keep Animator, bcoz i'll need it for.. animation-based hit collision melee
Also, anyone got good resource about animation collision melee for multiplayer?
@trail parrot disable all rendering, but u need the animators if you use animations or game logic
Is it worth it tho(for server's cpu, say in an mmo)? Should i try another approach like tweens, shape-casts, that only happens when a melee is triggered?
ยฏ_(ใ)_/ยฏ
I knew it
Relying on a unity exe as the server for an mmo? I would say if you are even considering that... You might not want to make an mmo. Making an mmo is your networking thesis, not your networking 101.
Umm im just asking?
And i'm making a multiplayer, with unity exe, and i dont see what's wrong with that
I dont get what u mean by thesis and 101 btw
ok does anyone have any experence in storing data on a server using unity?
because im 100% brand new to networking and want someone to help and answer questions
WhO gOhst pinged me
not sure if storing data in a server is considered "networking", but you have a lot of services for storage, you just need to interact from c# with web requests probably (or even using those services API like firebase for example), it depends on different factors, how frequently you need to access that data?
Usually you keep the simulation sync aspects of networking totally separate from data storage of any kind. It is networking, but typically that has nothing to do with the server/clients connections our state transfers. Usually that kind of stuff is pulled from databases or content servers asynchronously.
Guys, I'm making a multiplayer using photon. I created a scene like if two players joined a room, the next scene starts. My problem is when a new scene created everything in previous scene is destroyed right, so the connection also disconnects. How can I keep the connection alive between client if new scene loaded
Connections shouldn't really be tied to scenes in any way
@spring crane so the Rpc calls I made in scene 2 will execute in the 'other client'?
A bit unclear what the situation is. If you are just changing the level in the match, using the Photon load scene methods probably handles it nicely for you
@spring crane , I did it using this function
PhotonNetwork.LoadLevel(1);
Yea, so do you actually have some problem that you are observing?
I was working on my creating and joining room scene. Now I wanted to integrate it with my game scene. So I just wanted to know is it something that photon handles on it's own or do we have to find any alternatives for that
Prematch scene should be fine
Okay, thank you @spring crane
I did it!
I found a channel where they talk about Photon
I am so happy I could cry
So I have a map where players can run around and see each other. Think... Runescape. But als there are NPC cars because there's traffic.
I have players bumping into traffic that's local, but the traffic for the other players is not synced. So it's weird to see someone blocked by hidden obstacles or indeed plowing right through a car
How can I sync those objects without having someone own it using a Photon Transform View?
Can't I have a server own them?
probably, but i dont know much about photon
The people I spoke to said I probably should use photon for anything multiplayer
When I started, I thought I'd have to use websockets and just send the new transform props and an object ID
there are multiple photon products it depends which one you're using
Afaik only PUN is useful for what I want?
But I still don't know what photon does that I can't do with websockets
makes it easy and handles more cases
It handles the management of spawning/despawning over the networking and managing those objects by ID and such.
As well as loadbalancing, etc.
Doesn't sound too scary tbh ๐ค
You mean to write yourself?
Yeah
Go for it
Might be fun ๐
And might actually be good, because then I can make it so it doesn't require an "owner" by playing a prerecorded script server-side
Give it a shot
I found a couple of libraries for websockets in unity. Any recommendations? This one seems most promising https://github.com/sta/websocket-sharp
No idea, I never touch anything transport or lower. There are some in here who may have some ideas.
It is going to limit you to TCP I believe, so not sure what you long term plans are.
Though you should abstract whatever net lib you create from your transport anyway.
Does anyone have experience with Agones?
Can anybody help me with getting a prefab to spawn so that it spins?
Instantiate(foodToSpawn, foodSpawnPos, foodToSpawn.transform.rotation);
gets it to spawn fine within my code, but I can't figure out how to get it to rotate
(not just set the rotation; I want it to constantly rotate)
nvm. I just wrote a separate script to do the spinning and put it on the prefabs
yeah, just make it spin OnEnable. I assume it doesn't actually need to sync that rotation
Don't network that, waste of data
I'm REALLY new. I'm not sure what "don't network that" means. haha
do you know how I'd make it so the rotation is relative to the world, not the object?
I'm doing:
transform.Rotate(Vector3.up, spinSpeed * Time.deltaTime);
but adding * Space.World doesn't work
one of the objects is spinning on its own Y axis, but I turned it before placing it, so it's like rolling instead of spinning
Vector3.up = world's idea of up
transform.up = transform's idea of up in world space
Hmm. it's definitely not behaving that way
I would REALLY avoid doing any kind of networked game as your introduction to Unity.
it's not networked
OMG. I just realized I'm in a "networking" channel. I'm so sorry
My apologies. I'll head to a more general channel
๐คฃ
@rigid heron I know I'm late to the party but I would strongly discourage you from using Photon Bolt as a networking solution. It's not very intuitive, closed source, and the only features worth talking about (auth movement and hitscan rollback) are clumsy and don't work well.
Just trying to save you from the pain of using a solution that's honestly, speaking from experience, not great.
Bolt is a pain, but it is the ONLY full stack option of its kind.
Quantum will eventually replace it, but that isn't really accessible to the hobbyist.
Pun2, Mirror, MLAPI, Forge etc aren't complete stacks and have zero integration with simulation. You have basically write your own tick engine for them if you want to not make hot garbage.
semi-related tangent, but how well does FPS work on Quantum? I've wondered how FPS (or any precision shooters) hold up without attacker's advantage, and whether shots would miss often. Could see it being really frustrating to hit a snipe locally, then have it rolled back
You have to understand how deterministic lockstep works to get it really.
Everything is extrapolated rather than interpolated
So the player lives in the present, rather than how most state transfer systems work where the shooter lives in the future.
I haven't played any FPS sims with it, but I could see if you set the input lag to nothing, that the extrapolation could make the predicted enemy positions turn out to be incorrect enough to cause shots to miss. That is more a question for @gleaming prawn
yeah I get determ extrapolation, I'm mostly curious if it's something that's come up
though I suppose in theory you could send a "I shot a player" event to referee (along with the predicted inputs that were being used when you made the shot). Then the referee could roll back/resim with the inputs you sent and validate that the "I shot a player" event is replicated. It would change the sim from being "determistic with the same inputs" to "deterministic with the same inputs and events" or something
@opaque dew Ok, thank you, but what service would you recommend then?
I would use PUN2 for FPS games with 2-10 player per room and Mirror for MMO. The biggest problem with PUN2 is that you can't make a dedicated server for it and PUN is probably more expensive. Photon is peer to peer with cloud assistance. Mirror is server based.
I don't know much about the other services
Extrapolation for enemy players on fast-paced FPS is never really good, no matter if you use determinism or not, SPECIALLY if you have snappy, o-lag local prediction for the player character
In practice you require lag compensated raycasts.
hello! is it a good idea to learn C# .Net TCP/IP and UDP before diving into Unity networking? I have 0 experience in networking.
It's never bad to know some background but if you don't intend to create a new networking layer, don't bother with UDP and TCP too much.
As usual: Do a first mini project and or tutorial for networking. Get a grip on how to think about it. Then you can start your project.
Can someone recommend on good multiplayer tutorial, I prefer p2p networking.
I'm getting confused everytime I start a new tutorial...
learn mirror or photon
photon is probably a bit more documented
but I think mirror is cheaper
if you want more than 10 players at once in photon, you have to pay
peer to peer
you have a host
which is also a client
and the host connected to other clients
like in haxball
I think you still have to pay for more than 10 concurrent users
but not sure I'm not that experienced
just know some basics
PUN is your only complete solution for that
Mirror does the same thing
mirror does not have a relay
there's an asset I believe but it's more of a guy running his own thing rather than it being officially mirror
true
idk I tried mirror, didn't like it that much, but when I look at photon I don't like the prices
I tried making my own solution with sockets and liked that the best, but I don't know how to implement websockets etc so don't really have a good solution myself right now.
photon costs money but you do get things like support, hosting etc. that you don't get from open source
they set up a dedicated server for you or you have to run your own?
when I started unity 3 years ago PUN was the only thing that was basically drag and drop networking
I don't know the specifics but iirc it's similar to a relay server that they run, however I believe there is an option to host it yourself
yeah, the options aren't that great imo
I tried PUN, I got confused quickly
also sockets
yes but it also takes a lot of time to do everything yourself
yep
@carmine nacelle real-real P2P (direct connection between two machines) only works 100% of the time in a LAN...
I am gonna do some research
You can go for mirror in that case
I mean something like this @gleaming prawn https://www.haxball.com/play
If you are going to play over the internet...You need a library to help you:
- punch through (when possible)
- fall back to a relay service (you need to pay or host the relay servers yourself, AKA paying for them)
haha
Punch would work in about 85-89% of the times...
I am just learning
There is STEAM networking (if you plan only for Steam/PC/Mac), it does that for you (both punch and relay).... And you "only" have pay 30% of your revenue....;)
oh like terraria?
So, that's pretty much it... There's no free lunch, people don't give you server capacity/bandwidth fully for FREE
I will do more research and I will decide thank you.
oh like terraria?
Have no idea what you are talking about here... I know there's a game called Terraria
I will do more research and I will decide thank you.
There's more
I think it's steam networking
You should NOT come straight away just asking for P2P... It's not YOU who decide the best architecture for your game.. It's the game itself...:)
And game networking is a LOT more than just being able to send messages between the clients (p2p) or client and server
That is just the very very basics...
Libraries like the ones from photon (PUN, Bolt, Quantum) or Mirror, or Unreal Networking solved a lot more than just sending raw data.
Never said I am going to use that straight forward.
If you are NEW to networking, start with one of these (Mirror is free, PUN is free up to 20 players, same for Bolt)
Just clarifying as much as possible (sorry for the CAPS)
yw
isn't pun only up to 10ccu free?
hm weird last time I checked it said 10
yeah u right damn my brain must be fried or something
Is it normal that I can't run my game on my AWS free server?
I think it's giving me an error because it only has 1GB RAM but I'm not sure
idk the specs of the AWS free tier. But you shouldn't need 1gb of ram for a simple headless unity instance
what is headless again?
also it uses up to 800MB just for running windows server
so I only have 200MB left for my game
headless = unity with the rendering
the free tier also has very bad performance, it will NOT be enough for a realtime game IMHO.
But sure, go ahead...:)
Have you guys worked out how lag compensation would work with Quantum? Seems like no matter how you unwrap that it will lead to some kind of trust of the shooter's client that would have to circumvent the nature of determinism? @gleaming prawn
no trust on client...:)
@gleaming prawn @prime dawn @rigid heron I'd just like to mention that Mirror is not MMO ready, despite what they advertise. Don't get me wrong, I really really like Mirror. But there's performance things they need to work out first.
how does Quantum interact with middleware? or does it not use any?
We know that... By design it's not something would work for MMO... But that's not a problem...:)
Does the client just let all others know how far off the shooters timeframe was then? And they reconstruct somehow a best guess of what the shooter had extrapolated? Or is extrapolation reduced or removed?
Secondly, lag compensation is the easy part. Heck, I have an asset that was designed for Mirror but is more-or-less universal and it's whole job is to roll back colliders, and it works very well.
how does Quantum interact with middleware?
Can you be more specific?
The hard part is server auth movement.
Lag compensation is a BIG term really, and not all answers to the problem are equal.
well, most people I think mean raycast 'prediction' or rollback
@opaque dew about this:
but is more-or-less universal and it's whole job is to roll back colliders, and it works very well.
The problem is at what cost
if I wanted to integrate some third party library or like an asset that could potentially break determinism
Without a tightly integrated simulation/controller/networking arrangement - most "lag compensation" is mostly a sloppy rewind based on something of a millsecond based guess.
because you need to do that for EACH separate client...:)
They're all Mirror assets though.. but as I said the logic used to rollback colliders is universal
yeah its a time rewind on colliders using packet travel time
the issue isnt that the calculation is sloppy, its fairly precise
the problem is that how long it takes for the attacking player to get updates from their target, not how long it takes their shot to get to the server
I've written that kind of rewind before - it was "passable" but it creates problems.
@weak plinth Note possible with quantum, any 'game logic' assets for unity are 100% incompatible with it
I tested mine with a 120+ ping and all the testers said it felt really good.
Here's a video of it anyway https://www.youtube.com/watch?v=I82Gw7q_7VA
Ping isn't the issue so much as loss and jitter
1000 ping with stable RRT times will be perfectly accurate
stable RTT goes out the window on say mobile
I don't know of any FPS games that build their netcode around poor connections
Any good net stack should
Tick based systems do better for that reason, time isn't loosey goosey, its quantized
Vanilla Pun2, Mirror and such are all time based, so they all have limitations and are very squishy
fixed numbered ticks
Same answer, words in different order ๐
Ye, proper lag compensated raycasts need the exact number of "ticks" you need to "rollback" to
An that implies your whole sim is fixed-tick based (like quantum or Bolt)
Not sure how mirror works... so
time based
ye, so it's a loose lag compensation...
My SNS stuff is tick based, and I had to write an entire callback system to make it happen with Pun2 and Mirror
Okay so what you're describing doesn't at all interfere with time based rollbacks.
@opaque dew basing rollback on ping milliseconds = joke, nobody actually does that.
Nothing internal plays nice with simulation
Also what happens if the characters you are "rolling back" moved direction... Do you store the ring buffer of their transforms? etc
well, nobody outside hobbyists building unity games do that.
Bolt actually stores the ring buffer of the colliders for that...
Quantum we have the actual full data for that,e tc
Yes...I do
SNS runs ring buffers as well
It is the only answer to get past the problems with time based
It's not really a hard problem to overcome.
@weak plinth editor tools (like Odin inspector) are ok-ish to integrate...
Input managers like Rewired are FINE, no problem
Anything implementing gameplay (like asset store KCCs) are useless in Quantum
You just store states and move between appropriate states.
Time based is just terrible, it indicates a complete lack of understanding of how Fixed and Update should be used, and what they mean really.
again, not related
Anything view-only, like shaders, effects, materials, as long as they do not change anything gameplay, no problem
Internally Unity is Fixed based. Update is just for lerping... Fixed is for simulation logic.
I feel like we're talking about something completely different because fixed/regular update have absolute no affect on my rollback code
we are talking the same thing
Its just that a time based method is inherently very very wrong for networking
@opaque dew no what i mean is that nobody serious that's building high end FPS games are doing time based simulation, rollbacks, etc.
describe a time based method please
everyone uses discrete ticks
moving your stuff in Update(), and sending it at arbitrary ms based intervals is pure time based.
@graceful zephyr the best way is to probably rollback based on frames or an index sent from the server
eg: server sends a packet with id 10, client fires on 10.. server knows where to roll back to
Moving your stuff in Fixed, and sending Fixed results is tick based. Using update ONLY for lerping. That is tick based.
that makes sense, thanks
Anything involving determinism or sending inputs... fixed becomes even more of a must.
erver sends a packet with id 10, client fires on 10
That is a description of a tick (number) based sim
Not time based
@jade glacier I've seen your work and it's good work, so offense intended when I say, you're understanding the relation wrong.
I mean, feel free to correct me - but I am not seeing what I am getting wrong here atm.
how you handle your movement and all that jazz has literally no relation to collider rollback
no it doesn't.
You might be talking about the ability to do things off tick?
how you handle your movement and all that jazz has literally no relation to collider rollback
Not for the collision rollback, but it does with position correction from server (client side predictions)
These are ALSO tick based...:)
the only thing that matters is how you determine to rollback colliders.
not how to update your players movement.
which I advise against. I would round your actions like weapon fire to the nearest tick or even subdivision
i can, without a doubt, say that you are wrong here @opaque dew ... but w/e
internet arguments
ยฏ_(ใ)_/ยฏ
im out
If a user fires a gun, that shot NEEDS to align with a tick or an even subdivision, or else you are in non-deterministic hell.
I think it's a misunderstanding if anything.
it needs to align with a frame.
or logged tick of some sort.
so yes, using fixedupdate for that makes sense.
If you are time based, that is what you do yes.
You log it as a specific float value (which is expensive)
Align-with-frame = tick based (not time based). Putting time in the equation just adds poop to the thing
the difference is solution which is universal vs one which is designed specific to a game
you cant drag and drop a universal solution
The point we are making is to NOT be time based, it adds huge amounts of efficiency and sanity - and removes frame rate dependency from the system.
No, the difference is:
- one solution is exact and generally accepted
- other is inexact and will give a lot of issues in edge cases (and it's been abandoned several years ago for that reason)
You can do it however you want, but you are arguing with 3 library makers who have all produced working engines, and we all abandoned time based early on, and are just explaining why.
but my point is its less about using fixed/update and more about including the server tick into the fire call.
Time-based works, its just less than ideal in nearly every way
I agree....I never said it was better. Said the problem isn't that complicated, first most, and it's not.
Sure, that is the world Mirror operates in. "Good enough"
But then someone says "how do I do server authority over player movement with client prediction"?
And the whole system runs into a wall.
I'm not a spokes person for mirror ๐ I do make tutorials for mirror and assets but it definitely needs improvement.
I actually only started making tutorials for mirror because there were none at the time
Mirror, HLAPI and MLAPI STILL to this day don't have a built in transform or animator sync that work correctly - because of the difficulties involved in syncing time based.
How do you feel about Smooth Sync ๐
It is flawed in its approach, but it does gloss over the problem better
It just goes all rubberbandy and operates outside of any timing system
So it will look smooth, but add an animator sync... and the two will be in massive disagreement on timing
I see what your problem is now...
You have unrealistic expectations from the asset store ๐
Networking code can never be perfect and be a 1-size-fits-all solution.
I mean, I made a sync that does this... and its on the store.
So I am not talking out of my ass here.
does yours work with mirror or anything I throw it into?
There's a difference between one-size-fits-all unrealistic expectations VS plainly bad/wrong
I don't officially support Mirror because the keep making breaking changes, but yes it runs on Mirror currently.
smoothing animations is just throwing the dust under the carpet...
Would you mind throwing me a copy of the package(not a voucher) so I may test it out?
Really does not server anything serious
before you answer..
just the package as a unitypackage
The pun version BETA is free though
I'm going to be running it against this https://www.youtube.com/watch?v=g2cuzl9wLso
But nothing to see really, its just an execution of what we are talking about
I understand. I just want to see how it holds up.
okay, well I'm not remaking the video haha
I just want to run it to see how it compares
your inspector looks well made though, kudos to that
I work for Exit now, so what I am developing are extensions for Pun2 based on a tick timing system. Mirror/MLAPI support is just there for existing users so I don't bone them - but I really want the asset to die.
yeah, I understand that.
I've pitched several improvements and they usually get passed by.
I did not know SNS worked with Mirror as well @jade glacier that's nice
yeah and MLAPI and Pun2
Mirror support is and was hell though, those guys make breaking changes like no one else I have ever seen.
one of the main reasons I had to make my mirror tutorials for supporters only
spent more time fixing tutorials than making new ones
Making a video can't be fun, breaking changes are a real problem for video
was a time drain
I also really really enjoy PUN2, I won't recommend Bolt though.
It's workflow is awful everything.
That is pretty much why I want to Tobi and asked if they would be interested in me working exclusively with Pun. They NEVER broke anything on me. And when Tobi did once he messaged me letting me know, and when I suggested how his change could avoid a break he happily made that change. Zero headaches supporting Pun2.
Mirror team, they usually just would tell me how stupid I was for doing things like bitpacking, or wanting to send my own events rather than using their RPCs, etc.
I've been looking for a nice networking solution to make tutorials on but there would currently have to be a lack of tutorials
I won't recommend Bolt though.
It's still the only complete one, by far
for client-server, state transfer on Unity
@gleaming prawn yeah but..Id rather write those systems myself than use bolt.
Bolt is restrictive, but for a reason. It has a tight integration of Tick/Simulation/Controller that is needed for server auth to "just work"
I had to use bolt for a paid job and it slowed down development soooooo much
That's odd
in general it speeds up because you do not have to write it yourself
Which would take you 2 man/years to complete (assuming an excellent programmer)
I guess....far as frameworks go it was hard to work with.
Looks more like a case of not having been on the other side, so you think the grass is greener
If you are trying to make something outside of what it wants to be it can really be a headache. And the compile workflow and such can be cumbersome, but that is the price of getting codegen - which brings speed.