#archived-networking
1 messages ยท Page 62 of 1
It looks to me like serializing such stuff is going to be necessary because rollback is necessary on such objects
of course not, effects and sounds are reactions to the "fire" state/event
On the player and on all clients, you should have a method for the cosmetics of a weapon fire react to the state being applied
do you do rollbacks on effects and sounds?
Do you do the effects on verified states only?
Or predictions too?
Well it would be kinda weird if the player does something and the feedback effect plays10 ticks later
@harsh dew But only after 10 ticks later that info is reached to your pc
You are spawning that effect then
It's easy to predict how will that effect look after 10 ticks just looking at the reliable tick.
Looking at the predictions or verified state while spawning effects make no difference if that effect is directly and instantly caused on player input:
Like gunshots and stuff
.
For a case like this:
A cube is falling down, hits the ground then you get the sound effect
If you use verified states, you hear it 10 ticks later
If you use predicted states, you can hear it instantly
This is where it makes a difference.
.
.
It looks to me like it's acceptable to act on verified states when figuring out effects/sounds
(not using any information in predicted states)
I wouldn't even get bogged down in any of those choices
your state is a history of simulation results... you render for the player an interpolation between any two of those at a time....
when you consume a new state (take it from the buffer and make it the new interpolation target), apply the events of the previous state (the snapshot)....
when you apply that now completed state... you trigger the cosmetics
You do no rewind the players world view
you only resim the details of things like transforms on the clients
so none of what you are asking applies
When you apply tick 10... you trigger any resulting cosmetics for tick 10. If tick 10 says "I fired a gun"... then that should trigger your guns "OnFire()" or whatever method that handles the pretty sounds and lights.
The simulation has no interest in your cosmetics.
So in your architecture, when a cube object falls down from some height by itself, you get the hit sound effect after a small delay when it touches the ground in your sceen (what your player sees sitting if front of his screen playing the game)?
(That cube object is not a player, it does not get disturbed by player inputs, it's perfectly predictable)
Answer to the question will help me narrow down on what your architecture is
I think we might be not talking about the same things
If the cube hitting the ground triggers and state flag of some kind, then it is tied to that exact tick moment
Its not really a proper comparison, because the cube hitting the ground is not a player input.
If the player pulls their trigger, that queues a weapon for trigger for the next proper tick on that client.
As soon as that tick comes off the queue and becomes the "input struct" for the following tick... the player makes that the new interpolation target for the local sim... and it sends that input to the server
Right away, why would they not?
The cube hitting the ground is a state event. In this case not networked, just a physX state of "OnCollision"
I feel like I am not helping you at all with any of this. You should really just go complete your first attempt at this stuff, and if you aren't fully getting the standard architectures go read up a bit on Counter-strike, quake and Overwatch
They are pretty well documented, better than I can explain
Then I don't get the question at all
The client is reproducing this cube falling from server states?
yes
then the cube hitting the ground if you were to produce an event from that, would trigger when the cube finishes its interpolation into the ground
Either determinsitically on the client, with it detecting that collision itself... or as a state flag in that tick if the server dictated that that cube hitting the ground should produce some action. Which is not a great example, unless this is like a grenade and the server needs to say when it pops.
For this question, lets call it a contact grenade. After bouncing around the server decides that when it hit the ground this time, it explodes. It would set the "you go boom now" flag for that grenade on the tick where it hit the thing that triggered it.
So now, when anyone interpolates that grenated from the frame before that to that frame... it will end in a POW
tick 10 hits wall and goes boom.
so if the current interpolation is 9 to 10... its moving toward the wall
at the end of that interp (when we move the 10-11)... it triggers the boom graphic callback
I understand how you are saying effects/sounds are done just by looking at interpolation (interpolation: what person sees on screen)
But what if interpolation is wrong because it was based on prediction
Cosmetics manager doesn't care?
again, you are confusing your wacky system with the standard
if I am interpolating server states... there is no resim
those are final
server states to clients = final word from god.
there is no taking anything back
client doesn't predict the present time?
no, this is snapshot interpolation
you are talking about snapshot extrapolation, which is a layer of hell no one should wander into
i am not doing the snapshot architecture
i am doing the state sync architecture in that website you said
I post a lot of stuff, but I assume gafferongames - he has lots of experiments in different systems
but his primary article is about snapshot interpolation
trying to predict other clients weapon fire would be pretty impossible
but cubes like that can be predicted
because you can't guess a "bang" nor take back a "bang"
Cubes you can take back, because its just mushing around time if you try to extrapolate
RocketLeague has a lot of mush built into it
sends input for future
Yikes, we are so going in the same circles
i didn't look too far into snapshot interpolation
I am not sure again what the question really is
but can you make the controls responsive some way?
I don't know your architecture then, so the answer really comes down to what is best for your architecture
what you originally described was a low send rate, VERY low server state non-deterministic system... which is going to hurt.
With snapshot interpolation can you make controls snappy?
I believe you cant without some funky stuff
That funky stuff is called prediction
its what all the articles I posted are about
Its how CS:GO, Quake, OW and most fPS games deal with it
Photon Bolt has it all bake din
client prediction with server shot rewind
player lives in the future, server checks their claims with some funky rewinds
The altnerative is to extrapolate the world, but that leans very heavily on determinism and constant re-simulation.
Quantum is capable of that, but I have no idea how they make it work with FPS games.
My guess is things like weapon fire cosmetics are held until the simulation is certain it has all player inputs.
Okay so I've caught the late train but hopefully this will be quick: How do I do multiplayer if my game is not based on DOTS and isn't intended to be? Do any networking features in Unity (not a third party system) still exist that aren't part of DOTS or deprecated along with the HLAPI?
All the usual candidates @swift surge Bolt, Mirror, PUN2, MLAPI, Forge
If I understand correctly, those are all third-party
Depends how "hobby" your game is and the game type - which is going to be ideal
Say hypothetically that I can't tolerate third parties and I want to do that "write your own networking system" thing from that flowchart the Unity site has. What API exists?
Most first attempts at mp games are a terrible wreck, so give yourself time to do tutorials and generally fail before trying your dream project.
The Unity flow chart is just them trying to pretend they haven't created a radioactive wasteland of networking
That's the plan, actually. Get started way early. I don't actually have any (necessarily) multiplayer games in development, but I want to start learning a system that doesn't have its days numbered.
Do tutorials for a bunch of the libs
The third-party libs?
To see how they annoy you... and see if you can start to understand why they kind of suck. Then you will have to make some hard choices.
The snapshot interpolation i understand from gafferongames is
client doesn't simulate anything?
@jade glacier
But it looks like you are simulating
So your architecture is snapshot interpolation + simulation for prediction (are velocities included in your snapshot too?)
um ok
Depends o which article, he breaks things down into a lot of small pieces
he does have articles about client prediction
I have a bunch of libraries, but my current work is just on PUN2, so there is no server auth - there is just owner auth, so its almost entirely state transfer
Thats very different than what i'm trying to make
yeah, only some parts will apply
like the state transfer concepts
but you aren't even doing state transfer, you are trying to do some semi-deterministic thing, with very rare state transfers that try to clean up any mess
which I don't see ever working
no, i am doing the
reliable info in memory: inputs0, inputs1, inputs2, inputs3, inputs4, state0
all info in memory : inputs0, inputs1, inputs2, inputs3, inputs4, state0, localInputs5, localInputs6, localInputs7
in this example player is viewing timeframe:7
Sending inputs to the clients... and is the server simulating and sending out states?
5 inputs + 1state sent from server at 10hz
The server sending inputs implies a deterministic system
its determinism that relies on 5 frame long determinism
Will die just to butterfly effects even with perfect lockstep
No need to mention genders
How is that not what I said? You are sending inputs with rare states to try and clean things up? Is that not accurate?
I like these funny people with these funny "meme" pictures on their profile asking funny question in Unity discord.
those inputs are only there for knowing which frame player shot the bullet @jade glacier
i drew that
@jade glacier that was the first idea i had
what you said
i am not doing the
state send each 2 seconds thingy
not planning to do it
I am not following your current arch - you just need to make it and see. You can't really ask for tips on it, because you are out on a wild limb of your own creation right now.
Yeah, i really though you were doing state syncronization though all this time, that made our communication difficult
But it's been helpful
thanks for your time for the past few days @jade glacier
Let us know what your tests come up with
I think i know what im going to with effects, i may not have a question for a while
Would you guys recommend focusing more on limiting network bandwidth or better performance? For example, Iโm sending a input frame every 20 frames that contains 4 float values, each only sending a value of -1 0 or 1. The rational thing bandwidth wise would be to convert them from floats to sbyte, but that means that the game will need to convert the sbyte to int when performing its calculations. My question is whether not I should keep them as floats or if the use of sbyte is the right thing to do
This would condense 16 bytes to 4 bytes of data sent every inputframe
I could also probably use bit-masking in the future to condense it to a single byte, but first we need to come to a conclusion of whether not the extra performance cost is worth it
@swift surge that chart is kind of a "joke" and was probably put together by a PR department, contrary to the third party libs (and many advices (you get here), which come from actual developers. Make your choice.
@regal mesa It depends if one will become a problem or not. The focus is more dependent on the architecture you are using. With predict rollback determinism bandwidth does not become a problem unless you need more than 32 players or so... And then the solution is to compress the input as much as possible.
With state transfer you need to first care about scoping (sending data to who needs data only) and scheduling (updating remote entities with different frequencies based on priority).
Then, on top of that you think about compression
Of course if you are sending full snapshots all the time you need to think about compression first and foremost
Thank you, that was very helpful ๐
The units FPS sample uses snapshots with a neat compression approach, for example. (current implementation seems to limit it to games with a low player count and small complexity, but the approach can be stretched fine for many game types, including battle royale stuff)
Bolt does scheduling compression and scoping for you... I'm not very familiar with Mirror, but MrGadget here is the lead dev (am I correct?) And they have a nice discord server.
If you are building your own, that is a super short description of a few things. Guys like emotitron have a lot of advice recorded here on state transfer techniques (just read through the history).
@gleaming prawn Thanks for the props but I'm not the lead dev...just more visible than others on the team ๐
Still the face of it here...:)
And yes, Mirror has byte-packing built in. Bit-packing would be a small trade of +CPU for -bandwidth over byte-packing.
Cool
You can spot apply bitpacking when using a byte aligned reader/writer as well. Generally though, don't get buried in those weeds until you have your game working. Optimizing serialization is pretty easy after the fact - since its not an architecture change.
You will mostly find with first networking projects is that you are going to hit the same walls everyone else does, and that they try to warn you about. So the goal isn't to make a great networking attempt first try... the goal is to make all of the mistakes quickly so you can restart/refactor with a better plan before investing too much time into code you will end up throwing out. @regal mesa
Things like net/sim rate should be a simple variable setting if you code things right.
Latest update on my progress with Car Physics in Quantum.
From the video description:
Testing Quantum's predict/rollback fully deterministic simulation to implement 3D car physics.
Two game clients connected to same server, input being exchanged between them (via server).
No input-delay used (full rollback netcode mode), 100% WYSIWYG physics.
Testing Quantum's predict/rollback fully deterministic simulation to implement 3D car physics.
Two game clients connected to same server, input being exchanged between them (via server).
No input-delay used (full rollback netcode mode), 100% WYSIWYG physics.
Would be more interesting if you introduced network delay and packet loss
Hi everyone,
I just started creating a rogue-like (xp/stats loss on death) 2 players coop 2d game with a classmate and since we're both beginners we'd like to get some advice whether we should use Mirror or Photon to get it running.
Our goal is to have a host player and a client player and if possible singleplayer/local coop.
Our max player/server would be 2 and maybe 4 later but not more. From what I read Photon is made for games that don't require a lot of players connected at the same time?
Looking forward to get your advice on this.
(I hope this is the right channel to ask this)
@stray scroll I tested with another player in Brazil (250ms ping) yesterday... This doesn't affect your local view. But yes, I can add that to a video (just to highlight how well it adapts)
But we'll do that later when we record a better video, with a better rendering as well, etc
Also Jaws, the bandwidth numbers in this video are "bogus", because this test project has a "mammoth" input struct (we just keep adding more data to it, as it's a shared project).
We're now just cleaning up the code, setting up a few different cars, so these small temporary things will be gone. Thanks for the suggestion (I'll include a section with network lag + loss added)
It will be fun to see...:)
Hi @teal hound photon works fine with a lot more than that as well... Try to follow the basic tutorials and you should be able to have something running quickly
Ok will do, thanks!
nice work erick
interested to know if quantum replay on disconnects
or sends world's states for that frame and play from there
@weak plinth we have 4 different ways of re-connecting to a game
- replay all inputs
- store a snapshot of the latest verified frame when you're in game, use this when you reconnect and replay inputs from there
- get a snapshot from one of the other clients
- get a snapshot from server (if you're running a server-side simulation, this isn't required - but an option)
hey fholm, tnx for detailed answer, btw how many players could you host if it just relay inputs ?
@weak plinth we have a live game with 32 players, we've tested up to 50 ourselves
we can go higher, just never had any customer ask for it so
never saw deterministic system with this numbers, nice
no, we're pretty much world first with that AFAIK (i could be wrong, ofc.)
you use ecs like system for you new project ? the mmo one
Quantum API is an ECS yes
Not the same as the MMO stuff...
And the actual tested limit was 64 players (for Quantum - currently a hard cap we put - we're lifting for the next version)
i'm still amazed from the 20k number and tried to think how it was done
Lol, that has a lot of history from Fredrik involved
the physics system can handle more ?
Depends, what are you talkiing about?
if all players simulate then must be hard to compute complex physics like cars and such
if its more then 64 players
Quantum's physics engine is a stateless fully deterministic engine... It can handle a pretty decent amount of load (and we're not even yet done with optimizations)... BUT it's a full rollback netcode system, it really depends on your game load.
Oh, that normally is NOT a big problem because we do prediction culling (was discussed here a couple of days ago)
So we do not need to predict/rollback the WHOLE game state...
So, depending on how the game scenes are, you'll have 90%+ of the game running one-tick-at-a-time, and a small portion running full predict/rollback
For reference, MMO thing is my own hobby thing, not related to quantum or any of my professional work
Yes, I'm strictly talking aout quantum @weak plinth
Fredrik's MMO stuff doesn't have anything todo with the videos I posted, our determinstic physics, etc
IMHO (and I think Fredrik agrees) Running 20k players + 256k NPCs you will NOT even try to use a fully fledged physics engine... It would not handle it.
you added 3d physics to the 2.5d one ?
We've had a fully 3D physics since a while already.
We're constantly adding more and more features.
never saw deterministic fps, made hitbox for each body part ?
Vehicle physics was essentially implementing:
- wheel colliders
- spring/damper + stabilizer bars
- tire friction models
- putting all together as a car-solver, adding data assets for calibrating cars, etc
@weak plinth Doom was deterministic, so you probably saw at least one..:)
sounds like fun with no floats
Fredrik posted a video of our deterministic FPS a couple of days ago...
first doom was deterministic ? not bad
The bigger question I always had about a deterministic FPS with quantum has always been:
- will it be fun? Because quantum might be TOO accurate....
Lag compensation with favor the shooter helps a lot to make hits "easier"
BUT
Our tests show it's just as fun...:) Maybe we'll just publish a demo sometime, who knows....;)
Hello all! I am having a bit of a problem running a Command in my client. Host works fine but Client has an error
this is my code: https://hastebin.com/raw/pawacepozu
Hello anyone know a good tutorial about networking fps game for 2020
THANKS
also can I play a game online with somone else from another wifi?(not lan) in unity
@steel gyro fyi Wifi(is a certificate) = WLAN = LAN
So can I play with someone from other WiFi Not lan
My SslStream.BeginRead callback for an asynchronous socket server is consistently called when only one byte has been passed. The rest comes on the next callback. I want to define a 2 byte header for the total package size but can't since the first byte is always 1.
{
UnityEngine.Debug.Log("<color=orange><b>SecureReceiveCallback </b></color> ");
Connection conn = null;
int received;
try
{
conn = (Connection)ar.AsyncState;
received = conn.Ssl.EndRead(ar);
UnityEngine.Debug.Log("Received: " + received);
if (received <= 0)
{
UnityEngine.Debug.Log("<color=red><b>Received is 0.</b></color> ");
return;
}
}
catch (Exception e)
{
UnityEngine.Debug.Log("<color=red><b>Error in SecureReceiveCallback </b></color> " + e.ToString());
return;
}
byte[] data = new byte[received];
Buffer.BlockCopy(conn.Buffer, 0, data, 0, received);
Dictionary<string, object> args = new Dictionary<string, object>();
//Pass data to be parsed. Data is in conn.Buffer
args["conn"] = conn;
EventManager.RaiseDataReceived(args);
conn.Buffer = new byte[8096];
conn.Ssl.BeginRead(conn.Buffer, 0, conn.Buffer.Length, new AsyncCallback(SecureReceiveCallback), conn);
}```
i'm sure im writing just once to the stream. But received is always 1 then the next time is the rest.
@gray pond To be technical, Mirror doesn't do byte packing (though it does have PackedBytes, which is more of a varint kind of thing). It would be easy though to add a couple methods to your writer to make it one. It is just missing a length field in the Write/Reads to indicate how many bytes of the supplied value would be written.
For example Writer.WriteUInt32(MyUint, 3) to indicate that you only want to write the least sig 3 bytes.
Unless that has been added since I last looked, then nm.
with the writer as it is, the only packing you can do like that is by casting down, from say a uint to a ushort or to a byte.
This is what we have in master today @jade glacier @gleaming prawn
https://github.com/vis2k/Mirror/blob/master/Assets/Mirror/Runtime/NetworkWriter.cs
Not seeing a bytepacking write at a glance (but may have skimmed to fast), but what I see there as your primary writer is like 3 lines of code from being one.
I don't expect you to line-by-line review it - a skim would tell you what we're doing
PR's welcome always ๐
{
WriteByte((byte)(value & 0xFF));
WriteByte((byte)((value >> 8) & 0xFF));
WriteByte((byte)((value >> 16) & 0xFF));
WriteByte((byte)((value >> 24) & 0xFF));
WriteByte((byte)((value >> 32) & 0xFF));
WriteByte((byte)((value >> 40) & 0xFF));
WriteByte((byte)((value >> 48) & 0xFF));
WriteByte((byte)((value >> 56) & 0xFF));
}```
You already have that broken into byte writes, so just adding a count = 8 to the args, you could easily just tell it to stop at X byte writes... do the same for the read side, and you can claim bytepacking.
I'm nose deep in PUN2 fixes, I'm not the guy to do that for you - but you literally have it practically done - if anyone on the team decides to just add those extra lines.
{
for (int i = 0; i < bytecount; ++i)
WriteByte((byte)(value >> (8 * i)))
}```
Along those lines... I am sure that is bad what I just typed, but the idea is there.
I don't think your & 0xFF are needed. The byte is nuking anything left of FF anyway
That wall of text was for @gray pond
most libs have some tutorials for that libs usage
Give yourself a week, and play with Bolt, Mirror, PUN2, Forge - those are all mid level to high level
Bolt being the only actual full stack
so you suggest bolt?
FPS if you plan to make an actual competitive game and you have funding to promote it - Bolt is made for that.
Ok thnxx
It is CS:GO in principle. But it is a bit of a learning curve. And you will have to host your servers.
you know photon?
I work for Exit
They make PhotonEngine and the various libraries
Wait confused so what is bolt
I specifically am doing work on PUN2
kk
Yeah, this is why you have to go do a bunch of tutorials
you can't even form the right questions until you just play with what exists
bolt is virtual scripting no code?
networking is a mess, is hard, and is a long road. But you have to start by doing a lot of reading and playing with what exists for libraries.
You will not get away without scripting if you are making a networked game in Unity
Have you made a single player game?
kinda yeah
Photon Bolt is different from Bolt Visual Scripting
with what i done I can make an online gmae
they are to unrelated products
Bolt Visual Scripting failed to notice that the name Bolt was already taken
and now they confuse a lot of people
If you chose to try it, yeah - you will want to go to the PhotonEngine site and dig around
you will also likely want to join the Bolt discord server
ok thanks so much ๐
Any source/docs on this syntax? (C#) Action<List<RoomInfo>>
This is understandable: var myList = new List<ListElementType>();
Not sure sure that be a networking question @burnt axle
I would argue the opposite
Unity events are bloated, and should really only be used if you intend to make use of the Inspector serialization aspect of them.
Actions are just sugar, and they compile into delegates
I think he may be looking at existing PUN2 code and wondering what it is doing?
Not sure sure that be a networking question @burnt axle
@jade glacier Not directly no, i just saw it being used in a code for Photon. Nevermind ๐
Just more likely to get answers to that stuff in busier rooms fielding general Unity/C# questions
emotitron, youre right, i look at the C# docu right now, it looks like its simpler than unitys Events
shame on me :<
no worries, this is why we all talk in a public room
I get corrected all the time by people who know something I don't.
That is against the EULA @teal hound
Ilegal then. You either pay the one time fee for 100 CCU, or get into one of the plans if you get higher concurrent users
I don't understand, if players host a lobby themselves, how is this related to Photon? Is there a connection made to Photon still?
newbie here
Lobbys are hosted on photon servers
And even if you run your own copy of a photon server, it is proprietary software, built by us...
It's the same as running a machine with windows, you need a license for it...
According to the EULAs
You have open source alternatives if you think they would be cheaper (for LAN games they would, for hosting server, hmmm not always really). Check for Mirror anyway (the open source actively in development version of the old deprecated UNet)
The guys are nice and give good support as well...
If you are building a game for PC/Steam only, check the option valve offers for free (unlimited basic punch + relay)
On the other hand, Photon does it all for us right?
I'd say "Yes" (depends on what you consider ALL)
Because checking for the pricing plans 100 CCU for 5 years for 100$ seems really fair
it is, really
I mean, if we don't want to annoy our players with opening their ports and stuff it's better to just have Photon imo?
For hobbyists this is a bargain, as many times you are not planning to sell millions of copies (if you are, then the pricing there will be fair as well)
got it, thanks for the info
Yes, there's no need for opening ports whatsoever
I have a better understanding of it now, thanks!
Including if you go for Photon Bolt
Hi guys, Heartstone was created on unity. Does anyone know what they used for networking? Was it Photon or Unet?
Oh... so they made their own
Any recommendation on which to go for? Photon is quite pricy if the game scales
When you have a 500-people team you CAN, and you normally need to justify why aou are paying them...:)
Hahaha true
(disclosure: photon employee here) I'd argue Photon is quite cheap when you scale...:)
I could explain why with a lot of numbers...
But...
It never works to just say it...:)
Ok I guess you'll be right person to ask then
One of the reasons we've been doing good business all these years is because our pricing and benefits are super fair.
For 500 ccu does it mean that if 500 users installed my game for just 1 minute and then uninstalled it will I still be charged that much?
No
500 is CCU (simultaneous)
Running online at the same time
let me give you a quick rule of thumb:
Running online for how long?
- to get to 1000 CCU you normally need around 20000 DAU (daily active players), which translates to around 400000 MAU (monthly), or around 0.5 million downloads.
Simultaneously Vind
It doesn not matter how long, it only matters how many are playing ONLINE at the SAME time... We count the peak of that... That is it...
Our experience shows the rule above
To peak at 500 CCU you need to be very successful already (250 thousand downloads)
if you get 500 downloads you will not even show in the dashboard (the free 20 CCU tier would work)
The other rule of thumb we also tend to say is:
- focus on making a fun game...
- if you get successful, our pricing will NOT be a problem (quite the opposite)
Because what I'm mainly worried about is that during maybe the first week I will definitely go crazy and market it like a mad cow. But after that, people may uninstall and prolly find my game stupid, etc. So I'm worried I'll be charge for just that 1 time
But your numbers are good for me to understand things ๐
because a game that has the potential to reach that, if it doesn't sustain is a failure of the studio on how to market/retain players
And if you get 500 and pays that for one month, then next month you don't peak, you can go down to a cheaper tier, no problem
It won't bust your bank
Ahhh ok so if my CCU drops I will be charged the lower tier
We expect you to signup for the right plans
Example:
- say you have the 100 CCU tier (one time fee for 5 years), and in one month you peak at 273 CCU;
- we expect you to change the App ID for the 500 CCU max tier for that month (we won't stop your players from being able to play, we won't hard-cap the CCU at all);
- if you do NOT change, we'll send you an email after a few days, etc
- if you are SURE it was an Undesirable (is there such a thing?) peak, you can switch down back next month, ec
Trust me, if you get to the point of having good numbers, you'll be very happy to pay (it would be much much cheaper than hosting your own servers)
Quick question if I have 1000 CCU for only 1 min in the entire month, will I be charged for the 1000 CCU?
Valid argument: if you are aiming for Steam ONLY, and you do NOT need super accurate netcode (like Photon Quantum or Photon Bolt, just a basic thing like photon realtime), than you could go for Steam "free" offer (they get your money from the 30% cut)
Yes... Based on the EULA yes... But if you have 1000K for only one minute you probably have a problem.
And we won't blame you for sending an email asking us to reconsider that...:)
Again: first make a game
I understand and I agree with you
Are there photon servers globally located to support regions?
I think currently we have around 15 regions
hello guys
Hi everyone. I would be extremely thankful for some advice regarding backend between my game and my database.
- is it best practice in gamedev to use rest api for this purpose? May i ask for any kind of material to read and increasy my knowledge about it?
- Where i work (it's not a about games) we use aspnetboilerplate. Would it be consider an overkill to use it in gamedev backend (if anyone knows about it, oc)?
@rough garden most games use stateful custom TCP/IP connections for backend
not sateless http stuff
@graceful zephyr even for information like: If i include a market in the game where it gets a table of equipment (swords, gloves, armor...), wouldn't this information be better using stateless?
no
i have a linux with a tcp client un python waiting to send data to my unity with tcp sserver but cant make it happen :/
should i do a python server outside of unity to wait for the data and then communicate it to my unity scene ?
what about https://docs.unity3d.com/Manual/UNetClientServer.html is it a working library ? it says deprecated ..
thats not for tcp connections @cedar marlin
that is for udp
and you need to have both client and server in unity, using the same API
for it to work
aww ok
if you want to connect to unity using TCP look into TCPListener: https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.tcplistener?view=netframework-4.8
and use that
yeah im into that actually
i tried implementing this https://docs.microsoft.com/fr-fr/dotnet/framework/network-programming/asynchronous-server-socket-example
but unity freeze when i launch
have to kill it
will try tcp listener then thx
@graceful zephyr i fear i have the same behaviour as with synchronous server. it freezes unity
ok yes i guess it stays inside i suppose
oh yes since we put it into update no need for while right
ok got rid of the while true still does the same ๐ข
but if i understand well tcplistener is also a "blocking" server right ?
it waits and block everyhing while receiving the data ?
don't you have to run this as a background thread?
idk i'm not very familiar with networking to be honest
and i cant find any quality intel on the subject in internet
lol how am i supposed to take these reacts ? ๐
there isn't a lot of good information online about this
trial and error is the way
I did the thing i was doing with state syncronization
Left screen is client
Right screen is server
There are two of each object
On the client first one is, last snapshot(state) from server
On the server first one is, servers simulation 15 frames in the past (300ms in the past)
On both client and server, second scene is predicted scene from recieved inputs, snapshots and local inputs.
.
I control the server here
.
I control the client here
prediction errors are due to packet loss, it's smooth if i have %0 packet loss
I press space for that effect,
that information is recieved from inputs
By looking at characterInput.attackInput
which part? which screen?
packet loss is causing misspredictions
but i'll probably swich to udp send send duplicate packets
okey so it's with packetloss
but this sentance
"On the server first one is, servers simulation 15 frames in the past (300ms in the past)"
seems wrong
it's not?
you can both see the simulation and prediction on server
one is 300ms in the past
one is now
prediction on server?
has nothing to do with packet loss
it does see,
client predicting itself doesn't make any errors this time
(client is left)
- server is jittery
- server should simulate all players, including himself in 'now'
- client should simulate his own player in 'future'
I will run interpolation on both server and client based on the prediction result
has nothing to do with interpolation, you can see the 'leading' cube on the right screen jumping around
just look at the left 'leading' cube and the right 'leading' cube, its smooth on left, not smooth on right side
that has nothing to do with interpolation
thats the prediction?
it has to jump because input has changed and that change was from 120ms ago (network lag)
why are you predicting the clients on the server?
maybe this isn't for authoritative input stuff
server plays too as a client and wants to see "now"
no... that's not how it works
or well
that's not how it should work
1) server is jittery
2) server should simulate all players, including himself in 'now'
3) server should never 'predict' anything in relation to clients
4) client should simulate his own player in 'future'
there you go.
eh help I am using photon bolt and I made some fps kinda game but when I shoot it doesnt reduce other`s health I use states but it doesnt work
plz help
go to the bolt discord
There is a Bolt Discord btw @steel gyro where you might get better results
what he said
that's a lot of networking chat in general, its a small number of people compared to users of basic unity stuff
@high night anyway take my advice or not, what you describe to me 1) doesn't sound like proper implemented authority and 2) doesn't look right in the example (even with 0% packet loss) - no matter if you do interpolation or not
@high night You are going to get the same advice from fholm you got from me. Start with a standard known architecture and make it work before you start getting wackado.
You are jumbling up concepts without actually having made a very straight forward working system.
so what you are suggesting is
no player should ever predict other players than its own character
for both server and client
I'm not suggesting anything
I'm telling you that what you described and showed, to me, doesn't look like proper client side prediction /w server authority
If your system is designed for that you can, but you are starting with nothing so straight forward
i was grabbing the last recieved input when simulating ahead of last recieved state
instead ill just pass in a default input
if input was missing
What you described over the last week as I understand it is a partially deterministic input based system, but not deterministic, so you are trying to correct it with very lazy state transfers from the server
Sorry to interupt can I anyone help with photon bolt it says Only owner can modify "health"
but then you have the server trying to predict its own client as well, which is messy to say the least
@high night if client is jittery on server, then something is wrong.
assuming there's not a bunch of packet loss/etc causing it ofc
Server having packetloss to its own client? ๐
only reason im sending inputs is recreate events that happened in a single frame but not included in the snapshot
@jade glacier
that was the old idea i had you talked about just now
yeah, we have discussed it quite a bit... I can't follow your architecture (the devil is in all of the details of making these things actually work)... so you really do just have to go make whatever you are going to make and see.
unless you are asking us about a standard architecture, we can help there.
i believe i will fix the jitter fholm was talking about in a minute
by not predicting inputs
I am not getting what you mean by prediction then
unless you mean you are extrapolating inputs
prediction doesn't involve any guessing... its just applying inputs locally immediately, and checking later to see if the server agreed
that would be extrapolation
you should study RocketLeague
if you inputs don't immidenly take major effect input prediction can be possible without minimal jitter i believe
rocket league extrapolates other players on all clients, it behaves somewhat like a deterministic system as I understand it
it involves rollbacks and resims as i remember from the video
in that it is constantly resimulating and is extrapolating other users so the player can exist in the present rather than the future
easier in a physics driven stuff
prediction with instant acc/deacc
is always hairy
yeah, RocketLeague is a bit of a marvel.. wouldn't make that my first networking attempt
its also messy
even at its best
How does Quantum deal with hard events like weapon fire btw @graceful zephyr since you can't really resim those?
like once a gun goes bang... you can't really change that, the player has seen/heard it
we have event cancellation, we can tell you if you wrongly predicted an event so you can do a graceful fade out of audio/visuals/etc
ah, interesting
Seems like that would be one of the edge cases where FPS type games would really get tricky for you guys to code for
I guess worst case for that is you hear/see an extra gun blast - that just doesn't do anything
that's pretty rare though
but yeah, leads to no simulation desync, and as for false-positive feedback, we give canceled/confirmed callbacks for our event pub/sub API (which is the recommendation to inform the "view" of stuff that happened now)
reliable events, false negatives and duplicates were all handled even before we added canceled/confirmed
smart
This is what i was talking about,
No more prediction of other players' inputs this time.
However i predict the velocities just like any other rigidbody
So can still see into the future a bit.
I predict all rigidbodies and all objects (also run behaviour update for all objects)
but i don't predict an input for a missing input from another player
.
Does this look right?
I both move in server and client, you can see which one i control by me clicking on screen
.
left is client, right is server
.
no interpolations yet though
Being honest? I'm used to quantum, no it does not look right... Even the distances are off...
as you add internpolation, it would look ok-ish as long as you don't compare the two screens
But it's still not getting anywhere good IMHO.
Don't get me wrong, I think it's GREAT that you are trying for real
And showing it so others can give a few ideas... That's one way to learn (a good way I'd also say)
distances wouldn't be off in the previous gif
since is was feeding the last recieved input
as long as i kept pressing the button for more than a tick delay
Getting hands dirty with code... Always good... But after some more experience you'll understand that what Fredrik said is the right way to do (for server authority approach)
server is the authority over everyhing in the gif you see
What makes you think it isn't?
I said: after more time you'll see that the CORRECT approach for server authority is what Fredrik said
I'm not saying server is not the authority
I'm saying it looks really bad from a synchronization perspective
And this is your sample test, not even a real case... You prepared for this case
You already have my answer. Make a standard snapshot interpolaiton server authority model, with player prediction... get that working. Then get creative.
I disagree just with the above...:)
which part?
I think it's cool that you are getting hands dirty instead of just talking BARGOS
Oh, thought you were disagreeing with me
@gleaming prawn It's 10 hz tickrate plus 150 ms of prediction
could that be why you think it's looking bad?
In that he should immediately implement a standar snap-interpol
Yes, I'm disagreeing with you emotitron... lol
I think if he is doing a variant of that, he should get something working first
no, I think it looks bad because the distances were off. And we know from experience that your approach is not adding anything good
i don't think my implementation is similar to snapshot interpolation
I would start with some model that works, and then creatively tweak from there for a first networking effort
i am trying to do a state-syncronization
I wouldn't get creative until you have completed a working system of any kind... imo
snapshot interp IS a form of state sync
this
the snapshots are the syncs
i sent velocities,
and when i resimulate over the last recieved state
i get the future
but you just show the past
except for local player
i predict everything
sending velocities is more of sugar, that you can use to EXTRAPOLATE stuff better
looking at the velocities n stuff
but careful with the terms, predict and extrap have different meanings in networking circles
I don't want extrapolation, i like simulation
I want to build a game with melee mechanics @jade glacier
Buy Quantum ๐
something like mordhau/chivalry
not as much tho
I really think i have control over what i am building ๐ค
Why are you sending velocities, if you are not extrapolating states?
because what if the object bounces back
what you are implement is client side prediction with server authority, server then sends correct state down to client and client extrapolates for remote objects and his own based on his input
from something
@graceful zephyr yes, but extrapolation is archieved by simulation
rocketleague style
doesn't matter how extrapolation is achieved
the only difference between snapshot interpolation and state synchronization is that SI interpolates between two known values, and SS extrapolates based on known values and then uses visual smoothing techniques to hide the prediction error (if any)
you are employing some means to "guess" where things will be, and as such you will need to constantly be resimulating as new info arrives.
no matter it doesn't look smooth and correct in the gif you sent @high night so idk what ur doing ยฏ_(ใ)_/ยฏ
Does State Sync commonly mean that you attempt to align the timeframes? Just so we are all using the same terms @graceful zephyr
that's a different problem, state synchronization generally just refers to syncing full object state + extrapolate
instead of sync smaller object state + interpolate
State Sync to me just always has mean that an authority creates a state, and shares it with others.
that's ~kinda the definition
i mean there isnt any proper terminology defined here really
so
ยฏ_(ใ)_/ยฏ
there isn't an official 'name' for anything
regardless of interp/extrap... but if that is not the case I will revise my terminology usage
yeah, kind of just agreeing here is all
so at least we all are using the same meanings
@graceful zephyr are you saying that because i don't interpolate the last result from prediction?
client sees server update every 15 frames
on both sides
thats probably why
But as fholm is saying... how you predict/extrap the future doesn't so much matter. what matters is that if your model is trying to put the player into the present, it does it by guessing and that requires constant resims
Which I personally think is diving into the deepest end of the pool for a first attempt... but that is me
doing a state transfer every 15 frames is going to be messy regardless. 15 frames in a non-deterministic sim is a lot of frames for things to go off the rails with bad guesses
I'll figure out a way to smooth the last result of prediction and display it, remove visuals and both of the simulations,
and then i think you'll see what i mean
@jade glacier was just trying to show the worst case
Yeah, I would say just go do what you are trying to do. You already have all of our opinions and advice.
15 frames is really low
30 hz network rate is probably minimum for a decent competitive game today
most want 60 if its a few player game
hell my 20k CCU MMO backend targets 20hz minimum
oh wait that was 10 hz
sorry
tick each 15frames is wrong, that makes a different hz value
i send tick every 5 frames
i probably will increase it to 20 hz
are these transforms move inside a 3d grid ? @gleaming prawn
so grid layers ?
What's the latency/loss rates about for that vid? @gleaming prawn Looks in very in agreement
someday I will have time to actually play with Quantum. Its fascinating.
@weak plinth that's a fully 3D KCC working with slopes/steps/surface tangent movement over a Triangle Mesh + Primitives (boxes, etc)
movement input is WASD + Jump
There's also melee attack with that hammer + pickup/drop dynamic bodies in this demo. Just found this video.
This video shows two clients side by side. Let me grab a newer version of this same system on a slightly more interesting setting..:)
you should try a test of max players possible, sending only inputs and let the clients simulate everything should let you get high capacity
I would be most interested to see it handling the uglier edge cases, like missed attack guesses and such.
and you said you cull by distance? so even better
@weak plinth It only sends inputs, its a deterministic system
Player cap is game dependent GCat
We have games live with 32 players on mobile...
we have customers testing with 64 players, which is our hard-cap for current SDK version (lifting to 128 for next one)
It pretty much depends on how fast the game is, how expensive the simulation is, the target hardware min specs, etc
old machine can run 1k moving entities like starcraft
so why not getting near number like that
1k moving entities, as long as you:
- do not rollback at all (RTSs use lockstep)
- run at a somehow slower frame rate (these you mentioned run at 10Hz, or so...)
- use a navigation system designed for many many units (like flow fields)
ah
Maybe you are misunderstanding a basic fact here
RTS are normally 4-6 players
with up to 40k simulated entities, etc
Quantum can be used for these just fine... Although they require some GENRE-specific pieces we're not pursuing due to lack of interest from customer so far (like flow field navigation)
Keep in mind as well that to be deterministic all simulation is fixed point, no floats allowed.
Most customers are leaning towards twitchy gameplay more than strategic
sure, i thought you had culling for the input by player distance, so only send input of players near them let them simulate the stuff, when meet a player from far then send snapshot of their stuff and continue simulation from there
there's no way to cull input on a deterministic system
By definition this is impossible
I'm only half watching this, but seems like @weak plinth you might not be following what Quantum is?
You can only do that on State Transfer systems, not on purely input based deterministic ones
when meet a player from far then send snapshot of their stuff and continue simulation from there That is not a thing in deterministic
k
That is state transfer or snapshot interpolation.
You do not need determinism for that...
And you can't splice that into determinism, the states would be enourmous
I think you can do a state transfer to get caught up as a late joiner though? @gleaming prawn
Or do you just resim all of history?
Determinism gives a lot of OTHER advantages:
- straightforward killcam and full match replays;
- authoritative result validation from input stream (without the need for a live server running the sim);
- testability;
- 100% accurate collision detection + 0-lag physics simulation
fholm said disconnected players can get snapshot of verified frame, so why it would not work also distance based
Yes, Quantum supports full one-time state transfer for Late-Join/Reconnects, both from a buddy client and from the server (in case you are running a live sim there)
i thought the all point is its not traditional lockstep
you dont meet new player every frame
quantum is NOT traditional lockstep
one time
It's predict/rollback
With server authority for input (so you never wait forever)
there are two different things in play with what you are talking about. The ACTUAL state (final and real) requires a complete simulation of all inputs and all entities.
There is the cosmetic side that can do partial sims, for the "guesses" that make up the extrapolation - is my understanding of it @weak plinth
I think you underestimate how complex this whole problem is...:)
40 years of game dev experience pretty much resulted in these basic frameworks: deterministic lockstep, state transfers, snapshotting, deterministic predict/rollback... It's difficult to summarize in one discussion why the small details apply.
you do variations, etc
But for the love of god... people should start with one that is known as a starting point ๐
Quantum is a server based deterministic predict/rollback (on steroids because of all the features we give out of the box from the past few years working on it).
Is there a math library for c# that you can use for deterministic math calculations
Something that has all the operations in unitys Mathf
Something that does all the floating operations in the lowlevel as integer operations i mean
Not that i would use it now but just wondering
My googling didn't get me far on that
That is one of the difficulties @high night
What would be the difficulty?
There's no point in using "determinism" to simulate a partial world when just ONE bullet traversin in could break the whole thing @weak plinth
Why would it be difficult to make a math and physics lib that doesn't use floats?
@high night its not hard https://github.com/SnpM/LockstepFramework/blob/Master/Core/Simulation/Math/FixedMath.cs
that's why you either go full determinism (no need to transfer all the time), or state transfer/snap-inter (transfer frequently)
Oh
I wasn't talking about physics though just for regular Mathf. operations
FP math is public domain
fine erick, just was an idea, got my answer
You can find Q48.16 C# implementations anywhere
@weak plinth thanks
the fixed point math though by itself won't get you far, since you need your simulation to be all FP... which means fixed point physics
it has also physics
download the example and use as is @high night
if you can reduce your sim to all fixed point and ints... then you are golden yeah
hmmm interesting @weak plinth
You WILL need some form of physics, navigation, etc
you say: just do AABB... well, yes...
but it won't work with instant movement like in the quantum example, will have to wait after each click
at least golden until you start dealing with how to make your extrapolation work with constant resims, and the cosmetic mess that creates
Implement that, add a broad phase, add callbacks, add a solver (if you need movement), implement different shapes...
Add raycast and shape queries... HEY you are implementing a physics engine...:)
i see what you mean
will have to wait after each click
That's traditional lockstep, yes
You can cheat and use floats on the cosmetic side.. but they can't infect your states in any way.
Game networking is all about the simulation.... not about the messaging. He writes Quantum with fholm @high night
I'm one of quantum developers
oh, nice
They solve this stuff so we don't have to ๐
aight, enough chit chat. I have my own hacky netcode to complete ๐
and wife wants breakfast.
@weak plinth Is there a lockstep mit lisence framework that includes 3d physics?
This one is 2d physics only
you build rocketleauge like game ?
I haven't completely decided on what kind of game i want to build yet
Something with many 3d rigidbodies though (as many as i can have)
and explosions
you realize you are starting with the most complicated thing of them all, right?
Synchronized physics, 3D...:)
That's one of the "holy grails" of networking
@high night don't worry mate, check this one out https://youtu.be/5__my7uFfvM?t=49
he will release his asset in few days check it out if with will be worth it for your game
this looks cool
hmm, so this is lockstep too?
It probably is
i mean deterministic physics? don't know how it may be archieved
if it's a rollback one without a server, fine for a few game clients probably
i mean deterministic physics? don't know how it may be archieved
You write your own, with FP
he also made a shooter so 99% not deterministic, https://youtu.be/iwXTZyf_8Ak?t=25
and if you get the same results your player won't give a fuck if its deterministic
just to keep on your mind
if it's determinsitic?
By definition you DO get the same results
If it is
Where do you have info this guy will release anything?:)
Hello everyone,
I have been solo developing a networking solution for about six years, I hope this solution disrupts the current market selections we...
talked to him, smart guy
donnu if will deliver but more options for us none networking guys
oh nice
lol im mentioned like 4 times in that thread
This is NOT a determinsitic system
no its not
Funny
No, A lot of time was spent in this area looking at all the other solutions on the AssetStore, I chose a different path for physics. The players will set their Ridged Bodies off the host / server will control all of the physics and or movement.Put your application into headless mode for the server/host not sure what its called now but I remember 4.6 if you know about Fholm more then sure you were around then.
Not deterministic, standard state transfer / snapshot... Cool stuff though
BARGOS was asking for 3D determinsitic physics
yeah
Then you showed this as the solution to him...
i said if to the players it looked synced then it doesn't matter to them if it is deterministic, only to people who love the technical stuff
๐
It doesn't have to... no... But for physics it's normally the simplest way to have it 100% accurate and twitchy
"simplest" if you have a framework, of course
@high night you only want deterministic ?
What I said as this being the holy grail is that networked physics is NEVER simple
then my bad i though you wanted any solution
tbh i wouldn't jump on using some small solution develoepd by one guy on the forums, nothing bad or anything
He wants to do a 3D game with lots of dynamic bodies and explosions, this is networked physics...
Just wanted to know there was such a thing under mit licence and as a small framework
but it's gonna be full of bugs, etc.
note that while both lockstep and predict/rollback are both deterministic, MOST deterministic C# stuff out there will only work for lockstep
which doesn't really work well for an action game
tbh i wouldn't jump on using some small solution develoepd by one guy on the forums, nothing bad or anything
@graceful zephyr heh bolt ?
sure, but bolt was buggy as hell in the start
Yeah...
but sure if you made bolt 2 i would be on it in a second
yes but i already have a proven track record now
This is cool... Something in town to replace Mirror?
true
ยฏ_(ใ)_/ยฏ
don't want to say i'm a fan but i'm, bolt source is like a book
too bad now everything you make belongs to exitgames
Hope it has a proper good approach, and not just asset store mambo jambo for non-programmers
but gotta make a living i guess
Please no more messaging layers. Someone complete a stack already.
He did yet another one, yes
Including this spooky thing: :)
Also I forgot I dont use a window slider for the reliable layer so there is that.. Happy figuring that one out to all networking developers :p
wrapping messaging into RPCs, syncvars etc is fun and all... but its not needed
he will release source so we will find out
under licenses... AFAIK
which I think is 100% fair
So I will NOT see the source...:)
you will hear about it I am sure
but from all that is being said there, it sounds like a variant of HLAPI/MLAPI/Mirror
I'm not opposed to syncvars in theory, but they have to be how I am handling them for SNS, which is tie them to your tick/snapshot engine
having your monoBs spewing out Write()s in a completely undeferred way, is just going to burn people.
What is a "window slider?" @graceful zephyr Something in Unity I completely missed?
i assume he means a sliding window
i.e. what you do with sequence numbers, send window, etc.
that he did reliability without a sliding window... that's not very hard
I somehow have gone this long without ever hearing that term
yep...
not very hard, you trade of bandwidth and do it like ENet?
or you do like we do in quantum for inputs...
Sliding window is just efficient in certain cases...
ahh, is this more transport layer stuff? I am pretty clueless about that stuff.
ah yeah, its relating to reliable UDP... for my systems it has always been ack-less so totally slipped by me.
yeah its related to transport / reliable udp @jade glacier
yup, I did some quick reading on it. Pretty straight forward concept.
Is this channel only for Networking outside of NetCode (DOTS). New to the Discord so trying to see if I should keep all DOTS/ECS related questions in that channel, or go to more specific channels.
All networking code, but there aren't may in here with much working knowledge of DOTS. Never hurts to ask though.
If the question is more about networking theory, this channel will be better - but for DOTS specific questions, prob better to ask there.
It's not that this channel is outside of dots
The fact is that dots networking is not even nearly close to being usable in real production grade games.
Nothing against discuss networking in a dots based approach... It's just not ready as a framework
Most questions in this channel are fielded by Exit peeps. Unity doesn't have any community support people in here - so you are pretty much limited to help from others who are also playing around with Netcode. I think the DOTS chan would tend to yield more answers on that front, just because of the number of active bodies.
๐
Does anyone know if the snapshot interpolation of the Unity dots netcode is reliable? so if i set an bool for only 1 update cycle, will it be received 100%?
120ms second ping and no packet drop
Predictions are 150 ms ahead of servers reliable sim
10hz send tickrate
50hz simulation
Did that smoothing i was talking about, that will be as good as it gets
I assume you are running the misc boxes as non-kinematic and you are applying the same inputs to the player on both there. That should hold together since you aren't dealing with any late/lost user inputs or different machines running the sim. You are basically doing determinism right there.
But the system itself isn't deterministic, so you are going to need to test how that falls apart when your TCP packets logjam and arrive too late
And how it appears on a second client
Ah, so this is now snapshot interp?
or extrap it sounds like
with snapshots every tick, you should be able to get that into a usable state yeah
server state recieved
rollback prediction scene back to servers state
resimulate prediction scene forward for 150ms
set lerp targets to new positions
@jade glacier yes i guess
That is much more sane, seems workable
but theres more
to handle effects
let me put the model to the next level which is a little more complicated
i send inputs, but you dont see their use in this gif
it wouldn't matter if server didn't send inputs, gif would be the same
but heres what they are for
.
server state recieved
rollback scene back to state **before** the state server sent just now
resimulate scene for a tick with servers inputs ****
resimulate scene for another tick with local inputs
total simulation : 300ms
set lerp targets to new positions
If you are extrapolating with them, yeah - they are useful
not extrapolating
similar meaning in this context
at the * * * * part, all the effects, sounds are created that local client didn't know about
I avoid the use of the term predicting because it implies something else in state transfer
but there are no hard defs, so extrap and predict are kind of overlapping in meaning here
yeah sorry about that
you aren't wrong, I just am avoiding using prediction in this context
fixed it
i wont ever need to tell anything about which bullet spawns in which direction
You are going in a Rocket League like direction there
thats the point of all this
if bullet is just an effect i mean
and you are doing hitscans
Generally you shouldn't have to give bullet origins and vectors in any system, they can be inferred by the shooters state yeah
player look is already given in inputs
and its from the server so reliable
see what i'm doing?
The only dicey part is if you are allowed to predict weapon fire
like if the player holding down the fire button = continuous fire
Then you do have to deal with cleaning up a bad prediction that said the player fired, when they have not
i believe with this system i got, all sounds will be delayed by 150ms
i will play the sound immidently on that * * * * line
and wont keep track of it ever again
and wont predict holding down trigger
If you aren't trying to time align your sounds and effects like that, you may as well just trigger the effects as soon as the server state arrives
yes
That may feel a bit odd, but only will know if you try
if player shoots 5 bullets in 5 frames and sends one tick,
all 5 bullets will be spawned in same frame right now
but i might deal with that later
its better if i paced them out a bit
could introduce a delay which depends on which frame of the tick it occured and that would be it
yeah, that just involves making masks and such in your serialization that you use as part of your snapshot mechanism. It will be messy with what you are doing, since your fire effects are all a bit detached from the state consumption.
this is only for detached things
if i have a grenade, it will be a network object
just like a player is
serialable n stuff
but character doing the throw animation will be figured just like effects are in my system
I am having a problem with Photon PUN2: when using InstantiateSceneObject method, the IDs of the instantiated objects are not same across clients....
The call looks like this, and is only called on the master:
GameObject newBot = PhotonNetwork.InstantiateSceneObject(currentPrefab.name, spawnptV3, Quaternion.identity, 0);
Prefab is in Resources folder. Object gets instantiated on both master and client, but view IDs are different, and this is causing other problems. I noticed with the inspector, when running, that the object on the master is NOT owned by Scene, which also seems wrong....why would this be? I wouldn't think it possible to have an object created using InstantiateSceneObject to be owned by anything other than Scene.
I can work around this problem by placing static objects in the scene instead of using InstantiateSceneObject....then I can finally stream messages to change position and what not...but I don't really want to do it this way, it's kind of cumbersome. I have spent days googling for a solution....the closest thing I have found is the Asteroids demo, which seems to work properly using InstantiateSceneObject....but after examining the code, is not apparent what I might be doing differently that is causing InstantiateSceneObject NOT to work.
anyone his a project that i can work on.
@weak plinth I have had occasional issues that actually were just because when I tried to create/join a previous game would still be up and running, and it would be joining that.
You can test for that by changing the app version in PUN's settings and see if it persists
Regardless, if it was that - the problem should vanish after not starting a game for like a minute
but even if it was somehow joining a previous game.....the scene object is spawned in both clients I test when the method is called....so at least the objects are in the same room....
it's just that the ID assigned are different
@stiff ridge Might have some ideas - he is the PUN2 specialist - though he is on Germany time
ok....do you think's OK if I leave a DM for him, asking for help?
or just wait for him to respond here?
He will notice it when he is on next
best to keep it public, so others who are doing this stuff might see it.
I personally ignore most PMs for that reason, not to be rude, but because the whole point of the pub chans is everyone can see and contribute to convos.
Like I would like to see what he has to say.
ok, thanks for the advice!
Hi I need an advice for a game ive been developing for a couple years now
Ive been wanting make my game dedicated, but gamelift is not compatible, so I dont know much ๐ฆ Im really confused, ive been really demotivated since then
If someone can guide me I would appreciate it a lot, Ive been off the game for a couple months, and I really wanna come back.
What is the question you have?
it sounds like he wants to set up a dedicated server
@gleaming prawn yes I want to setup a dedicated server but im a solo dev and im pretty lost, it works pretty well with photon PUN, but to switch to dedicated servers i need guidance
I want to know what is better for my game, i tried gamelift but its not supported with the unity version so thats not gonna work
probably best if you just set up your own sockets
sockets?
sorry im very bad at networking
i was lucky enough to setup photon, i know what rpcs are and photon related stuff other than that im clueless
If you use photon, why do you need dedicated servers?
I mean, if you are using photon bolt, than it would make sense
But I assume you wrote the game with pun, in that case it doesn't make much sense to try to run a pun client as a dedicated server, it would be wrong in many levels. Primarily the clients would always use photon relays and that would make things bad for no reason.
But you said yourself: I'm bad at networking... It's difficult, to say the least, to develop a multiplayer game without that.
Try to ask a very specific question, maybe someone can help
@lost herald you might look at tom weilands stuff on YT
In this first part of my C# networking tutorial series, we set up a TCP connection between a dedicated server and a Unity client.
If you get stuck or have questions, ask them on my Discord server: https://tomweiland.net/discord
Kevin Kaymak's channel: https://www.youtube.com...
@weak plinth : Are you around?
I would have to test but by all means, the IDs should be the same. As only the master client should be able to use InstantiateSceneObject, it's not a case where you call it on all clients alike.
I think we'd have to take a look at a repro.
I noticed with the inspector, when running, that the object on the master is NOT owned by Scene, which also seems wrong.
This is likely a confusion by the inspector. Each networked object is controlled by some player. Including scene objects. The master client typically controls scene objects and maybe the editor then shows it as "mine".
Make sure the prefab you instantiate is referenced correctly or in a Resources folder.
In doubt, I would check the prefab's PhotonView. Remove it and add a replacement, if you think anything could be "stuck".
Or: Use a new, very simple prefab with just a PhotonView on it to test with.
For me, the viewID is matching...
@gaunt zealot What do u think about Photon Server?
Im probably just gonna hire someone to do the multiplayer stuff for me
Is there a specific reason why you want dedicated servers? What are the benefits you need?
By the looks of this, Photon Bolt might be best suited. Dedicated matchmaking servers but players host matches in Unity and others connect directly.
Great features for shooters.
A steeper learning curve than PUN but also more powerful.
@stiff ridge but what about hacking
I really enjoyed using PUN back in the PUN1 days..... but the relay server adds too much additional latency
so instead of figuring out some solution
I decided fuck multiplayer
and my lifes been better since
๐
@lost herald : In Photon Bolt, one client is authoritative. It can be hacked, for sure, but you can gradually make it harder.
@lost herald Photon Bols is as authoritative/hack-proof as a tool can be...
You can host dedicated servers (unity headless instance) or one of the players can be the authoritative listen server
Anyone willing to answer a quick question about PUN2 and how to make a damage RPC ?
If the shooter is the one you are giving damage authority and you are not making any anti-hacking attempts - the shooter would message the target' object on the owners saying "I hit you"... that owned version of the target would modify its health accordingly, and the health system would broadcast that to all. @wanton scroll
Any Firebase Users?
thanks @stiff ridge .... prefab is in the resources folder, as I already mentioned....I think I will have to make a small test project that exercises this issue, and if it continues to have the same problem, I will post the code somewhere for you. About the inspector: everywhere else i checked, including the Asteroids demo, showed the owner for scene objects as 'Scene', even for the master client. Only in my project, where the IDs are not matching, did one of the owners not say 'Scene'.
That's usually the ideal, if you can make a small repo that causes the problem, makes it super easy to either find the bug in your code or in the library. @weak plinth
hello, i'm try to map vector2 to an int. then i have a little problem at my code that i cant debug it! please check this 3 files and help me
the [test]s file
and the test results
i have 0.3 error. whos can help me? (if you want to check code, please open tests file first. because there is some other functions at "GridCalculator.cs", that not used at [test]s file.)
at next level, it is vector compression, to send vectors over network.
sry ,test fail when x ~= 99.9f
can you just make use of vector3int for all of your simulation and never let it go to float? @urban jackal
@jade glacier but cant i just host a dedicated server to it then? so nobody has authority of damage and health
post your code btw using like hatebin.com, rather than posting files that need downloading
There is no dedicated server with PUN2, unless you are making plugins for the relay
PUN2 is a bit different from most of the libs, in that its relay based. The server is just a message conduit between clients. It doesn't host any game logic.
Assuming you are still talking about PUN2 and not Bolt now? @lost herald
ah, then disregard that answer
For Bolt that is the expectation, that you will be coding it all as server authority. Most of what Bolt is based on making server authority work. Its architecture is the same as CS:GO
I missed earlier discussion though, so I don't think I know your actual question @lost herald
I already have a multiplayer game running client hosted with PUN 2 but its very unsafe to release since client hosted has bring lots of issues like hacking, delay etc depending on the host so Im looking for a solution if I should switch to Photon Bolt or try Gamelift but gamelift is uncompatible with my unity version
so Im very lost now
Ik the basics of PUN 2 and stuff but for dedicated server im lost
its battle royale like game with loads of action and like 20 players
If its in Bolt you should be able to just host it on a game hosting service that lets you host Unity game instances. I don't know what those are, but they definitely exist.
PUN2 won't be an option, since you are that far along with Bolt. Changing libraries this late in the game is hard enough, but you are talking about leaving Bolt - which is the most complete HLAPI there is for this stuff, so you would end up having to completely rearchitecture your game when giving that up.
Anyone in the Bolt discord able to give any tips on how to host?
Ooooh, thought you were saying you already were in Bolt.
Totally different animals. Bolt is a complete Server Auth statck, so it does a lot more for you... but also restricts you a lot more.
I would give yourself a few days to go make a tutorial with it and just see if it seems like a fit.
If i may butt in, your client and server should be able to be ported into anything. If you are making your own network solution
If they are built currently for a client authority model with relay servers, its going to be quite a bit of work to move to Bolt.
Bolt wants to take over your controllers and physics in order to provide rewind and resim, so its more than just changing the messaging layer, its switching from any handling for desync from your own rolled stuff to Bolt's
Probably why making your actual game being completely separate from the networking api is an importance
Takes a lot of work to change the actual code instead of using an interface
Fo sho, or fully committing to your HLAPI, which means really being sure its going to not fail you down the line.
You don't port away from Bolt, but its has a lot of proper shipped titles and is trusted... so as long as what it does matches your needs - worth getting entangled.
I mean HLAPIs in general
Right..
stacks that force you to hard code to them
though ironically HLAPI is not a HLAPI
its just a messaging layer
Bolt was made by a guy i looked up to when learning networking so investing your project in that i wouldnt disagree with fo sho
its fholm, he works on Quantum now. Is active in this channel
Ah gotcha, i thought UNET was the hlapi
Oh hes still active?
@graceful zephyr hemlo
They called the transport LLAPI, and then misnamed the next layer HLAPI... I think expecting to one day make it a complete stack. They never did.
Rip
very active, have no not talked to him in here many times?
Unity didnt have some insane network devs did they, i dont even know of the ones there now
He and Erick were pretty much most of the channel convo this AM
I think its time zones preventing me from ever seeing him online
The issue is that HLAPI, PUN2, Mirror, Forge, MLAPI try to complete the stack, but since they have no simulation/state/input control they really are just messaging layers.
Commands/RPCS/Syncvars are nice wrappers for new users to not get buried in the serialization process. And the assigning and managing NetObj Ids is nice... but they all avoid the actually hard work of simulation.
I remember when i was fucking with syncvar and got SO confused
Which is also why they are pretty interchangable and abstractable
Syncvars are troublesome because of the timing mechanisms of the libraries. They write to the message buffer adhoc, with no handling for deferment or tick alignment or deterministic order.
So for complex games that try to make MP with those things, they tend to get buried in race condition hell.
Thats what i went through
yeah, its unavoidable
that and without it being tick based... good luck getting a smooth interpolation of anything every happening
proper networking is about creating a very strict simulation, with very strict division of timings
It made me so mad because i didnt identify the problem immediately