#archived-networking
1 messages Β· Page 83 of 1
any suggestion on playfab or gamesparks and why people are instead approaching pun / miror more
PUN isn't authoritive at all and perhaps one of the easiest networking solutions for beginners
I never tried mirror so can't say anything about that
what would you suggest if i wanna get into sever based games like dedicated server handling all game logic
any DIY for that
becase i dont really feel pun and mirror will help in a long run
There are but I'm not sure that you're ready for that task yet and it's going to be frustrating
It requires you've done quite some research already before you can try to make something useful
I'm using an 'easy' option but it also means I have to do almost everything myself
If you're interested to find out, look into ENet
i am willing to do the dirty work if it helps in long run
How much experience do you have with networking and programming in general
networking not much that is why i am willing to learn it but with programming lets say 5 years
You at least need to have good programming knowledge
i know c, c++, c# , python pretty well
weak networking guy u can say
xd
thought i have made games with firebase and unity
That'll help though, but networking is something really specific so it's not something you can just do on intuition
tbh i have my game down so if i can get my hands on a part where i can have dedicated server and i can use them for my game , it would be really good
i am willing to learn
i think networking may be the only part putting me down as a programmer hence i wanna get that up
You can, if you think you can learn a new framework that doesn't have so much documentation but you know how to use the few simple mechanisms
I haven't found any simpler option than ENet yet, that's why I like it so much
Tip #1 to design networked games:
- it's about how you control the simulation, not about how you send data
i have always wondered how these games like fall guys, among us store data in networking scenarios
knowldege on that would be damn returning\
Start thinking how you would design a synced mechanism so all machines are "aware" of a "tick", and everyone simulates around that tick.... and everything you send/reconciliate is tied to that tick rate
With ENet you don't worry about how to send data, that;s what the framework does for you. You worry about your packet structures and your networkingloop
Among Us is RELAY, it's a DIY version of something like PUN
networkingloop
That's the ticker... But it's more than just networking
It should drive how the simulation runs
I can't say about the other tools that I'm not familiar with, but these from us use this principle:
- Photon Bolt
- Photon Quantum
- SNS (PUN2 add on by @jade glacier )
If you want to try ENet, you can use either C# or C/C++ with it so that is nice, and it's very lightweight as well
is it scalable?
Yes
also, is among us server based or client based?
Because of its simplicity and being very lightweight on memory there's a lot of room to scale
A guy made a video using DOTs and ENet with a simulation running 5000 clients or so
That's pretty decent for a single server instance
Yeah but just to give an idea of what's possible
It's in general not the networkinglibrary that is the problem, more like how you handle your business with it
just for the sake of networking i have even thought of switching to unreal engine
unity feels like beta
DOTS is in preview, not complete, not in a usable state right now... Cool to learn though
in this sector
Don't rely on built in networkingsolutions
Depends on what you plan...
Don't rely on built in networkingsolutions
You mean Unity's?
For example, great example as well π
The new one has good foundations, but like everything dots... Not interesting at all yet
Multiplay is just server hosting
My point is, the engine makers are focused on offering features, not really specializing in some specific field like networking so I'd rather get a solution made by people who put all their time in the product they work on
Nothing to do with networking SDK
Swanson. the UE networking is decent (not perfect, but decent)
Maybe you're right and I wouldn't doubt your word on that
also, why dont people here suggest playfab or gamesparks?
I never tried UE it doesn't even run on my hardware
But to choose an engine just because of the networkingsolution is also bit strange to me
playfrab or gamesparks?
We do suggest that, but that is NOT networking SDK
These are player-profile DB services
Playfab is decent, and has been a favorite choice by most of our customrs.
You can also run your own solutions, etc
But they are NOT a networking SDK... They have some very RUDIMENTARY tools in that direction.
You mean it's for stuff like scoreboards etc?
But nothing beyond the very very basics, so not really useful for that purpose (runtime networked gameplay)
they provde live environemtns right?
Yes
they provde live environemtns right?
Ye, good for running matchmaking, etc
It's NOT designed/targeted to realtime gameplay
I'll list all providers I know of that actually give you something related to realtime networking (no judment on quality, featureset, etc). And I might forget a few, but here we go:
- photon (several products: quantum, bolt, pun, realtime, server), mirror, mlapi, darkrift, forge, normcore, spatial-os/improbable, coherence, Steam (they have a p2p punch+relay fallback service), XBox (teredo p2p punch+relay fallback), Nintendo (also p2p punch+relay fallback), and afaik sony also offers something (forgot)
These are the usual SDKs/services people discuss here + dots
official dots + coherence are very very preview/alpha, and afaik have nothing released with their stuff
all the others have games released with
Isn't darkrift only TCP or is that something from the past?
I think I once ticked that one off the list because of that reason
is steam worth looking into? i think they have a lot of add on and customisation
multiplay or gamlift are HOSTING services (you write the game with something like bolt, mirror, and run dedicated servers in these services)
since most indie would be releasing on steam
Isn't darkrift only TCP or is that something from the past?
As I said, I did not judge anything... Just listing the SDKs which are related to realtime (that I remember of)
is steam worth looking into? i think they have a lot of add on and customisation
It's VERY barebones... Very, really vera
Wasn't asking for judgement just a yes/no π
- it just gives you a trabsport layer + invite system
Wasn't asking for judgement just a yes/no π
Yes or no depends on WHAT you want to do
For example a shooter or racing game, not just a point and click
any database you would suggest along with these sdk u just mentioned , it may even influnce the choice of sdk
For example a shooter or racing game, not just a point and click
Then, NO
having a streamline process would be far better than hooking up a lot of stuff here and there
any database you would suggest along with these sdk u just mentioned , it may even influnce the choice of sdk
It should NOT influence the choice of realtime SDK, these are completely separate problems
DarkRift is using UDP and TCP for unreliable / reliable transfers
I'm using SQLite for database
That does not say anything... It might be just a premature choice
I mean, do you have a clear separation of what you need a DB for?
Yeah you're right maybe it is
Made the choice purely for sake of convenience, easy to set up and just run SQL commands I'm already familiar with
DBs are used for storing:
- player data (profile, achievements, owned item IDs)
- match history (your runtime SDK/service might STORE data here, but they are not directly related)
do u have a sign up process if yes how do u link them w player profiles @shut yarrow
Yes I do
Made the choice purely for sake of convenience, easy to set up and just run SQL commands I'm already familiar with
Storing gameplay/player/match data is a lot more than this...
Player registers and gets saved in a database, then he can login and I'll retrieve his/her information
do u have an identifier for that player like a unique id
Yes
Just take player signup/athentication for example:
- most services (like ours) let you plugin any custom authentication to allow plyers connect to the realtime network... you just provide a REST URL with some conventions
but again, this is just <5% of what you need for a multiplayer game
π
if you want to create an online multiplayer game, forget a bit about storage, player profiles, etc, these are "orthogonal" requirements...
Changing to other SQL based database isn't an issue for me though, for now this is sufficient for me
Exactly my point π
The choice of database is just not related/relevant to the runtime multiplayer part... that's my only argument...:)
But again it depends on your ambitions
oh okay thanks for the pointers , could u suggest some source materials to get into these newokring process @gleaming prawn i am not that great w networking
[about DB storage] If you plan to release a game for real, and make money out of it... you either:
- use existing services like playfabs
- (after a lot of experience) write your own that will be cheaper (but really really after you learn A LOT by releasing other games using services like above).
This is the road taken by developers I know
by source materials i mean somehting that can really explain the process that goes in between gameflow, signup-> gets registered-> calls to db with indentifier-> created profile something on this line
could u suggest some source materials
I suggest you start with a game that is easier to network than a shooter or a racing games (these are both challenging).
i would prefer doing an asynchronous game than live game
Then go to youtube and watch tutorials about Pun/Mirror, whatever you fancy
I think that's what Erick was talking about before, those are secundary subjects
Will be difficult to find an all encompassing guide
i would prefer doing an asynchronous game than live game
Then you do not need per se any of the above
And not practical either
BUT, still
it's all about the SIMULATION, not how you send data
for an async game you need:
- a way to store the full game state
- the game state must be compact (so it's cheap to send/receive)
- the clients must be able to recreate the whole View/UI from a snapshot of the game state
- simulating the turn/command on a server (or using determinism) will be important in this case)
- simulating the turn/command on a server (or using determinism) will be important in this case)
@gleaming prawn
so this is my concern, it has t be server authoritative right?
maybe a dedicated server that handles these game states and assigns lobbies
That's a world of pain I'm not willing to undertake yet
I'm trying to make it semi authoritive cause I just want to make something that is fun to play, then see how popular it will be and if it;s even worth doing all that effort
So no server side physics, or server giving permission you can move/shoot whatever
it has t be server authoritative right?
If you use determinism, NO
I'm trying to make it semi authoritive cause I just want to make something that is fun to play, then see how popular it will be and if it;s even worth doing all that effort
THIS
idk what determinism is and in what context
I can't say better than this...
I know gameservers with 1000 players and they don't even have full authoritive model
That's the spirit IMHO Swanson
It's important for them to have actual admins to keep it fun and fair
I know gameservers with 1000 players and they don't even have full authoritive model
Among Us is an example...:)
I play a lot of san andreas multiplayer
make a fun game...
Yeah indeed that is the top priority
It might sound weird but I'd love to see people cheat, then I know I'm on to something good
Nobody's going to care to cheat in a game that has 3 players
But yeah main point is, it is difficult to do it right (what is right anyway?) and if you can get away with cutting corners then do so
Anyway I need to sleep thanks for the nice talk and hope you both have a good day. Good luck with your decision @spring valley
built in networking can be great, just not UNET!
Hello
This triggers only 1 time
even i have 2 players
even with 3 players, still same
Pretty sure OnJoinedRoom is just for the local player
And OnPlayerEnteredRoom in IInRoomCallbacks is used when another player enters the room
I'm assuming you are using pun
Is the class inherting from MonoBehaviourPunCallbacks or do you just implement the callback interfaces?
That's what the method signature looks like
I'm so new to Photon, i'm probably using the second thing
I do not have experience in PUN
What is difference between Photon RealTime and Photon PUN
My application is using Photon RealTime
I'm new to Photon
Realtime: just the base transport layer SDK
Pun: simple state transfer for Unity (built on top of realtime)
For the app ID, it won't make a diffference, as both use the same relay servers and protocol...
If it was a Quantum App ID, then this would be important (because there's server logic going on)
Thanks!
While using Unity.Netcode, if I have a ghost object spawned on the server and then mirrored to clients, the material flickers... no other objects in the scene do this... any insight?
I would ping the DOTS channel with netcode questions. Few in networking really use Netcode at the moment, since its still preview. @honest spindle
π thanks!
why cant i find NetworkManager anywhere?
Unet has been long deprecated @analog python
ok then how do i do multiplayer
Mirror and Pun2 are the most common starting points for people learning networking.
@jade glacier im trying to use Mirror; but it is not working
Be specific.
You can join their discord to get some help.
using Mirror; and get The type or namespace 'Mirror' could not be found (are you missing a using directive or an assembly reference?)
Ok learn C# first.
i do know what the error means but i dont know how to fix
Likely you have/had errors in the log before installing.
And it can't run the script that adds defines in unity.
ok installing rn
You are joking right?
no i am sorta new to unity
Did you not install the library you were trying to use?
no
plus i have never added extra things to projects before from that place
Again. You are in way over your head here. Too soon to be trying game networking.
Make a few complete single player games before subjecting yourself to networking. Installing is the easy part. This only is going to get much much harder if you are new to unity.
Networking makes everything 4x harder. Stop. Make simple games. Learn Unity. Then maybe.
so question. how do i go about multiplayer in 2020?.... i know the hlapi unet and llapi are deprecated and we've moved to multiplay. How does a small developer in 2020 get started with this without having to 'contact us'
so question. how do i go about multiplayer in 2020?.... i know the hlapi unet and llapi are deprecated and we've moved to multiplay. How does a small developer in 2020 get started with this without having to 'contact us'
@lime lance try mirror which is basically enhanced unet or Photon
thanks
np
Yeah mirror looks really promessing
what
mirror is "enhanced" photon?
mirror is an evolution of UNET, it has nothing to do with photon >_<
my god.
Everything is on a numbered tick, and that is basically simulation ticks.
A simulation consists of Prev State + Applied Inputs = New State
So standard FPS handling is players collect inputs for the next tick locally, and apply them to their character for that tick, but also send them to the server. The server applies them and broadcasts it's State result for all objects.
The predicting client compares its history of results for that tick with the server's results when they arrive, and if they mismatched there is a desync.
When there is a desync, the client must rewind the simulation to the point of disagreement, apply the server state, and resimulate forward again, using the history of inputs.
The server aligns all players incoming ticks to its simulation numbering
Simulates them all at once, and extrapolates any that didn't arrive in time
Then sends out its results with the tick number
They may have done something like that, but that is also very old tech now
Not sure how that kind of system would be sane to rewind, lerp, etc
can you paste the line of text that seems to suggest that?
That is not a standard server authority practice, but time based can be done - at the cost of complexity and more CPU usage for the server.
I guess first question is who is this author, and what game have the produced with the system they are proposing?
You can do just about anything you can think of in networking. If you are willing to deal with the complexity and overhead involved in what is suggested here, it is doable.
It isn't typical, but it is doable.
Determinism goes right out the window, so you will be leaning heavily on brute force for most everything.
I see all of the points I am making are right there in that same doc
More cpu drain, more complexity, more hacks
Source may well have, Counterstrike and such are fully non-deterministic and have super basic simulations
The article seems to touch all of the pitfalls and perks... so I may have missed what your original question was.
Another alternative route since its a simplistic simulation is to run the simulation at an insanely high rate. You can then drop sent inputs as needed to let the server extrapolate them and such.
To be clear, this type of thing is very specifically tuned for fast FPS shooters. If that is what you are making, by all means give it a whirl.
In that case though, you still wouldn't be sending "time", you would still be quantizing actions to a tick on the client... just the ticks happen so quick and often that they won't feel like they contribute to input lag.
Input lag with a fixed tick system would come from a low sim rate... since to keep things sane you would not apply weapon fire, jumps, etc immediately, you would apply them on the next simulation tick, so that they are in perfect agreement with any movement code.
You can fire shots between ticks, but to keep that sane with your sync, you have to start really getting meticulous with your lerping code and such.
If you have a lot of world entities and AI.. I would forget what you just read on that blog immediately π
If your server has to run a giant simulation, you want your players to be part of that. Making them move outside of that is just more work for your physics/sim engine, and is going to create all kinds of uncertainty about where things are/were.
No harm in experimenting with any/all of this - but I would NOT try to implement that into a project that has to go live without a lot of proof of concept tests preceding it.
We might be discussing different things
That snippet looks like fixed tick
That will make for some interesting rewind and resync code
It well may be a bit more squishy with it's ticks like that. It is a relatively old net engine, and the requirements may have allowed for that.
It may be that they didn't count on rock solid timing from PCs. Or they did that too allow for offtick events. I'm not sure.
Give it a shot. Just be aware of the complexities that come with it.
Rewind and resim will be significantly more complex to implement.
anyone else getting an SSL Connection Failed rn? My traffic monitor is telling me the remote certificate is invalid, not sure if its a problem on my side or theirs
I'm having a tough time doing something I perceived as simple: syncing player metadata with Photon PUN. All I want to do is add an ID to the player, just as it has a Nickname. I tried using photonView.Owner.SetCustomProperties but either I'm doing it wrong or it's not how it should be used... Does anyone know how to do this? Or have a link that shows how to do this..? I found a serialize solution but that runs very often, and I only want to set it once. I could ofc do a check to see if the value changed and if so add it but it just feels like a lot of work for 1 id, so it's probably dumb.
player properties are normally a good way to do that
can you post a specific technical question on why you think it's not working?
If you follow the manual and set custom player properties, the other game clients will receive the on properties-changed callback, etc
After joining a channel I do: photonView.Owner.SetCustomProperties(new Hashtable {{ "videoUid", uid }});
Which seems to work. But then doing photonView.Owner.CustomProperties["uid"] doesn't because photonView is null.
After joining a channel
You mean a room? Channels are a concept of photon chat, so I'm double checking you are not confusing things
in which machine?
you can only do that from scripts that are place in game objects that have a photonView
I meant a channel, but it's specific to some other part of my app
lol
Yeah, no that part I know
Well... if you have a null pointer, clearly there's some mistake in the game object setup, or something like that.
It's a convenience method to help me get it, which is why I don't get it. It's on my Character which is on the prefab that has the photonview
Maybe you should join Photon's discord
They have a discord?
I could only find their retro forum
Oh cool...
post the question there, someone will answer you
add some code... The approach itself is good
Does anyone know how to redirect internet traffic in AWS that is going to an EC2 instance over to an internal IP URL for a webapp running on that instance?
can someone tell me why photon only works in development builds? is there a fix?
@wheat zodiac not sure what you mean
are you saying you want host.example.com to resolve to 127.0.0.1 instead of 54.x.x.x for a process running in an ec2 instance?
or are you saying you want https://host.example.com/path to be answered by http://localhost:8080/
use traefik
does unity have play with multiple different game session window like in unreal engine?
you can open multiple copies of the editor using symlinks to the Assets folder
Hello guys. I'm working on a WebGL archiviz application on Unity right now and I'm using the addressables system to help me optimize the loading size of the app, since it will have a lot of assets for the furnitures. So I'd like to ask if creating the group bundles with remote build path and remote load path will automatically separate the assets from the build and thus fasten the load time, or do I still have to manually indicate to unity that those assets shouldn't be included within the build? Thanks in advance
Look into addressables, I'd say. That said: Wrong channel?!
Sorry I didn't know in which channel to askπ This seemed the most appropriate for me haha
how do i persist network state between differnt scenes whilst using photon?
eg ; if i created a room in scene A but right after that my game is in scene 2 that i want the host to go to , how would that happen, as right now i get a null refernce excep pointing towards photonclient when i try to access name of room in scene 2
Probably Custom Properties are what you are looking for? @spring valley
are you changing from the master server to the game server though when you change scenes? Or just changing scenes mid game?
Be careful to use specific networking terms... phrases like "the host to go to" can mean a lot of things.
People usually use Custom Properties for that. They aren't the most efficient (they transmit and store as strings), but if it isn't a high traffic value that should do the trick.
What do you mean by high traffic value
Gets changed often
It's usually just the network object right ?
like if its a player position, that would be a terrible use case.
Could u gimme an example on why would we carry on same coordinates between 2 scenes?
Not sure what that use case consists of. But I would look into Custom Properties and see if they fit what you are trying to do.
How do we achieve the custom properties?
I would start here:
https://doc.photonengine.com/en-us/pun/v2/gameplay/synchronization-and-state#custom_properties
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!
help my bullets are not killing other players even tho everything is done right
it works if i place a fake player in the scene
sure everything is done right? π
well no, maybe i am spawning them wrong?
but idk
if i place a fake player in the scene and shoot it dies
Yeah, sounds like you have a bug there
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using Photon.Realtime;
public class KilledMultiplayer : MonoBehaviourPunCallbacks {
public Vector3[] spawnPositions;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
public void OnTriggerEnter(Collider other)
{
if (!photonView.IsMine)
{
return;
}
if ((other.tag == "enemybullet") || (other.tag == "grenade") || (other.tag == "grenadesandbox"))
{
transform.position = spawnPositions[Random.Range(0, spawnPositions.Length - 0)];
}
}
}
heres my script (the bullets have enemybullet tag on them) ^
I don't see any networking there
I would start by completing to Getting Started tutorial
I don't know what this script is trying to do that would be networked.
"KilledMultiplayer" doesn't really give much of a hint of what the object is
You don't really even have a starting point here, I would have to walk through the entire process of working out what your projectile is, how it is identified on the network, who has authority over it, and how it interacts with objects (though that part looks like with tags)
Someone else will have to help you, that is WAY more topic than I can give a quick answer on
uh ok
spawnPositions.Length - 0 you sure this shouldn't be spawnPositions.Length - 1 ?
my bullet just goes through the other player and nothing happens
take it to #π»βcode-beginner
this does seem like more of a coding question
dont wanna flood here
It's funny, I had what I thought was a coding question and got sent here π
I'm looking for some help on photon webooks. I'm a complete unity noob, but I do have a working chat application that hits my BaseURL when someone signs in, although I'm completely lost on how to pass it anything other than hard coded parameters. Has anyone used photon webhooks before? I have some specific questions and I don't want to flood if no one has any idea what I'm talking about
The very short version is that I don't understand how to configure PathPublishMessage. The documentation doesn't explain what the term means or what a possible value could be
Can someone tell me where these webflags are actually set? https://doc-api.photonengine.com/en/pun/v2/class_photon_1_1_realtime_1_1_web_flags.html
I see the settings, but don't know where to add the flag
anyone use mirror and know how to make a gameobject only visible to the client it was generated on?
I never used Mirror but I suspect you shouldn't use functions in that framework to instantiate objects, instead use the regular Instantiate function
someone on the Mirror discord helped me sort it out. had to do with checking if (isLocalPlayer)
That is typically the incorrect answer, it just works in simple games. hasAuthority and IsLocalPlayer get confused regularly. @lucid sable
Be sure to know the difference when using Unet or Mirror
has authority has to do with whether or not whatever is doing something has authority, whereas islocalplayer is whether it is the local player
I only wanted it drawn for the local player, so I told it if (!isLocalPlayer) return in LateUpdate()
If it only applies to the Local Player object then should be fine.
yeah. it's a field of view/fog of war type deal
server doesn't need to know what the visible area of the player is I wouldn't think
at least I can't think of a situation off the top of my head
I'm not fully following your questions, but sounds like you have it sorted.
https://ncase.me/sight-and-light/ scroll down a bit and mouse over
like that
but yeah I've got it sorted
Can I just share I've rewritten my server with C++ and now memory use is stable and about 9 times less as with C#? π
I love C# but managing memory is such a pain in the back, for some reason I can't keep a stable memory use and it just keeps growing overtime, regardless of manually calling garbage collector
For example in C# the server used about 10 MB after starting, and after 2 days sitting idle it was 40 MB. With C++ after 2 days it's still around 1MB
Still need to figure out for my clients if they have this issue when being connected for longer periods, I suspect it's less of an issue because they deal with a lot less data than the server but having that sorted would be nice
You can make a memory allocator of your own in C# without having to go through that mess.
Please enlighten me. I've done something fairly simple with a wrapper around the MemoryStream class which returns stream.ToArray() each time and I feel like that could be a problem because it just creates new arrays all the time that the garbage collector (in theory) has to pick up on
yeah, that is what ToArray does
Ideally I'd have a single buffer and write my stuff to it and just reuse it but I find that a terrible workflow in C#
Which networking library?
ENet
It has a C# wrapper which I use for the client and I use the native library for the server
No clue on that front, because you need to send it an arraysegment<byte> or a byte[] and a length
Depends on what the library can take, hopefully they have a buffer and length type available to you.
I think the library itself isn't causing the problem, it's me messing it up
You have to look into the enet API for ways to pass data
It returns you a byte array from the native library, I copy that to another buffer, then call a method which disposes of the data in the native library
No, you need a way to get a byte[] to it that is the wrong size, and a way to tell it how much of that to use.
If it only accepts a perfectly sized byte[], you will have to allocate.
But I suspect that is accepts different types of objects and wrappers.
Well it tells me how many bytes are in the buffer though
Does it let you tell it what byte to start reading from and how many bytes to read?
Send(byte[] buffer, int offset, int bytes)
something along those lines
I suspect it just uses a single internal buffer and it fills it, then returns you a pointer to it with the length of the data
But the wrapper takes care of the intrinsics, I'm just consuming some simple interface calls
I have nothing to tell you, other than you have to look at the enet API and see if there is a way to send a buffer with size info.
It gives me info on size
Hopefully it has an overload or a method that accepts a buffer and some size info
you are misunderstanding I think then
you don't want a buffer size from it... you want to GIVE it a buffer size.
On the read side, it gets more complicated
unless it gives you a nonalloc method, its likely going to allocate a byte[] that is the exact size as the data that was in the packet.
I think I can actually set the internal buffer size but I think that's not the issue
Either way, you have to see what the API gives you for send and rcv... if it lacks nonalloc options, you will have to modify enet to have them.
I think all the serialization/deserialization what I'm doing is doing a number on the garbage
I have no idea.. without the API in front of me. All I can say is check the API for nonalloc options.
It does have a way to assign a custom allocator, haven't looked into that though
If you can give it a non-alloc, you would want to send your backing byte[] from your MemoryStream
and a bytecount
But it seems to dispose fine of the data it receives, the problem is on how I do things with my data after it is received
Not sure if MemoryStream will give you a ref to its backing data though
Not sure either, I only know of the ToArray() function
Thanks I need to look into that then, hopefully that saves me from having to allocate new arrays each time and just use whatever already exists
So if you just send that, you will be sending a bunch of garbage.
Ah that's not good
I feel like constantly fighting with C# to get it to behave nicely and not waste my memory -_-
Yup, that is the tradeoff with managed languages
I can get away with doing server in C++ but for the client it's not an option
I will look into the custom allocator options and that GetBuffer function
well. it is actually... the guys from uMMORPG have a transporter that add a guy in the middle, probably in c++ which actually does the server communication
so the c# client communicate with the c++ client, and the c++ communicates with the server
I doubt Vis2k is doing anything like that in C++
So you mean the client does interop with a C++ plugin?
I totally want to prevent having to write all that myself π
What kind of game are you doing that is driving this much complexity?
I'm using this wrapper because the guy who made it put a lot of time in it already and he knows better than me how to do these type of things
I'm pretty happy with it actually, it is not the cause of my memory problems
There's more sources to get it from, but I got mine from NXRightHere on github
if its NX's, it for sure has proper methods
He made changes to the original C library so it's easier to wrap in a C# assembly
just use the GetBuffer, and pass it that and the used byte count
sorry, maybe i misunderstood what booster was about
Not sure what he offers on the read side, I haven't looked at his enet implementation, or if it has a nonalloc method to use.
Are you on his discord server? @shut yarrow
No I didn't even know he had one
But again, I'm quite sure my problems have to do with my lack of understanding how to manage memory in C#, it's not the wrapper that I'm using
I find that heaps easier with C++ because it's kind of how the entire language was intended to used, to do it yourself and then get a crash on the simplest of things if you mess up π
And surprisingly enough no crashes yet, no memory leaks yet
mixing your C++ and C# like that wouldn't be the path I would take.
Just no idea what to do for the client, other than take your advice and look into th GetBuffer method
The reason he made a C# version is so that you could keep everything right inside of Unity without passing between libraries like that.
It's not really mixed though, it's only on the server
If you can manage the complexity, go for it.
Server uses the same library, but not the wrapper, just the native
Very little right now
No not just a relay but does very little as of yet than passing through messages
Just focusing now on making it as stable as I possibly can and also very simple to extend my future plans
Server receives packets, reads them, then calls a callback in a GameMode class which I use to do all game logic
I don't find this too complex, it's actually fairly simple
I'd dare say simpler than in C# π
Some things are little bit different, but the big advantage is I'm not fighting to keep memory use low and stable
Other than that it's exactly the same structure as the server I did in C#
Using the same library, but instead of the wrapper that interops with the native libary, I use the native library directly
If you look at the github you'll see how little documentation ENet has, because there's isn't much to it from a consumer's point of view
The wrapper uses a little less code to set up a server or a client because a lot is abstracted away, but using it is not that much different in practice
It likely matches the C+ api
Yes it does
Is unity network free?
what do you mean by Unity Networking? Unity has NO working library to offer for multiplayer... You need to use tools like Photon, Mirror, etc
And what do you mean by free?
That downloading and using the lib is free of charge, sure a few are... But that you will pay nothing to have a multiplayer game running, no so... You need to pay for servers (or at least relaying servers), unless you are doing just a LAN game.
PUN is free until a certain amount of users
Yes, but that's only enough for development or if you are doing something like a school project
Same goes for normcore, and other production-ready services
If it is more then a personal project or school project just pull the wallet
Easy as that
yep
That's why I asked what he meant by "free"
Free is deceiving... There's no such thing
We make large network based games and we use PUN
I work at Photon
I'm being super clear
Mike?
Yeah
Great guy
I learned a shit ton from him
He is haha
I'm working on cross platform support atm
You guys use PUN for pretty much anything... I'm actually one of the devs of Quantum...
You'll bump into it at some point...
Mike wrote PUN I think
co-wrote some of it, yeah
We have a lot of internal tools and extensions
He and Tobias AFAIK
Can't imagine using anything else for networking tbh
You guys have a lot of success with it... But you can go beyond
But it all depends on what you want to do... And Among Us is here to show the same approach you guys use (full relay) is no roadblock for blockbuster success
Totally agree
I think the devs had a hearth attack when it blew up like that
Make it 3D and you have an easy cash grab
Mechanics are easy af
Networking has nothing really complicated as well
xD
ye
Anyone here who uses the RestClient plugin for Unity who I can ask some questions ?
So Iβm looking at this code here for downloading asset bundles. https://gist.github.com/yaeda/5410868 - so if I were to use a script to download an asset bundle with a scene and all of its resources and instantiate it would I then be able to just do LoadScene?
Hello i have 3 types of guns. They're different 3 gameObjects. We change gun by pressing 1, 2 or 3 and it activates the selected gun. I want other clients to see the activated gun.
I mean, how can i make other clients to see activate/disable events
Guys,I would like to ask a question about Photon Pun2 free version
What are the pros and cons of it?
WAY too vague a question really
How does one do client input resimulation with velocity movement? Just store velocity at each move and use that? But what about drag?
That's not really how you set room properties. And you can't see them before joining the room, or get them after leaving the room like that.
Where are you getting that code sample from that is showing you to do it this way?
Whatever tutorial that is from, needs burning. :)
it looks like you are trying to set the rooms properties from outside of a room?
ah, it was set inside the room
I think you have to enable something to make properties visible outside
https://forum.unity.com/threads/get-custom-room-properties-in-lobby-pun2.590113/
Tobi makes reference to it in this forum topic
Jean talks about making properties visible to the lobby down that page it looks like.
that is really old though, so likely is talking about pun1
topic says pun2 though
so probably is relevant.
working now?
cool
KCP docs should describe what it does differently from standard rudp
Hello, how can i make other clients see if a gameObject disabled or active
by having the controller broadcast its state with an RPC or using IPunObservable
Hello everyone... I am planning to do a very basic Online Game.. a shotter one (I have made single player games before).
The problem is... I don't want to use PUN.. I want to make an Online game without PUN... and then I will use PHP and MySQL for backend stuff (login, etc)
Do you guys know a tutorial to make an Online game without PUN?
You can check mlapi/mirror
maybe mysql?
what about using uNet guys?
do you recommend me to use just uNet?
unet is deprecated
is deprecated but still works?
haven't bothered to find out. either way there is very little incentive to use unet over mlapi/mirror/photon services
welp i have another problem
so im trying to create rooms
and it gives no error
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Photon.Pun;
using Photon.Realtime;
public class CreateRoomMenu : MonoBehaviourPunCallbacks
{
[SerializeField]
private Text _roomName;
public void OnClick_CreateRoom()
{
if (!PhotonNetwork.IsConnected)
return;
RoomOptions options = new RoomOptions();
options.MaxPlayers = 4;
PhotonNetwork.JoinOrCreateRoom(_roomName.text, options, TypedLobby.Default);
}
public override void OnCreatedRoom()
{
print("Created room succesfully.");
}
public override void OnCreateRoomFailed(short returnCode, string message)
{
print("Room creation failed:" + message);
}
}```
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using Photon.Realtime;
public class RoomListingsMenu : MonoBehaviourPunCallbacks
{
[SerializeField]
public RoomListing _roomListing;
[SerializeField]
public Transform _content;
public override void OnRoomListUpdate(List<RoomInfo> roomList)
{
foreach (RoomInfo info in roomList)
{
RoomListing listing = Instantiate(_roomListing, _content);
if (listing != null)
listing.SetRoomInfo(info);
}
}
}```
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Photon.Pun;
using Photon.Realtime;
public class RoomListing : MonoBehaviour
{
[SerializeField]
private Text _text;
public void SetRoomInfo(RoomInfo roomInfo)
{
_text.text = roomInfo.MaxPlayers + ", " + roomInfo.Name;
}
}```
but it wont spawn public RoomListing _roomListing;
and i dont get why
any help?
You should debug that foreach loop to see if it actually runs
Also this is a clusterfuck with 3 scripts having to do something with a room, it'll be more to the point to make it a single script
hi i use photon in my game
i have rooms with max players 4
if in room are 4 players, i can't join to room
how can i do, if all rooms are full, player will create room
?
Retrieve RoomInfo array, go through all items and if all are full create a room
@jade glacier I know how to do client input resimulation with fixed step movement (e.g using transform.Tranlate to apply movement). But this movement has many problems. I tested a non-resimulation velocity movement and thats much better but I can't seem to think of a way to do velocity movement resimulation?
Hello guys, I have a question, what's a good place to start if I want to make my game multiplayer?
I have a main charracter with spells, controls, movement, all that
And I want to spawn a second such character for now
But form another client, and have them like this:
@feral valley multiplayer games are totally different from ssingle player you will have to rewrite most of it
mhm
Even stuff like gravity modifiers on objects
and movement from axis
and OnMouseDown()...?
Could you point me in the right direction as a total beginner?
I was looking at firebase, forge, photon...
@grizzled narwhal not really following the question sorry
There are 2 types of movement: Fixed step e.g adding a vector to position every movement step. And velocity -> adding force to the rigidbody and moving that way. I know howw to make resimulation with fixed step (thats easy) but I don't know how to do it with velocity?
Physx isn't deterministic in a way friendly to that. But if you go that route you need a history of velocity states as part of your history and state from the server.
yeah mhh
resim with velocity, like rewinding and stepping the physics simulation forward? could never get it working good in physx. there are lots of guides and examples out there though
It will never be 100% back in agreement,. Since you can't store the physx state.
hi i trying to join, or create room cs public void StartGame() { if (isConnected) JoinRoom(); System.Threading.Thread.Sleep(2000); if (!IsInGame) CreateRoom();
but i get an error
how can you avoid mistake
Follow a tutorial
ingeniously
If you can't make sense of the tutorial, you can also use the prototyping components that handle all of this. You can also look at them for their code.
I'm investigating network layer options for my current project. Has anyone used MLAPI? Can you tell me if it supports clients connecting to multiple servers? Based on this documentation, I would assume not:
https://mlapi.network/wiki/networking-manager/
The NetworkingManager is a script component handling all your Networking related settings, your Networked Prefabs and your registered scene names. A Transport component is needed on the same GameObject. It is responsible for handling IP adresses and additional settings.
Typically people needing that kind of extreme use case will be very advanced and experienced network devs, and they typically will be rolling their own networking library for that. MLAPI is very similar to Unet HLAPI and Mirror. It is meant as a messaging layer and net entity management system for general use.
Trying to get some of these HLAPI libraries to do anything exotic often results in doing more work to make them conform than it would to just make your own.
This is why simulation is king, and you don't blur messaging with your state syncs
messaging <-> Tick Based State/Input Buffers <-> Simulation
applying messages directly to states will create all kinds of interesting race conditions and anti-deterministic outcomes.
Once all on a tick, apply events at the end of interpolation, rather than the start.
@jade glacier Appreciate the response. Trying to avoid high-level and low-level. I just want something in-between to give me performance & not have to deal with some of the lower-level headaches of packet stacking & splitting, while also having UDP support with reliable & sequenced messages. I've been toying with the idea of using LiteNetLib, but want to know if you had any specific recommendations?
I want to completely avoid anything that uses reflection for their RPC handling π
I might just have to roll my own.
That is why tick based is better than time based.
@weak plinth I can't even make it work close to decent but sadly fixed movement is hard without character controller
I'm not sure what you mean, but sounds like you have an idea of how you want it to work. @gaunt socket
Hi, anyone here was any experience with GGPO + Unity?
Is there a way, to have LAN in a Unity game, without renting any extra servers or anything?
Yeah, just set up a local server
do you know a good tutorial @shut yarrow
It's quite a general question to be honest. If we're not just talking about the actual coding aspect of it, you should have a machine which can function as a local server the others in the same network can connect to. This can be as simple as doing port forwarding in the router and the clients connecting to that machine
If you want to know more about the actual coding part, there is a lot of information to take in, and I suggest you either look into existing frameworks to do this, or search for TCP/UDP server and it'll lead you in the right direction
alright thanks
No problem
@full girder there are actually some tutorials on doing this with C#, here is one you can check out https://www.youtube.com/watch?v=uh8XaC0Y5MA
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/...
It's quite informative
thanks. I intend on adding co-op on a game I have, once I fully finish it
If you're new to this, try to look at as many sources as possible. There will be bad ones of course but you'll get a good understanding and see some parallels
yup
@azure nimbus i have a lot of experience with rollback netcode, but not specifically ggpo in unity... whats up?
What's the best, most simple multiplayer method for a connect 4 game?
How to spawn an object (for me a bullet) without using a network identity on the camera I have?
@sterile void you might need to clarify that question.
@graceful zephyr, A friend of mine is asked me to integrate GGPO in his fight game. however, GGPO seems to be windows only. He is mainly targeting Switch.
have fun π
GGPO is just a very small
wrapper
around predict/rollback logic
for you to hook into
if the game wasnt made to be deterministic and predict/rollback
it's.. well, a lot of work
I know that will be a lot of refactoring
@sterile void you might need to clarify that question.
@jade glacier
Ok so I have a player with a camera attached as a child.
The problem is: I want to make a FPS multiplayer game, but I use physical bullets, so I want to spawn those bullets. The problem is I use the bullet script on my camera and for spawning I need to use [command] function and so to add a network identity to the camera, but te player already has a network identity so there is a bug...
if the game was just built in unity, like normal unity SP game?
it's a complete re-write
for make it fully deterministc predict/rollback
usually
havent seen the game ofc, but that's just speaking from experience
I normally use an ECS approach. which make everything easier. however, I do believe that he code everything in plain unity
@jade glacier nevermind, i will replace the script in the player and use the position and rotation of the camera for spawning
@azure nimbus yeah... idk what to say π
so do u have a question?
around GGPO
it is indeed windows only?
its native C/C++ i think?
u should be able to port it
just yeah u might need to modify it
ofc
there are some docs in the official github repo, afaik ggpo is only for windows,
but james is working on backroll which is basically a rollback implementation for c#/unity
not sure how far he is with that though
GGPO has so hard dependence with vcruntime...
Yeah, don't try nesting network identities. Command in Mirror sucks, so you will have to get messy with your setup @sterile void
@azure nimbus it can probably be separated
also, to make your game compatible to ggpo, the simulation should be deterministic, be able to simulate multiple logical frames in a single visual frame,
be able to save complete game state and restore game state from a save state,
and.. I think those are the main requirements
there are certain methods for ggpo you need to hook up to and those are some of the things you have to fulfil for it
I haven't really been here recently, have you seen james recently fholm?
I'm sure he knows things about ggpo
ah I see
from this corner of the internet π
but even then the hard part isnt GGPO, the hard part ismaking a game that can do what GGPO needs u to do
have been leaving ecs kinda, but actually before I finished to implement what I wanted π
as I understood it, ggpo is handling transport of packages, connections, detecting when states are out of sync and some primitive input prediction I think - not sure about the later.
but all else to set up for it has done in the game code custom to your game
ggpo just has the basic plumbing for predict-rollback, input prediction, etc.
that's about it
and it has stubs for socket plumbing afaik
@graceful zephyr , so, your suggestion is to open the GGPO source up and remove the vcruntime dependence?
@lusty crow, I did read about it. like was telling fholm, I use a ECS approach there how the data is apart from render. so I can execute the systems many times and then run the render. so at first sight it could fit GGPO requeriments...
when I first had the idea to implement rollback netcode, it was basically a completely rewrite of my game ^^
@azure nimbus i mean if you want to implement GGPO... the first place to look would be GGPO source code and see what needs to be done to make it work for you
that seems like a logical first step π
I just unsure if GGPO is the right rollback for my friend, since it has some dependence with windows only stuff
there's not many other options
would you guys suggest some other rollback lib to make things easier?
apparently it is conveniently possible to just make a snapshot from all relevant entities in an ecs world?
what you want to do sounds exactly like what james was working on for his rewrite of the smash-like game fantasy crescendo where he was testing out his library https://github.com/HouraiTeahouse/Backroll
not sure if he is still on this server though, I checked the names, but there is nobody that stands out to me as him
FWIW i am the lead/inventor of photon quantum, its the only commerically available predict-rollback i know of
but its not free/open source ofc
oh nevermind, he is still a member of this server, james7132
not sure why I didn't find him before
but his last message was on the ... 8th of september?
here
yeah, by a quick peek in the backroll repo, definitely he is ahead of me and already faced that I'm facing right now!
@graceful zephyr I image that you are photon related due your role and suggestion.
Well, I'm open to use a commercial asset. I will check about photon quantum.
my friend have a hard deadline for the February. If he will need to rewrite everything, the soon the better
@lusty crow, I may leave him a message.
the plain unity approach is such a pain for online games
@lusty crow, why you are leaving ECS?
I'd be interested too how his rollback ecs adventures went and what he's working on now.
it depends, but.. what's certainly true is that for a network game compatible architecture, it is much better to think at it from the very first minute of development and align architecture decisions towards it, but that also requires prior knowledge of it.
I think it is often unavoidable to have rewrites or iterations while being in the process or learning how something works
I mainly wanted to revisit something I have done in 2018,, a bullet hell game, and thought ecs was perfect for that use case.
With implementing ecs physics to a bullet hell game but.. I kinda lost motivation.
all I had left was to to make job compatible animation curves which I already had in the old bullethell game, (but it works differently know, as you can use blob assets for things like these now), and make some levels.
Hello there,
I have a quick question.
I am planning on making a fps game with 32 - 64ish player multiplayer support.
I want to get started learning networking and would like to know where to get started.
What would be the best recommended netcode solution for my application ?
If you haven't completed several smaller networked games, I would consider doing that first. 32 to 64 players creates all kinds of difficulties you don't want while learning networking.
I've got a small problem (using photon 2 btw). I got 2 players, both can enter a room and start up a game. When they are in the game, and one of them disconnects, it's not their own character that gets destroyed, but the other player's. So player 1 leaves, and player 2's character gets destroyed, so then player 2 gets ownership of player 1's character. I really don't know why this happens
also, every client only has ownership of their own character
nevermind, fixed
Hello, could someone tell me how I can start making a server for unity?
Mirror is usually people's first step in that direction @grand elm
I'm really very new and I don't know what that mirror is
In our course they tell us that we have to learn on our own
Look for Mirror on the asset store, they include links to their discord and such there.
Yup
Where should I start looking for hot to make a UDP server that doesn't block on receiving packets?
That will just be based on your transport choice and settings.
I meant client, but it seems to be easy to use for that purpose as well?
What is easy to use?
mirror
UNet will be deprecated, is UnityWebRequest part of UNet?
UnityWebRequest will keep working as well, will be moved to a package in future.
Thank you @spring crane
how can i set maximum amount of players in a room with PUN 2
found it
does this make the maximum amount of players 2? im asking because MaxPlayers is of type byte
byte can hold values up to 255
does this make the maximum amount of players 2? im asking because
MaxPlayersis of type byte
@inland lion ya
You won't get anywhere near 255 players connected to a room though, even with a simple game that would add up to a brutal amount of data per second.
I only need 2 anyway
It's a connect 4 game
Doesn't have more than 2 ppl per 'room'
Hi dudes, i'm want to create a similar game like heartstone, what is the best choise for online part? i mean, what is the best framework for create games to fight 1vs1 with players?
if you want to have it competitive, you probably want to have an authoritative server that keeps tracks of games/game states to prevent cheating or at least to make it harder,
requirements seem to be 1vs1, and latency is usually not a big issue with card games, so it is okay when messages are a bit delays - meaning you don't usually need prediction logic, you just apply the effects or data the server sents to you when you get it.
I'm not sure about the best choice, but Mirror would certainly be capable of that.
you should also ask yourself if it should be possible to completely run the simulation on the server side, using only inputs from the clients, and if so, how to do it.
https://blogs.unity3d.com/2020/09/08/choosing-the-right-netcode-for-your-game/
thanks!
hey ..
there is an ANR ..
What is the solution.. help me
ANR "Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 4. Wait queue head age: 5604.6ms.) com.unity3d.player.UnityPlayerActivity"
Hey I'm new to networking in Unity.
I've setup a NodeJS back-end which has endpoints
/auth/me <= returns te player
Now I am at a points where I do so many requests at different layers and points (hopefully not more than 10 requests, but I need to take action ASAP!)
What is the best way to manage routes and requests? I use IEnumerator in my requests, dunno if that is how it should be?
is there any tutorial or anything I can read? Because I can't find anything useful
this is how I personally do it. Create a class to wrap the request.
then it's like
var req = service.Echo();
yield return req.Run();
Debug.Log(req.success.contentOfRequest);
I've been building a utility for generating all this for you. It's currently under development tho, but it might do what you need. all you need is a swagger.json file
@pliant marten let me know if you need any help using the tool
then it's like
var req = service.Echo(); yield return req.Run(); Debug.Log(req.success.contentOfRequest);
@silver steeple damn this is actually very nice!
Im confused with this whole unity networking business, fall guy uses it if I'm not mistaken is it pretty much aimed at higher ranking studios only?
Whenever there's an "inquire" option its never a good sign for indies.
**"multiplay"
Does not seem to be much information out there
pun2/mirror
If you are just starting up, Pun2 and Mirror are the usual starting points
This is the game I really want to work on right now.
Does anyone want to help me/know which direction I should start? map layout, recruitment?
I have one friend who can sorta help with programing, but I'm free every Monday-Wednsday
You Can DM me about it
I even plan on making a group chat
I look forward to anyone wanting to help, and greatly appreciate it
Not that kind of networking
lol
xD
Unity Connect
idk if this is the right chat to ask this question but oh well does anyone know any good server hosting for multiplayer games
Amazon
Hi all, I'm new here. Can I post questions about Mirror (Networking) here?
Yes, but you'll probably get better help in the Mirror Discord server.
I didn't know they have that. Thanks. Mine might be a more general question.
So I want to have an event system that handles a player dealing damage to another player.
I used a singleton class called GameEvents, and when a bullet collides with a player, it calls
GameEvents.current.Damage(........)
I'm just confused as to should I make my GameEvents object networked?
im new to all this so
i dont know whats wrong i just get this
Assets\NetWorkManager.cs(35,35): error CS1002: ; expected
It will fix the error you have now
You also made same mistake on line 22
O
oh
can you tell me what it is
this is kinda my first time doing stuff like this so its a little hard for me
@red nexus you might be better off in learning about general programming before moving on to networking.
π’
You can do it! no need to cry π
He means no offense but you're in for a world of pain trying to do this when you have problems with the basics
i have been watching youtube videos on this doing what they do and trying to learn but i dont understand how its wrong
That tutorial is still above your current level of understanding
why is this stuff so hard
It's not but you're trying to run before learning how to crawl and then walk
Yeah but you aren't doing that really because you forget things like a semicolon at the end of a line π
It's a small detail but it doesn't mean it's not important to know
yea im just really excited for what im doing
I understand but even if you get it to work you have no idea why it works, and if it doesn't work, you have no idea how to fix it either
That's why trying to do networking is a bad idea to begin with
i fixed somethings
and now im stuck again
and i just need help on how to do it
i just want to know how to fix them
Assets\NetWorkManager.cs(26,21): error CS1061: 'RoomOptions' does not contain a definition for 'MaxPLayers' and no accessible extension method 'MaxPLayers' accepting a first argument of type 'RoomOptions' could be found (are you missing a using directive or an assembly reference?)
i now get that
You spelled this wrong MaxPLayers
Yeah
Anyone using steamworks for matchmaking? I have it working if I apply no room filters but if I apply AddRequestLobbyListNearValueFilter I get zero results.
Wondering if anyone has any examples of use for it I think Iβm doing it right. I apply lobby data on the host. Then in client Iβm applying the request before attempting to search. Only thing that stands out to me is when you assign lobby data the data is required to be a string by steamworks.net but the filter uses an int (I am assuming it is converted by steam?)
SetLobbyData
bool SetLobbyData( CSteamID steamIDLobby, const char *pchKey, const char *pchValue ); (C++ version from steam) also shows it using a string
Pun1 or Pun2?
Pun2 typically it is PhotonNetwork.LocalPlayer.ActorId or something similar to that. @grand skiff
PUN1
Not sure about Pun1
Probably asked this before... but why are you using Pun1 for new development?
I do not know actually, i was starting to make my game with PUN2 but i got an error (couldn't fix). I removed everything then i downloaded PUN1, there was no error.
Fixed it
how can i know if a player is joined in PUN1
Use PUN 2 π
PUN Classic is in maintenance. It will not get any features and likely won't get updated for the next Unity Editor versions either...
When you get errors, read them carefully. Ours are written to tell you what to do. Else, post it here and see if this can be sorted.
I swear i will use PUN2 in my next game π
Or i will just remove PUN and replace it with PUN2
You will also get better help, since Pun2 is what most others in discord will be using and be familiar with. Myself included.
https://doc.photonengine.com/en-us/pun/v2/getting-started/migration-notes might help transition to pun2 π
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!
i'm not sure i will do it now. If i cannot fix this little bug with PUN, i will go to PUN2
isn't PUN1 depreciated? Or is that something else
oh I should read messages. Ignore me
It is basically in LTS... but the Unity Asset Store doesn't really allow you to post assets with that kind of finesse. It just is there and public, or it is not.
Looking for network solution to making real time online multiplayer games. So far I'm looking over:
Photon: Quantum
Photon: Bolt
Heroic: Labs
Any recommendations of other potential candidates?
Photon pun/mlapi/mirror
Quantum is aimed at funded studios, so it costs a bit to get into and isn't really for hobbyists at the moment. But for funded projects should be the first platform investigated. It isn't a fit for everything, but if it is a fit, it is the hands down winner in most areas.
Past that, largely you should try tutorials for Pun2, Mirror/MLAPI, and Bolt to get a sense of what the architecture and hosting implications are for each.
Thanks for the advice. There wouldn't be a site that compared the bunch, would there?
None that don't get them all wildly wrong.
@jade glacier good to know
Looking for network solution to making real time online multiplayer games. So far I'm looking over:
Photon: Quantum
Photon: Bolt
Heroic: LabsAny recommendations of other potential candidates?
@wispy thorn spatialOS
what is photon quantum
@weak plinth quantum is the deterministic plugin of photon. Uses a lot of custom stuff (like physics) because unity is not quite deterministic.
ok thank you
Hi! So Iβm currently trying to make a physical bullet with Unet but my problem is that the bullet move too fast and go mostly trough the enemy player...
Setting the rigidbody to continuous works, but not with networked player, so is there a good way to make the player detect when he is hitted everytime, and to stop the bullet going through the player?
@sterile void How do you actually handle the bullet?
with Unet problem 1
your client needs to predict the hit using continuous collision detection or the server needs to tell the players when they got hit
or whichever client has "authority" tells the other client they got hit
Hey all, with Unity Web Request, if i had something like ```cs
IEnumerator Request () {
using (UnityWebRequest www = UnityWebRequest.Get(url) {
yield return www.SendWebRequest();
}
}
Are you able to resend that request?
(within the same scope i mean sorry)
so,
IEnumerator Request () {
using (UnityWebRequest www = UnityWebRequest.Get(url) {
yield return www.SendWebRequest();
yield return www.SendWebRequest();
}
}```
@sterile void How do you actually handle the bullet?
@B.A.R.G.O.S#0973 So Iβm currently spawning my bullet (with has identity and transform sync) the bullet move were Iβm currently aiming, but because I want to simulate bullet drop, I canβt use raycast for applying damage...
So I decided to use collision between the bullet and the enemy player(the player has identity and transform sync) my problem is 90% of the time, the bullet go trough the enemy player even if the bullet has rigidbody set to continuous.
So what can I do if I want to apply damage with physical bullet? Or how can I make the bullet detect correctly the enemy player?
@high night So I handle the bullet by using raycast and raycasthit. In my LateUpdate method, raycast verify Iβm hitting something, if yes, I set the target to the hit point, else I detect the ray.point(1000) and set the target at this point.All the information about the target are in a vector variable.
Then, I use command to Instantiate then spawn the bullet. Then I make the bullet go towards the target (with physics).
My bullet has a sphere collider, a rigidbody set to continuous, a network identity and a network Transform set to sync rigidbody3d.
@sterile void You should just sync the health and bullet hit visual effects from server
dont let client modify health and visual effects
@sterile void You should just sync the health and bullet hit visual effects from server
@B.A.R.G.O.S#0973 I know, Iβm doing that, nothing changes...
What is your guys' opinion on spatialOS
@sterile void You wont expect or accept OnCollisionEnter or aything to trigger in client
Client wont care about collisions and physics, disable physcis if you want or set kinematic
Client will only spawn hit effect when server tells it to
Typically for state transfer, as BARGOS is saying - you will set all objects that are not the authority version to be kinematic. Trying to replicate physics will devolve into an unmanageable mess.
You only simulate physics on the authority server or client - then you broadcast the transform state to others.
The exception being any place you do client prediction. For example each player likely will simulate their player locally immediately, and the server will apply the same inputs and simulate it as well, and the server sends out the resulting state. But for most objects all clients are just lerping between previous state snapshots - rather than trying to replicate physics.
Hello! What is being used in Unity for multiplayer right now? Since Unet is deprecated
Just scroll up a bit, that gets asked a dozen times a day here @azure mango
Yeah, but I was asking if there is anything "oficial" or that Unity supports
NETCODE is their only official project, but it is experimental at best.
The transport that uses is also available, and not reliant on DOTS like NETCODE is. But I have no idea since I haven't played with any of that.
I will give it a look. Thanks!
I wouldn't rely on "official" as being a good thing when it comes to networking. Unity has a horrific track record with its networking solutions.
So it would be better using something like Mirror, Photon etc?
I don't recommend anything, since I work on one of said libraries. I do recommend scrolling up and reviewing the chat history on the topic though. It comes up often.
Okey, thanks anyways
Can someone suggest a good mirror tutorial?
One which explains how to synce movement , shooting , etc properly among all clients?
I would start in the Mirror discord channel
Far more Mirror specific discussion there
So I am confused, what's the correct way to do networking in Unity in 2020? Do I need a Unity Package? Should I just use .NET?
I want to try out a simple exercise for now, simply join in a Scene along with another player and move around together
Scroll up @left knoll that question comes up every few hours.
So HLAPI is the new way
unet is the deprecated one
and I don't really wanna touch DOTS lol
Just to start networking with a simple example
All the examples I've found so far is "make X-complicated game using some specific third party library"
I don't want a MMO, I guess maybe the best I could describe it is "Among Us/FallGuys" networking capabilities
join a room with 5-10 players, have them broadcast around their coordinates and actions with a server, that's it
You haven't really look well then because you would've found photon pun as most likely answer
There's a million answers and videos from all the years out there. Like the Brackeys one is using the UNet
I was so confused because I thought Unity would have a built-in system, but most people I've asked told me to not use the Unity networking as it's not ready or something
Its deprecated
Photon pun come with an example scene
You can move around and fire
Yeah it sucks but pun has been filling that gap for many years, it's probably most easy solution for beginners who just want to try things out with not too many features
And like, say I use Photon, how crossplatform would that be? Would at least do Windows and Android? I am assuming consoles are an entire new beast with networking
Unity does not have a working networking solution right now.
For researching, I suggest looking at all of the available solutions and seeing what each of them offer.
Photon PUN is a good choice though.
Not sure but I think they also have android support but you might have to pay for that
Pun support all platforms afaik
But since pun is basically free while you're developing there's not much to lose
I'll try it out, this is the correct one, right? https://assetstore.unity.com/packages/tools/network/pun-2-free-119922
Yes
Also, if you read the description of the asset, it mentions cross-platform support.
Same with their official website.
Ahhh nice
I am also looking at the 2021 Unity roadmap and seems a new stable Networking is planned for then
Don't hold your breath on it
Yeah, roadmaps can change
β¬οΈ Also, networking requirements are specific to each game and there will never be one library that works for everything.
Oh yeah, and not to mention platforms
Yeah and like mentioned before, Unity has a terrible track record of networking features and they start something new just to drop it like a rock and then promise to do better somewhere in the future
Wouldn't be the first time for Unity to half ass a feature
Yes lol
Well one huge issue I had with Unity was Input and they did a pretty decent job with the Input System
In their defense that's quite a fundamental piece of a game engine but networking always has been weak from their side and it looks more like a marketing move to get more people to jump on board when they offer it
As evidenced by the success of games like Mediatonicβs Fall Guys: Ultimate Knockout, great multiplayer games are possible in Unity today, and we will keep making it easier.
Hehe
Oh uh, Photon requires an account.. for what?
To obtain an Application ID
Mirror and mlapi work like Unet HLAPI. No account needed since there is no relay or matchmaking. You will eventually have to sort out how to host though.
I see
@left knoll saw you mentioning tutorials and that you might be using Mirror. Here's a really extensive resource. https://trello.com/b/x67wL4kH/firstgeargames-mirror-tutorials
Over 20 tutorials, several assets, and even some projects
Organize anything, together. Trello is a collaboration tool that organizes your projects into boards. In one glance, know what's being worked on, who's working on what, and where something is in a process.
Oh damn, thank you!
Hey i got issue in photon when in room have only 1 player than all works fine but when 2nd player comes to room then joystick wont work is there any solution ?
Be sure to disable all controller code when photoView.IsMine == false @humble dew
I have a problem so i am using pun2 and i have an object that has a photonview ect to be able to see it online but i dont want it on a certain child of that object so it will only show locally but i have no idea how to do this can any1 help?
im trying to add multiplayer to my connect 4 game using PUN2, and i have rooms of maximum 2 players, whenever a player joins a room, he has the option to ready up, but the ready up method is on an instantiated prefab, and it gives me this error:
i also have visuals for when a player readies up
the outer circle should light up when pressing Ready Up but it doesnt because of the error
so in my game when i kill the other player, they get teleported (they die) to me (temporarily) but nothing happens for the other player
any help?
i am using a raycast shooting system and health
Guys,does MLAPI have player restrictions?
Probably not in the sense of how many connections can be made with the various transports. But you likely will hit some CPU and bandwidth issues sooner than you are hoping.
Probably not in the sense of how many connections can be made with the various transports. But you likely will hit some CPU and bandwidth issues sooner than you are hoping.
About the CPU,how can this be improved?
@weak plinth No answer for that. You have to see where the bottleneck forms.
but once you get past 16 connections to a server you have to start being more and more careful. Doubling the player count exponentially increases the workload for most systems.
Networking newbie here.
What tools would you guys recommend I use for a small multiplayer games?
I'm looking to include basic Leaderboard and Text Chat System.
I've had a look at Mirror on in the Asset Store, and I've heard about Vivox, which allows up to 5000 players.
but once you get past 16 connections to a server you have to start being more and more careful. Doubling the player count exponentially increases the workload for most systems.
It is written that MLAPI can safely hold 64 players
@woeful badge what do you consider a small multiplayer game? Never heard of Vivox, but it's not very likely you're going to have 5000 players on a single server anyway so that is kind of meaningless tbh
To me sounds like your best bet is to start with photon unity networking (look it up in the asset store)
@shut yarrow Thank you for the response.
Sorry, I meant that Vivox allows up to 5000 players for free on the server at a time, over multiple active games.
I only want something like 10 players per "room" really.
I will have a look at Photon, if it's free.
Only looking for something to use in small test projects like game jams or doing proof of concepts.
Photon is free for up to 20 concurrent users spread over different rooms. So you could have for example 10 rooms with 2 players each and then you've reached the limit of the free plan
For testing it is quite good
Awesome, thanks π
I will check it out later tonight
@weak plinth Is it written on the Unity blog post or on MLAPI's documentation?
Better ask on the MLAPI's discord server.
I have a problem so i am using pun2 and i have an object that has a photonview ect to be able to see it online but i dont want it on a certain child of that object. I want it so it will only show locally but i have no idea how to do this can any1 help?
How do you guys go about testing multiplayer games on a single computer? Not being able to open 2 editors for the same project is pretty limiting, and having to build and run every time takes time and doesn't give you easy access to things like the console.
I just build it, which is annoying. I wish that Unity had that one Unreal feature that duplicates the editor game window for testing multiplayer. There was some old editor extension for it, but I don't think it works anymore on newer versions of Unity
@still hare I using this
https://github.com/VeriorPies/ParrelSync
@stray sedge think you can try the plugin I posted above
@frank quiver Thanks, I had actually been using that, but randomly it started throwing errors. I get an error:
APIUpdater encountered some issues and was not able to finish.
Some stuff about not being able to find temp files... and then a dozen errors such as this:
Library/PackageCache/com.unity.inputsystem@1.0.0/InputSystem/Editor/AssetImporter/InputActionImporter.cs(24,42): error CS0246: The type or namespace name 'ScriptedImporter' could not be found (are you missing a using directive or an assembly reference?)
Seems like it doesn't like the InputSystem package, but I don't know how to fix it
And this is only for the cloned editor
@weak plinth Is it written on the Unity blog post or on MLAPI's documentation?
@spring crane no,sort Of
Mlapi - Recommended for - ~64 players
I have a problem so i am using pun2 and i have an object that has a photonview ect to be able to see it online but i dont want it on a certain child of that object. I want it so it will only show locally but i have no idea how to do this can any1 help?
Pun2 has titles with 64 players and that lists 2-8. That chart and the page it is from are considered a joke among net devs. All of the net options can handle 64 connections. The article is heavily biased toward MLAPI, likely because Unity hired its dev.
Having 64 players connect isn't the problem for any transport. The problems come with how much network data 64 players can produce without careful planning, and the CPU costs of schemes required to cull and compress serialization. 64+ requires more skill and knowledge on the devs part.
is anyone here experienced and can help me with multiplayer game with photon pun
you can dm me
Likely not going to get any help that way. Best to just post your question in the channel and see if anyone has an answer. @fallen frigate
i'm trying to use photon. But i'm stuckon RPC part. I even copied the code but it still says this.
here is my code ``` void Update()
{
if (photonView.IsMine)
{
if (Input.GetMouseButtonDown(0))
{
photonView.RPC("RPC_ShootGUN", RpcTarget.All);
}
}
}
[PunRPC]
void RPC_ShootGUN()
{
RaycastHit2D hitInfo = Physics2D.Raycast(shootpoint.position, shootpoint.right);
if (hitInfo)
{
Debug.DrawLine(shootpoint.position, hitInfo.point, Color.white, 2.5f);
Debug.Log(hitInfo.transform.gameObject.tag);
if (hitInfo.transform.gameObject.tag == "Player")
{
hitInfo.transform.gameObject.GetComponent<Health>().damage(damage);
Debug.Log("damaged");
}
}
}```
What class are you putting this in? and is this class on the root of an object that has a PhotonView?
@lunar plinth
oh wait
i forgot photonview
b r u h
well that worked
thanks
but now another question how can i know which player is which count
like how do i know how player one is player one
i need it for score system
Every connection gets an Player objects, which have an ActorId
PhotonNetwork.PlayerList gets you active players
but how can i know which player controls which player
i mean how do i know who controls actual model
You are confusing your terms I think
Player = connection
Your Player as you are describing likely means some PhotonView Prefab you instantiate that is the player avatar
i mean i want to check who killed who. I'm really new to all of this tho
There is no intrinsic connection between the Player (actor/connection) and any particular object.
Every PhotonView has a creator, an owner, and a controller.
If a PV gameobject kills another gameobject.. then you would look at their PhotonView.Owner
Players can own 0-X number of PhotonViews
So there is no "Player game object" unless you define one yourself.
i just can't wrap my head around it