#archived-networking
1 messages ยท Page 108 of 1
i dont understand what you mean still but as long as you understand it that's all that matters ๐
@wraith monolith sorry my english is not good
i just don't understand wht you're trying to accomplish
what do you mean by "decentralized game"?
what is a "dynamic page"? a page whose content changes over time? if so, why would that cause timeouts...?
@wraith monolith trying to build a play-to-earn game. The page gets constructed by javascript, so it takes some time to load. webcrawlers like google time out on such pages, but no problem, got a rest solution thanks to github
so i got a blockchain wallet, made with qml and use a webengineview to run webgl build in unity. Works. now I want to try to let the char try to chop a wood block and make it sent a coin to its wallet address
where does unity come in? the google crawler isn't going to make any sense of a untiy canvas
that has nothing to do with unity though
doing the request from within unity
sorry, what is the page you're trying to load?
block explorer page made with insight api
is this like a JSON endpoint?
and you need to access that data from inside the unity player?
now it is ๐
I exposed its REST/api it works
now to pump the return data into a json thing
Using WebGL how can I retrieve a data from the browser using a key?
Hey guys, is there a good tutorial on mmr matchmaking with photon?
Try this: https://doc.photonengine.com/en-US/pun/current/lobby-and-matchmaking/matchmaking-and-lobby
Photon Unity Networking framework for realtime multiplayer games and applications with no punchthrough issues. Export to all Unity supported platforms, no matter what Unity license you have!
What is the recommended networking method for self-hosted local LAN games? (host/join button that spawns a "server" and "client" both running on peer devices in the same local network)
i checked out photon but it requires a login and you cant selfhost in the free version
is there any other one i should check out?
Mirror or MLAPI (Netcode for GameObjects)
Hi, I am planning to add Online Multi Player To my Game, Should I use MLAPI. If not what should I use? I heard about Photon but I am not sure about how well it works.
and also I heard that MLAPI is experimental
Bump
Photon PUN, MLAPI, Mirror. All good choices, Photon PUN does more of the heavy lifting for you I'd say
Thank you.
So I made a multiplayer game with photon unity networking and I made an among us-like kill system. How do I make it that the player is declared dead to all clients? (The player dissapears for now when killed but I also want a pop-up to show to tell u that u died) how can I do this? thanks.
this goes over best practice for destroying things in PUN https://forum.unity.com/threads/pun-photonnetwork-destroy-or-destroy.344158/
ty
np if you have any questions feel free to come back here
Can I play a murder animation on top of this?
ya jsut make sure you use a PhotonAnimatorView
ok
Also how do I make it so only traitors can kill?
AKA the impostors
u press F to kill
well your getting back into non network logic, just find tutorials for what you wanna do and remember that everything needs to be instanced or destroyed using photon and must have the photonview component. beyond that everything else you need to get the game working should be fairly straight forward. if you dont know how to set up photonview stuff i recomend blackthornprods tutorial its very simple
alright ty
public bool isImposter;
void Update() {
if (//Check Input) {
//Do checks and call the kill function.
}
}
void Kill() {
if (!isImposter) {return; //Do this on the server to stop cheaters from setting themselves to an imposter and killing everyone}
// Do kill stuff
}
i'd learn about Remote Procedure Calls
void Die()
{
PhotonNetwork.Destroy();
}
if you want to handle a load of stuff after the player is killed; you need to call an RPC after the server has dealt with the death
I do have a photon view
this just checks a bool....
yes? that's what they asked...
thats local
I'm not sure exactly how Photon does their sequence of events but generally:
void Update() {
if (Input.GetMouseButton(0)) {
ServerMouseDown();
}
}
// This needs to be turned into a server only function
void ServerMouseDown() {
RpcMouseDown();
}
// This needs to be turned into a client only function
void RpcMouseDown() {
// Some stuff
}
@granite yew ^
Rpc should only be used if there is stuff you need to specifically do on Clients.
Server Commands are used to stop players from cheating their variables
so I just add a [RPC] on top of it?
So when you set someone to an imposter; the server should hold the variable as to whether they're an imposter or not; to stop a non-imposter player from just turning themselves into an imposter and murdering everyone else
if you havnt used photon why are ytou trying to help??
i dont wanna waste my time on this but I wouldnt listen to this guy
its important that all variables that you use that you don't want the player to cheat are assigned to only in server commands and not in client RPCs
@fierce niche I've been making a Multiplayer game for the last 3 months. The concepts are all transferable
If you don't know that concepts are transferable, why are you trying to help?
HEY plz dont argue
If Photon uses the [RPC] tag to handle Remote Procedures, then yes
use the [RPC] tag
if you stick to this you will be fine #archived-networking message
that documentation doesn't handle Yoshi's issue at all.
It just deletes the player from all clients
its not a doc....
they want to turn the dead players into Ghosts
ok im getting trolled lol
agreed
It's a Forum post, that just discusses how to use Network.Destroy()?
You want to turn the player into a Ghost? @granite yew
Yeah
Yeah, don't listen to Tracy.
Destroying the object; when it's assigned to a player with authority; will completely bodge any controls.
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!
The owner of a PhotonView (which I assume from like, 10 seconds of just looking at the doc; is the thing that syncs the instance on the server?) has Authority.
If you Destroy it, there is no longer anything for the player to control.
Can I just instantiate a new ghost player prefab?
Seeing as i've not used Photon; I use Mirror; then can you quickly tell me how you assign the "Player prefab" to the Photon script?
You can send a screen shot here so I can see it; just want to know that what i know about Mirror is the same as what Photon uses in concept.
for example, Mirror here uses a "Player prefab" slot built in to the component
my Player Prefab is just a generalised Prefab, with no specific "State" inside of it. @granite yew
The code dynamically instantiates a "state" as a child object inside of the Prefab
So you would have Photon instantiate a "Stateless" player prefab; then when the player is spawned and set to be alive; instantiate an alive Prefab as a Child of the main prefab with
Instantiate(child, parent)
(obviously altered to your liking)
then when they die,
Destroy(child.gameObject)
Instantiate(ghost, parent)
you'd use the ghost/child as a motor, and then move the parent using functions
child.cs
void Movement() {
// Assuming you're using transforms
parent.Move(1.0f, 0.0f)
}
parent.cs
void Move(float x, float y) {
transform.Translate(1.0f,0.0f)
}
public void KillAnimation()
{
if (Playa != null)
{
Playa.GetComponent<Play>().Die();
}
else
{
}
}
void Die()
{
PhotonNetwork.Destroy(Playa);
}
Here is my code
that will just Destroy the Playa (gameObject?, I can't see the type declaration)
it won't spawn a Ghost
Where is this code? In the player?
Yes
you don't need to get the component of the script you're calling it in.
Is that script called Play.cs?
or is the Die function in a different script?
To put this very simply:
If you want something to be destroyed for all people; use PhotonNetwork.Destroy()
If you want something to be destroyed locally; use Destroy() and an RPC
the upside to the top one (Network) is that it is destroyed on all clients without the need for an RPC
but the upside to the bottom one is that you don't have to destroy the main player Object, allowing you to instantiate a ghost inside of it, and then get rid of the alive child
I believe you can still destroy the Alive Child with PhotonNetwork.Destroy
and then use an RPC call to spawn the Ghost
The Play script and the die function are in the same script
then you don't need to use playa.getcomponent
you can just call Die
unless you're trying to kill another player
I am
Playa is the player who you are targeting (sorry that I didnt respond earlier I was doing something) @sinful flare
Hello... I am having troubles to enter store.
Can anyone please send me PUN 2 free edition so that I can download it?
it doesnt matter if Google Drive or something like that
I don't want to rush you, but I have a client waiting for me and I need it as soon as possible, so if some of you guys can send me that I will be thank to you
soooo MLAPI was a big waste of my week
dont use it guys
doesnt work with websockets or webgl in general
and it doesnt use proper object authority for more complicated linux VPS. It ran great on unity, then I thought I did something wrong then, googled it and found mod staff reports like,
WebGL build error
@olive vessel
So eah, MLAPI is kinda hot garbage. and dont get hyped into using it
its far from ready for any mid-large scale projects and isnt even supported for github testing via webgl
Thanks again unity dev team for making another useless feature that cant even do anything thats needed of it for the scale that it "needs" to be used for.
I sware everytime unity doesnt just out-right BUY someone elses product, they make their own sandwiches without bread.
@agile spade Unity MLAPI is still marked as being experimental, so the expectations might be a bit high here.
then why does literally ever forum on unity got mod recommending it? It's not ready.
honestly, I don't think it should even be downloadable yet. at least till the websocket thing is fixed.
object authority and multiple scene layor syncing etc might not be in the scope of 50-80% of unity game devs but, the websocket and webgl thing definitely is.
As a WebGL developer I would also like to think WebGL support has this level of importance, but I don't think that is really the case. Also worth noting that Unity moderators are generally just people from the community, so take suggestions and opinions with that in mind.
@agile spade Do you have links to threads where Unity MLAPI was recommended?
Danny, you're super active here, so let me give you some light on a few reasons why WebGL sometimes does not get the same level of "support".
Of course I can only speak for us (photon), not other companies, but here are my two cents.
We do not (yet) support WebGL in a couple of products (namely fusion and quantum) because they are designed around native memory operations (long story short that's the only way to do what they do with the performance level necessary), and these were not even well supported by browsers until recently (there are long discussions on browser sandbox forums about providing a high performance version for memcpy, for example)
This has come a looong way since then, and looks like all necessary operations are now exposed with decent performance on all major browsers, and unity webGL builds do give access to them.
Because of this, we're constantly re-evaluating actually fully supporting webGL builds (in quantum and fusion, as photon realtime and PUN already support them). Not YET done, but we're scheduled to try again soon...
So it's not that we do not WANT or do not give enough attention. Hopefully it will change soon (for those two products).
The other source of concern is WebSockets... They are TCP, which is far from ideal for high performance multiplayer (which is the main focus of quantum and fusion).
So, unfortunately, WebGL is not the most straightforward platform to support (as you perceive "externally"). It does impose a lot of restrictions for us tool and engine developers.
@spring crane just my two cents... Hopefully things will keep evolving positively.
@gleaming prawn what Photon product would you recommend for local LAN only? (different devices, someone is host, others are peers, ..)
All of our products are for online, and involve connecting to our clouds...
But both bolt and fusion try to connect directly to the Unity instance that is the server (if using client server mode on fusion)
so technically the connection will be fast/local
but we do not have products for Offline/LAN only....
Although we expect to ALLOW this (without direct connection to cloud) for fusion soon...
But notice that LAN only is the exceptional extra feature, and that the actual product is for online
but technically the best product for you game should not depend on this, bug actually on the Gameplay
okay, so photon might not be the correct solution for my goal then ๐ค
It's the gameplay that normally dictates which kind of networking you need
like, RTSs require determinism, shooters basically require tick-accurate state transfer + snapshot interpolation + lag compensation, etc
Yea browsers definitely have their own challenges that people should be aware of. In that comment I was primarily trying to counter the implication that the product is not successful unless browser platform is supported.
You mean yours?
object authority and multiple scene layor syncing etc might not be in the scope of 50-80% of unity game devs but, the websocket and webgl thing definitely is.
There are many categories where that is true, I agree (that browser support is important) like audio/video conferencing, etc
I mean, Quantum is highly successful and never supported WebGL (although we certainly wanted to)
Exactly.
So I may not agree 100% (to that particular statement)...:)
but you have a valid point on being super important. Agreed
what would the networking reqs for an action-based co-op game?
Action like what? Like an action RPG?
yes
Midwintรคr catches you at Khazar's Pass.You shelter in a cave as the days and nights grow long and cold,as the snow seals you in and as the world darkens.Midwintรคr is a narrative-driven stealth action game inspired by medieval horror folklore that combines careful tactical planning with fast-paced arcade execution and innovative gossip mechanics....
Coming soon
maybe steam page might give better info ๐ค
is this your game? or an example?
my game
Did you see this page? We are stating pretty clearly on our docs site what we do not support WebGL and even have community driven workarounds for how to make WebGL work with MLAPI. https://docs-multiplayer.unity3d.com/docs/develop/getting-started/about-mlapi
Being disappointed in something is completely fine but it's hard for me to digest information for how to improve out of your feedback. If you could provide us with more constructive feedback so that we can improve we'd really appreciate that.
looks super nice...
From our products, both Quantum and Fusion would fit well... Specially fusion could give you the probably required interest management etc.
But you mention there you have online and lan MP already, so you probably already have a lot of things implemented using a certain approach.
Which may impact any different decision.
But you super welcome to try out fusion, or send us an email if you have more questions, etc. You can PM me in that case.
/ wave...:)
Hi. I asked this yesterday but I didnt got any good help. My among us inspired kill system is not working nor spreading throught the clients. How can I fix this?
For one, https://www.youtube.com/watch?v=RwKkJNc8UcQ mirror has 0 issue ignoring object authority until I activate a online scene.. MLAPI threw tantrums over it. Just saying, mlapi shouldnt even be a discussion (yet). Give it a good 8 months until you guys drop it like everything else. xD (sorry that was maybe a bit too heat towards you but, still funny to me)
small test for the mmorpg I'm making, connecting to my temporary AWS server, connecting to mirror transport, and logging in and authenticating with PlayFab.
I am using photon btw
well, what transport are you using?
ah lol
okay, well first you gotta set the kill to the server first, then after is validated sync it to the clients
should be that simple.
not sure how you programmed that though.
photon you mean PUN?
ah
if (Input.GetKeyDown(KeyCode.F))
{
if (PhotonNetwork.playerList.Length == 5)
{
Playa.GetComponent<Play>().KillAnimation();
}
}
Sorry, I can't help much with PUN
its ok
umm i dont see a network animation attached
also, whos listening to the Input.GetKeyDown?
wait what?
if (Input.GetKeyDown(KeyCode.F))
{ is a unity solution
so how must i change it?
do you have a #IF UNITY_ENGINE at the top of your class?
also, do you have photon script syncs enabled in you player settings?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI
what is that?
[PunRPC]
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!
there you go buddy
now, im gonna watch netflix, cause i just spent 14 hours programming and making 3d assets for my MMORPG. lol i need a break before I do ubereats for food money tomorrow and sunday. lol
ok
you can add me tho if you want.
@granite yew you can also join photons public discord
yeah
hey! I have a problem that appeared for some reason and I can't fix with PUN.
Basically when I use "tranform view classic" if I put Lerp for example, the other player keeps lerping back and forth, from zero to the new position... it used to work fine but now it just doesn't..
why this? ๐
You need the Photon.Realtime namespace I think
I'm just using Photon.Pun; and it works
I'm using both an it doesn't work
But only Create Room doesn't work
If I do RoomOptions = new RoomOptions ()...
It works
Can anyone please help me with this? #archived-networking message
I only need you to send me PUN 2 free version so that I can drag it into Unity. It can be via Google Drive if you want.
I cannot access asset store I have trobles.
Can you please send me the package?
I personally cannot, you will have to find someone who will
ok, I will wait, thank you
whats the easiest framework to set up small scale stuff
Small question: How can I set a GameObject variable to a player that ur touching? Thanks
so, will this work for one an individual player?
like, one thing i always get confused about with multiplayer is how to single out local players with objects that arent already associated with a local player.
i want to nest this networkmigrator to the player panel. and unnest it in the players base. so, that way the network manager doesnt throw errors when I'm trying to move a player around in their base without server authority.
but obviously i just want this to nest/unnest on the local machine.
i think im in the right direction but, since i have little experience with this shit. i could be waayyy off.
btw, the void start doesnt do anything (yet) which, im aware of. im just putting it there as a "logic holder" so, you see the way my brains thinking i should grab the panel in scene.
lik, idk if it will get a hit with EVERY player panel with the 100 people on a scene at one time or not.
or just the tag on the local machine. don't know. lol
btw, im using mirror
is this better?
think i did it with [TargetRpc]
but, not i gotta start an "autoServer" aka a port-port auto cnonect until i get enough patrons to get the paid version of a VWS
How can i make variable same for every player with Photon?
Hey, how can I
gameObject.SetActive(false);
for everyone ?
Its not Syncing if I want do deactivate a GameObject, im using Photon btw
And how do I pass GameObjects with RPC?
RPC.
You can't send gameobject references (or really references in general), but you can attach shared IDs to gameobjects and send those IDs instead
PUN does this with the PhotonView component, which has a viewID attached to it
Depends on how often you sync it. If you need to sync something several times per second, OnPhotonSerializeView is probably what you want to look into, otherwise just use RPCs.
you said you program for webgl projects . while im using webgl to test alpha build with my users, how do i send a string to a php file to send an email? (smtp doesnt work in unity websocket) So, I really need a way to send the users email, and the genrated authentication code to my users.
can anyone help me with making it so it changes to a random map after like 5 mins? and it have a timer up the top (using Photon) here is manager script https://hastepaste.com/view/mHcLoU and here is launcher script https://hastepaste.com/view/RXhcEQ
its funny, gamemaker support websocket but, unity doesn't. i just do not understand why unity is so behind in somethings..
making users download your game is not as easy as getting them to click a game.io link
Can someone help me explain in steam Networking why SteamMatchmaking.LeaveLobby((CSteamID)current_lobbyID); Doesn't actually leave the lobby? ๐ค
Has anyone use polarith ai with mirror networking? I can't seem to get it to work together. My Ai works fine without any mirror component.
Hey, does anyone know what is the common practice for networking a game in unity 2019.3 ? i wanted to use MLAPI but its not supported. and Unet isnt going to work anymore either
You could try Mirror, it might work
Is mirror reliable? im working on a fighting game so i want to keep frame delay as tight as possible
I would say it's more reliable than MLAPI
it may also be worth noting were planning on putting this game on steam
will that change anything?
Mirror has a Steam transport if you wanted to use Steam matchmaking
Alright thank you! i appreciate the help
@timid compass Something like Photon Quantum would probably be more appropriate than average state transfer networking solutions like MLAPI or Mirror. Fighting game networking is a pretty specific case when it comes to networking.
https://docs.unity3d.com/Manual/UNetSceneObjects.html?_ga=2.232298911.1873409603.1632557785-941155760.1631663242 this is the most ambiguous explination ever. how the hell do i save a networked gamobject to my scene?? @spring crane @olive vessel
i made a netbutton that, listened for on authority, and runs a client publiv void to bring the client to their base. scene.
obviously, it turns inactive on run.
but, it uses network info. and should have a network Id(i think)
but, either way, id like the answer on how to save a network object to the scene so it automatically loads.
I'm new at photon
um this is about photon I don't know
I want it too random healthBox in list
and RPC to everyone
but I cannot get HealthBoxScript
why
Im using unitywebrequesttexture.gettexture(uri). But it seem it mentioned it success &isdone but data i got is null.
I even tested on webbrowser with the uri and it show correct picture .
Any idea on how can i debug this issue?
Hmm, seem like need dispose webrequest when done using it. The issue are happening when requesting multiple times.
Not my original code, helping debugging stuff
You don't use UNet
so, yeah, dont answer my question..
what is it with programming boards being so worthless? you ask a question. no one answrs or they pick out dumb shit in the context while avoid the main fucking point
I'm not gonna lie to you, I don't really like you, and I can't share my exact thoughts on you without being warned.
I find it unbelievable that you thought it acceptable to continue pinging me despite the fact we haven't spoken in days, and that you thought it acceptable to ping a moderator, and that you thought it acceptable to slate MLAPI, and demand support for a deprecated package.
Perhaps you should leave the server, and make your own game engine, so that it can have all the lovely features you demand, I'm sure you'll make a mint with it!
You don't get to ask your question here, because UNet is, and has been deprecated for 2 years. Go and find another solution that is supported.
hello I have a question, which is better Photon BOLT or PUN
on the website I see Bolt is better but I also hear that PUN is very important
anyone who has more info on the subject??
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!
took 5 seconds to google
If new project, best is Fusion. Neither Bolt nor PUN
but there isn't a fusion asset store yet
just check photon's Docs website
Fusion has been released in beta a few months ago, we're about to publish a sample on the asset store (already authorized). This same sample/demo is available from our website already
thank you, I will check it out...
I was planning on waiting for the asset store to be released cause I am afraid my game will be bugged due to fusion.... especially that the game's networking is completely FINISHED using PUN
Fusion is the replacement of both PUN and Bolt, which are legacy products already in maintenance mode (receiving only bug fixes)
If you have a Finished game, it may not be worth it
PUN will still be supported with bug fixes...
I suggested because you asked if PUN or Bolt...
Neither is the answer... If you were considering moving to Bolt (which is also totally different than PUN), you should consider Fusion instead
yes this is why I am afraid of doing anything with fusion, was considering changing into bolt till fusion is released THEN change everything again
But being an almost done game, I would not suggest this blindly... You should evaluate if it's worth for you.
Basically depends on the features you need, etc.
makes no sense to change to Bolt
is there a tutorial on fusion that I can read
If you consider changing, change to Fusion
Where is the pricing for Fusion?
there's the Fusion 101
We shared on our discord in announcements long time ago
Not on the website yet, I think
I never tried an SDK
check:
fusion 101 (on docs website)
samples (also there)
a couple of videos I posted on my YT channel (if making an FPS, they are particularly useful)
Hm, weird not to put the pricing on the site but ok
the link to these videos are also on our Discord, fusion channel, pinned messages
yes please ... i am making an fps game, can I see the youtube videos
it's just that takes time for the Web team to finish the dashboard integration for you to be able to subscribe
The princing is public
@gleaming prawn thank you a lot this is really helpful
Just a little box with it in on the introductory page would have been mightily useful
Could even put a disclaimer saying that it could change before launch
we don't plan to change the announced prices.
I'll forward this, I agree with you
We're not hiding anything, as it's been publicly shared
Believe me I am interested in Fusion, I just don't want another Discord server in my list
Makes sense... It's just that this channel here is too small for so many different solutions
It's totally optional, but there's a growing community of people using fusion, with a pretty big momentum already in place
I'm fine answering any question here, sure
But there's a lot more technically rich stuff being discussed there, etc.
is there a fusion discord server?
and are there any tips moving from PUN to Fusion?
yes and yes... for the second:
https://doc.photonengine.com/en-us/fusion/current/getting-started/coming-from-pun
it's a very high-level summarized guide, not a step by step one, as there are some important differences
I can't share a link to the Discord server here (as it's against the community rules), but feel free to PM me and request the link if you are interested.
i was about to release a demo to the game on thursday ... I am gonna release it with FUSION!
I added you
I want to build a dedicated server for like 100max Player, following a Tutorial from Tom Weilland and want to host it for free, any suggestions?
Free hosting seems like an oxymoron
want to host it for free
That is the difficult part
what is the cheapest solution then?
you want 100 players, do you want a high-quality, high tick rate solution? or just the cheapest ones?
The cheapest ones are mirror and mlapi
but I can't attest they will run 100 connections at high tick rate.
You need to check that with other devs
Maybe you don't need high tick rate
I don't know if I need a high tick rate, it's like a Star Wars Squadrons VR clone. And I know Mirror and MLAPI are using ports that players need to port forward and a lot of players won't be doing it.
well, you said you wanted to HOST the servers
If you are ok with some players also acting as the server, you can try photon fusion (no need to port forward). But that is NOT free. So I'm actually not trying to "suggest"...:)
the only free options (for the netcode part) will be those (mlapi, mirror) and a few others around (that may not be super popular - I'm not aware of them)
But that does not include any connectivity options that will reliably work over the internet....
Honestly, you want to build an online game, most likely you need to pay (someone has to pay for servers, bandwidth, etc).
One option is to use Steam networking - or Epic game services (but those are not netcode frameworks, just transport layers). So they won't solve your 100 player question either...
Alright I will look into it, Thanks for your help ๐
@jade glacier just want to say thanks for the tip about interpolation you gave me about 1 year ago. I haven't been working on my server for quite some time, but we had some talk about why my movement was jittery and you brought to light the flaw in my approach. I was only setting position on 0.1 second intervals (as soon as I received a packet update) instead of constantly running interpolation in the update method between the current position and the newly received position. I've completed rewrote my networkingsystem and with your suggestion I managed to get it to work ๐
Anyone here any good with Photon?
You can use MLAPI / Mirror with a relay based transport that way your players don't need to port forward. Both solutions have plenty of transports for that available.
Hey guys, do you know about any tutorials about MLAPI for a survival multiplayer? I know how to set basic connections, but I have no clue on how to set multiple scene management (one per client) or how to handle huge worlds with chunks for each client.... And seems like google has no answers ๐ฆ
If a UnityWebRequest exposes 'downloadProgress' why doesn't it expose the download size somewhere? if they have access to the percentage, they should have access to the file size right?
or did i miss a property somewhere
Is there a way I can specify and change which clients have access to a specific NetworkVariable ?
(MLAPI)
I've tried using the ReadPermissionCallback like this
NetworkVariableBool gunBool = new NetworkVariableBool(new NetworkVariableSettings { ReadPermission = NetworkVariablePermission.Custom, ReadPermissionCallback = NetworkViewManager.CheckReadPermission }, false);
The issue with this is that the method checking for read permission has to be static, so I have no clue to which Client (player) the NetworkVariable belongs to in the check itself
Or maybe Object Visibility is a better way to do this, as I assume if a player is hidden it won't be receiving the network traffic
?
Hello is there a good tutorials about tcp, kcp, udp and all network transport,relays?
Check out Tom Weiland's videos ill link his tutorial series ๐
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/channel/UCThwyD-sY4PwFm7EM89shhQ
List of commonly used ports: https://...
thats episode 1 but go inside and it goes to like episode 14 i think not sure if this is what u want but it is good
Thanks so much
No problem i think he covers tcp
does anyone know why my mirror network manager isn't showing up in DontDestroyOnLoad when i press play?
Is it present in the scene you are starting in?
Hey I wanted to ask if its possible for someone to help me with something incredibly important..
People are stealing my friends gumroad packages and I wanted to do a script that opens a window stopping anyone from going into the project and then asks for a special license that gumroad gives you and checks if its a valid license
i mean this isnt really networking related
but you can do that but thats a whole project not just one problem
Hey! I tried to install MLAPI with git installed, in the package manager, pasting the link found in the documentation but..
it gets me this error
- Starting ILPostProcessorRunner
ILPostProcessorRunner caught the following exception while processing arguments:
And I have no clue on how to fix it: the only forum post that I found with this error says to install git, or install the package from the link in the package manager, or adding the link in the manifest.json file, and I've done everything but it still doesn't work
Can I ask help regarding Photon PUN?
Is there a way to manually call the roomlistupdate to get an updated list on open rooms?
Also the server behaviour seems pretty inconsistent, now I'm testing with 3 players and the server only detects 1...
Were there any further details?
It's full of directories paths, almost all finish with Mono.Cecil.dll
The first are:
ILPostProcessorRunner caught the following exception while processing arguments:
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Could not load file or assembly 'Mono.Cecil, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e'. General Exception (0x80131500)
Could not load file or assembly 'Mono.Cecil, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e'. General Exception (0x80131500)
Could not load file or assembly 'Mono.Cecil, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e'. General Exception (0x80131500)
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at ILPostProcessorRunner.<>c.<ProcessArgs>b__7_7(Assembly asm)
at System.Linq.Enumerable.SelectManySingleSelectorIterator2.MoveNext() at System.Linq.Enumerable.SelectEnumerableIterator2.ToArray()
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at ILPostProcessorRunner.ProcessArgs(String[] args)
System.IO.FileLoadException: Could not load file or assembly 'Mono.Cecil, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e'. General Exception (0x80131500)
File name: 'Mono.Cecil, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e'
---> ILPostProcessorErrorException: Could not find assembly file for assembly named 'Mono.Cecil'.
Tried the following paths:
Library/Bee/artifacts/1900b0aE.dag\Mono.Cecil.dll
C:/Program Files/2021.2.0a15/Editor/Data/Managed\Mono.Cecil.dll
C:/Program Files/2021.2.0a15/Editor/Data/Managed/UnityEngine\Mono.Cecil.dll
C:/Program Files/2021.2.0a15/Editor/Data/NetStandard/compat/2.0.0/shims/netfx\Mono.Cecil.dll
And it's about 8x this big
Most likely your project name or path to your project contains a special character. We don't support them. The "space" character is also not supported.
Oh, yeah, my name cointains a space and a '... Thanks!
any help?
@cedar cloak I just started on Photon as well, but my guess would be to create a button and connect roomlistupdate to that button so when you press it, it will update.
Does anyone here know where I'd find how to create like a pregame lobby in Photon, for example.. Among Us before they click start because they're waiting on more people or Phasmophobia where you join a lobby and can talk before starting. I can do it with all text but I was wanting to spawn them into a level together as they joined before actually starting the game
uh youre using photon?
id put all the players in a room with basic movement and crap and when the games ready (i guess when the host pushes a start button or something) call an rpc via the server to all the players that starts the actual game
uh have a ping @feral oak
anyone have any thoughts why my objects movement is slower in editor than a server build. Im using Mirror for my networking. Below is a code snippet from my movement code and the difference Im seeing in movement speed.
{
if (_IsInitialized && isServer)
{
UpdateFrame();
}
}
[Server]
public void UpdateFrame()
{
if (_Initialized)
{
Transform goal = _WaypointProgressTracker.target;
Vector3 vectorToTarget = goal.position - transform.position;
float angle = Mathf.Atan2(vectorToTarget.y, vectorToTarget.x) * Mathf.Rad2Deg;
Quaternion q = Quaternion.AngleAxis(angle, Vector3.forward);
transform.rotation = Quaternion.Slerp(transform.rotation, q, Time.fixedDeltaTime * rotationSpeed + speed);
transform.Translate(speed, 0, 0);
}
}```
Editor Server -> Editor Client
Server Build -> Editor Client
Any tutorials on how can I communicate data from a game to another game?
Like two seperate Unity games or like two Matches in your game?
I have my game and a different android build where I wanna get real-time data out my game
Hmm
Something like rust companion app, if you play rust https://rust.facepunch.com/companion
I don't but i know where ur getting at
Why does everything have to go to the andrid build?
I guess it's possible to have a common data base but I dunno if that's efficient
Why not host the info somewhere else or somin?
Because I wanna have the minimap and chat on mobile
Maybe too
but maybe i dont see why this wouldn't work
Like a central system where one can set and the other can get info?
Doesn't sound that secure tho
Tru
I mean you cant really expect it to be secure it is gonna most definitly has some potential flaws that could easily be exposed
It doesn't need to have flaws if you know how to code and protect your project
yeah
I dont think that the method RoomListUpdate exist, thats the issue
Doesnt the OnRoomListUpdate gets only called in response to photon and so cant be manually called?
If you want help with the RoomInfo calling manually it shouldn't be too hard
Basically
Just store a list like
List<RoomInfo> room;
then add the room to that list in the override methos
with
room.Add(room);
then you can reference all the rooms and their info whenever you want
But
This wont help with updating the rooms in which you will need the callback
Wait what room should I add?
I need to gets updated on EVERY room available, for now I refresh by just disconnecting and reconnecting to photon
But this thing is inconsistent
what
I told you a viable solution
You can add the rooms to a list which you can reference from anywhere
Can you please make an example method on how could I do that?
Cause for now I'm still struggling to understand, I get it that I need to get new rooms but how I get them updated?
Had you read the docs?
And they told you how to do it if you pay attention
Ive already tried to manually calling it but its not working
And docs dont have a description for this kind of issue
Docs don't need to have a description for your issues
Docs tell you what's possible and what's not
then seems like its not
PhotonNetwork.GetRoomList() is gone. You get rooms list and updates from ILobbyCallbacks.OnRoomListUpdate(List<RoomInfo> roomList) callback.
and the callback is only called by the server interactions so doesnt depend on the client
...
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!
hmm i've never used that in my life
but it is probs that same as
public override void OnRoomListUpdate(List<RoomInfo> rooms)
You are probably remembering PUN1
Really
nah
it is in pun2
{
UpdateCachedRoomList(roomList);
}```
thats a snippet from the doc
Though you can also inherit from MonoBehaviourPunCallbacks instead of using the interfaces
another very bad inconsistency I'm getting is that photon is not refreshing its playercount or other server infos in a reliable way
it should update properly tbh
I just logged with 3 different builds and the PhotonNetwork.CountOfPlayers was most of the time 1 (sometimes even 0)
In your current room?
connected to the master server
you just have to be connected to photon
@cedar cloak what is that you are trying to do?
its the global playercount
I'm from Photon
AFAIK we don't expose the global player count from the client API
Do we @stiff ridge
?
So maybe I'm wrong...
You said it's returning 0 to you
and you test with several clients on the same region, right?
I'll ask here if you need to be connected to the Master when you perform this query
so thats why Im becoming crazy
my condition is PhotonNetwork.IsConnectedAndReady
sure take your time
{
if (PhotonNetwork.IsConnectedAndReady)
{
connectionStatus.text = "STATUS: ONLINE";
nickname.text = "NAME: " + PhotonNetwork.NickName;
roomCount.text = "ROOMS: " + PhotonNetwork.CountOfRooms;
playerCount.text = "PLAYERS: " + PhotonNetwork.CountOfPlayers;
}
else
{
connectionStatus.text = "STATUS: OFFLINE";
nickname.text = "ID: /";
roomCount.text = "ROOMS: /";
playerCount.text = "PLAYERS: /";
}
}``` this is what I call on my little debug panel just to understood what are the info received
and sometimes I get status online but playercount 0
I mean, you have 3 servers you may be connected to:
- nameserver (initial handshake, authentication)
- master server (matchmaking, create/join rooms)
- game server (when in a room)
I'm asking here in which of these you can query that info...
You can only get it on Master
tobi said right here
to be clear I do not work with PUN much (I work with Quantum and Fusion).
makes sense... Thanks
I use modified mlapi 
Indeed I call it outside of a room
and as I said this behaviour just worked with the same code, but some time its not
same for the roomcount
You sure you are actually landing on the same region and room?
have the values ever been correct?
Cause if they fluctuate thats a different story
But if they never that doesn't seem like a Photon thing to happen
tbh
yes
Also there is a delay i think on this
On my previous project the issue was there but was a lot less frequent
as far as I understood its called every 5s
In my opinion i have never faced this problem ๐
ye, I confirmed again with Tobias (and suggested him to make the inline doc to be more clear). Make sure you are connected to the MASTER server when you perform that query
If you are in the name server, it will give 0... same for when you are in the master
you mean game?
no like the last thin
this one
you said the same for when you are in "master" but you mean "game" right?
so that query only works while connected to 2 (master server)
does not work when you are in name server neither in game server (room)
Yep
Btw since you have worked with Quantum would you reccommend it over Fusion? ๐
Cause i believe fusion is a rising project with lots of potential
it is connected to master when I get the roomlist info
but currently it is in developement
It is not custom to call the rooms
and when I do refresh
I would not disconnect then reconnect
that is a bad way to do so
as i said
Store a list of roomInfo probably then work of that then use the callback to update that list ๐ that way it is easily accessaible while staying up to date ๐
Debug.Log(PhotonNetwork.Server == ServerConnection.MasterServer); this return true everyframe but I still didnt get the right server info
Sorry, was off
Both Quantum and Fusion are high end netcode solutions... I personally do not recommand one OVER the other... It's more of a decision based on these two aspects:
- gameplay (certain genres basically push for Fusion, like FPS, TPS, etc - while others push for Quantum like RTS, Brawlers, Fighting, Tower Defenses, etc)
- your team (Quantum's ECS is actually a game engine that fully decouples simulation from view, which is a great way to keep the code super clean and organized, but you need to check if your team enjoys working with it - most do; Fusion is Unity-land)
I think this one is complimentary to that one.
sure
Btw, I stream every Wed and Fri about Quantum.
Oh nice what do you stream on ?
And I recently started a new project, and the first stream was this:
- single player wave-simulation + boat physics
- ported to Fusion
- ported to Quantum
- all on the same project
- playtests all against each other, and showed the code, comparing the differences, etc...
what is the cap for mlapi?
Here's the specific video for that initial stream (the tittle is WRONG):
https://www.twitch.tv/videos/1136196388
it will probably be deleted soon by Twitch...
Why would twitch delete it
this is the full description of the stream:
Coding an online multiplayer boat game using efficient water simulation and buoyancy:
- start with basic single player prototype (bare Unity, no extra assets).
- port to multiplayer using two different approaches: determinism (Photon Quantum) and state transfer (Photon Fusion).
- playtest and compare all three versions.
- continue development of multiplayer mechanics (probably with Quantum).
Other topics:
- periodic multi-wave sampling as water simulation.
- vertex-shaders for efficient rendering.
- spring damper physics for buoyancy.
- surface drag physics for keel, rudder and hull.
Note: the goal is to create fun and engaging mechanics with efficiency techniques. No focus will be given to accurate water simulation.
it is useful to society unlike some things on twitch tbh
ty
what is the limit of mlapi?
Im not too sure tbh
Sorry, I do not work with mlapi... Someone from the Unity team will answer.
{
roomList = p_list;
UpdateRoomList(p_list);
base.OnRoomListUpdate(p_list);
}
private void UpdateRoomList(List<RoomInfo> roomInfoList)
{
Debug.Log("UPDATING ROOM LIST");
roomcount = 0;
foreach (RoomInfo roomInfo in roomInfoList)
{
Debug.Log("ROOM FOUND: " + roomInfo.Name);
roomcount++;
}
Debug.Log("ROOMS AVAIALBLE: " + roomcount);
}``` I tried this but it still gives me 0
Please don't ask in 2 channels
why can I join a game, then leave it but when I try to join another game after that, I get an error.
What error? What networking framework are you using?
PhotonView ID duplicate found: 999. New: View 999 on RoomManager (scene) old: View 999 on RoomManager (scene). Maybe one wasn't destroyed on scene load?! Check for 'DontDestroyOnLoad'. Destroying old entry, adding new.
thats the error
im using photon
Do you end up with multiple RoomManagers?
when I leave the game, my RoomManager gets removed, I only have one in the game
How is it getting removed?
InvalidOperationException: Duplicate key 999
i also get this error
It probably isn't getting destroyed if it is marked as such
it is marked as that
Since you know, don't destroy
You have to destroy it
but its not there when i switch scene
it will thrwo the error
if you do not destroy the object
as there is a previous trace
say i do this
Did you check the don't destroy scene?
Menu>Game>Menu the second time i go to menu there must have been a ROOM Manager the (Old Instance)
what
Things marked with that are moved to a special scene
You can view it like any other scene at runtime
i always have a roomManager until I leave a game. i have it before and in the game but not after
i dont understand
Hierarchy shows you all the scenes loaded with their contents
If something is marked with DontDestroyOnLoad, it will be moved to a scene called that to avoid being destroyed with the scene
ok
but how do i fix the errors
the room manager has a script on it
public static roomManager Instance;
void Awake()
{
if(Instance)
{
Destroy(gameObject);
return;
}
DontDestroyOnLoad(this.gameObject);
Instance = this;
}
@spring crane
@jolly wadi
Just destroy the singleton on leacing
you have an name for the objet
so when moving back to the old scene make a coroutine giving enough time to destroy the singleton then go back
something like
Destroy(roomManager.Instance.gameObject);
Hey, what's the best way to handle hundreds of projectiles? I want my 2d multiplayer to have physical projectiles and not raycasts, but giving each one a network transform component seems a bit... overkill
Should I send an RPC by each client that is shooting with the data of the projectile, and then spawn each projectile locally in the client?
Look into Firebase itโs a google database. Tons of tutorials on YouTube of how to implement and store data
Why would I need an external database?
You said you were trying to store data?
Itโs a solution that can be a little more secure also, and you can grab the information from the database and place it in your game via code
I have a database already? How can I host a massive multiplayer without one xD
Giving me an online database provider is not answering my question, but thanks 
if you already have one just use that database to get the data to the app? lol
Efficiency???
what
yes thats efficient what are you reading lol
why would two databases be more efficient
Do you have billions of players
Has anyone used any of the steam relay transports with MLAPI? I've just checked out the various community versions but can't get them to work well:
- ImprovedSteamTransport -> can create host and client, very very laggy, loads of exceptions about unknown messages. Disconnect doesn't seem to get propagated.
- FacepunchTransport -> can create host, client gets "Invalid Connection"
Without diving in to the errors, I'm just interested if anyone is using them successfully right now
I skimmed through and from what I saw you need a database.. I also didnโt know you had a database, so maybe telling us what you have would lead to better help? You should 100% be using your database to store and get the information.. thatโs what theyโre for.
Is reading and writing a database at same time from two different applications a good idea?
I mean I doubt you need it that often? But unless youโre reading and writing a ton of data I feel like it would be fine.. thatโs what theyโre for lol
I need it every 5 secs xD
Why?
Real Time data
I think I should make an api and that talks with the db
It's the only solution I can think of
Well then make an api
That's what I did for my first solution, then I swapped to using the particle system for my bullets
As the particle system can be used to create a wide variety of different guns in an interactive way
Not sure if this will work optimally yet. As the client you sent an RPC when you press and let go of the mouse button which toggles the particle system on both client and server
@weak plinth look up n-tier architecture
That's a slow method tho?
You have to put all data into a query
It's not slow no, but if performance is critical there are other ways you can build it
For instance, you could have a hosted app that keeps all the data in memory. If the app goes down you lose the data though.
You should look into redis
It takes all data from game then queries it untill its able to store it while the dB is not being read so it might get some lag in game while storing data
?
redis isn't a bad idea, it also has pub/sub etc
I prefer having data on my own server
Redis is something you'd launch a server instance of
And communicate through an endpoint
Like a normal relational database
Or you can use it locally on one machine and communicate through it with multiple applications
It'll perform better than a relational database in speed
However, you usually don't use it to store persistent data, as once it is turned off the data is gone
It's too much data to be hold into ram and cache :(
Redis supports persistence
It does, but I'd suggest storing persistence data in a regular database like postgres etc, and then load it into redis at launch for the real time communication
@cerulean crescent what's the benefit of that? you're just adding extra steps to achieve the same thing
Usually all the data you have isn't really required to be communicated in real time, so storing exactly all the data in redis is a waste of resources (Ram), whilst a relational database like postgres or mysql would store it in your ssd / hdd
Ok sure, I'm just considering the realtime requirement ๐
Yeah if all the data should be read and written in real time then I don't see why redis persistence mode shouldn't be used
I guess we need to know the problem in more detail though
But I feel like that is usually not the case
Yeah I agree, the scope of the problem isn't really all that clear
I worked on a project where we stuffed everything in Redis instead of spitting stuff out in to appropriate databases, so definitely agree with your point.
I guess we are talking about CQRS really
Though it was mentioned that it would be done as "frequently as 5 seconds" or did I misunderstand that
Because that's not really that frequent in terms of read and write conflicts goes
.
How can your mmos dataset not fit in ram... there isn't a game out there that isn't storing game state in memory. Either way the db tech you use should be abstracted away by your 'db server' that's handling any additional logic like locking a char etc. Your game server shouldnt be speaking directly to the db
@weak plinth can you to try to specify your problem more clearly?
- What are the types of clients? (e.g. game, mobile app, webpage)
- What data do the clients send? (type, size, frequency etc)
- What data do the clients receive back?
- How many clients are connected?
- Does the data need to be persisted? If so, what data?
Imagine rust https://store.steampowered.com/app/252490/Rust/ and imagine https://play.google.com/store/apps/details?id=com.facepunch.rust.companion&hl=en&gl=US&referrer=utm_source%3Dgoogle%26utm_medium%3Dorganic%26utm_term%3Drust+companion&pcampaignid=APPU_1_DGxUYZOZKc787_UPm8uHaA
The only aim in Rust is to survive. Everything wants you to die - the islandโs wildlife and other inhabitants, the environment, other survivors. Do whatever it takes to last another night.Rust is in its 8th year and has now had over 300 content updates, with a guaranteed content patch every month. From regular balance fixes and improvements to A...
$93.49
542099
69
Game and mobile app
They need to communicate
Player position real time ( a lil delay ofc)
Server status
Game chat
Events
Etc stuffs I store in db
It is possible and it's not hard, but I wanna do it as efficient as possible
Without corrupting the database
Any reason you don't want to use the networking solutions such as MLAPI, Photon PUN or Mirror etc?
How does that help me?
Have you written any 'server' apps before? e.g. a socket or rest endpoint?
Yes
Because they're made for networking, whilst databases tend to be used to store data
Here's what I recommend:
- Create a 'server' app
- Don't bother with a database for now, just store the data in memory
- Implement the various APIS (e.g. GET players, PUT position)
- Test it out with your clients
- Implement the databases on the backend later
I do use mlapi for networking
The in memory solution will be blazing fast, but wouldn't be resilient. But adding in a database later is easier (and standard practice)
How can I communicate player position to an apk without database
What kind of endpoints have you written before?
Wdym, what sort of apis I made?
For sockets: you have an app running, listening for socket connections, then you write data back/forth over that connection. You have to handle the data serialization yourself.
For rest: you set up some HTTP endpoints e.g. https://yourserver.com/api/players - and then use GET/PUT etc requests just like a web browser does
Yeah I did say that I'm planning to make an api to communicate to game
But you haven't got experience with either yet?
Only theoretical knowledge
I just get the image that you want to communicate the live data (game traffic) though a database, but maybe I've misunderstood as you say you're using MLAPI
OK, you'll have quite a bit to learn but it is possible
clearly you didnt choose ur database right or didnt learn it. there is things that allow locking
Postgres handles concurrency to great degrees
Database is a red herring here, it's not the right solution
Redis would work because it also implements a few protocols on top
But you don't want all your clients connecting directly to a database
Yeah communicating game traffic through a database seems quite unorthodox
@weak plinth do you want to write this in C#? Or are you familiar with other languages?
And inefficient
@cerulean crescent I don't think it's the game traffic. I think they want to use MLAPI for the normal networked game stuff, plus a second channel to share data with a server + other apps.
Well uh js for networking
And do you want to host it yourself or run something in the cloud?
I have a server computer
OK cool
So I guess you want to pick whatever stack you are most comfortable with. Personally I'd use ASP.NET (because it's C#) but you might want to use node js
I would try setting up something simple to send data to, query data from first
If you haven't done that before, it's a little project in itself
When they send the data, you can just keep it in memory somewhere, then query it when they request data
Once you've got all that working, then you might look at persistence etc.
Maybe this is helpful: https://docs.microsoft.com/en-gb/learn/modules/build-web-api-aspnet-core/?WT.mc_id=dotnet-35129-website
Create a RESTful service with ASP.NET Core that supports Create, Read, Update, Delete (CRUD) operations.
Iโll ask again since it seems more people are here. Iโm using Photon for networking and I want players to join a scene after the master creates the room. Essentially a Phasmophobia type pre game lobby before the game starts where you can all walk around and ready up before starting.
I know how to change the scene for all but canโt quite figure out how to get players individually joining a scene but syncing together
Sorry if Iโm not explaining well
Among us is another example where the players spawn into a scene as they join and once the master says start they all change to the new scene
How can I set object active across network? (Photon PUN)
Found the answer I believe. Figured Iโd share it incase it can help anyone else.
I think itโs OnPhotonSerializeView
@odd kite
Youโd find a lot of solutions on this just by googling that are pretty helpful
Thank you so much
๐ฏ for posting the solution once you found it
(MLAPI 0.1.0)
Is there a way for my client to know whenever another player has been made "Visible" for said client by the server with the Object Visibility API?
I was thinking of using OnBecameVisible, but that is only when an object becomes visible within the camera but I want to know if they're outside of the camera vision as well.
Is there any method to do this as of now, where the client is notified and if not, would be it be reasonable to suggest such a feature? Thanks
Hey I got a question when I Change a bool in my SceneManager, for other players the bool doesnt change. how can I fix it?(using Photon)
Has anyone used the SteamNetworking P2P transport? I'm running a host and client locally and there's extreme lag between the two
Hey guys, I have an issue with my photon. My region is connected to the same region as everyone else (Canada) and the build versions are all the same but my device specifically cant join a random room.
I figured out the problem - you can't run host/client with same steam Id... the messages get randomly delivered if you manage to connect at all. You need multiple PCs to use this.
but dont games like csgo allow hosting a game for friends in you own lobby on your pc
Yes, you can be a host, which is yourself being a server and client at the same time
But with the Steam transports, you can't use the same PC to have a host and client at the same time, because they use the same Steam ID
Yep, that's fine, because all your friends will have different steam ids
- I was starting host in one instance (so it logins in to steam, then starts host on steam relay)
- Then starting client (logs in with same steam id, then sends connect to relay)
But you send messages to a steam id, and because both host and client have the same steam id, it gets delivered to one... so for instance when the host replies, the message gets delivered back to itself
I'm going to test it works on different PCs, and if it does, just use a non-relay transport for local testing
Is there anyone familiar with rollback netcode that could help me get started on implementation? (i fully understand rollback and lockstep and how they work)
I can also pay per hour, mostly looking for a mentor
Tom Weiland implemented it for his game it seems to work for him . He sorta explains it but yeah idrk ๐ค
His implementation is not the predict rollback I believe heโs asking for here
If I understood right, the question was for GGPo style rollbacks,
I am one of the devs of photon quantum, which is like that on steroids. I did not say anything because heโs asking for mentorship, not a productโฆ:)
Tom Weilland does not teach everything he implemented with his state transfer, he barely touches the surface of the complex topics
Itโs a nice channel and content, but very far from being a complete source for whoโs starting (it has some ideas good for intermediate level developers though)
Hello everyone). Maybe someone fumbles well straight for different multiplayer implementations and can help with advice? I myself personally have only a very basic idea of โโit, and now I have an idea to make a 2D game, where it will be with 99% probability - only 1vs1 battles, but there will be a lot of other objects, maybe hundreds (of course, I can clients to count according to the same formulas, but then there is a huge risk of catching this data by a smart person, changing it (in general, cheating)). And I do not want to have p2p for sure, at least for the top reason, well, and the fact that then the connection will depend on the main host, well, it will have a big advantage, which should not be in my idea at all. So, I suppose, all I have to do is use a server that will handle a bunch of small "rooms", if I can call them that in my context. And that's why I look towards MLAPI (it doesn't matter to me at all that it is only developing there. The main thing is that it gives what I need and that's it) or DarkRift2 (noticed somewhere and how it understood it is the lowest-level one (but that does not mean that. I need to write everything from scratch) compared to all other implementations, but if it gives more control over the situation, then it's for the better). I donโt want to use a photon or a mirror from the principle. I don't want to use it 100%. Maybe someone can tell their opinion)? Of course, in theory, I can make my own multiplayer, but for sure it's too long, especially when this word "multiplayer" brings boredom on the part of me as a developer. Well, itโs right at the lowest level of reel, Iโll get tired of working with him, huh).
Before that, I just thought that I would write everything on DOTS, but the project tiny (and only on it you can write 2D games on DOTS) is so incredibly experimental that it's rave... And then was only one choice of multiplayer from Unity herself (DOTS-Netcode).
Curious to know what principle Mirror is violating considering the overlap between Mirror, MLAPI and DarkRift. PUN is understandable considering that you are not looking for "p2p" and are looking for authority or some other from of security. Sounds like one of the high end Photon products could be a good fit there.
Unity Tiny has supported 3D games for a long time (check out their showcase projects), but Unity ECS is in a pretty unknown state when it comes to what is and will be available in the near term. There technically is at least one thirdparty networking solution from vis2k (primary author of Mirror) called DOTSNET.
3D games? But I wrote that I want to make a 2D game). I just don't really like the instability of the tiny project, because we can only guess how it will be supported. And, I want to start making the game right now and maybe even maintain it for a long time, and with this tiny project everything is very muddy.
And about the mirror ... I just don't want to try it and that's it).
Looks like people here have got experience with Mirror? Currently following Brackey's UNet Multiplayer FPS Tutorial (as it's deprecated I'm doing it with Mirror) - but I'm getting a Null Reference:
NullReferenceException: Object reference not set to an instance of an object
PlayerShoot.Update () (at Assets/Scripts/PlayerShoot.cs:32)
It only happens when the second player is added. It looks like I'm not getting an object reference to the second player's 'CurrentWeapon' .. but it's got through script not in inspector and works when only one player is connected .. so not sure where I'm going wrong!
Here is my PlayerShoot Script: https://www.codepile.net/pile/BNWvbZRM
Here is my WeaponManager Script: https://www.codepile.net/pile/d3orgj1D
Here is my PlayerWeapon Script: https://www.codepile.net/pile/L8m56W8J
Thanks in advance!
Mirror supports 2D and 3D (it doesn't actually care which) and can easily support a bunch of 1v1 concurrent matches per server instance. Yes you'll need to run your own public server(s). Mirror's discord can be reached through the link on its asset store page. Docs and examples included.
Best to seek Mirror support in their Discord - link is on its asset store page.
If you use MLAPI, the Object Visibility API could be useful if you want to put multiple players into the same server, but separating them to only communicate and see each other (1-on-1). However, this is only visibility of what clients see, so your server will still have all the players in the same scene. But since you're making a 2d game, you could even divide physics (collisions etc) so that they all act on their own Z position. That way each 1-on-1 pair won't interact with each other, and will only also be rendered on the clients correctly
guys, what would be the best way to use webrequest and able to abort it?
I think the code im helping debugging using 1 variable that i assume got override by another webrequest
another method is to use "using ", so that it properly dispose after connection complete
but iirc the code was using it at beginning, but was removed because cant be aborted
anyone have tips?
also, the problem i had earlier still happening randomly
it will get a picture from online server
the webrequest said it "isDone", but the data is empty / null
but if i get the via browser, its fine
uri / address is correct
I have a saving system where the data gets saved for players and the world
the world save is saved only on the host's pc
when a client joins
how could I request that data from the host?
and also
the way I'm saving is a bit weird
there's a singleton gameobject in the scene that has a script that sends a command that saves the world data for the host
that's all and good
but when a new client connects, the singleton doesn't have an instance anymore
so, those are my two problems
anyone know how to do this?
Hi guys, i'm working on simple tcp server/client system. And now i'm going to implement the movement and i want how to deal with smooth movement with sync position between server and clients.
Any know any documentation, reference to see?
no
Tom Weiland has a great series on TCP/UDP networking, definitely worth checking out
How would i make a killcounter. With the script i have it only lets me count deaths as it only gets kills when the player has below or 0 hp and because of that I can only know how many deaths some1 have and not how many kills. pls help
please don't ping random people.
should I use multi threading or select for my server?
I am creating a 2D fighting game with a max of 4 players
quick question
public class ItemSlot
{
public int itemId;
public int amount;
public string scene;
public ItemSlot(int _itemId, int _amount, string _scene)
{
itemId = _itemId;
amount = _amount;
scene = _scene;
}
public static Item Item(int index)
{
return ItemDatabase.instance.GetItemWithIndex(index);
}
public static int Id(Item item)
{
return ItemDatabase.instance.GetItemIndex(item);
}
}```
it's saying it doesn't have a default constructor
the public static functions are there just so I can access the data in a cleaner way instead of just writing that whole ItemDatabase.instance.GetItemWithIndex(index);
default constructor is ItemSlot()
That's not a networking issue, but the problem is that you don't have an empty constructor that takes no arguments.
yeah yeah I fixed it
I think
I hope-
nope
still gives me the same error
ItemSlot can't be deserialized because it has no default constructor (at ItemSlot)
Add a public ItemSlot() { }, otherwise the serializer can't create the instance
It should though
does it affect it in any way if I have one file for inventory and itemslot?
like this?
should I separate them into different scripts?
It needs to be public
or do I need to make it public?
make it public
Constructors always needs to be public, as you almost always create instances of that object from other classes
np ๐
^^
I come back with another problem
I'm instantiating an object in a function as a command
and then spawn it on the network server
if I check for authority
it just gives me an error
now I'm getting another error-
NullReferenceException: Object reference not set to an instance of an object
{
Debug.Log(GetComponent<NetworkIdentity>().hasAuthority);
if (!GetComponent<NetworkIdentity>().hasAuthority) return;
if (PlayerInputController.inputActions.Player.Attack.triggered && Time.time >= nextTimeToConsume)
{
CmdConsume();
nextTimeToConsume = Time.time + consumeCooldown;
}
}
[Command]
void CmdConsume()
{
playerStats.currentHealth += consumableItem.health;
inventoryHolder.RemoveItem(new ItemSlot(ItemSlot.Id(consumableItem), 1, SceneManager.GetActiveScene().name));
}```
this is the code
now it has authority
but just gives me an error whenever I call CmdConsume()
I think it might be the inventory.RemoveItem thing
I'm getting into developing multiplayer games, and I want to buy server space to test the games I make. I already have a webserver and a domain name, but I'm told it would be tricky to run multiplayer with a webserver, and someone suggested I look at the AWS options
I'm looking at this one specifically
the amazon EC2 T2
does anyone know if I can use something like this for multiplayer games?
Can someone show me using MLAPI how to share an INT from the Host to Clients? I've watched 10+ tutorials and I cannot figure it out. ๐ฆ (The INT from Host is mapSeedValue that I want given to the Clients so they can generate the same world).
Hey guys, I'd like to do a local object spawn per client triggered by a client event (spawn of a projectile) and I'm trying to use RPCs to do that, and the RPC's parameters are the position and proprieties of the object. I'm using a ServerRpc to call an RPC with the client, but the rpc must be executed by the client, so this ServerRpc just calls a ClientRpc that spawns the objects per-client. Is that the correct method to handle it? It seems a bit... weird, to me, but I'm not experienced enough to find better solutions.
Here is a bit of example code that uses a Debug.Log and a string:
void Update()
{
if(IsOwner)
{
if(Input.GetKeyDown(KeyCode.Q))
{
SendMessageServerRpc(number.ToString());
number++;
}
}
}
[ServerRpc]
public void SendMessageServerRpc(string msg)
{
SendMessageClientRpc(msg);
}
[ClientRpc]
public void SendMessageClientRpc(string msg)
{
Debug.Log(msg);
}```
(number is a public integer variable)
It seems to work well
I think you can use a client rpc, it will be called by the server/host with the seed as a parameter, and executed by the client. It might, for example, save it in a local variable (so the client rpc would just save the seed in the "public int seed" variable and, if needed, call another function to do something with the seed)
@indigo thicket "seed as a parameter", I have to set this though to call it. So a client joins game, they need the mapSeedValue to generate the Hosts world. So I'm confused how to set it to the method as a client. I've managed to build everything so far in the game and its alpha ready btw. so I'm not 100% noob.
A client joins the game and remains in a wait state until the ClientRPC is called, so the client does literally nothing if he never receives the seed. However, when a client connects the host will send a ClientRPC with the seed, and the ClientRPC will be executed by the client with the new seed
Once the client has the seed he can begins to spawn things and execute the game as normal
ok trying to follow along.
I have no clue on how the host handles the new connection event, or how to send a ClientRPC to a single client so I can't help with that, but I'm pretty sure the docs have everything because I was reading them some hours ago
I'm spawning the player, I call a method to activate player then another method to generate world.
So I call a ClientRPC when player joins, give all clients hosts map seed, with the mapSeedValue as a parameter. But I'm calling this from the clients side when they join, so I don't understand how I can set the parameter as the Hosts seed.
My brain aint working I guess on this.
The following table details the execution of ServerRpc and ClientRpc functions:
A client RPC is called BY the server (or the host, that is both the server and the client) and is executed BY the clients.
So a client connects, the host detects it, and calls the SendSeedClientRpc(int seed) function
NetworkSendRpc() ?
The client(s) will then execute this function
No; look at the table
You just have to create the SendSeedClientRpc(int seed), that will be called BY the host, and will actually be executed by the client(s)
The host should detect the new connection and call the ClientRpc only for that client
ok, how does the host call it though when a player connects?
I understand everything till that point.
yea, sounds easy right?
With every new connection, Unity MLAPI performs a handshake in addition to handshakes done by the transport. This is to ensure that the NetworkConfigs match between the Client and Server. In the NetworkConfig, you can specify to enable ConnectionApproval.
@indigo thicket thank you
I have approval connection, oh.......
I understand now
I have to do it there. got it!!!! makes sense now
! ๐
It should work. thank you so much!
Lazy I havenโt used this networking solution presumably mirror or MLAPI?
MLAPI
Yeah
The formatting looks to be fine so I would agree with what you have coded there
Like I can somewhat understand how it works does it produce positive feedback๐ค
But obviously Iโve not really used MLAPI ๐
Ok so I spawn local projectiles with an rpc call. This should be ok because there will be thousands of them in the scene. However, I've got some problems, that a networkTransform and a NetworkSpawn would fix kinda easy: 1) the projectile's position are not 100% in sync, and 2) if I need to destroy a projectile the server/client has no idea on how to identify each projectile, and giving an id each projectile seems kinda... overkill, maybe. Am I doing everything right? Should I use a networktransform, or should I use an ID on the projectile and check the collision on the client?
I'm using MLAPI
Checking collision with projectiles on the client should be cool, but checking enemies collision on the client is ..ok?
I'm not sure if that works
does anyone know why i am getting an error with this code ```using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using UnityEngine.SceneManagement;
using System.IO;
namespace a.parkour.fps
{
public class Manager : MonoBehaviourPunCallbacks
{
GameObject player;
PhotonView PV;
void Awake()
{
PV = GetComponent<PhotonView>();
}
private void Start()
{
if(PV.IsMine)
{
Spawn();
}
}
public void Spawn ()
{
Transform spawnpoint = SpawnManager.Instance.GetSpawnpoint();
player = PhotonNetwork.Instantiate(Path.Combine("Resources", "player"), spawnpoint.position, spawnpoint.rotation, 0, new object[] { PV.ViewID });
}
public void DisconnectPlayer()
{
StartCoroutine(DisconnectAndLoad());
}
IEnumerator DisconnectAndLoad()
{
PhotonNetwork.Disconnect();
while (PhotonNetwork.IsConnected)
yield return null;
SceneManager.LoadScene(0);
}
}
}```
error:
Where is lien 22
wait srry wrong error
Oh I know why
it dosnt instantiate the player into the scene as the spawn method dosnt get caused
i fixed that one
{
Debug.Log("spawnning...");
Transform spawnpoint = SpawnManager.Instance.GetSpawnpoint();
player = PhotonNetwork.Instantiate(Path.Combine("Resources", "player"), spawnpoint.position, spawnpoint.rotation, 0, new object[] { PV.ViewID });
}``` dosnt get called
{
if (PV != null)
if(PV.IsMine)
{
Debug.Log("starting to spawn");
Spawn();
}
}```
how do i make it not null?
Do you have a photon view on the object?
Also I recommend taking the line you put in awake and putting it on the start of the start function
ok i fixed it thx
oh wait now only one player can join
that would be a problem with PV
I used debug.logs and it registers the photon view of the other player but it dosnt instantiate another player
hmmm
well this is pretty much the same code i implement
so i dont see a reason for this too happen tbh
there is updated code
anything wrong with it?
k did that still not working
what?
{
Debug.Log(player.NickName);
}
error
now i get that error
still no work
like? public class Manager : MonoBehaviourPunCallbacks
cause if so it dosnt work
no errors just only instantiates first player and not second
can anyone help?
@jolly wadi are you still there?
Im actually rather confused
could it be to do with my launcher script?
or here is the original manager script but i edited it to use multiple spawn points and thats when the errors started https://hastepaste.com/view/PtVblC
Pls stop pinging me
i will look over the scripts
thx
ok
but then i edited for multiple spawns
is there anything wrong with it?
Hey guys. I am using Photon Transform View to sync players spine rotation but it is not syncing. I have added a transform view to its head and that is syncing tho. This is a mixamo character btw. Any help would be appreciated ๐
Hello! May I ask, is it possible to make one photon 24/7 running server which can be turned off for maintenance and updates while saving it's state(players' buildings, stats, levels - it's a really small mmorpg) and on? If so, is it easy or not? Is there a guide for that?
U would have to host the server from home ๐ I think ๐ค
why so? they have pun cloud option, no? At least that's what I've found...
the problem is that all guides that I found describe room-based mp but I want something a little different
hmm
Netcode for GameObjects
i know this isnt mirror discord but, anyone know why there manager destroys network id objects n "awak" instead of iterating through an index and updating scene id checks or conn? after 3 weeks had to go back to mlapi cause mirror literally cannot be made for a game using multiple map scenes.
mind numbing why anyoe would program a awake function like that
setting in a dictionary to look for index(scene) connection id path, and obj would be FINE for scene changes
does mlapi plan on dealing with multiple scenes?
Library\PackageCache\com.unity.jobs@0.8.0-preview.23\Unity.Jobs\IJobParallelForDefer.cs(77,85): error CS8377: The type 'U' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'NativeList<T>'
btw, anyone know why after downloading mlapi the unity.jobs add on is giving this error?
@stable charm proud of you guys, you added multiscene support it looks like and websocket within 3 weeks of my breakdown last month. thats fast. Question though, can you guys make a video or list on how multiscenes will work? Can you message me one of the devs making mlapi. i have a very clear vision and explaination of my game and how the mechanics will work, i know mlapi is new but, so is my project and id have no issue making my mmorpg a showcse of the mlapi capabilities if you guys were willing to work with me.
i have been using unity for single player since 2011
but, mlapi is new but, already looks better than photon and mirror now. and thats after just a month after i started my project.
Hey everyone, do you guys have any recommendations on networking beginner tutorials? I'm not sure which service to use... I need voice chat too so I don't know which ones have it.
Doesn't Photon have a voice product?
Should I start with MLAPI?
MLAPI (Netcode for GameObjects) is pretty nice, I find it easier to use than Mirror
But I don't believe it has voice capability built in, so you'd have to look for that solution elsewhere
I see... Thanks!
so, i would say "study the basics of rpc and vsnyc with mirror example projects
then, after that. go to mlapi
when i first started with multiplayer mlapi looked very intimidating.
but, is waayyy better then mirror. because everything in mlapi can be over-written. mirror has really dumb mechanic they put behind encpasulation blocks and it makes it impossible to do your own logic "especially with multiple scenes etc"
you can actually use a database based api for voice. i use playfab
does anyone know how i can make it choose from multiple different spawn points in this manager script? ```using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using UnityEngine.SceneManagement;
namespace a.parkour.fps
{
public class Manager : MonoBehaviourPunCallbacks
{
public string player_prefab;
public Transform spawn_point;
private void Start()
{
Spawn();
}
public void Spawn ()
{
PhotonNetwork.Instantiate(player_prefab, spawn_point.position, spawn_point.rotation);
}
public void DisconnectPlayer()
{
StartCoroutine(DisconnectAndLoad());
}
IEnumerator DisconnectAndLoad()
{
PhotonNetwork.Disconnect();
while (PhotonNetwork.IsConnected)
yield return null;
SceneManager.LoadScene(0);
}
}
}```
make a array and then use Random.Range
ok
what sort of array?
1 sec
this is my spawn manager script using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpawnManager : MonoBehaviour
{
public static SpawnManager Instance;
Spawnpoint[] spawnpoints;
void Awake()
{
Instance = this;
spawnpoints = GetComponentsInChildren<Spawnpoint>();
}
public Transform GetSpawnpoint()
{
return spawnpoints[Random.Range(0, spawnpoints.Length)].transform;
}
}
do i use it?
add it to your other script and make sure the spawn points are the chidren of the spawn manager game object and make sure they have a spawnpoint script
or any other component just make sure only the spawn points have it
so just copy and paste into mine or only certain parts
your script should look like this
is SpawnPoint another script?
it deleted it
