#archived-networking
1 messages · Page 66 of 1
I was sure that most of RTS uses this model
This is not the "model"... It's just who is responsible for hosting the INPUT management
It's still lockstep
In most RTS, the "host" is just the input batching manager (so you get rid of the most common problems with 30-year old lockstep)
Most people new to networking never get this concept until way later and after a lot of refactors/restarts - Game Networking is about the simulation, not the messaging
yes..::)
In summary, there are several things being messed up in general, we need that post...:)
With no bias, and no preferences, just pure information...
Easiest route is just start a google doc, and rather than answer things here... just write them into that doc, and point people to read that.
yikes, I just said "word doc"
Almost put on my old man pants there
lol
That would be awesome because there are literally no structured and comprehensive info on these topics on internet
gafferongames has great information, but its not about libraries. Though generally the "which library is best" talk is already on the wrong path.
And requires several tiers of tooling and understanding
gaffer on games is mostly great. although he has his "preferencies"
I think the first thing before anything is to understand what a complete networking stack looks like for the different game types.
Gaffer is just nice because he discusses a lot of the basic concepts in one place. Some of his old examples I thought were kind of down pointless paths... like his networking physics stuff.
The way he talks about determinism seems to "consider" 20 years of predict/rollback development worth of a couple of words (at least last time I saw)...:)
He definitely seems to live more in the snapshot interp world
exactly his networking physics... He uses lockstep when he should be using predict rollback...
He also stopped working on those docs, so I assume he knows more and better now - he just isn't writing any more.
And stuff like prediction culling, etc, nevermind...:)
It's inevitable. Giving away any of this knowledge is a lot of work with very little gain if you already have landed a sweet gig.
But don't get me wrong... Glenn is a great guy, and probably an inspiration for most of us here (me included)
I mostly just appreciated that he supplied great visuals and put the time in. Better to have a slightly incomplete reference... then no/scattered references. And appreciated that I could just point people there rather than answer the same questions over and over. 🙂
I just made a google doc where I am going to copy long winded answers to questions. Will see how good I can be about copy knowledge dumps from the channel into that.
@verbal oar I would disagree. There are ton of GDC talks, articles, blogs, sources about networking
Probably bad luck finding information.
Hello everyone!
Quick (and newbie) question here. Is it a bad practice to use HttpClient from System.Net.Http instead of UnityWebRequest? I am writing a service and I would like to have no Unity's stuff in it.
I was using a lot of async/await code along with System.Net.Http.HttpClient but I thought I would have a not-optimal threads management and maybe this namespace is not available on some devices so I decided to go with coroutines and UnityWebRequest but I don't have enough experience to know if it's a good decision or not.
I can already see that one drawback of coroutines is it's more difficult to return a value. Don't get me wrong I know it's doable but it's less convenient than int randomNumber = await RequestARandomInteger();
Hello i have this problem
https://github.com/Unity-Technologies/multiplayer/issues/83
That is UNet?
No thats unity transport package new update
I see they are using some of the old class names. Can't help you with netcode, haven't touched it. DOTS channel might have more people in the know.
👍
My physics based game wouldn’t be where it is right now without Gaffer
Idk how “outdated” his material is, but his articles about determinism and networked physics are all designs Rocket League uses
So outdated or not, we have a modern AAA game today that uses them with great success
(The most successful networked physics based game made so far in my opinion)
Just wanted to chime in there and say that @jade glacier @gleaming prawn
Rocket League goes quite a bit beyond the basics he discusses. But yes, his stuff is a very useful introduction to the concepts. I think we are all in agreement.
I'm not sure what you mean by Rocket League using his designs. He didn't make the concepts - he just did a nice job of illustrating them.
Rocket league is a great game, and a tour the force by its developers from all I read.
You can send messages to any client @weak plinth
Low level photon realtime messages
RPCs are how you said, but they are just awrapper around normal raw realtime.messages
My point is @glacial totem maybe we should have many more great physics games, besides rocket league. Maybe I'm wrong... And maybe I expressed.myself badly, I don't think his article is outdated at all, his descriptions are also excellent. I just think he chose not to explore one of the options all the way to the most modern approaches (IMHO).
wrong rob tagged lol
np
Any photon server experts over here?
We are using custom server application that implementes room based networking (smiliar to loadbalancing). The issue if when we have more than 2-3 players in room, the movement updater on server if slowing down so much the client recives only 4-5 position updates instead of the needed 10/s. We implemented it like following:
Each room has updatedMovement list which collects all movements of actors each 105ms roomTick shedule. Then the server updates all clients about the position chabge by sending fullList to clients. The incomming rate is about ~10msgs/s but when 3rd player joins the incomming rate that client recives goes crazy down to 3-4/s for some reason
Have you profiled your code that does these updates on server?
There has to be something really bad going on either.on your update code or somewhere else for this to happen with this low player count. We run a few thousand players in one machine (Albion online does that as well)
The fact that you are implementing a server app based.on the standard load balancing arch, wouldn't you actually be well server by just using load balancing and normal room plugins on your self hosted photon server?
That might save you a lot of implementation details. You can run timer based updates on rooms, etc... We do this for our base quantum plugin (at 60hz by default, much faster than yours)
I mean, I've been implementing photon server.room plugins for the past 3 years and I know ofmcourse how to reach its limits. It's just a lot higher than this...
well, take a look at the RoomTick() code its like that
if I'm instantiating a bunch of map tiles OnStartServer, do the tiles HAVE to be local player authority? It seems like the server should own them, but when I do that only the host gets a map
https://gfycat.com/lavishfalseasianlion
I've been trying to port the new stateless ECS's Unity.Physics into monobehaviour classes and gameobjects
This is client's view
Client recieves a new state from server at 5hz
Reverts back 10 frames, resims 10 frames when a state is recieved (lives 10 frames ahead of server)
There used to be harsh corrections on objects before on each state recieve+rollback+resim, but ecs physics really seemed to have fixed the issue for me.
Cubes are a little slippery but thats because Unity.Physics doesn't support "stacking" yet i believe
I did my byte by byte state comparion before and after 10 frame rollback+resim for same timeframe
It seems to be always same until a another player changes it's input
edit: I tried moving around, shooting arrows and doing the byte check on every rollback+resim on clientside, i seem to get a different result in check every 15 seconds or so, i don't know why yet
"yet" isn't accurate
it will never be great at stacking
they already fixed the initial issues where you couldn't even stack 3 cubes
but there's only so much you can do without cache
@vital hawk
What do you mean not accurate?
Probably as in that is the stacking support. Expecting some sort of big gains in this area in the short term might be iffy.
https://cdn.discordapp.com/attachments/497874303463850004/682716548686807047/randomness.gif
Also this seems to happen (in clean project)
Disabling "burst" and "optimizations" seems to fix it but i'm fine with it, bounce trajectory seems to be deterministic
hello i am still trying to create and understand udp socket networking with csharp
first I would like to know if I am on the right track, then I would like someone to help me understand what I do not understand,
if someone has a few minutes to grant me here are the scripts
Player and Client: https://codeshare.io/G8KoXB
Server: https://codeshare.io/5Q1LZ7
and i'm sorry for my bad english
thank you
@high night yeah I mean, they can't do wonders with the stacking without having some sort of a cache, and that's against the stateless design
so, wouldn't expect the stacking ever to be even comparable to what physx or havok has
yeah, right
That's pretty much it... I talked a bit with the guys from havok, because our engine is also stateless... And that's pretty much it.
You get some basic stacking, but not as close as what you can do with caching collision data over time
hello, so i just switched from mirror to photon recently and for some reason cant connect two people to the same server, however i do get this error
im trying to use ConnectUsingSettings()
ill go to sleep anyways and try to figure it out tomorrow
First thing to try for that is set the Fixed Region
Its possible for the editor to come up with a different "best region" than builds first run. A Dev Region is being added in a release soon to deal with that since it happens so often. @rich flame
Though that error suggests something else.
Make sure nicknames are unique
Ok thanks emotitron and danny, ill try those tomorrow
@high night my feeling is that if you're having issues with Unity.Physics at some lenght of time, like 15 seconds, i feel like they probably have tests for this, so maybe share the scene with them
@amber trench It's very likely this is my fault, that seems to happen at the same time i get a lag spike
I'm thinking it's changing how the inputs are applied locally and sent to server
Or maybe server lagged and missed some inputs
I'll try to debug my inputs further
I was expecting better determism on same machine
anyone know any videos i can use to make my game multiplayer?
im trying to use unet but idk what to do with it
I'm sure you can find some if you search for them. I recommend making few singleplayer games first to get comfortable with C# and programming
what about lan? is that easier
@clever hinge I am not an expert at all but I don't think it's far easier since you always have to sync games, to send packages etc. It is easier because you may have a lot less issues with your network but you still have to deal with a network, it may only be more reliable. I think !
Yea it's just a lot to chew at once. Making games is already hard
ight
Hello everyone.
I cant post all the code here so as you read you can check out this hastebin: https://hastebin.com/icesiyunes.cpp
I am very new to unity and networking using C# and its been 2 days since I started to struggle with some really basic issues. I think I need help. I have a service that can do web requests.
see service's method on hastebin
Pretty simple. I want to be able to execute multiple web requests synchronously (one after the other) using coroutines and I want some service's methods to be able to return data from their coroutines (yield return toto). In order to do that, I am using a wrapper for coroutines that can returns data.
see calling the service on hastebin
The wrapper comes from this topic :https://answers.unity.com/questions/24640/how-do-i-return-a-value-from-a-coroutine.html
I have multiple issue :
- the synchronous part does not works as expected. The 2nd request does not wait for the 1st to finish.
- I have modified the wrapper so I can pass a generic type to it that define the type of data returned by to coroutine. But I don't know how to make it generic.
see coroutine wrapper on hastebin
You can look at the commented code to understand my issue.
Here is what I have tried to do to fix it.
while (target.MoveNext())
{
if (typeof(T) == typeof(string))
result = target.Current.ToString();
else
result = (T)target.Current;
yield return result;
}
But it's just not a valid code.
I just don't understand how to write services that can be called both sync and async (up the to caller) and return datas. Sorry!
(Oh and thanks a lot for reading this already too long question. Even if you don't have answers but just samples or resources its already welcome of course!)
yes @high night for networked physics, you will almost always have to do something of the form of
- client sends input packet tagged with last packet number received from server, client-side simulation occurs normally
- server buffers packets during its timestep from clients, executes client inputs in order to compute physics
- server sends collected, authoritative inputs with with incremented packet number, client reruns physics
- server discards inputs sent with earlier packet number (the time to send your input has elapsed)
if you need to hide physics objects from some clients and not others, this obviously gets really complicated
your life would be made easier by unirx
is unirx for controlling monobehaviour update callback?
If you aren't going fully deterministic you can constantly clean up the PhysX disagreements with state transfer. But that is never REALLY networked physics.
I don't think there is any such thing as networked physics, it implies something that can't be.
@jade glacier i did try that
cleaning up doesnt do it, physx cache needs to be serialized somehow
Either you are predicting physics and cleaning it up with server states and resims... or you are deterministically extrapolating and doing a lot of resims.
For the deterministic side you aren't networking the physics though, you are just being deterministic
It will never reach 100% agreement
you are just using the state sync to get things in BETTER agreement
Thus why deterministic is the ultimate.
I have had luck in the past with tests of syncing using just rb transform and velocities, where things stayed in agreement more than not
Rigid collisions usually don't work with the rollback/resim with physx i believe
This hot mess is hard to see, but basically when the spheres show lines coming out of them they are in disagreement. So you can see that they got back into agreement in one frame and usually stayed that way until the next collision.
I don't think I would want to build a game around that mechanic though.
That was PhysX btw with partial resimulation (separate physics scene that resimulated just one ball at a time against copies of the world colliders)
oh, sounds funky
@high night resim works fine with PhysX
you have to deal with collisions
oncollision enters
collision forces
or any kind of addforce
What do you mean?
they are cached and applied next frame
My game uses all that stuff
Not sure what that means
if you increase your prediction frame count, don't you see harsh corrections on client side?
even though there isn't any other player input change
What do you mean prediction frame count?
how further client lives ahead of server
That should only be the latency of the client though
If a client has 33ms of latency to the server, they should only be 33ms into the future
Also yes, the more latency a client has, the more harsh the corrections will be
But I don’t know what AddForce has to do with anything
even if client has 500 ms latency,
if all players except this client are keeping their inputs same
this particular client shouldn't ever see any corrections at all
Correct
I believe this will be very much possible with unity.physics
A 500ms client in the game with no other players shouldn’t see any latency
It’s also possible with PhysX for the most part
It’s very dependent on your physics simulation
What does AddForce have to do with anything though? Lol
in practise yes,
but i like this rocket league physics because i just think it's easy because you don't ever have to deal with individual cases when you write netcode
if my arrow collided with enemy at frame: 500, it should always be frame:500 when resimmed
and with same force
@glacial totem https://cdn.discordapp.com/attachments/497874196274348032/685257841556062228/IMG-20200207-WA0000.jpg
@high night
addforce is cached
it's effect on velocity is seen in the next physics update
@glacial totem
listen to this:
That shouldn’t effect anything though
no,
when you load a new state, these addforces will be carried over
you see the problem?
that's a big problem
It’s not though
oncollision calls are also leaken into the next state you are loading
If you still have cached states, you did something wrong
and i do my damage dealing methods in oncollision
You shouldn’t have any cached states if you called Physics.Simulate
If that’s not the case, you aren’t doing thing in the correct order
Physics.Simulate should have already been called for the the previous tick before you do any resim or rollback for the next tick
So that shouldn’t be a problem
Physics.Simulate will invoke OnCollisions
Next Physics.Simulate actually will call the callback
@high night did you disabled Auto Simulation?
yes
You must have done something wrong? I don’t experience these problems
You are saying Physics.Simulate will clear the addforces, call all OnCollisionCallbacks?
From my experience yes
So you do the serialization right after a Physics.Simulate
Yes you should t be sending data until you call Simulate()
Same with saving the state locally for comparing corrections
You also should be getting fancy and quantizing your physics data
But that needs to come after you get everything else working
Quantizing will make everything even more deterministic
I tried quantizing, it made my objects slippery 😄
I quantized it all for that example video above as well, should have mentioned that. Since the networked values were lossy, I would apply the lossy networked value to the server. Which also probably had a stabilizing effect on the simulation.
Def
you quantize every simulated frame or or for every sent state?
every captured state, so could be every tick or every X ticks if the networking was set to send every X
Basically I would apply to the authority version exactly what was being sent to others.
Which likely would cause what you witnessed... slippery objects 🙂
If my server is only sending every X Sim ticks, then quantizing in-between frames would break things
The goal being to do exactly on the player side what you do on the server
hello, does the server have to simulate the same thing as the client? I mean do they need that the server contains the map to detect the collider etc?
anyone used mirror for networking?
trying to set it up but when someone joins all other players start falling through the ground
@pure vector you should join the Mirror Discord
Hi All, anyone knows what is causing this in my hierarchy? I get all these "not loaded" scene items..
@gleaming prawn ? are u single person who develop photon?
if not how much of u guys are working for this framework?
Exit Games is ~50 people
Just the team developing Photon Quantum is 10 people (I'm only one of them)
So NO, I'm not the single person developing photon (I'm not even a developer of photon server or photon realtime, etc)
There are at least 5 or 6 of us in this Discord server alone.
How could I sync a health bar
You sync the health, not the bar
The bar would look correct on all clients then
if they should see that entity/Object
Bar is just UI
Have a small issue regarding interpolation. I made a system in which packets are always ordered, so the players always interpolate to the latest packet. One issue I had yesterday was that I would get small stutters, rarely but they would happen. The code in which I am interpolating is as such:
float timeSinceLastInput = Time.time - deltaT;
float t = timeSinceLastInput / Time.fixedDeltaTime;
transform.position = Vector3.LerpUnclamped(this.netObject.lastPacket.position, this.netObject.currentPacket.position, t);
transform.rotation = Quaternion.SlerpUnclamped(this.netObject.lastPacket.rotation, this.netObject.currentPacket.rotation, t);
Works insanely smooth most of the time, just the occasional stutter that ruins everything. I read in some articles that it could be caused by the interval between server updates not being constant, although I can't see how that would affect it as it would just keep lerping with the t value
deltaT is Time.fixedTime when the client recieves an update from the server
Your t is not ideal
If you are using fixed update as your timer, you need to consume every fixed. Update should then use (time - deltatime) / fixeddeltatime
public void RpcTakeDamage(float d)
{
if (currentHealth <= 0)
return;
//ONLY SERVER CAN CALL
currentHealth -= d;
healthbar.localScale = new Vector2(currentHealth * 2, 3);
if (currentHealth <= 0)
Die();
}
[Client]
void Die()
{
//client side death
Debug.Log("died, on client.");
CmdDie();
}
[Server]
public void CmdDie()
{
//server side call for death
Debug.Log("died, on server also.");
}```
What's wrong here ?
@jade glacier @gleaming prawn
On the take damage function
void OnTriggerEnter2D(Collider2D col){
if (col.gameObject.tag == "Player"){
Destroy(gameObject);
p = col.transform.GetComponent<PlayerScript>();
p.RpcTakeDamage(projectileDamage);
Debug.Log("You hitted a player");
}
}```
That's a lot to read without knowing what the error is we are scanning for.
There is no error
Then it looks great 😛
That is the error then. Where is it not working?
The bullet dont even collide with it
Use Debug.LogError for these dirty tests btw, and use Development Built in settings, so you can see messages on your builds.
And just test to make sure messages are getting where you expect first
I don't touch RPCs, so I don't know the ins and outs of them very well.
If the bullet isn't colliding, that is a physX problem
like your projectile is moving too fast for the collision to detect. Nothing in your code is going to work if you arent getting a collision
Oh woops, sorry didn't disclose enough info emo 😅 The server events are triggered in FixedUpdate, the lastPacket and currentPacket is set as the server update event is triggered. The code I posted is ran in Update for each of the client players, same logic applies to the local predicted client where he moves
but you'd rather have it so that it's not
float timeSinceLastInput = Time.time - deltaT;
float t = timeSinceLastInput / Time.fixedDeltaTime;
but instead
float t = (Time.time - deltaT) / Time.fixedDeltaTime;
deltaT is assigned as such upon a server update:
player.netObject.deltaT = Time.fixedTime
A flaunt in my interpolation system might also be that the currentPacket is the latest received packet from the server, whereas I read most places that interpolation is always 1 behind 😅
Most recent received will defeat the point of the buffer, if I am getting your usage
The buffer is intended to smooth out the jitter of the internet... if you consume frames as they arrive, you are baking that jitter right back in.
If you are going to consume things right away you will be making a bit of a mess - but going that route you will want to make your lerps unclamped so that they can extrapolate if a new frame fails to arrive in time... but extrapolation is going to lead to rubberbanding.
Consuming right away and advancing the snapshot/targets... means you will have to keep some kind of track of where you were in interpolation prior. It gets messy.
I see... So instead I should take the 3rd last and 2nd last packet and interpolate between the two, once a new packet arrives, shift places
And yeah the latest thing is probably why it's s snapping
Typically you don't think like that... you just put them into a ring buffer (or something like that with a queue).. and you pull from that on the same tick that you generate frames.
Your deserialization uses the frameid to know which slot to store the frame into
If you go to pull a frame and that frameID is not there yet.. you extrapolate a frame... you don't just grab the next available
You will then add some code to monitor the health of the buffer... to see if its too fat/thin and adjust as needed over time.
For server based, the server never adjusts, so clients typically have to to do that - by repeating a frame to grow the buffer... or running two frames to shrink it.
Overwatch deals with the server buffer by having the server tell clients to speed up or slow down a bit until it is happy with the buffer.
Where the ring buffer becomes really important is when you are dealing with lost packets... because otherwise you will shrink the buffer every time you lose a packet if you are just pulling next from a queue.
Then later, you can get creative with missing frames... like if the frame after that arrived, you can recreate the missing frame by interpolating between the two on either side... etc
Yeah I see... Will try and get back to the drawing board, atleast I got a better understanding of my issue 😄 Cheers as always Emo
No problem. You are following the exact path everyone follows for this.
I have a basic conceptual question! 🙂
I have position/animation/rotation multiplayer networking set up; Now, I want to add in melee combat PvP. On who's side should I determine if a player is hit by another player's attack?
For example, say we have two players, Y and Z. If Y attacks Z, who's computer do we detect for the hit on; Do we detect on Z's computer since they are the one who is hit, or do we detect on Y's computer, and send the "You were hit" signal to Z's computer? On who's computer do I register the hit collision?
(This is my first time setting PvP up!)
Are you server or player authority?
You may want to read up on those, because that pretty much will decide how these things play out.
@jade glacier I am still slightly confused which I am using. I network with Photon Engine PUN, and I use a matchmaking system to room players together; Then I use components like the Photon View and PhotoLocationView and my own OnSerialize method to send data. Which type would this be?
Would I be Server managed?
Also, which way is better for PvP?
Actually, I think I am Player Athority, right?
Yeah, I'm Player Athority my mistake 😅
How would I set it up with my Player Athority system? Who registers the attack collision, the attacker, or the person hit?
never trust the client
trusting the client = trusting hackers
If it's casual or not competitive go right ahead and trust the client. Not everyone is making a AAA laddered competitive game. If you expect a lot of success and hackers, go ahead and plan for that... But way too often people get bogged down worrying about hacking, and never even finish a basic online game.
Pun is relay, so it's not conducive on its own for server auth. You need to write server plugins to make it such.
You can play with the extensions I am making for Exit that extends PUN2 to do most of what you are talking about. But it's not ideal for competitive PVP.
https://github.com/emotitron/SNS_PUN2 @nimble eagle
To answer your question, you basically have to decide your authority model.
Whichever connection has authority over a thing, is the final word for that thing. In server authority, the server is the final word for all things.
In PUN2 its mixed authority
So the shooter has authority over say their movement and their weapon. So they would shoot, determine what they hit, and broadcast that. Then whoever they claimed to hit would respond to that by applying that hit to their health... since players would have authority over their own health.
But again... This is describing PVP... which is NOT the ideal gametype for Relay.
@jade glacier Thanks so much! Yeah, I'm going to keep it with Player Athority for now, since the PVP isnt particularly competitive and is more just a fun extra for now; I don't have the time or programming resources to set something like server side up right now and I may not need it a ton 😅
The main mode of my game is PvE, so it will be fine to stick with player Athority for now!
Thanks for the information and help!!
https://docs.google.com/document/d/1moPBIt8cNe-h1uG01pvaOZQvrIjZfSBfDmVa793X6AQ/edit#heading=h.qql6b8eo9tfa However it is demonstrated in the tutorial using that type of mixed authority.
Server authority adds a lot of complexity, as you have to tie in your controller and physics code into your simulation and tick system. If you want to learn how to do advanced networking you can go there, but expect a couple years of learning and constant refactoring if you go that route.
Good to know, thanks! I think the current Athority model should work fine for now, I can always upgrade later if I really need to and have the resources then 🙂
You can't really "upgrade later"
Doing server authority means creating a proper tick based simulation and tying in your controllers and physics
I mean more like "Hard change" later 😅
If you REALLY plan on going there, start there now. Or use like Photon Bolt
good luck 🙂
Thanks! You too!
Server authority adds a lot of complexity, as you have to tie in your controller and physics code into your simulation and tick system. If you want to learn how to do advanced networking you can go there, but expect a couple years of learning and constant refactoring if you go that route.
@jade glacier
Let's say I want to create the simplest form of this, though.
Just 2 spheres knocking each other off of a plane or cube.
How do you switch client authority or incorporate the other players rigidbody.velocity into your own movement?
Give us SOMETHING, even in the simplest form.
I like using Mirror, because it's simple like UNET. How would 2 spherical players knock each other off a board?
I have been trying to figure out the simplest form of networking & physics.
If you go without prediction, you just send inputs to the server, and the server sends resulting states to all
But that makes for nasty input lag
Which is why prediction becomes a thing... And that's where things get messy
I can make a Unity UNET/Mirror game where 2 players push a Cube with a Rigidbody around... but cannot make a game where 2 players push each other around.
A UNET/Mirror game where 2 players push each other around is what I am interested in learning more about...
... I want to understand and build a "Shove Your Enemy Off the Platform" Game. 1vs1
I tried OnCollisionEnter(Collider other){ if(other.collider.tag == "Player"){
if(other.collider.velocity > rigid.velocity){
rigidbody.AddForce(rigid.velocity -other.velocity)
}
}}
ROUGHLY along those lines, my code is way off... but I have tried some things within that scope.
IF OnCollision the other collider.tag is a "Player", add force depending on who's velocity is greater
But I must be barking up the wrong tree... because it works like for the first collision... but doesn't update the "pushed" players position on the Server
Clients & Opposing Forces.
If, however, I make a game where I just add a Cube with a Rigidbody, then both players can kind of compete in pushing the Cube.
But Client vs Client physics.... I don't get it.
I might even be able to Launch a Cube from one player to push the other player, but butting heads from player to player is beyond my understanding.
Most Multiplayer Games either have it where you STOP when you collide with another player or Clipping/Collisions with other players is simply turned off.
But I wanna be like "Move Bitch! Get out the Way!"
How do I accomplish Ludacris Multiplayer Physics?? Lol
using Unity Rigidbody.Velocity
or magnitude
?
I can maybe make it so
if(Player1.rigidbody.velocity > Player2.rigid.velocity)
{
Player2.clientAuthority = false;
}
else{
Player1.clientAuthority = false;
}
then once Movement.velocity > Rigid.velocity grant authority back to the client?
Is there any way to make something like that work?
Imagine 2 sphere's (Players) pushing each other off of a plane or cube.
Common objects like a ball in rocket league is very advanced
I can understand that, but there has to be some sort of tutorial or resources on how to accomplish it...
Rocket League can be narrowed down to Pong or Air-Hockey, but how do you do it in a Networked Mutliplayer game?
There is no one way, but the most solid is deterministic extrapolation
But also very difficult
No Easy Street on this one?
Nope, that is why mirror and other libs don't do it for you
Few people know how to make that kind of states correctly
You can and should try making it an easy way. It will make the correct ways make sense.
http://ytwizard.com/r/ZnM79m
http://ytwizard.com/r/ZnM79m
Unity Networking From Scratch
An Introduction to Unity's UNET System
Here is a more advanced tutorial, based on UNET. I avoid the network transform and manually send movement messages at a desired speed. I've always found the network transform problematic, so here is how I get around it. For this tutorial, I decided to make a basic project f...
Those are good resources for learning Multiplayer Movement in Unity...
... but what about Client vs Client collisions?
at the end of that video he barely discusses rigidbody physics over the network...
It has to be more about locating the correct resources, rather than "Oh, it's really hard. Just give up."
The thing is, it is hard. And most good developers gave up giving advice...:)
Because the advice is hard... Resources:
- start being a good programmer with solid foundations, really (this takes time)
Then there several good starting points, source networking blogs, gaffer on games, gdc talks online on the topic
Nine will be simple and fast to use
None*
This is why most of us give advice very seldom (because most askers want comfortable answers, some magic quick trick that will do the job)
Physics over the network is one of the hardest topics, FYI
In short, you either:
- do a complex state transfer approach with local prediction (including remote objects).
- use deterministic predict rollback
If you ask a more technical and specific question, maybe someone will answer with the details and references as well.
And if you liked unet's API (which was abandoned by unity), you can use mirror (the open source version of it, which is under active development - they have their own discord server though)
How would you generally solve "parenting"? I want to be able to pick up boxes basically, and put them in arms of player. The player can have different avatars, which are currently not synced, but I simply use headheight + rotation for camera. Since these boxes are dynamic otherwise, I'll need to do some changes on them when they swap as well. So I could use a system that runs after interpolation of net transforms to fake parent it to the arms of the characters, and on server I kind of does the same, and ofc removes collision properties. I could simply parent it to the character entity, but it might look ugly that it is kind of static compared to your character transform. Anyone got any ideas on this? I'm using ECS NetCode ;3 so trying to work within their framework as much as possible.
hmm, this is tricky
I mean:
- if it's just for visuals of the object being carried, I'd make them a child of the local arms;
- but yeah, if you want to resolve collisions (of the carried box with other stuff), you want these to be coherent with the visuals
So you can use the "fixed" offset approach, or actually make the server "aware" of the individual avatar hand offsets, etc
This is one of the elephants in the room TBH: you need Animation data + tooling to be tightly integrated to whatever netcode you do...
And the current state of animation on Unity is not looking super good.
In summary, the final solution would be:
- integrate your animation/avatars to the client/server netcode, so you will have local parenting predict close enough
As long as the avatar position/rotation/animation time and state are part of the synced state, carrying the box would be done view networked "events", so you do not even have to sync the box position (of course)
For the system I am making for pun I do it with indexed mount components and a state sync that deals with things like re parenting. @stray scroll
Is the Dots Netcode something more special or what should I be googling to find tutorials?
I have found it very hard to find anything I can work with properly.
Anyone got an idea?
https://docs.google.com/document/d/1moPBIt8cNe-h1uG01pvaOZQvrIjZfSBfDmVa793X6AQ/edit#bookmark=id.dl94f8mg2ppw This doesn't show how specifically, but it shows the components I ended up creating a bit. Basically though if the state enum has the "mounted" flag as true, then the object sets its parent to the object ID and the mount ID that is synced, and the RB.kinematic and such are changed to make it stay put, and the transform stops transfering its state. @stray scroll
@gleaming prawn morning
Morning...
So your system also takes care of switching the "mounting" state of these objects between state-transfer vs being-carried-don't worry
yeah, and it has interfaces that coordinate all of that with the syncTransform
like it automatically injects a teleport and notifies the transform sync of the reparent
I debated whether parenting belonged as part of the syncTransform but it ended up being so tied to the state of the object (state being mounted, resting, spawned, visible, thrown etc) that it ended up there
Its sort of what I am hoping one day PUN2 will have a built in server plugin for - where the relay own objects and maintain that state.
Hmm, I currently have the state on both character and object. But I currently don't have some ID to the hand in any way, so I might have to start to actually add the avatars to the server and client as a start.
The mount mainly is just there to create a very small index value
@fresh frost What do you mean by "more special"? It's preview, not many people are using it. There is a the repo https://github.com/Unity-Technologies/multiplayer, with their docs https://docs.unity3d.com/Packages/com.unity.netcode@0.1/manual/index.html with a "getting started" section. It's far from production ready so would only use it if you're really not aiming to release in some time and can't find a better solution x)
like if you have only 4 mounts, you can network which mount with just 2 bits
i cant understand !islocalplayer Can someone Help me???
@jaws with special I meant some different form to programm it, and thanks alot I will look into this
can someone help me about !islocalplayer???
@fresh frost It's based on their DOTS framework, so you'll be using entities. So there are certain systemgroups (client,server,prediction), and attributes to put on your systems and components, and certain patterns to use.
Please
@runic rose ask a technical question
Netcode as far as I can tell is a pretty boilerplate server authority with state transfer model. It just is working with some of the benefits of ECS memory alignment to automate some of the tasks.
what you mean
@runic rose I think in UNET it is that the behaviour is attached to a gameObject which is owned by the current client running the application.
Ask the question you want to ask
i already asked
Instead of asking if someone can help you
isLocalPlayer in UNET?
We do help, by answering technical programming questions
@stray scroll okay thanks alot
UNET/Mirror require players to have an "avatar", and all Commands have to come from that.
can someone help me about !islocalplayer???
Yes, just ask the question...:)
LocalPlayer is the netid that is designated as that object
For Unet/Mirror questions you should hit up the Mirror discord... everyone in there uses it so you will get a lot more answers about how things work in those systems than you will here.
Few people in here actually use either, but many of us have enough experience with them to give basic advice on it is all.
AND... as with all networking. Do the tutorials first.. then ask your questions.
Hey 👋
I'm really struggling with getting networking in my head, can I get a quick yes/no if my approach makes sense 😅 :
game instance on my android running as a host (with mirror), second game instance as html5 on itch running as a client
essentially only the host needs the app installed
Not sure what the question is in there? @wet portal
You are building out unity as a web player and want to know if Mirror works for that? I would assume that depends on which transport, but that is something you should ask them in their channel - they will know the transport options better.
sorry explained it badly. Say I make a game, install it on my android. Then I build it for web and host it somewhere where people host stuff. Will networking work between those game instances?
I imagine the answer is general but for extra info I was gonna go with mirror
it just sounds like no question cause the question is so basic I think 😁
perfect, thanks @jade glacier 🙂 Just needed a confirmation cause I'm never sure with networking
Are you in their discord?
its going to depend on the transport if it can work with web players
Hey, i need help with Photon Unity.
I'm making a 2d game, with multiple cameras, but i dont know how to make camera follow for Photon. (1player / 1 camera)
@frank edge You should check for ownership in character,
If the character is the owner, then you find the camera.main in character and make it follow the character
Just like you'd do player control with owned character
@jade glacier Plugin based player has not been a thing for a while now, just to be clear. Web techs are now used.
@wet portal Mirror ships with websockets (among others) and there are few ".io games" using it.
Not sure what that is in reference to @spring crane
You are building out unity as a web player
Plugin based solution was called "Unity Web Player". Some people still think that Unity web support == plugin player.
Ah
Was just referring to any browser based build - no clue the mechanisms they use for that now.
Yea Unity screwed up by calling it that 😄
HTML5 I would just expect they have their own wrapper now
That wrapper whatever it is being the player in this context.
Yea currently runs on WebGL and Web Assembly
Good to know
Hi there. I read that UNet is deprecated and won't be supported in future anymore. I read through the Deprecation FAQ, but there was nothing written about any current alternatives to UNet.
I would like to start creating a multiplayer game but I'm not sure if it's even worth starting it right now. The new dedicated-server multiplayer feature by Unity is apparently still in work, so the only offical option is using UNet.
Should I start the project using UNet or are there any good current alternatives to it?
https://support.unity3d.com/hc/en-us/articles/360001252086-UNet-Deprecation-FAQ
Please ping me when replying. 🙂
Mirror?
oooh
nice, thanks!
will this allow to, sort of, "upgrade" to the new multiplayer feature of Unity as soon as it has been released?
okay :/
aight, thanks, I'll have a look at it
Nope. Any of the heavily tied to Monobehaviour libraries are going to make the jump to ECS.
hello, im using photon and i was wondering why its telling me errors about client being on name server and ready
@rich flame : If you run into errors, it makes sense to try to read them carefully. Anything inexplicable can be copy and pasted from the console, so we get the exact error.
Else we have to guess what's up in the first place...
The PUN Basics Tutorial might help you make the first steps:
https://doc.photonengine.com/en-us/pun/v2/demos-and-tutorials/pun-basics-tutorial
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!
oh ok ill paste the error
i guess i cant copy paste so ill just grab a screenshot, this is the unity window, it still works just the errors annoy me
You can copy and paste the full error
From the bottom tab you have the full text
A screenshot is not a lot of help... The full error will show the stack trace
BUT, the error is clear:
- you are trying to call Join room before you joined the lobby...
- the sequence is: connect (name server, authentication, etc) -> connect-to-master-server -> [optional] join lobby (list rooms, also on master server) -> create/join rooms
Please review your code, probably you missed a couple of steps from a tutorial.
oh ok i didnt realise i could copy from there
do you want a pastebin for both the scripts
so heres the error JoinRandomRoom failed. Client is on NameServer (must be Master Server for matchmaking) and ready. Wait for callback: OnJoinedLobby or OnConnectedToMaster.
UnityEngine.Debug:LogError(Object)
Photon.Pun.PhotonNetwork:JoinRandomRoom(Hashtable, Byte, MatchmakingMode, TypedLobby, String, String[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:1588)
Photon.Pun.PhotonNetwork:JoinRandomRoom() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:1522)
Lobby:Update() (at Assets/Lobby.cs:51)
heres a link for the lobby script
can joinRandomRoom be used with connectUsingSettings?
You can start with the prototyping components, and just modify those later if you just want to get going.
These guys.
Ok so i have just started using Photon as is seemed to fit my needs. The photon server is pc hosted and I want the game to be hosted by players (like minecraft and games alike) Is there a way that i can change the ip that I am joining using code? like, Input ip 127.0.0.1 and connect?
Just Photon Server you are using? Not PUN2 or Bolt or any higher API?
So you installed PhotonServer and you are trying to run PUN2 with your own Server instance?
yes the photon server jdk
its all setup
I just want to know if theres a way to change Server
Not sure how PUN2 interacts with that, that might be more a @stiff ridge question
@stiff ridge Ok so i have just started using Photon as is seemed to fit my needs. The photon server is pc hosted and I want the game to be hosted by players (like minecraft and games alike) Is there a way that i can change the ip that I am joining using code? like, Input ip 127.0.0.1 and connect?
How do i set Server
With the server field?
by setting it?
using code
I'm sure, don't know off the top of my head though.
You could just see where that field connects to since Tobi isn't around. I'm sure it's in the docs somewhere but I usually just trace the code from settings to see where things lead.
can you send a link to the docs?
I just google the things I am looking for. I don't actually ever open the API reference or other docs directly.
sorry i was in the shower but thanks @jade glacier ill try that, might also just check the tutorials but ty
@jade glacier so I found something called connecttomaster which allows me to put in peramiters
Sounds right
The setup for self hosted servers is explained in "Configuration For Self Hosted Photon":
https://doc.photonengine.com/en-us/pun/v2/getting-started/initial-setup
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!
what does this error mean
JoinRandomRoom failed. Client is on MasterServer (must be Master Server for matchmaking) but not ready for operations (State: Authenticating). Wait for callback: OnJoinedLobby or OnConnectedToMaster.
i just want the player to connect to a server
Kind of what it says, you are trying to JoinRandomRoom but you aren't first connected to the master.
Are you using these components? If not use those, or borrow the code in them as the start of your own. You can also extend the OnJoinedInstantiate component and override its behaviors rather than making your own from scratch.
@rain surge
this is my script
using Photon.Pun;
using UnityEngine;
public class LobbyController : MonoBehaviourPunCallbacks
{
public int SceneIndex;
public override void OnEnable()
{
PhotonNetwork.AddCallbackTarget(this);
}
public override void OnDisable()
{
PhotonNetwork.RemoveCallbackTarget(this);
}
public override void OnJoinedRoom()
{
StartGame();
}
void StartGame()
{
if (PhotonNetwork.IsMasterClient)
{
Debug.Log("Starting Game");
PhotonNetwork.LoadLevel(SceneIndex);
}
}
}
sorry for late response
this should just load the scene right?
You aren't first connecting to the main server though
I would again, start with the boilerplate prototyping code and modify that.
ConnectAndJoinRandom has the startup code pretty stripped down so you can see the steps. You won't guess this stuff really, you have to follow the tutorials or use the templates.
{
Debug.Log("Region: " + PhotonNetwork.CloudRegion);
}```
Did you intend to call like ``PhotonNetwork.JoinRandomRoom();`` in there?
You connect to master, but you don't tell it to do anything in response to that.
I am making the simple connection to my PC hosted server ```
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
public class NetworkController : MonoBehaviourPunCallbacks
{
//Variables
public string IpAddress = "127.0.0.1";
// Start is called before the first frame update
void Start()
{
PhotonNetwork.ConnectToMaster(IpAddress, 5055, null);
}
public override void OnConnected()
{
Debug.Log("connected to server!" + PhotonNetwork.CountOfPlayers);
}
// Update is called once per frame
void Update()
{
}
}
but for somereason the OnConnectedtoMaster is not working
OnConnected is supposed to be OnConnectedToMaster I was just testing
Nvm I got it fixed. it was just I messed the ip things up
is there a easy solution for adding multiplayer in an existing unity project, which has been going on for a while?
or does it more like require designing it for multiplayer from the ground up
The typical answer is you do not want to add networking after the fact, especially if you have never done networking. Networking is all about producing a tick based simulation that is conducive to being reduced to inputs/states.
If the game is insanely simple you can probably tackle it. But I would make a basic networked game before even trying something real regardless.
ty
You could probably sync the most complicated stuff with RTS networking though right?
running in the past i mean and with deterministic sync (only tranfering inputs over network)
.
If you don't use physics and switch to integer math,
and if you are okay with input latency over network,
and also if players don't join an already started game,
i believe it could be very possible to convert an already made game into multiplayer
Anyone recommends using either Photon PUN or something else for networking to make quick prototypes and test stuff?
I've been running into issues on how to manage the movement and network things with photon doing it from scratch or maybe some assets I could get to prototype with and such?
you are welcome to play with the PUN2 beta stuff that I am working on that does a lot of it for you.
https://docs.google.com/document/d/1moPBIt8cNe-h1uG01pvaOZQvrIjZfSBfDmVa793X6AQ/edit#heading=h.qql6b8eo9tfa The tutorial can get you a sense of what it is.
@jade glacier I bought a character movement from asset store but turns out it isnt made for PUN 2 there are some other ones but not sure if I should get it, just not sure if I can even manage the PUN stuff tbh
Depending on how badly it cooperates with FixedUpdate, it should actually be workable.
Idk if its allowed to mention asset stuff names here and such mind if I DM you the name of it ?
The tutorial somewhat covers how you would convert it to a player object, and you tell a component which controllers should only be active on the owner.
you can of course
KCC sent me a code so I could test his asset with it, but I haven't gotten to it yet.
(Kinematic Character Controller)
Unity takes 30% of asset store sales, so they have NO problem with people talking about assets here 🙂
Ah, alright
But the scripts are pretty complex and I wanted to whip something quick together to present as prototype and showcase 2 player working, I got a basic movement working and Cinemachine camera but it doesnt work like I want it to tbh
I saw there is also this: https://assetstore.unity.com/packages/templates/systems/pun-multiplayer-add-on-for-opsive-character-controllers-148555 but not sure if I should get it or what to do tbh
I've seen that one before, one of my users was using that. It has some pretty heavy use of more advanced animator features, but I think he was able to get it working with the syncAnimator
I don't know anything about that second asset, so can't comment on the quality of that code or how interoperable it is with other things.
Can you tell me more about the SNS thing?
Just that its an extension library for PUN2. I would pretty much just be cutting and pasting text from the Overview in the documentation.
The Opsive stuff does a lot of similar stuff, so I wouldn't try to mix the two.
@jade glacier I am and my group planning to make a multiplayer fps, do you recommend going PUN route or even using the SNS since its in beta or it doesnt affect like releasing the game on steam or such
Sorry if the questions are dumb, pretty new to all of this
If its a competitive FPS, I would recommend Bolt typically. Is this a project with funding, or just for your own fun?
Doing server auth yourself without any networking experience can turn into 2 years of learning.
If its a competitive FPS, I would recommend Bolt typically. Is this a project with funding, or just for your own fun?
Currently it is just us working on it as a project for uni, and out of pocket to release (required to release to pass)
Doing server auth yourself without any networking experience can turn into 2 years of learning.
ouch
Would you recommend for beginner like me and my group to maybe go single player/split screen route then 😅
If you are new to networking, I would not try to make a real game until you have made a few fake tutorial-like games.
If you are new to networking, I would not try to make a real game until you have made a few fake tutorial-like games.
Sorry, didnt understand
Learn to network first, then start work on your game.
Don't try to learn to make a multiplayer game with a project you intend to finish. It will take 20X longer than you think, and you will hate the game by the end after you have refactored and restarted 20 times.
So we should maybe divert into singleplayer/split screen game rather than network (and while with that in the background myself learn networking stuff)
Until you know the vocabulary of networking you are going to make all the same mistakes everyone makes when starting.
I can't answer that. I am just saying that you will not just "network your game" nearly as fast as you think.
especially if you are learning the whole paradigm of online multiplayer and the architectures needed to make it work.
Hmhm, I mean I havent slept and been trying to make a simple move 2 players work for the past 1 and half days and it still has a million bugs
And we are also required to "release" the game to pass 😅
yeah, everyone can get two players moving in about 20 minutes.... its easy to get started and feel like you are making progress
yeah, everyone can get two players moving in about 20 minutes.... its easy to get started and feel like you are making progress
Thing is I am struggling with that already so I guess thats why I am trying to latch to asset store stuff and make something work but maybe I should drop it
the issue is when the race conditions start to pile up, and you see what latency/loss/out of order packets do to your whole system... you get buried in the details of why the quick and easy ways don't cut it.
You can try the CC asset and see how their built in networking translates into a working game.
I have no idea what kind of networking they have going on behind the scenes, so I can't comment on if it will turn into a race condition hellscape, or if its solid.
Hmm I see
I would start by doing tutorials for a handful of the libraries.
Bolt, Mirror, PUN2, SNS, Forge and whatever else you find.
Thing is we are required to make a game and push it and make profit (even if its low amount) within 20 weeks 😅
I think promising multiplayer was a mistake
yeah, multiplayer in 20 weeks is not something even as a dedicated MP dev I would want to be promising, unless that game is super simplistic.
It took me 2 years to get solid with creating a good state transfer interpolated system, and a lot of restarts and refactors. For that kind of timeline you will want to pay for a full stack like Quantum or Bolt. Or go let them know that a MP game in that timeframe is not recommended.
MP games have a whole other layer of complexity on the marketing side... since you aren't selling content - you need players to populate your servers, so players are the content.
I wouldn't even talk to anyone about networking until you have some small working MP games you built on a couple of the libraries.
You need to start to learn the vocabulary before you can even ask the right questions.
I see, thing is they put me in charge for MP in this project game and I am worried if I come forward letting everyone down it will mean everyone getting an F or something because we had to pitch what we will be making and so forth
You need to start to learn the vocabulary before you can even ask the right questions.
Hmhm, sorry if I am asking dumb ass questions
better to correct their expectations as soon as possible.
What the hell company are you working for that would even float a profitable MP game in 20 weeks as being a thing?
It isnt a company per say, its a "gamelab" project where we are a company and we got 20 weeks to make something and release it and profit, we put multiplayer on it since we thought it will be good selling point but that is going to bite us in the ass I see.
Since you can get a green light on your own custom idea or you get a pre defined serious game concept to make (which are all shit) 😅
better to correct their expectations as soon as possible.
@jade glacier We do have a coaching session tomorrow morning and I will be brining the news to drop MP all together but idk if that means they will fail us or how it is going to tbh
We were told to scope down on our concept but idk if dropping MP is considered scoping down and if we drop MP we also need to edit the concept since it was a pvp shooter, not sure how they will take that tbh let alone me telling my group not possible
I wouldn't go into MP for profit without REALLY knowing the landscape.
Yeah from everything you told me so far, I am 100% dropping MP
I don't even know that landscape. Its a whole different sales proposition, and has a whole different cost structure.
I would play with networking if it interests you. But I would avoid commitments surrounding it until you have some experience on your own.
I dont really know how the "real" world of game dev works but the coaches are acting as "investors" so idk if it is alright of us to go them and say we changing our whole concept we got approved on (not fully, still keeping some elements we had from previous one) but also dropping MP, not sure if a real investor would say wtf and kick you out 😅 since if they say that i dont have the expereince to say "no" and counter argue or such
I would play with networking if it interests you. But I would avoid commitments surrounding it until you have some experience on your own.
@jade glacier Yeah that is what im planning to do after everything you've told me ^^
Good. Don't let me discourage you from getting into net dev. It's fun, interesting and challenging. Just not something I would want to be learning under the gun.
Good. Don't let me discourage you from getting into net dev. It's fun, interesting and challenging. Just not something I would want to be learning under the gun.
@jade glacier Oh nono, sorry I didnt mean it like that, I am super interested and will be taking it in the backend while working on this project just not actually develop it for something to release in 20 weeks
okay so i'm missing something- are RPCs and RaiseEvent intended to essentially call a function across all clients?
Raise event sends a message to others through the relay
RPCs use raise event to send messages that simulates a remote function call.
hey is anyone online now? I have some networking problems
Im having an error with Photon Pun2 RPC Function:
Illegal view ID:0 method: RPC_AddCharacter GO:PlayerCharacter(Clone)
PhotonView with ID 0 has no (non-static) method "RPC_AddCharacter" marked with the PunRPC or @PunRPC(JS) property! Args: Int32
@ashen canopy : In doubt, just ask. If nobody replies, you can update us on any progress.
@stable epoch : That looks as if you try to call the view.RPC() on an object that's not network instantiated?
Use PhotonNetwork.Instantiate() or load the object with the photonView with the scene.
Either will set a viewID for it that's non-0.
That looks as if you try to call the view.RPC() on an object that's not network instantiated?
@stiff ridge
How do i network instantiate something?
It's better I send you to a tutorial than trying to squeeze the info in a few messages:
https://doc.photonengine.com/en-us/pun/current/demos-and-tutorials/pun-basics-tutorial/intro
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!
PhotonNetwork.Instantiate does it.
I am pretty sure Google has
well it is a little confused
what is this error? Assets\FPSPhoton\Scripts\NetworkController.cs(3,14): error CS0234: The type or namespace name 'Pun' does not exist in the namespace 'Photon' (are you missing an assembly reference?)
im new to photon
FPSPhoton isn't Photon. Did you buy some 3rd party asset/
No I just made that file
do i need to move it to assets?
it was working fine the other day
No idea. Does it not show errors in VS of not being able to find PUN?
nope
I can send the code of the C#
but i tried making a new C# file and It sill wasn't able to be added to an object
using UnityEngine;
using UnityEngine.UI;
using Photon.Pun;
using System.IO;
public class NetworkController : MonoBehaviourPunCallbacks
{
//Variables
public string IpAddress;
public string Name;
public string NoName = "";
public GameObject EnterIP;
public GameObject EnterName;
public GameObject StartMenu;
void Start()
{
}
//check if Ip entered is valid
public void JoinPressed()
{
IpAddress = EnterIP.GetComponent<Text>().text;
Name = EnterName.GetComponent<Text>().text;
if (!string.IsNullOrEmpty(EnterName.GetComponent<Text>().text))
{
Connection();
RPC_CreatePlayer();
}
}
//join the local game
public void JoinLocal()
{
IpAddress = "127.0.0.1";
Name = EnterName.GetComponent<Text>().text;
if (!string.IsNullOrEmpty(EnterName.GetComponent<Text>().text))
{
Connection();
RPC_CreatePlayer();
}
}
//Connection
public override void OnConnectedToMaster()
{
Debug.Log("connected to server! " + IpAddress + " | " + PhotonNetwork.CountOfPlayers + " players " + "| Name = " + Name);
StartMenu.SetActive(false);
PhotonNetwork.AutomaticallySyncScene = true;
}
//addplayer
private void RPC_CreatePlayer()
{
float randomValue = Random.Range(0f, 10f);
PhotonNetwork.Instantiate(Path.Combine("Prefabs", "PhotonCube"), Vector3.up * randomValue, Quaternion.identity, 0);
}
private void Connection()
{
PhotonNetwork.ConnectToMaster(IpAddress, 5055, null);
PhotonNetwork.LoadLevel(0);
}
void Update()
{
}
}
iv made most the code from scratch
None of that code gets red underlines in VS?
Restart everything maybe. If VS is happy with it and Unity isn't might need to toss your library folder and such.
Restarted Unity?
Nope i will do that now
Ill check if maybe the scenes are causing it too
name error is there
theres lots of errors
Assets\Photon\PhotonRealtime\Code\LoadBalancingClient.cs(3435,77): error CS0535: 'ConnectionCallbacksContainer' does not implement interface member 'IConnectionCallbacks.CreatePlayer()'```
Assets\Photon\PhotonRealtime\Code\SupportLogger.cs(45,46): error CS0535: 'SupportLogger' does not implement interface member 'IConnectionCallbacks.CreatePlayer()'```
Assets\FPSPhoton\Scripts\NetworkController.cs(3,14): error CS0234: The type or namespace name 'Pun' does not exist in the namespace 'Photon' (are you missing an assembly reference?)```
Any idea now?
If you start with a fresh install and the latest PUN2 do you have any errors like that?
I think I will try this when i get back home today
for now I think i will take a break
deal with it later
Go back to a git state when you didn't have these problems
what is a git state
Are you using git?
or any of those
No ive never made backup of the project
noob move ik
It was working before i went to bed last night
comment out all of your code and see if PUN2 by itself is giving any errors
And slowly readd your code.
there was one error before i went to sleep last night and all it was is i put a prefab in a wrong folder
yeah im going to get off and deal with this later
I have to go
Hmm, this is most likely just a NetCode thing, but their code currently on send buffers X amount of previous input commands. Currently my input is setup so I send e.g. if I trigger a button press, which is not the same as holding down the button. So currently only one trigger/command. Soo.. if the framerate is trash, like it is in the editor, so the client doesn't have framerate enough to produce input for all serverTicks, it will copy the closest older tick when generating send buffer. So.. this causes in editor for me when I click once, to click 3 times. So any ideas if I'm thinking about this in the wrong way? Would rather not go in and change their code.
I know I could A
- Fill up the empty input spots on my own until the tick I'm generating input for, to make sure no trigger input is added there.
Or B - Add generated tick to the input data, which I can check vs on server side to disable "trigger input".
For Photon if i make a master server and dont add any rooms does that mean the master server is one big room and i dont have to do and room things?
Master server is just there for matchmaking pretty much.
I don't know it all that well, but I would expect there to be things you can do while connected to the MasterServer to indicate what kind of room you want to join. But out of my wheelhouse. I would need to read the docs and do the tutorials.
You are hosting your own server you mean?
yes
Even with that, the master server is probably different from rooms.
Rooms are the actual game.
Master server is there to find players to put into the game instances.
ok
Using JUST server and not PUN2 though I have no idea what the usually architecture is, if any.
Connecting to the Master you don't have any awareness of other players and such... its just you and the master working out which room to put you into.
So you aren't going to be doing any "game" stuff there.
what does this mean? JoinOrCreateRoom failed. Client is on MasterServer (must be Master Server for matchmaking)but not ready for operations (State: ConnectingToGameserver). Wait for callback: OnJoinedLobby or OnConnectedToMaster.
Where are people getting their sample code lately? This keeps coming up.
oh i can send the vid im watching
Would you like to donate? Visit my PayPal.me @ http://firstgeargames.com/donate/
but yeah do you know how i can fix it
public void CreateRoom()
{
if (!PhotonNetwork.IsConnected)
return;
//Join or create room
RoomOptions Options = new RoomOptions();
Options.MaxPlayers = 10;
PhotonNetwork.JoinOrCreateRoom(_roomName, Options, TypedLobby.Default);
}
//room callbacks
public override void OnCreatedRoom()
{
Debug.Log("room created");
}
public override void OnCreateRoomFailed(short returnCode, string message)
{
Debug.Log("failed to create room?");
}
public override void OnJoinedRoom()
{
Debug.Log("joined room!");
}
public override void OnJoinRandomFailed(short returnCode, string message)
{
Debug.Log("Join room Failed! " + message);
}```
Where are you calling created room though?
That should be inside a connected to master callback
it should be inside? of onconnectedtomaster?
How does join or create room work anyways
It has to happen somewhere after you connect to master
Just use the prototyping components
I wish there was a photon series for my need
because i have to piece all the code together and most of the time it doesn't work
I would start with the prototyping components, and expand on those
ok
wait
so i dont know if this works
but what im trying to do is make it so i can join differant ips that other people are running
so ive made a input ip field and all that
That sounds not pun at all
Pun is relay, players don't host. One player in each room will be designated as master client, but they are not a server, and players don't connect to one another
is there a way that i could do this tho
if not its fine with me but
im just messing around
I need to know if theres a way to make servers like minecraft has done them
player hosted and all
Just use some networking solution built for that sort of setup
do you know any ive been looking around and couldn't find so i tried photon
If you want players to act as actual servers you need something other than pun.
Mirror, MLAPI, Forge Networking, some other Photon products, DarkRift... 😄
Pun avoids having to deal with punchthrough and host migration by doing away with both. Which has benefits and shortcomings
Most networking solutions are classic dedicated server setups
ok thanks i will check out all of these
is there a recommended one out of all of them though?
Any option that allows a client to host usually has some punchthrough scheme available for free if you host or for charge of not.
yeah minecraft has that problem but idc
the games for me and my friends at the moment
and there's no point making huge dedicated servers at the moment
Mirror has very active community and API is very similar to UNet
Noble whale sells a nat punch asset for it.
I think im going to try mirror seems pretty cool and not to complicated as it is based of of unet
It's just a messaging layer, like pun is. So you'll have to do a fair amount of work yourself. Be sure to join their discord.
It's no longer tied to UNet in any way, just inherits similar API
They are trying to keep close to drop in replacement for projects that used HLAPI Community Edition, which was then dropped in favor of making something completely new
They have long departed from drop-in replacement. I've had to support them with my asset for a couple years, and there have been a lot of breaking changes from UNET
is hlapi any good too
because it seems interesting
the movment is perfectly synced
is it viable to use for a fps
?
They are messaging layers. So you are on your own for proper syncing.
and anything special about forge networking
I sell assets for syncing transforms and animators because the networking libs are pretty bad at that with their sample components.
Forge is a slightly different wrapper, but it's still a messaging layer with meet object identification.
Bolt is your only full stack option for fps.
photon bolt?
but then i run into the same problem of no player hosting
so i guess i have to make do with the other options
For anyone bored and stuck inside wanting to learn some networking I have a great series online 😄 https://www.youtube.com/playlist?list=PL-Cz1YO2-mXHMPQayscAYeR4AdwfC29TQ
@robust otter If HLAPI were any good, they wouldn't have created Community Edition of it and then given up on it 😛
@jade glacier That might be, but that was more in a way that tutorials are very interchangeable
I imagine some of the breaking changes are covered by their updater though.
@weak plinth can you use nodejs on mobile devices or for LAN gaming in general considering no player has nodejs preinstalled?
Only the server is node js, so in a lan setting you would need a server that could run node or use your dedicated server. In terms of this technique is only doesnt really work with the WebGL
WebGL or when you are LAN gaming with none of the devices have nodejs installed. I know about the dedicated server setup. Basically if you are targeting a game which is multiplayer connecting to a dedicated server/player machine with nodejs, node js is your way to go.
Your clients wont need node js though so you should be okay
Yup. This is why I had to go for pure C# way to implement networking for a mobile game setup.
For testing I used a machine with nodejs installed but later on I had to reimplement things with C#.
It was a local game setup over wifi
Yeah this is trying to replicate what you would see in a AAA environment for a game where you just connect, find a match/room and go. Mobile sample is something like Clash Royale where all the clients connect via mobile devices to a hosted node js server on like AWS for example.
Hey guys, how can i make different spriterenderer colors/different players in unity photon pun?
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
public class Player_Color : MonoBehaviourPunCallbacks
{
public static int number_of_players;
public float number_of_p;
private SpriteRenderer sprite_render;
public Color Blue;
public Color Red;
public Color Green;
public Color Pink;
public Color Light_Blue;
public Color Light_Red;
public Color Light_Green;
public Color Light_Pink;
private void Start()
{
sprite_render = gameObject.GetComponent<SpriteRenderer>();
number_of_players = PhotonNetwork.CountOfPlayers;
if (number_of_players == 1)
sprite_render.color = Blue;
if (number_of_players == 2)
sprite_render.color = Red;
if (number_of_players == 3)
sprite_render.color = Green;
}
private void Update()
{
number_of_p = number_of_players;
}
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.IsWriting)
{
stream.SendNext(sprite_render.color);
}
else
{
sprite_render.color = (Color)stream.ReceiveNext();
}
}
}
i made this code, but it doesnt works
You want us to fix it for you? @gloomy meteor
Basically to fix it for you
place a transform view and etc to your gun too @gloomy meteor
In the inspector as component
(PS: I dunno the whole case)
oh i get it now
hey i still need help
anyone who can help me?
the rpc isnt being called i guess?
rpc is working but i can still not see other's weapon
Seems like the issue is game logic related since the RPC obviously works.
yea i guess so
the gun is being equipped locally so i guess the equip method is just fine
but it is not being shown to others
You dont need to pm about the issue, its better to let others know about it here so others can benefit from similar problems.
sorry
And if you want others to look at your code you need to paste the whole code.
ok lemme do that real quick
Its okay, just letting you know how it works around here 🙂
Do remote clients have access to the prefabs (or just gameobjects) like the local client has?
they have access to the the whole player character including the guns(prefabs)
both players can equip the gun locally
they can shoot each other as well
and even bullet holes can be seen just not the guns
you checked my code?
The PunRPC method looks fine, if you are able to see other bullet holes (i assume this are PunRPC too) then the issue is within the specific eguip method.
yea dude i am kind of stucked here
but i guess even the equip is working fine when i am able to equip the gun locally
What does this line do: t_newEquipment.GetComponent<Sway>().ismine = photonView.IsMine;?
oh thats for the weapon sway
That doesn't say me anything
its for only showing sway if the user is using the gun
you want me to remove that and try again?
Nah, try to change the gun prefab with something else and see if that works
ok
bro
if i have set local position to set the correct position of the gun does that mean that only i can see the gun at that position?
So I need to instantiate a prefab as the child of the object that is calling the instantiate using mirror
how do i do this
I have made the instantiate work but it does not spawn as child
Um, im new, i want to make a lan/online server game like minecraft or terraria. Do i need to know socket programming for that?
no
at the moment im learning mirror
its a replacement for unet
which is now depricated
@weak plinth I recemend Photon https://www.photonengine.com/en-us/Photon
or mirror https://assetstore.unity.com/packages/tools/network/mirror-129321
as for mirror here is a good series to follow: https://www.youtube.com/watch?v=zSTubohQcvE&list=PLkx8oFug638oBYF5EOwsSS-gOVBXj1dkP&index=1
If you are completely new learn to make singleplayer games first so you can know the basics of c# and unity.
Global cross platform multiplayer game backend as a service (SaaS, Cloud) for synchronous and asynchronous games and applications. SDKs are available for android, iOS, .NET., Mac OS, Unity 3D, Windows, Unreal Engine, HTML5 and others.
Mirror is a high level Networking API for Unity, built on top of the low level Telepathy library.
( Forum )
( Discord ) ( Docs ) ( Sponsors )
Mirror is built and tested for MMO Scale Networking by the developers of uMMORPG , uSurvival and Cubica .
Mirror...
Would you like to donate? Visit my PayPal.me @ http://firstgeargames.com/donate/
Mirror Discord: https://discord.gg/N9QVxbM
Mirror Documentation: https://mirror-networking.com/docs/
Mirror Git: https://github.com/vis2k/Mirror
if you want to spend money for servers and stuff use Photon
if you want to host the servers use mirror
both good
I heard that MLAPI is a much more better alternative than the Mirror
Is there a reason?
@buoyant stag why is it better I need to know because i just started using mirror and if I should switch over
@robust otter https://mlapi.network/blog/2019/03/13/the-current-state-of-unity-networking-a-critique-of-mirror/
This is a post to all game developers currently seeking a network library, or if you are currently using one of the high level libraries. I will be giving some critique to the popular networking library UNET and primarily its largest fork Mirror.
Thanks will check out
Thank you
Just one remark: using mirror or mlapi, or any "free" solution you will also spend money on servers (you need to host them somewhere, unless you are just doing a LAN game). And these are not exactly cheap... Specially when a single machine can barely run a poorly designed server...
why not cheap? I've hosted 40 players on https://www.hetzner.com/cloud with the 2 vCPU option, but it was with the old bolt 0.4.3.1 i think and its understatement to say its better coded then mirror one or mlapi, etc..
also i think the main feature of bolt is more productivity then performance, you can setup a game in a weekend in bolt but it will take you 2weeks - 1month with most other networks to create the same experience
not even mentioning a real game
I'm not advertising bolt in itself... It also requires you to host the servers...
I'm saying the person said in photon you pay for servers, as if you would not pay in other solutions. You always pay.
And 40 players in one machine? A single self hosted photon server can host thousands of players, so it really depends on how efficient you can make your server logic.
I just question that common belief that paid solutions are expensive... Many times they are cheaper than you think.
@buoyant stag That post recently became 1 year old. While some of the stull still holds true, a lot of the sillier performance things have been addressed afaik
My primary problem with MLAPI is that while it seems better and more mature in practically every way, it lacks the community support and thus I'm always wondering if I'm the first person to do something with it in production.
Sort of "known bad" situation
@spring crane I'm not sure that the Mirror changed it's paradigm :c
Even if it works better than before, I think that stuck with tool which have a strange direction is a bad idea.
Sort of "known bad" situation
@spring crane I understand.
Did you contact with developer?
Contact who?
@spring crane with TwoTen
I think he'll be able to help you
I didn't work with MLAPI yet, but I have my own tool and I helping people who contact with me by email
I think most developers do it also
I'm trying to avoid the situation where I have to talk with TwoTen or Vis2k. I know games (more importantly, browser games) that have successfully launched with Mirror. I don't know any that have launched with MLAPI.
Even more games were launched with UNET 🙂
Yes
Anyway we need a new wonderful common solution from unity
Netcode come to us and be wonderful pls!
I heard they were doing something along with DOTS
looks like there is something new cooking, networks are blooming out this year for some reason
doesn't look bad at all, also neat replay system
@weak plinth what is game?
I am trying to implement rocket league style networking (rollback-resim clientside prediction on all objects with full server authority)
(game is not related to rocket league)
I also want to have voxels on top it
I thought i should exclude the voxel system from this rollback/resim system
It will not regularly sync states, only inputs to this system will be sent out by server
Make it into a different system that runs in the past on clients and never rolls back
(All colliders are static in this system)
You think it's a good idea?
How would I go about doing multiplayer when a user clicks "play", without having them type in the port/server they want to connect to?
Sorry if this question is worded weird, I'm fairly new to this aspect of Unity.
Do you mean a quick join feature?
Honestly myself im only a novice
but i remember like the default unity server join thingy had somethign like that
ill do some research
Thank you
np mna
It's very difficult to find people in this community willing to help.
sorry for my lack of knowledge lol
I've asked a few people here, and I've been either straight out ignored or neglected.
unet matchmaking servers might not be up since unet is deprecated
It's not matchmaking
When you click "play" button on my website, it will launch the downloaded file
and you'll be in the game
If you want a single dedicated server for now, i guess you could hardcode it's ip/port
Just another unity instance? @slender bear
It's going to host the game
But you should probably do the headless build that excludes graphics stuff
That i haven't done yet, i heard port forwarding
Hmm, i see
But you should probably do the headless build that excludes graphics stuff
@high night Have you guys tried the Headless Builder asset?
It excludes stuff like graphics, shaders, lighting from headless builds
I was referring to this
Yeah, but those builds still contain all textures in the build and in RAM, etc.
Which isn't needed
oh, and this asset doesn't do that?
No, it strips those assets, and also shaders, etc.
People in the reviews are reporting much reduced CPU and RAM usage
hmm, i'll check this asset out
Any tips on sending player movement to the server?
How would I go about sending it securely?
Trying to prevent someone from spoofing other players character position
@jade glacier
It's currently an issue in my game
A kid is spoofing all players off the map
And it's ruining the game experience
What is your architecture? Clients should only be sending their own inputs to the server.
Clients should be unaware of other clients connections
Can post it of course
Can't promise I can read it, but someone might
Server knows which input comes from which client
You will get a clientside error too if you tried to send inputs or a command from a different players "player object" (authorized object)
(can't send command from unauthorized object or something)
That input will never reach the server
@slender bear
You could spoof the location on the client for screwing with the hit detection system, but one client shouldn't be able to affect other clients like that
hi, quick question, what do you guys think is the ideal method to set up a simple multiplayer game, where theres only 2 - 4 players at a time. i can have under 20 concurrent users, so preferably an option that has that setting as free
iv heard of things like photon and unity's unet or mirror
any advice on what might be best for my use casE?
Hi there, I was wondering if anyone would know how to change a game object's name on client side and then update that to the server side? I'm using UNet right now but i'm at a loss on how to update it to the server
@tawny hollow By Commands, i.e. command attribute. Note that UNET is deprecated.
Is there an alternative due to it being deprecated?
Check Photon or Mirror (mirror being Fork of UNET)
what are the cons of mirror
Ah, just double checked the documentation on Command and realised I wasn't calling the command in the client's player object
This seems to be fixed now, thank you
Mirror is not fork of UNet
Well I guess the high level API is, but my understanding is that most things have been reimplemented by now. UNet's transport layer is not used either.
@dry pewter With Mirror you would have to setup your own servers. You also don't get region based stuff out of the box.
Is it not? Their storefront says it's based on it, and that's what I've heard people saying, might be wrong I guess.
PUN is ideal if you don't mind players having a bit too much authority
Yea I guess I jumped on the gun a bit too soon with that. I think it technically is fork of UNet, but I don't know how much of actual UNet is left at this point
@stray scroll just started using mirror and I am loving it for my needs. it was really easy to learn if you already know how to use unity. There are some downsides like having to host the servers yourself. but that's what i wanted in my game so it was fine. yesterday last night i got 4 of my friends to join my game and it was almost flawless, the person hosting the server has almost no impact on performance. If you want the games to be hosted by the players or you are planning on making the servers yourself then go with mirror. ( you can follow almost any unet tutorial but somethings you will have to figure out yourself ) Hope this helps!
ps. one of my friends was in the states and im in canada ( not that far but still you get the point on how well it handles players )
If your planning on spending money on your game and making it worldwide with matchmaking GO WITH PUN. mirror is ment for player hosted games and lan.
Sorry didn't read the rest of the conversation @tawny hollow
You can do matchmaking stuff with Mirror, but you need to implement that yourself on top of Mirror. Server list solutions are already available.
It's a bad idea to do snapshot interpolation for a melee fighting game? (like chivalry, mordhau, street fighter, for honor)
Having all other players in the past is an issue i assume
What do you think is the best choice of networking for a fighting game as such?
streetfighter type games you typically want extrapolation with a lot of resim
Or some hybrid if you can swing it
For fighting games you are typically working with events, which are deterministic in nature once they occur. Like once you start a move its pretty locked in how that move is going to play out for the next X milliseconds
@gaunt socket You'd send full inputs for each frame to server and let the server simulate them all
This way most of the time, servers instance of your character will deterministically end up in same pos
And server sends back the new position of your character
This position the server sent is from the past now. Lets say frameNo == 100 for example
And client sees frameNo == 120
Your client will compare its instances saved position at frameNo == 100 to what server sent
If it's different you'll set your characters position to what server said t frameNo == 100
And simulate with the same inputs you recorded (and sent to server) until frameNo == 120
player won't notice all this
I said position but it's not just position you have to these for.
You need to do the same stuff for position, rotation, velocity, angVelocity, health of the player, how many bullet the player has left in magazine, etc etc.
It's the full state of the character
Depends on how you architect it. You either let the player predict and exist in the future, and have the server rewind for attacks, and rearrange the world to how the client would have seen it, or you do it with extrapolation (an ideally determinism) and you have the player constantly try to guess the future state of the server so that it lives in the present.
@gaunt socket You shouldn't need to do any prediction woth extra logic like that
Just shoot the projectile like you do in server without waiting for server response
And then send the input to server that says you shoot
Server will simulate with same input
And will most likely have the same output
You should treat the projectile same as* movement imo
I still don't know if you are talking state interpolation, or input extrapolation
Me?
yes %99.9
it may not hit the other player though
if other player moved away at the last milisecond
you still display the blood effects though, theres nothing to do
you get a missregistered hit if that happens
client sees that it hit but on server its not
Client prediction typically means extrapolated state transfer. Clients respond to their own player input immediately locally, meaning the player exists in a different timeframe than the server.
Rewind is employed on the server in that case to recreate the different world view the player had when they shot
One alternative is continuous input extrapolation on clients, where they constantly are guessing the future of unowned objects.
This requires a lot of resim on clients, as new player inputs arrive it has to rewind bad guesses and make a better guess
^this is whats called "state syncronization" right?
State sync just means the sun results are shared. As opposed to player inputs.
It's messy extrapolating states, so typically state transfer means interpolation.
And deal with the inherent desync with rewind, or client authority.
Phone typing, lots of typos here
damn fat fongers
Just dumb prediction. Google can't predict tech conversations well
Interpolated state transfer with client prediction and server rewind is the csgo way... But not the only way.
you wanna create a fake projectile?
and never display servers one
Servers projectile trajectory will be totally same though
its totally predictable
For projectiles you can talk advantage of their deterministic nature
@gaunt socket if projectile shoots in 200ms or something like that, you can work with it
but hmm
nevermind that
In the past with state interesting I would fire them at a slower velocity and some initial delay, then lerp them so the merge with the expected server confirm, then accelerate them to actual speed.
Or the reverse if you make them in the players timeframe
In the past with state interesting I would fire them at a slower velocity and some initial delay, then lerp them so the merge with the expected server confirm, then accelerate them to actual speed.
@jade glacier
Ohh, i did something similar to that
that was some messy code
https://youtu.be/3XCf5AALFgY
Just lots of futzing until you find the right compromise for your particular game, and the speed involved
It's not the only answer, just one possible one
my fast forward was smooth though
that would be if with player auth if I remember that post
hah this is bad though o need for extra code for extapolating projectiles
https://drive.google.com/file/d/0B7wLFN2dg2IROVhvakRmbk1tUmc/view?usp=sharing
This was my test doing the server auth with client faking to get in sync
Same idea as yours, the color change indicates where it is in getting into agreement with the world state
yeah, fires immediately but at a slower rate
so that it will be partially in agreement with what it is expecting the server to confirm
it basically starts slow and then speeds up once it is in agreement with the world state
so its basically shifting timeframe from the player, to the world
its purely cosmetic regardless
the server has the only real projectile
you can hide it with a little player side shot latency, if its a slower moving projectile
lag compensation is a word I personally avoid, since it implies all kinds of things that may not be meant
There are multiple timeframes in play when interpolating... so I just think of which timeframe things are in
The player movement is 100% in the players timeframe... the world around the player are all in the server's time frame
@jade glacier
if you had hitscan shooting, and had the world view in past, wouldn't that cause issues?
You pretty much have to do server rewind for hitscan... or go with client auth
"compensation" is a terrible term... could mean anything
CSGO and Photon Bolt rewind the scene on the server so that things are close to how the shooting player saw them, and recreates the shot.
vs modern battle royales where the server can't spare that much CPU, my understanding is they give a lot more client authority
so the client says they hit someone, the server just does a simple "is that reasonable" test instead of a rewind.
If you fire a hitscan instantly as a player, the hitscan you see is in the players timeframe
The server if not rewound would say most of your shots missed in that case if it has shot authority....
so the two choices are give the client authority... or have the server do a fancy rewind
The third alternative is to extrapolate
its the most elegant result, but hard as hell to do
extrapolate everything
other than the player
players could maybe extrapolate but only for close proximity
you attempt to bring the world into the players timeframe with constant guesses
That is how determinstic engines like Quantum deal with latency
It is constantly making a guess based on players past inputs and it resimulates every time it gets new more current info
So its constantly lerping between guesses
fighting games tend to extrapolate yeah
they have very lightweight physics so constantly resimming isn't a big deal
the result is some amount of rubberbanding
vs interpolation where things move rock solid smooth, because they are certain.
(for fighting game netcode, there's a nice gdc talk about mortal kombat's netcode on youtube: https://www.youtube.com/watch?v=7jb0FOcImdg)
<@&502884371011731486> channels are automatically dissapearing every time i leave them
i cannot find them again
nothing is muted
something with your bot I think
@weak plinth expand the "programming " section for example, you will see all channels
If its not expanded, you only see channels with updates
Helloc can someone help me a little with photon here
I have pun 2, and i have a train in my scene, but it dosen work,
The train hase childs, i tried to put on each child a photon view but it dont work
What am i doing wrong
@hallow fractal I believe photonview wont work on child object
If they haven't changed how it is
(my info might be outdated)
Soo only the mother needs to have it right @high night
Yes
@high night i think i did it before but let me try again
Can't put a photonview on a child object afaik
@hallow fractal Don't try to put a photonview on players gun for example
Have some component in parent that syncs the player's gun over network instead
@high night hmm no it dont work
Do you mind if i seend you some pics of the object?
k
Only parenting "GameObject"'s transform will be synced
@hallow fractal
PhotonTransformView doesn't care about child's transform
And that includes the train
Soo each vagon needs a separate photon view right?
Yes
