#archived-networking
1 messages · Page 119 of 1
Thanks!
how do I update GameObject's active state when using Photon Multiplayer
?
like I wanna set a gameobject to not active
but it doesn't update in the other client
(ping me)
You need to tell other clients to disable that gameobject. PUN isn't going to assume too much about what needs and doesn't need to be synced.
Hello. I want to make timer that will be the same for all players. how can I achieve that? My game is not a realtime multiplayer. Is it somehow possible to store timer script on database and read from it from every player's perspective? The only thing that all players will have in common are this timer and the leaderboard.
Both timer and Leaderboard should Reset in specified time
hello guys anyone here using pun2 ? i need help about event code
i pass the constant with byte value is 1 to the raiseevent function
then i debug the event.code from the Event function it return 209-210 value, why?
You will receive events for all codes, which is why it's important to check the event code to make sure it's the one you are interested in.
i found the problem, changed raise option to all fixed, thanks 😄
that's kinda why i'm askin lol
Hey guys i have been strugling with this error for the entire day and i need help
Any inpuy on how to solve this
How can i make a meeting system like among us in photon unity networking? I already got the functionality of calling a meeting but idk how to make the actual meeting UI and the ability to vote someone out.
Hi. I'm stuck on 0 for the playernumber using netcode following a tutorial by Dilmer Valecillos. when I add a host it keeps the networkvariable 0 on 0 although it should increment it.
public NetworkVariable<int> playersInGame = new NetworkVariable<int>();
public int PlayersInGame
{
get
{
return playersInGame.Value;
}
}
private void Start()
{
NetworkManager.Singleton.OnClientConnectedCallback += (id) =>
{
if (IsServer)
{
Logger.Instance.LogInfo($"{id} joined the server");
playersInGame.Value++;
}
};
NetworkManager.Singleton.OnClientDisconnectCallback += (id) =>
{
if (IsServer)
{
Logger.Instance.LogInfo($"{id} left the game");
playersInGame.Value--;
}
};
}
``` I also happen to have 2 errors on the "Logger" script, but that was taken from his github
Ping me if you have an idea what might be the reason
https://doc.photonengine.com/en-us/pun/v2/gameplay/synchronization-and-state I would start with an RPC.
Hey, i need some recommendations.
I was previously using PUN2 for networking and Firebase for Data management (User Auth + Storing Data). Unfortunately i felt into some problems that could not be solved. So i am looking for a Platform that suits the same things but with another feature: More server Control. I read lots of things on google about things that could match but i am not sure. I found following ideas:
-
GameSpark - they recently moved to AWS GameSpark and after registering, it seems to be in a very incomplete preview so it cant do multiplayer yet.
-
Epic Online Services - that seems also very nice but i just havent found that much like getting started guides to make a realtime Multiplayer Game in Unity. For UE4 theres lots of resources and guides but i havent found lots of people using it for Unity and i dont really know why
-
Unity Gaming Services - Idk, obviously it might be the best to use the integrated unity services but they doesnt fit my needs. e.g. there is no way to easily control the server. I could probably duplicate my project and make it as a standalone server application but just while writing it it sounds completly bad
-
Mirror Networking - same as Unity Services, dont want to duplicate the project or built it 2x each time i want to update or test anything. Also it doesnt contain DataStorage by default & User Auth, so i would be required to use 3 different services from 3 different platforms
My Recommendations:
I have a multiplayer Racing Game, where players authenticate using email (or username) and password. Then they will be moved into a Paddock (something like a Lobby, where they can run around, chat, view leaderboards with best racetimes and invite others to join a race). When inviting others to a Race, all the target players will be moved into the a new "server" or "match" where they can drive until the end and then they get moved to a paddock back
Any help is appreciated 🙂
Problems currently:
- limited to the PUN2's bad Pricing - 100 CCU limited, otherwise its getting expensive af
- Firebase seems to be more optimized for simple Mobile Games, not for multiplayer solutions
- Firebase doesnt have good options for filtering for leaderboards and in some points is insecure
- PUN2 doesnt offer good options to write racetimes in the leaderboards on the server. They need to write from the client which is not that secure
mirror has an EOS transport which allows you to use it with epic online services, its completely free and you seem interested in it so i'd recommend mirror + eos transport
i made an empty line in between the good things and mirror because i probably not gonna do it with mirror. the huge disadvantage for me when using Mirror is that i have to keep updated 2 different Projects. In PUN2 i loved the concept that the backend is completly managed for me. Things like AWS GameSpark and EOS seems to be similar but has another easy option to add things like Firebase CloudFunctions does but directly integrated into the networking
but do you mean, that the networking etc. is running over the EOS and i just use the structure like in mirror?
mirror is based on one project only, you shouldnt be using 2 projects
2 projects is not recommended at all, you will run into tons of issues trying to keep them in sync
Yes, you can just use mirror and basically plug into EOS using the transport @flat jackal
Okay, when using Mirror and i would like to use things like Multi-Rooms like Photon has it, what is an optimal solution to get that working? Pun has different Rooms where every data is sync only in that room. In Mirror it seems that its one giant server and not by default split into multiple instances
Youd be using the EOS relay transport, which does essentially the same thing, you can host lobbies etc
so if mirror for example can only handle 500 players, i would be limited to that until i did some more work to scale them dynamically etc.
One lobby is one "server", it would all be client hosted over relay per lobby/room instance
so i would not use a mirror server? Does it mean that when i connect to Mirror from the Engine, it connects to the backend of EOS?
they are not server hosted?
Mirror has dedicated server build options as well as a client host option
ie. One person is the host and everyone connects to him
client host means it runs a server instance in the background?
ya locally hosted
Essentially yes, in the same application
the server creater is hosting the game from their PC
Okay, i just dont really get the thing with EOS transport, can you explain that further?
srry for intersecting btw
is it just the Mirror API i use but in the backend it connects to a dedicated EOS server?
np, all help is appreciated 🙂
yeah im not the best with networking i just use steam servers lol
even opinions and recommendations are helpful
if the game is small and meant to play with friends hosting the server of the host's PC isn't that big of an issue
especially when you take into account grand strategy games like eu4, hoi4, vicky 2 use that same method of locally hosting | most rts game use the same method of hosting
it connects to a relay server, which allows you to connect to the host or host games yourself without configuring your router (port forwarding etc...)
Steam Networking does not seem to offer that much. Like no clue about adding backend options etc. and there is no pricing. I dont think its free if you have 1k CCU etc.
Steam charges 100 dollars for their services, which is also what you pay to get your game on their market in the first place, it is indeed free once you pay that (and you even get the 100 dollars back once you make enough sales)
You are basically paying for it with steams cut of your revenue (30%)
that sounds like using the EOS for synchronizing states, player positions etc. but i just use the Mirror API that internally commuincates with the EOS
30% of sales gross revenue is taken
so that definitely makes up for hosting costs
lol
ah okay lol, that makes sense
it's the same system steam uses
They have their own relay servers etc
steam might have a limit tho because if the game is completly free and has thousands of CCU, its not profit for them
its not profit for the game devs either
in game cosmetics is a source of revenue for example
again, if you have thousands of ccu, you have millions of sales.. which steam has taken a cut of
Also, relay servers are insanely cheap to run compared to game servers, it's not like its a ton of money they are losing (if any)
im working on a big project atm personally and there is a mp aspect and I want to host servers off my own person server rather then rely on local hosting
so while im no networking expert i shall find a way to make it all work
This is possibly not the right place but, anyone can suggest where i can hire someone, specifically using photon quantum?
I asked in the photon disco, photon circle, photon forum, and none seems appropriate
The unity forums have a section for collaboration, job postings arent allowed here unfortunately
Cool will try that
It's kinda hard for quantum case i guess, its not free and those who are using it are most likely already an established project
Yeah, you will most likely have to train whoever you hire
Hello everyone,
My question would seem too common but I really couldn't find anything about it on the internet,
how to sync Players animations via network?
the first thing i had in mind was to sync player inputs and simulate the animation based on tha, it will work like a charm but what about ai players who don't have inputs?
Thank you
Can you make a game like clash of clans with photon networking
yes
theres something called a photon animator view
guys
help
uh
for some reason my photon netmanager just doesnt connect to master
it gets to "authenticating" then it just fails and gives up
I my self don't know the answer, but at photon discord server they could give you the answer.
They have helped me as well.
sick
I'm sorry, I should have given more informations :p
our game is an authoritative server model and does not simulate animations, which means that the animation must be predicted according to the states.
but i never did it and never saw anything about it on the internet. :/
if anyone has any reference or idea that would be much appreciated Thanks!
anyone know a way to monitor network traffic with the new unity netcode? The profiler is not showing anything under network messages/operations
Whats your thoughts on the gaming circle (paywall) for photon fussion samples / tutorials ?
I feel like being too restrictive with learning material is a bit unfortunate. I would imagine some of the basic material could be released while maintaining more in-depth templates and video material paywalled, but haven't really checked this stuff out in a bit to say for sure.
where is photon discord server
i kinda need it
Invite is in the pinned message
oh sick
im following a steamworks multiplayer tutorial rn, but they are using a system where there is one main camera and multiple players that can be seen in one area, how could i make is so that everyone has their own first person player instead?
can you tell us which tutorial you're following?
uhh should i send a link?
sure
https://www.youtube.com/watch?v=9v1ATUwOM1U&list=PLfFBezYu5hogMS3QeJkM1FQfl3s1sCzwV&index=3&ab_channel=Zyger its this one
In this video I will be showing you how to implement player movement. I will go over how to firstly move every player into the game scene. Then how to spawn players for every connection and create movement that syncs across the server.
------Tutorial Links------
Previous Video: https://www.youtube.com/watch?v=kld9s...
Mirror: https://assetstor...
oh so thats steamwork with mirror?
i can try help with Steamwork but not with mirror, sorry
anytime
Give the player prefab a camera, and then when the player is spawned, if this is not the local player, disable the camera
Who know pun2
I need to have a buttom for start the game only when all player is ready
Could you try and explain how you would do that please? Just pretty new to unity and c# so im not entirely sure how you would do that
hello, i'm new to networking in games and i want to implement this feature in my game
i see there are a ton of networking APIs for Unity but i am unsure which one fits my use
i have a 2d 2v2 fighting like game, so some articles or youtube reviews say that I should use MLAPI, Mirror or Netcode for GameObjects
which one would be best suited for my need?
Sounds like you need very good lag compensation, in which case really the only out of the box solutions for that are Photon Fusion and Quantum. From there the differences become a lot smaller, but worth pointing out that MLAPI is now Netcode for GameObjects, as it was renamed during Unity's acquisition of it and further developed under Unity. Mirage is an interesting alternative to Mirror if you are particular about your code architecture.
Interesting, thank you for answering. But I see NetCode is a "Pre-Release" package, is it safe and reliable to use in a game that can be potentially released on play store or steam maybe?
I'm not seeing any pre-release markings on the doc, but whether you can call anything 1.0.0 stable is probably debatable 😄
I am asking because this came up in the Package Manager and it just came up in my mind if it's okay to use, is it reliable and so forth
Define reliable software 😄 It probably wouldn't be marked as a pre-release if the team behind it thought it was ready for production.
well in my case i meant reliable as in someone can use it in their game and publish the game
No, if you're new to Unity and C# you ought to abandon the idea of multiplayer, and focus on learning first
ok, thanks!
hello . I am new here . I am trying to send a video from an ip camera to unity scene
any suggestions
?
Does anyone have an idea whats the cause of the error is?
private NetworkList<bool> boolParameters = new NetworkList<bool>();
thats the marked code btw.
Okay, Nevermind i moved the instantiation into Awake and the error isnt there anymore.
Guys, who using Photon: where are the rooms saved when they are created? (my teacher asked me, and I didn't understand the question)
Perhaps they meant where the rooms exists in the networking setup, as in which computer in the whole network stack is responsible for storing the room information. Saving generally implies some sort of persisting storage, like game save or a MMO like database.
My game is slowing down after I use this to get json from web. this function will be called every second. Why Is my game performance so bad because of this? please
Try DownloadStringAsync and await it so that your game is not freezing while downloading the string
I will try that!
thankyou
Hello.
I have .Net Web API project with a lot of endpoints. All of them require authentication before reaching out to them but the login API
but I have to controll the incoming users to prevent API abuse.
for the DOS and DDOS attacks.
Have you got any documentation to point me there.
Hey all, using Mirror and I have a character with animator and works fine locally. I have network animator and client authority checked. States are changing client side but not synching across
If a ddos attack hits your application you are already done for, you need to catch those earlier. Most cloud hosting providers provide some service for that e.g. AWS Shield. Besides that you can also implement a rate limit for API calls, but that wont stop ddos attacks because the payload still reached your application.
how do i use normcore for pc
i setup photon and cosmetics but how do i make it where ppl can also see the cosmetics
sigh are there ANY decent examples of using Mirror or netcode to spawn in different GameObjects for different players. As much as I know all developers want ALL network players to have the exact same prefab and just be clones, that's not whwat I want so none of the docs or videos I've seen are helpful
and not "Oh we can randomly pick a different color on the server side" crap either
why not?
lol
Hi, im using Photon and i have it all setup and working but i need help with enabling and disabling gameobjects that all plyers can see when enabled
ive made the script but other players cant see when i enable or disable it
i know i need to add RPC but idk how to implement that in my code
is it networked object ?
not sure what you mean
what photon component you add to that object so it work with photon
it has photon view and transform components on it
oh , then you need to use rpc i guess
yeah
idk how though
https://answers.unity.com/questions/774987/photon-enable-disable-object.html ive looked at this multiple times but i just dont understand it
Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.
can anyone help me understand this better
i think int blockToRemove is the id of that networked object
and you have to call it like RemoveBlock( Gameobject_Id, false);
im confused
to explain more about what im doing, i have a object under my main camera and then buttons. when you click the button, it sets that object under my main camera to Setactive is true. When you disable it, its sets active to false.
Hey, I´m looking for a Networking Solution that can be hosted on dedicated servers without the need to pay any fee´s or cloud services. The solution should be free and a good fit for a FPS Game. Any Suggestions? 🙂
Anyone has thoughts on Fish-Net Networking? 🤔
As for the actual asset, I have no idea. 😆
Hey guys, I'm using Mirror and Fizzy steamworks and I'm running into an issue with having a teamname update on anything past the first connection. Anyone willing to look at my project and help me troubleshoot? been working on the issue for 3 days now.
[Netcode] Failed to create object locally. [globalObjectIdHash=0]. NetworkPrefab could not be found. Is the prefab registered with NetworkManager?
UnityEngine.Debug:LogError (object)
How do I resolve this issue?
I am making a game with Netcode for the multiplayer and now i want to make the multiplayer work across different computers and networks. I searched in the internet but the solutions are rather unclear. Does somebody know how that works?
Depends on what you mean by different computers and networks.... In you protocol where you have localhost by default, you set that as the ip Address of the other computer on the client side IF the computers are either 1. on the same network or 2. the host is on a host server or ip that's routable or firewall rules are port forwarded. There's info in the docs I thought dealing with punch through and Relays... I use Unity relay (or did)
Okay, thanks! I think i will take a deeper look into Unity Relay.
realy? i guess i make a bow around that then... Any good alternatives for a FPS i want to host the servers myself and dont want to rely on cloudhosting and it should be free 🙂
I'm actually not experienced in networking. Photon and Mirror are popular though.
doesnt they rely on cloudhosted servers ?
i was looking into Photon Bolt but there was pricing listed
Networking middleware for Unity 3D and realtime multiplayer games and applications. Get started without having to know the details of networking or write any complex networking code.
100ccu and up costs quiet some money
Hello, i'm have a question: what they give ccu in PUN?
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!
it says 20 is free
i need help; both counters are only showing up for one person rather than each persons respective counters showing up for themselves only; here is my code, what should i change/ add?
Hey i have a problem with my multiplayer game when the game spawns the player with the gun it works fine but the other player can't see the player's gun how can i fix this
We’re supposed to be able to answer this with the information you’ve provided?
heres my camera
Player prefab
ands the Game Manager
to summon the player
i can see the gun
but i cant see the other player's gun
Has anyone experienced problems with the mirror network solution when you want to use raycasts for shooting. I am using the Network transform script to send my character movement over the network but i cant get a hit with a raycast when I shoot it from another client. I checked if the collider of my player is dislocated but that isnt the problem. So i suspect that the network transform script is making issues. When i shoot on the initial spawn position of the client it will say it hit the client even though i moved the character away. Any ideas?
are you instantiating it on the server side? If you don't instantiate on server, it won;t show up on clients.
Using Photon PUN, how do you usually sync enemy AI over a network?
I am currently trying to allow host to handle all movement decisions and host sends the AI position to sync across clients
any video rec's on networking AI?
NOt sure about Photon, but with netcode and Mirror, just use Network Transform and check Client Authority. Photon probably has something similar
I need some help on photon if someone know
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
i need to do a readybutton for make a player ready
I would like to make a system to make the player ready when I click on the ready button.
If all the players are ready then I can start the game.
I would like to achieve this using PUN
?
Hey people, I'm new to multiplayer and networking, what would you guys say it's the better choice for someone who knows Unity well but has never made a Multiplayer game, and that's free. (At least for 10+ concurrent users)
Thanks !
Could someone help me please? I am using Photon and cant implement the Callback Methods in my script. I searched the web but could not understand how to do it even not in the documentation
Implement MonobehaviourPunCallbacks and using Photon.Pun
Then override their callbacks
does anyone here have any idea on how to fix the issues with rigidbody in photon pun? I have implemented a knockback script but it's a total mess with photon
Maybe you describe what's happening in more detail.
One of the clients will be in control of the networked object you want to knock back. This needs to know it's being pushed. An RPC to AllViaServer might be in place to update everyone (including yourself) at about the same time to be pushed back.
Hello i have created my ready player alone
but when i put ready the other player dont see when i am ready and the state is broken
0 = number of player ready
1 = player in the room
but the player is ready
AND now when i have 2 players
the number of player is set to null wtf
Hi, after a long break I'm getting back to my project. I was wondering a long time ago to migrate my project from Photon PUN to Mirror. There is some guide to do this smoothly or I must do it manually?
hello can you help me with photon ?
About that ready buttons?
yes
i have already done the logic but in network it is broken but when i use debugger is work fine
is the the value what i want
but i can't the if the other player is ready or not
I am making a chat system with the default RPC system. The reason I don't just use Photon is because I want to evade fares (and because Photon is currently down)
It almost works, and only the ClientRPC part is stopping messages from being added
Is there anything I am doing wrong?
public class ChatManager : MonoBehaviour
{
public TMP_InputField ChatInput;
public TextMeshProUGUI ChatContent;
public bool InChat;
private List<string> _messages = new List<string>();
private float _buildDelay = 0f;
private int _maximumMessages = 14;
[ClientRpc]
void RPC_AddNewMessage(string msg)
{
_messages.Add(msg);
}
public void SendChat(string msg)
{
string NewMessage = "Player" + ": " + msg;
RPC_AddNewMessage(NewMessage);
}
public void SubmitChat()
{
string blankCheck = ChatInput.text;
blankCheck = Regex.Replace(blankCheck, @"\s", "");
if (blankCheck == "")
{
ChatInput.ActivateInputField();
ChatInput.text = "";
return;
}
SendChat(ChatInput.text);
ChatInput.ActivateInputField();
ChatInput.text = "";
}
void BuildChatContents()
{
string NewContents = "";
foreach (string s in _messages)
{
NewContents += s + "\n";
}
ChatContent.text = NewContents;
}
void Update()
{
if (InChat)
{
ChatContent.maxVisibleLines = _maximumMessages;
if (_messages.Count > _maximumMessages)
{
_messages.RemoveAt(0);
}
if (_buildDelay < Time.time)
{
BuildChatContents();
_buildDelay = Time.time + 0.25f;
}
}
else if (_messages.Count>0)
{
_messages.Clear();
ChatContent.text = "";
}
}
}
Did you synchronized the "ready" variables? By OnPhotonSerializeView?
No i have use CustromProperties
can you show me ?
Become any tier member on my Patreon below for the source files!
Would you like to help me grow? There are a variety of ways you can support me here: http://firstgeargames.com/donate/
Using Netcode, is there any way to spawn a GameObject which was instantiated in a client across the network inside of a script in the instantiated GameObject? I tried using a ServerRPC call with the spawn method inside it, but i just received a warning, that the object didnt spawned.
Hey everyone, I'm trying to learn Mirror (and networking in general) and I'm already having a hard time figuring stuff out... I've got the players (same prefab) spawning at their correct location, and in the player script, I've got a Command to instantiate a dice under the player. The dice prefab got a NetworkIdentity and a NetworkTransform, same for the player. But as you can see, it only works on the host (right screen) and I don't understand why...
public class Player : NetworkBehaviour
{
public GameObject dicePrefab;
private void Start()
{
if (!isLocalPlayer) return;
SpawnDice();
}
[Command]
void SpawnDice()
{
GameObject dice = Instantiate(dicePrefab, new Vector2(transform.position.x, transform.position.y - 2), Quaternion.identity, this.transform);
NetworkServer.Spawn(dice);
}
}``` Here's the code I have.
Hello guys i need to do a ready button but when i click on ready the ready (true) is not see by the other player and i cant do anything
someone can help me ?
My PlayerItem.cs logic
https://pastebin.com/JZkTKB6S
My Room (LobbyManager Logic)
https://pastebin.com/gCJwdXXf
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
@river meteorlook my code
I am at work now so I will take a look later
ok no probleme take your time !
I sent you tutorial how to sync values and you did nothing about it
I saw that now Unity charges a license to use headless mode (Unity Server Build), is there any way to use Unity headless on my server without paying any license?
hello
anyone good with photon here
i just need make this instantiate
use networking
PhotonNetwork.Instantiate
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!
doesnt explain this specific format already looked at that
Because i dont need to use That
Is for a menu not for a game
And people tell to me to use CustomProperties
And ÔnPropertiesChanged
Anyone?
The knockback code works great when I'm offline but with photon networking it's insane. When I hit the player he slowly moves and continue to move without him stopping at any point and he keeps shaking for some reason. I tried the rpc target all via server but still the same thing happens
Hello everyone, does anyone know how to implement the login with Facebook with all the features it comes with like share to Facebook on unity PC app?
This sounds like a problem with the implementation. Make sure the controlling player executes the knockback and updates everyone else about the position update. Make sure the components that monitor and sync the transform are not countering the sudden movement by lerping from an old position to the new one. It might need a flag to signal this to everyone else.
The component that observes the transform and sends update is also the one that receives and executes them. If there is a special kind of movement (knockback, etc), you may need to add special handling.
How about using event codes, maybe it might sync it better than the player himself
Hello guys i need to do a ready button but when i click on ready the ready (true) is not see by the other player and i cant do anything
someone can help me ?
My PlayerItem.cs logic
https://pastebin.com/JZkTKB6S
My Room (LobbyManager Logic)
https://pastebin.com/gCJwdXXf
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I told you what to do man. But you know better you do not need this so don't ask for help...
I don't know what's the point for asking and the you say "I don't need to use that". OF COURSE YOU NEED and there's your problem why other player don't see ready value because it's not synchronized between them.
You even didn't try.
You must learn how photon works. It's not traditional server client communication.
no i dont know better ;c
I dont know better but for the avatar selection its work without View is why i told you that
people tell me the best way is to use CustomProperties and OnPlayerPropertiesUpdate
did you know about it ?
maybe i can share screen my code for you see whats happen
hello
guys i am new to photon and when i type using Photon.Pun; it says ||
The type or namespace name 'Pun' does not exist in the namespace 'Photon'||
.
EDIT ; i FIXED IT AFTER 3 hours of prrrr
Hello everyone!
I’m David Salgado, a member of the Unity Multiplayer team. We’re working on our next wave of focus areas and would LOVE to hear from you about what you are building and how we can help.
When you have 5mins please help us by filling out this survey [https://unitysoftware.co1.qualtrics.com/jfe/form/SV_eM9GaUix9NCRxGu ] to better understand your needs and use cases. We want to make sure we’re investing in the right areas, and that we have a good understanding of your benchmarks/requirements.
THANK YOU!
DavidS on behalf of the multiplayer team
If it's without view, add a view it should have it if you want to synchronize it between playwrs
Hey guys, using MIrror and the Multiple Additive Scenes. I have an issue and not quite sure how to solve it. So, for player move, I check Pysics.Raycat(ray, out hit, 100, m_LayerMask) and use the returned value in hit to set destination. was working but since I started using Multiple additive scenes (works great so far for my use except for this issue). So getting the ray via mouse click works, but it does not hit the floor. I have a box for floor with layermask Walkable. m_LayerMask is set to this Walkable selection (ALL worked before I started implementing multiple additive scenes). Now, it does not hit. if I debug log, hit is (0,0,0) with distance 0. I've tried differnet distances but it just isn't hitting it. I have the PhysicsSimulator object and script in the scene with the floor. But I have a feeling I'm missing something or another way to do it
FYI, if you really are part of Unity, you should put this on the web site and link to that and not ask people to click links here especially since they can't be verified as Unity's
Discord is cesspool of scammers and I'm not about to click any links in here like that
As a test, I passed in the ray point to the navMeshAgent.SetDestination and what do ya know? THat doesn't work either. So, Physics.Raycast doesn't work and NavMeshAgents don't work
In Unetmatchmaking how do u create a match with custom attribute I try with the match request (https://docs.unity3d.com/530/Documentation/ScriptReference/Networking.Match.CreateMatchRequest.html )but it didn’t work.any idea?
Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.
David is really a part of Unity but yeah you are right it doesn't hurt to be careful since Discord is full of phishing links. You can also find the link here on our forums https://forum.unity.com/threads/survey-help-us-prioritize-multiplayer-focus.1276898/#post-8101853
maybe give him a yellow color 😄
I do not have such powers 😆
Got it, I have to call physicsScene = sceneImIn.GetPhysicsScene() and then use physicsScene.Raycast and oddly enough, that fixed my navmeshagent movement lol
and how do we know YOU really are part of Unity??? lol anyways, I'll check that out, I have some feedback to give
hi i have this error with photonnetwork 'PhotonNetwork' does not contain a definition for 'AutomaticallySyncScene' help pls
how do i setup Inverse kinematics with normcore in vr
cuz it wont work
the multiplayer works but my robt kyle ik setup wont work in normcore
why do I get this error? Shouldn't the SerializeValue accept FixedString32Bytes? Strings can't be used in netcode
Starting from the latest version you have to use ForceNetworkSerializeByMemcpy<FixedString32Bytes> instead of just FixedString
thanks! That works like a charm 🙂
I checked the docs but maybe I just missed it
can anyone help with normcore? i want to setactive a object with normcore
hello i have a problem with the fact that one player controls all players for some reason.
so how do i fix that
?
Could i get some help with setting up photon first time and i been trying for a few days btw for vr
Hello
if((bool)playerProperties["IsPlayerReady"])
i have a problem with this
Specified cast is not valid
if someone can help me
help
because you are getting value from table and it can not be casted to bool type.
maybe .ContainsKey would be better
ok thanks
how do i fix this
@pallid girder Following your question from beginner code, you want https://doc-api.photonengine.com/en/pun/v2/class_photon_1_1_pun_1_1_mono_behaviour_pun_callbacks.html#a0773380d4f4a416b43752da2d746f9d6 not OnConnected
thanks
Anyone here experienced in using Photon for making multiplayer FPS games? The programming is giving me an aneurysm
Hello guy
hey can someine help me with a grappling hook vr script?
ok first add a bool
IsPlayerReady is a bool :c
then set it active in the dunction
i dont understand what do you want sorry
is better now i thinks
ok but isplayerready have do get activated you can check it by adding a debug.log under the playerready = true
i have already done
put under playerreadyimage.setactive if(playerreadyimage == false) return;
ok wait your problem is that it dont activate
yes
he appear
and he disapear
oh it disapear after a few seconds?
yesss
is that
i see the image 0.1 sec
can you send the full code?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
(Mirror) Any ideas on what's happening with my spawn ? The host on the right is perfectly fine but on the client (left screen), it looks like it has been spawned from the bottom left corner of the canvas and I don't know why
network transform ?
already has it, it's shown in the inspectors of the screenshot
Well there is no value assigned to nsm clearly
But is it not a singleton or something?
Pretty sure it's a singleton, but I can't exactly check
Sure there's tutorials online
Networking isn't easy
Again, I don't believe you need to new it
I think it's a singleton, find a tutorial
Well that's a load of crap isn't it
Sure
Are you new to Unity and C# itself?
Then you shouldn't even be trying multiplayer
It will make you miserable
Doing multiplayer as a beginner to C# and Unity is beyond foolish
Can someone tell how should I go about a learning? All was going smoothly till I hit this wall
Then again, find a tutorial online, there are tutorials for Netcode and it's older version MLAPI
But you're not gonna have fun, believe me
Because you're diving in head first without learning to swim
That's the easy bit
That part is almost no work on the dev's part
somebody please tell me how to fix the one player controlling both players problem
well it was pretty easy to set it up
i followed a tutorial for PUN2, so basically it instantiates a player prefab in a room with a specific scene
its just that one player controls all players
nice
but anyway, i need help fixing this problem, so if anybody can say something other than "networking is pain", that would be nice
You might wanna try with the Photon folks directly. Look at the pinned messages for an invite to Photon
ok
This is a basic-ass question but
I'm trying to make a multiplayer game
Should I start with a singleplayer demo and then add to it to make it multiplayer, or should I build it to be multiplayer from the ground up to reduce headache?
Multiplayer has to be done at the start alongside development.
Yeah, that was the first fault with unity done by me 😅
And now i choose the wrong one API and I must switch it to another one
@restive vigil Don't ghost ping people.
Exactly what that is. Anyway, don't be annoying.
!mute 790720788697055242 3d Nevermind, keep being annoying then
f11#4273 was muted
If anybody is wondering about what networking solution to use, I suggest Riptide, by Tom Weiland.
You dont get the network object component like in photon. You have to send the packets manually, but the freedom that this gives you is 110% worth it
Its not as complicated as it might first seem
Ok, question. Using Mirror but I have a NON-networked gameobject I want to move to a different subscene. How do I do that? Googling gives me a bunch of crap using Entities and DOTS
being it's local, I don't want (and I don't think CAN) use NetworkServer.MoveGameObjectWhatever
I'm googling Unity move gameobject to different subscene.... not sure how else to search and not get dots crap
OMG.... SceneManager.MoveGameObject
Hey, could anyone help me out with joining a photon room via a web link?
I want my users to be able to copy paste the web link to share
@zenith prism
I guess you could have some random string the room link
And put it in the hashtable here
Find the room that way
Can someone answer me this question. I'm using parrelsync to see what errors I'm getting but does the same thing with a built version. Host side (going by the additive levels) works fine. It goes from offline to online scene fine and changes level to the first level. The client side also goes from offline to online scene and has the first game level loaded, but when I click the button to go to the first game level, it just goes black, player disappears and errors. Strangely, on the server/host side, the player character is there in the right level. Again, both client and server have the level. Another weird thing is, it's a click the screen to move (navmeshagent.setdestination) and even though nothing is being click the client just slowly moves acrosS the screen... error are as follow.
Failed to spawn server object, did you forget to add it to the NetworkManager? assetId=f8583a61-682d-70b4-b837-97b8664beea6 netId=10
It's in the list of spawnable prefabs and spawns on the server, just doesn't spawn on the client
With my Debug.Logs I'm getting the correct index value and logging the right prefab.name
As you were told before, just ask your question.
My quzstion is how camera on photon work
Photon has absolutely nowt to do with Cameras?
I get these errors when I call a clientRCP or open this observer tab after opening disconnecting as the host and recreating the lobby. Why?
why is this network object giving me these errors?
this happens for any network object in the scene
i dont understand
Hello someone can help me ?
I want to do have a camera follow for my player (car) with PHOTON (PUN2) but i dont know how can i do that
Photon has nothing to do with Cameras
If you have a player prefab with a Camera, you need to enable it for the local player and disable it otherwise
That means that every client then sees through their own prefab's Camera
Aside from that, you can make it follow with a PositionConstraint
When ConnectionApproval is true, you are also required to provide a callback where you put your approval logic inside. ConnectionApprovalCallback is called by the Client host.
who is client host?
hello guys anyone use the sql connection? i'm not using System.Data.SqlClient. i'm using vs code i try the nuget packed. i installed system.data.sqlclient nuget bug not fixed pls help
Sorry for my bad english
hi, I want to instantiate a custom character made by the user in a room using photon, problem is idk how to make the reference. the workflow is as follow, i connect to photon first, then i lead the user to a scene where he can customize the character, now i want to instantiate that custom character, any ideas on how to?
I have a cors error when attempting to make a GET request to a uri that redirects using the webunityrequest class thing
If you use the photons character only for a clients entry point, it'd make things easy for you
When I use that, I only use it for sending some commands
And the actual character can be some other networked game object
the only prefab from the resources folder?
Using netcode for game objects - I have steam up and running and working however I don't know how I can tell what the steam id of each connection is. Is there a specific point during the connection process where I can pass this information to my game code?
Is it easier to make one overworld MMO style or instanced dungeons that players can join in groups and players can have their own solo player instanced homeworld? Just trying to decide on the scope before I get deep into learning the backend. Thanks!
Hello. I want to make a multiplayer card game and currently having troubles with choosing networking solution. So I want to have one server hosted by me that controls different rooms for the players. Can PUN server do that? Or is it only for player-hosting? What should I use?
You mean the photon server. Or photon cloud?
@tawdry dock Players shouldn't be able to cheat there. So I guess it's photon server?
You could get third party anticheat from unity
Yeah, thanks! But I'm asking for a proper networking solution for my situation
Yea pun2 would be great for the card game as networking. Pun2 has a good documentation of setting up the rooms and more.
It's like designed for that kind matchmaking.
the only prefab from the resources
So you advise me to look into photon server?
If you want to have a lot of authority of the server and it's quite easy to setup. But I would mainly focus on building the game first. And then looking of photon server. If you are going go pun2 I would try to test the game for photon cloud. Because photon cloud has servers all over the world. And photon cloud is based on photon server.
Thanks!
So for local multiplayer, should i do UDP or TCP? I have a small survival game and all i really need is for player position, what they are doing and if they are dealing damage. I was thinking of faking TCP with delayed UDP (like when i start the server the packets are delayed by like 150-300ms to compensate for Australia to canada for example) but that sounds extremely hard so is there a quick and efficient way to do multiplayer for my small game?
Best use a readymade reliable udp transport or netcode library. Either protocol is fine for small scale games.
Hey guys! Can anyone help me with photonNetwork? I have a problem that players from a Lobby join a room they choose, then they can press start or leave, so after they have seen the players in the room they can decide if they still wanted to join the game (they can make sure their friend is in the room), so they all have to press Join Game individually, this means they are not all spawned at once. And the problem is that older players see players that joined after them, but not vice versa. 😦 help pls
In PUN, you only get the list of players when you joined a room.
If you want to find a room where your friends are, use FindFriends. If you still need players to join a room to decide if they want to play in it, I'd keep the room open for a while but close it (set IsOpen = false) and take it out of the matchmaking (IsVisible = false) to begin playing. The Asteroids Demo that comes with PUN has a screen where players gather and they can confirm they are ready to play. Could be a startpoint to work with and then customize.
yea, but as its gonna be a pvpve survival game, I want to make something like in unturned, that somoene has been playing for like 5 hours and the room is still open.
But if u want ur friend to come play, u just say him the name of the room, he clicks on it, he can see the playerlist in the room, then he can decide when he wants to start the game.
I dont want all the players to start at once.
I see. Well yes, if someone knows the room name, it's easy to join.
We don't send the player list to the master server (where the lobbies are), so you can't access the player list without joining. But .. you could just join, then decide to not play and leave. Or play.
Do you guys have any idea on how to reset the transform position and rotation with photon pun?
The controlling player can do that and a PhotonTransformView script will send the latest position and rotation as state to the others.
Do you mean how to "teleport"? So that others won't lerp to the new position from wherever they are? Then you need to send along some flag that tells others the update is a teleport and to also put that into the previous known position (to avoid interpolation).
I tried to fire an rpc in the other player but it didn't work for some reasons
this is exactly what I did, but the players who join later, dont see the players who joined before them
Make sure you used PhotonNetwork.Instantiate, have no errors and that all players are actually in the same room.
Aside from that, there is no well known bit you might be missing, so I'm having a hard time helping. Maybe implement a minimal project and if that works, compare what's different in your case now?
It should just work...
Do you need to be moderated?
In photon2 the IsMasterClient sometimes will always return false even if you're the master client
Anyone know why?
You might be checking the value before the value is set. Are you doing this on Awake?
when you make a multiplayer game, do you create a game server process for every ongoing match (gameplay scene with players in it) ? so if your gameplay scene has max 2 players and there is 20 players that want to play you run 10 "game_server.exe" to load the scene for them?
is that how mutlplayer works (or is that wasting resources and i should try to make 1 game server create multiple matches)
That is how it works outside of MMOs. Essentially the result of a successful matchmaker is a newly allocated server (process or container) that everyone then connects to. Servers may be reused. It’s pretty much the only way to dynamically scale a game.
when you say servers can be re-used. is that like if that server process is running but everyone left then you just reload the gameplay scene and wait for someone to connect? that way you don't have to wait for a new process to load?
yes
Networked games inherently don't have to be separate processes and many networking frameworks/libraries do support multiple servers in a single process, but software often isn't built with this use case in mind.
actually MMOs can work the same way, but on a more complicated, larger scale
Unity does provide some level of support for multiple simulations within a single space, but not sure how good that support is. At the end it's generally a lot easier to just run multiple processes despite the overhead.
really big MMOs integrate this kind of scaling inside the main process and shard internally, but the principle is largely the same with processes being replaced by threads or some other shared memory thing that is very performant
one way you can do sharding internally is via team/proximity-based interest management
thanks alot for the explanation it was confusing me for a while now and honestly made me overthink how i'm suppose to make a multiplayer game (because I initially thought you're suppose to connect a lot of players to 1 game server because less process = better, lol)
but now that i think about it , if they're headless anyway that will help save performance too 🤔
if you host your game on something like playfab it runs on a 24 core CPU with 64 GB of ram that can be allocated whichever way you like, so you can have 24 processes run on their own dedicated core on a single machine, or one process with 24 cores, or anything in between
and also documentation for the library i'm using makes more sense now lol
is that on a free tier
i'd say the sharding strategy depends a lot on how well you can parallelize network stuff inside your engine
if you run 24 cores on the free tier the "free" will last for about a day
then you pay something like $150 per day (might be per month)
dont know really, havent tried
in practice data egress is more expensive than compute though
i was gonna sign up but was afraid of screwing something up and getting a big bill at the end of the month while still developing 💀 .. so i thought i'll learn more for now
that happens VERY easily
its best to make all dev builds auto-terminate after ~5 minutes to prevent problems like that
and make sure you limit the core and server count to 1
with 1 server and 1 core the free last for almost exactly 1 month
awesome i'll check them out again today, i was planning on using their matchmaker service soon anyway
and it resets every month
ah perfect
matchmake is different
that doesn't run on a server you control
its billed per request at something like 0.00005 cents
oh.. so i just use the api to send the matchmaking server they give me info about open games? is that the same as using a list server?
so you can control the cost of that by limiting your poll rate
for matchmake you configure a queue on playfab and have clients create tickets in that queue, provide some info about themselves and the API then tries to match other tickets together, when the ticket is successful (say 10 players have been matched up) it notifies all subscribers of the match and gives them the server info you specified in the queue
not really subscribers though... you need to have clients poll the status of their ticket
that is good to know, thanks a lot for all this info
i dont feel as "lost" anymore for now and at least know what to research
yea i would rather pay for something already being done by the pros instead of trying to implement it myself , especially if price isn't breaking my wallet
DIY is more likely to break your bank unless you know you will be VERY successfull
but i really like Mirror so i'm doing that myself + plan to use playfab for services i need
IMO an indie team has no real hope of developing a dedicated server platform of that quality/capability
good thing is, if nobody plays the game, it costs close to nothing to run it
and if you have a monetization strategy that scales with the server costs, its quite safe to run in auto-mode
best thing is, if your game gets popular over night, you can, if you choose so, flip the switch and allow 100000 players to connect... but you'll be broke the day after
get popular overnight but end up broke the next day 💀 ?
just don't make a free game 😄
yea that's scary lol .. i can only imagine the kind of stress that would cause to a indie team (quick popularity that wasn't expected)
the problem is that it worked fine and with an update it all went wrong, I don´t have a clue what happened
is using a networking library overkill if i just want to make a single player game with server interaction on it with no physics syncing , for example like a slots game or spin the wheel?
can i just do it with http requests to a web server?
eg. like
Spin the wheel
- user clicks spin button
- HTTP request to a web server,
- spin animation on a "wheel" plays while he waits for response
- server generates JSON response of a random pick
- client uses that data and "wheel" stops at corresponding image
or is that still vulnerable to cheating from client?
i wanna take baby steps by making a simple game
The issue ended up being there was a ghost room with the same name already created, so whenever we used JoinOrCreate for the room with the same name we weren't "actually" the first people in there
No. You are gonna use a bunch of libraries to make that http interaction work too. Just because they are http libraries doesn’t make them lightweight or simple. Quite the opposite actually.
Someone can help me? when I start to join my lobby in a other game, the camera from the first player switches to the camera from the second player
I also cant controlling the camera
I am using the standart asset third person asset and photon for the multiplayer
would be glad if someone can help me
If you mix new and old clients, then this won't work. To avoid incompatibilities of updated clients with old ones, each uses a different game version and the matchmaking is completely separated from one another (despite using the same AppId).
If you test only new clients, this is not an argument, ofc. Make sure everyone is in the exact same room. Then look out for exceptions / error logs and fix those (if any).
I don't have enough info to help, really. Maybe you test the new version with a minimal project first, then figure out what's up.
well, the whole project is still kinda minimal, it just took me like 8 hours that i dont wanna start again 😄
but since it's a single player game and no physics, wouldn't it make sense to just let the player load the scene on their device only and just request simple json data from 1 webserver instead of creating a game server process for every player that wants to play the game ?
Make sure you aren't judging your solution only by its superficial convenience. Convenient often means "very wasteful" and you may end up with exactly the problem you wanted to avoid. The simplest and most basic thing you could do is using an efficient transport library like Enet, Telepathy, LiteNetLib, KCP, Ruffles, etc. and just send a few bytes around
so im using photon and im a little confused with RPCs and i have had look at youtube and otherthings and they wernt usfull so dose anyone have a tutorial?
ok thanks for the advice, i agree i should just stick to a networking library since learning it is also my main goal in the first place
can someone help me 1 on 1 pls?
hi everyone i have a doubt about using mirror or photon for multiplayer what would you guys suggest
i just want to add unity networking to my cv
hey, does anyone know how to differentiate between players
and not sync objects
I am making a multiplayer game and I have a question, Basically my game has a canvas where the player can type in what he wants but when I set the canvas as player it instantiated the canvas to both the player screens making them unable to type. Is there a way to hide the canvas? They have network identity
How much does networking cost?
https://www.photonengine.com/PUN/Pricing
You could start here to get a rough idea.
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!
great. will check.
Hi Everyone, I'm using Netcode for GameObjects.
Is there a way to call a function on a specific client from the server?
It seems like [ClientRpc] calls the function on every client.
Sending to one client is mentioned here: https://docs-multiplayer.unity3d.com/netcode/current/advanced-topics/message-system/clientrpc. You pass in ClientRpcParams with ClientRpcSendParams that has an array of client IDs.
wow, I totally missed that, I already have the clientId in my function so that's perfect, thank you!
Would recommend fusion not pun
Networking has to be built into the game from the start. There is no retrofitted multiplayer.
Hello, I tried to use ParrelSync with Unity to Sync my project, so i could try multiplayer. However, the clone, so the second player, doesnt have a camera and the first player controlls both player objects. How can I fix that problem?
You are probably doing something wrong in your netcode
Inverted condition? Normally you should have one in your script that says "if this is not the client, don't execute". You probably have that inverted
Hm?
It is soul destroying
I tried getting into it the other week and I've already thrown it on the backburner
I'm afraid not, Netcode has changed a lot since I last used it, that was a year ago
does anyone have experience with large scale network hosting?
You might have better luck in the Netcode Discord, it's pinned here I believe
you might also just get lucky here if you post your actual question
hi everybody, i've inherited a rather old project from 2015, which hasnt been updated since, with the hopes of porting it to html5. ive gotten pretty much every issue sorted out except with the networking aspect. the game is multiplayer only, and it uses PUN for multiplayer. i havent really done multiplayer in unity before (or unity much in general), but what i can tell PUN is pretty old and outdated, but i would rather not update the entire game code to fix it.
the issue im having here is with connecting to the main PUN servers from the webgl application. from the editor it loads up and connects to the servers just fine, however when i compile it to webgl, it gets stuck on the ConnectingToNameServer state. ive tried googling for answers and trying a bunch of solutions but nothing has seemed to work so far
hi, i'm having this problem with Mirror where i can't start a new lobby after i left the previous one i've created, does someone know why ?
here's the code:
public void LeaveLobby()
{
foreach (var playerObject in NetworkManager.GamePlayers)
{
Destroy(playerObject.gameObject);
}
SteamMatchmaking.LeaveLobby(new CSteamID(CurrentLobbyID));
NetworkManager.StopClient();
NetworkManager.StopHost();
}
for some reason the .stopclient/.stophost doesnt seems to work
You may have to update it to at least the last PUN Classic version there is. WebGL export and WSS usage (which is required in this case) changed somewhat since 2015 and there is no guarantee your version works today.
PUN Classic is on the Asset Store for free. It has no major breaking changes (ofc APIs changed somewhat and logic may be affected) so it might not be as much effort as you expect now.
thanks haha, I actually updated a lot of it to PUN2, frankly most of it so far was just changing some properties to use PascalCase instead of camelCase (so far anyways)
Yes, that's true. Even PUN 2 is relatively similar. It might have a bigger impact on the gameplay though. It changed, how property changes are distributed / updated and even slight timing changes are sometimes sneaky.
Glad you are willing to update to PUN 2, as PUN Classic is really outdated by now.
it appears that has been the case actually, streams arent sending players transforms positions and such
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info){
if (stream.IsWriting) {
//We own this player: send the others our data
stream.SendNext(transform.position);
stream.SendNext(transform.rotation);
}
else{
//Network player, receive data
correctPlayerPos = (Vector3)stream.ReceiveNext();
correctPlayerRot = (Quaternion)stream.ReceiveNext();
if(Vector3.Distance (transform.position, correctPlayerPos) > maxDistForLerp)
transform.position = correctPlayerPos;
}
}```
this for example
There is a PhotonTransformViewClassic component in PUN 2. Might be more similar to what PUN Classic did.
would there be any better options for a multiplayer solution? looking for mobile, vr, and pc
Doesn't matter really as far as platform goes, you can choose one in the pinned messages. All of them can work with PlayFab as well, which can also facilitate cross platform identification.
But for the style of the game you can enquire on their respective discords which one would do better.
im not doing anything competetive so im not too worried
just confirming, unity multiplayer is free to start?
If you use something like Netcode for GameObjects and use P2P, then there's no cost
If you want game servers, you get what you pay for
alr, thanks
Hey there, I don't realy understand the purpose of network transform child component of Mirror. I mean, if I have a player empty with network Transform on it, should i use network transform child for all the model objects inside my player object ? (for exemple should i use it for my gameobject with mesh for left arm, same for right arm, foots, etc ?) and .. why ?
Thanks a lot !
If depends how important precise synchronization of those child objects is. With character you usually would get away with just making sure animation would look very similar in the same conditions. But if gameplay mechanic depends on precision you can make sure that child object is synced properly.
Yea you only need the network child if the child is changing independent of the parent and those changes are not synced by other means (like synced animations).
Okay so if it's just my parent moving my child it's useless, but if i have animator or scripts (like movement) moving parts independantly i should use this component right ?
You do not need it if the changes are synced by some other mean, like through synced animator
Oh okay thanks a lot 🙂
[Photon PUN] how should i go about syncing coroutines on a network? I have an enemy AI that jumps into the air and slams down on a player. Should I make the host run the coroutine and just simulate it happening on the clients rather than making clients run the same coroutine?
In most cases: Sync the result
What if I need the coroutine? It has a loop in there that lerps the enemy position up into the air and makes them fly down at a player. I want that to be smooth on both computers.
heres how it looks on singleplayer - in multiplayer it starts/ends fine but that lerp is jittery
I find myself avoiding syncing things that involve lerping/coroutines/ elapsedtime loops etc. etc. If anyone has any resources that would point me in the right direction id appreciate it
sync the result, i.e. the positions/events that are produced by the coroutine. You generally only want to run non-gameplay (purely cosmetic) code on the client.
normally what you do is: sync the raw values (results from gameplay code) form server to a proxy object on the client. Then have a "visualizer" or "view" object on the client that takes the raw values and interpolates them to produce smooth transitions/movement
you can get quite fancy with this interpolation, using prediction to make the movement appear less laggy.
if your network middleware has a good network transform this will make things much easier
hey does anyone understand ssl encryption. i have a unity application , a python server written with the sockets library, and an ios app. i need to send the data back and forth between the unity application and the ios app via the server and this data needs to be encrypted. does anyone understand / explain to me how ssl operates and how to implement it?
it is already implemented for you in any halfway decent http client library, you use it by specifying "https" as protocol in your URIs
Hey, I'm using Netcode for GameObjects.
Players starting play together in main menu scene. All main menu scene network objects are replicated without any problems, but then host start proper game, main menu scene is unloaded and new game scene is loaded. Problem is that for different players time to load this game scene is different, so scene network objects on this game scene won't replicate. Is there way to force network manager to try replicate scene network objects one more time?
It should do that automatically. What you describe is an issue in all projects, so if it doesn’t work you are breaking the automatic handling somehow
Hmm... So mayby my way to change scene is bad? Host use ClientRPC to call changing scene in clients. Also I first load game scene additive to main menu then unload main menu? Should I do it in another way?
read this:
https://docs-multiplayer.unity3d.com/netcode/current/basics/scene-management/index.html
https://docs-multiplayer.unity3d.com/netcode/current/api/Unity.Netcode.NetworkSceneManager
TLDR: use the supplied network scene management
Netcode for GameObjects (Netcode) provides two paths for scene management through the NetworkManager.EnableSceneManagement property. A scene consists of the assets for all or part of your game. While simple games may only consist of one scene, your game may contain many scenes that require synchronization for loading and unloading as users play.
Main class for managing network scenes when EnableSceneManagement is
working with TcpClient, what happens if i don't call NetworkStream.Close()?
and TcpClient.Close()?
Thanks!!! I was loading scenes with classic SceneManager.LoadScene instant of using networkSceneManager.LoadScene. Problem solved 🙂
a potential memory leak
Any mods here?? ^^^^^
@tepid egret Don't post ads on the server. #📖┃code-of-conduct for links
Do unity netcode work with android connected to a wifi router?
Yes
Thanks for the heads up, I appologize for my misstep
What is the difference between UnityTransport and UnityRelay?
I want to be sure I'm using the local and not the online one
Unity relay requires additional setup, so you can't just "accidentally" use it, if you want to be super sure, make sure the protocol field in the inspector is set to unity transport and not unity relay :)
Thanks! Most people say it's hard to make a multiplayer game, but I'll try it anyway
That's the spirit
Any Mirror users in chat?
How would i go about passing the server a user name on connect? Can i override StartClient?
hi
It's possible to ovveride OnStartClient if my memory is good
ohhhh ye ok that helps
Hi
how to use Photon chat function PublishMessage correctly pls
I'm new comer to photon
That should be covered by the docs:
https://doc.photonengine.com/en-us/chat/current/getting-started/chat-intro
how do i create a vr player spawned with photon😩
Hey again
I have a little problem and guys I need help
With Player names
When I connect first player, names show perfectly fine
But in 2nd player it doesn't show 1st player name
nvm fixed.
Hello! I'm following a photon game tutorial word for word, but, when i'm creating a room, it doesn't work. Maybe it's because something changed in the new versions, I don't know. I was googling and i saw that a lot of people had the same problem, but no one gave a satisfying answer. Btw, when i first launched my unity game, it worked. Here's my code (the Debug that i marked shows 0 rooms):
public void CreateOrJoinRoom()
{
if (PhotonNetwork.CountOfRooms > 0)
PhotonNetwork.JoinRandomRoom();
else
{
RoomOptions options = new RoomOptions();
options.MaxPlayers = 2;
options.IsVisible = true;
options.IsOpen = true;
PhotonNetwork.CreateRoom(null, options);
}
}
public override void OnCreatedRoom()
{
Debug.Log(PhotonNetwork.CountOfRooms);///////////////////////////////////////
}
this line of code is giving me an error on photon PUN 21
2*
and this is the tutorials line of code
this is my error
RoomInfo is in Photon.Realtime, a configured IDE should suggest this fix to you, configure your IDE using the guides in #854851968446365696
in Photon, does a collectable (that spawns that every player should see) need a PhotonView element
hey, my photon player is really buggy in 2D, any other player is teleporting around the place!
could this be a lag issue, or a issue that I can fix?
and if I release this game, will this be an issue to all players?
Should I be using NetCode for my multiplayer game or something different? I can't get NetCode to install right.
what kind of multiplayer game? Netcode is still in preview, once stable it will be the default option that is integrated best into the Unity 'experience', Mirror is the 'free' option that people commonly use for 'easy to get going' and 'great community support' for authoritative networking, Photon PUN is also an easy option if you don't care about authority, Photon Fusion is ideal if you need to build a tight FPS / ARPG experience, for MMO you (probably) have to roll your own on top of any transport layer you choose.
Hmm. I was thinking MMO :/
how much multiplayer programming experience do you have?
Little to none
I can scale back and for testing/prototyping I'll use anything simple
there is no scaling back an MMO game
stuff you do for small games do not translate to MMO requirements
Hmm
I've done some basic stuff with sockets in c# but I don't think that'd scale to MMO level stuff
for MMO you need to do so much stuff on the backend that just syncing gameplay is the easy part
Are there any links you can provide so I can learn?
MMO networking is basically about running a single client experience on multiple servers in multiple locations and with different specializations for handling the various systems of your game
there is no standard solution, and no resources on how to do it beyond knowing the ins and outs of all the components yourself
I was thinking of using Azure for the server side
that is just a hosting platform
you can use playfab to deal with various parts of the backend like secure storage of player inventory and purchasing, but playfab is not aimed at MMO games
I think the part I have the most issues with right now is understand the inbetween programming
inbetween what?
For instance, unity works on game objects and I believe I just need to serialize the data for sending back and forth but I'm not sure
Or what's the core concepts in making this work?
well, naturally all you do, at a fundamental level, is sending messages between two computers
you have to define what these messages mean to the two computers and which roles they play
Encoding, decoding, and you signing where to send it and how to use it
a multiplayer middleware like netcode/mirror/photon helps with formalizing that messaging process
I see
each of those contains a transport layer which deals with the actual encoding/sending/receiving
I think I'm going to be having to send a lot of stream data so does any of the options have UDP with integrity check I guess?
under that transport is usually another layer based on the IP protocol (UDP or TCP) that does the even lower level receiving/sending
most multiplayer games are built on top of a binary reliable UDP protocol
Do any of these automatic hand reliable UDP?
their transport layers do
examples are Unity Transport, Enet, Lindgren, KCP
generally nobody reinvents reliable UDP for their game, everyone (even professionals for the most part) use an existing implementation that is battle tested.
What would you recommend using for the transport layer and for the messages?
the important thing to understand here is this: your gameplay syncing solution you use for comms between the client and gameplay server does not matter much in the larger scheme of MMO things. you can create a MMO with 50 people per gameplay server and make it appear integrated into a much larger world
Are you referring to the method of using multiple servers/VMs and having it appear as one "world"?
the hard part is figuring out how to make player transition between those servers smoothly, so the appearance of a larger world is plausible, you can do this a 1000 different ways, from running the game on a mainframe and actually doing it all on separate CPU cores, or you scale via VMs and have to involve a scalable "server transition database" to move players around
This will require some thinking
you can look into presentations of "spatial OS" for some ideas
the tricky bit is also not in doing it for 10 people, or even 100, its doing it for 100000 people
in the olden days (WoW), they did it by not doing it and just locking people into actual servers, i.e. actual physical machines and made their servers run quick enough to handle 2000 people, this also involved a lot of game design choices that limited the amount of events that needed to be synchronized
I don't see how to get the special OS. Is it a paid service that they run their own servers?
spatial OS is a enterprise level solution. Its not something you can just download and use.
but they have made some presentations about their architecture that are educational
Ok, I think I have a good starting place to learn from. Thank you for talking to me.
Hi. What i'm really looking for is a rundown on what solutions are good/bad for real time PVP games. I'm not making League of Legends but that style of constant input.
What should I steer towards/away from for a real time pvp game like that?
I was originally thinking peer2peer lobbies and using photon for that.
The game would be similar to gauntlet, just a little prototype at first but I don't want to start with a solution that is not right for a real time game.
An array has a Length, not a Count
Your method declaration is incorrect
You'll need to show some code
Hey! In my game (using Netcode) I have vehicles which can use every player on server (like in GTA). I used ClientNetworkTransform to allow clients move vehicles, everythink works fine - host see when clients driving vehicles, but when host enter vehicle, it is instant teleported to vehicle start position. How can I correctly code vehicles that can be moved by any player?
I submit ownership to player on entering vehicle, so I guess problem is that when host get ownership back, vehicle teleport to his saved position
I just rewrote the lines and it worked
Yes, because the method needs () for where the params go
i rewrote the exact line
The Awake line was the issue, that is not how you declare a method
A configured IDE should underline this, if your IDE is not, head to #854851968446365696 and complete the setup guide applicable to you
ahhhhhhhhhh
i see
yeah i configured vs code
ive said that in begginer code 44859438593485 times
but it wonr work for the life of me
i gott go to school bye
I have an issue
when I create a server or lobby it creates the lobby successfully
when I try to join a lobby from another device
it doesn't join unless you have to create a lobby once again and rejoin it from the same device
I'm a bit confused whether or not lobbies handles some of the connections between players. For example, I read some networking guides/docs and see that you can start a server with NetworkManager.StartServer(). Does Creating a lobby do this? If not, do I need to connect the users again at some point?
Anyone familiar with Vivox chat?
For some unknown reason players can’t hear each other inside a channel?
I’m passing the same channel name though
Any ideas?
@balmy cloud @mild tartan Probably wanna mention which networking solution you are using. Odds are a lot of people are not going to engage with the question if they can't even figure out whether it's related to a networking solution they are familiar with.
how do i display the number of online players in photon PUN V2?
What information would I need from a java server to start building a client in unity with a tcp socket connection? It would be my first project in networking, im already sorry in advance if that question is rather weirdly put 😄
https://doc-api.photonengine.com/en/pun/v2/class_photon_1_1_pun_1_1_photon_network.html#a3789f83ba1db7486a19d6b810634ea51 Few methods there, the Photon docs are real useful you know...
Are you sure you should be doing multiplayer...
@spring crane all right. im not actually sure which solution im using to be honest lol. I guess it'd be the HLAPI? looks like maybe I should use photon, seeing a few people using that in here
I just started w/ the lobby pinned doc because it seemed useful for what I was going to try and start building
You are NOT using the HLAPI please
Actually haven't looked into this service at all, but it seems like this service don't rely on any specific realtime networking solution. You would use it with some other realtime networking solution, like Netcode for GameObjects (Unity). Photon provides a lot more integrated experience from what I've seen, which makes the learning process a bit easier.
It was deprecated years ago
We sometimes get people using it to make their new MMO because of that Brackeys tutorial
Can you persuade them off it and onto the new solution? Of course not 😂
@olive vessel , as an alpha male game developer, what's your go to networking solution?
Far from that, but I'm loving Mirror at the moment
cool will check it out. im confused tho. is netcode == hlapi? are they both deprecated?
netcode is the HLAPI replacement, about 10 years and 1000000 bugfixes better
netcode, yes
cool
I want to implement photon into my physics based 2d fighting game, but heard that there could be issues if I use rigidbody. I’m using the rigidbody.addforce function for all movement will it work fine or will there be issues
Hello. I'm trying to use Netcode for GameObjects on 2020.3.34f1, and just updated to version 0.50pre and I ended up getting this;
(0,0): error - System.NullReferenceException: Object reference not set to an instance of an object| at Unity.Netcode.Editor.CodeGen.INetworkSerializableILPP.Process
Does anyone know what causes it? Could it be because of my code?
Hello, is there a way to stream scene assets to the unity clients? I would like to create a scene that loads the assets remotely. Is this possible?
StreamableAssets and Adressables can help
Thanks, I was asking if Addressables would help on the addressables channel but nobody seems to know
Do you have any source of knowledge you can refer to solve this specific problem? I would appreciate it
I beleive StreamableAssets + AssetBundles could also work. As these aren't built in, but can be streamed as necesarry
Thanks
if I load a new scene, will my network manager connections terminate?
right now, I have two users connecting to a lobby. they're supposed to both load scene when there's 2 users in the lobby. it works for the client but not the server, I think because the client is loading the scene and the lobbyAvailable slots goes back from 0 to 1 before the server user has a chance to loadScene as well
nvm that's not the issue. available slots never going to 0
weird. on client and server I swear im getting same lobbyID, but not seeing availableslots decrement the 2nd time
will the host's lobby data change automatically when a client joins? or do I need to heartbeat it / requery it or something
I am creating my server using Facepunch.Steamworks like this:
var serverInit = new SteamServerInit("test", "test")
{
GameDescription = "test",
GamePort = 28015,
QueryPort = 28016,
Secure = true,
//DedicatedServer = true,
VersionString = "0"
};
try
{
SteamServer.Init(appid, serverInit, true);
SteamServer.ServerName = "test";
SteamServer.AutomaticHeartbeats = true;
//SteamServer.DedicatedServer = true;
SteamServer.MaxPlayers = 2;
SteamServer.LogOnAnonymous();
}
catch (System.Exception)
{
Logger.Warning("Dll not found? Why.");
}
it says Connectivity test: result=Connected, in progress=0
so i guess that my server is working
but my client won't see it
private void GetServers()
{
internet = new Internet();
internet.OnChanges += OnServersUpdated;
internet.RunQueryAsync();
}
void OnServersUpdated()
{
if (internet.Responsive.Count == 0)
return;
foreach (var s in internet.Responsive)
{
ServerResponded(s);
}
internet.Responsive.Clear();
}
thats how i am looking for servers
Can we get the other players ping to server in photon?
Without them having to send their NetworkTime?
Hey folks, I have a SignalR back end I would like to have a Unity client work with for a small project I am doing. I've found a lot of solutions online and was wanting to ask the braintrust what their recommended way of doing this would be.
Hey, just asking, pretty simple, is there a way that I can make a multiplayer. camera for unity that follows each player
One camera to follow all players?
Technically the situation isn't necessarily any different from local multiplayer, just make sure you sync all the necessary data and then use the data pretty much as if it were local.
There might be additional polishing things you may want to consider depending on the data you need, but it should get you started.
no, thats what it looks like right now, I want a seperate camera for each player
right now, the camera is a child of the player
You sure you don't need a camera just for the local player?
but the behaviour is kinda strange, being that the cameras do not seem to be assigned properly
i think thats what I need ngl
all i want is that the camera follows your player
Preferably I would hook into the spawning method of the player object, but if that isn't available, you could have a component on the player object that spawns a camera prefab if the object is locally controller
Or have a camera that is looking for client's local player object, if that is available
could you please refine your point as I don't understand. My player(as of the moment) is a prefab that is being spawned with PhotonNetwork.Insiantate()
I don't remember the stuff available in PUN by name, so just go with the component on the player object approach to get something working.
Create a component that spawns a camera prefab in Start if the PhotonView is local.
Am i already not doing that by having the camera as a child of the player, so they both spawn in?
Get rid of that camera and make it a prefab.
The goal is to control the spawning of the camera
using unity netcode for game objects is there a way to run code on a server without using an rpc function. To be clear I don't want the code to be called by a server rpc I want the code to run on the server by default.
You could do a runtime check to see if the game is running in host or server mode, or you could use https://docs.unity3d.com/2022.2/Documentation/Manual/PlatformDependentCompilation.html to control what code is present in server/client builds.
yeah maybe. runtime check would work just fine but if I am using a local host how would I affect the actual server instead of the local host client if I do it in a runtime check
You should be able to differentiate between client, host and server.
At least for the runtime check. Compile time would be a bit more challenging 😄
yeah but won't that only have effect in the client if you use a local host?
I am still very new to netcode so its still a bit confusing
Not sure what you mean. You should be able to have different code paths based on all 3 states.
ok so let me clarify. I want to run code on a server that is hosted on a local host. As far as I know the local host is split into a server and a client and just running the code like normal will only effect the client version on the local host and won't be synced on the network. So is there a way to g et code to run on the server side of the local host without using a server rcp that can be called by all clients?
I don't think server side of a host is really a thing, which is why host is a separate state from being a client or server. To run code when in host mode, you check if you are running as a host. Client that is in host mode generally shares all state with the locally running server. It's more of a server that is also acting as a client rather than a client that is running a server, if that makes sense.
oh alright. Yeah that makes sense. Thanks for the help I will try it out
Semicolon on a method declaration, should it be there?
"using UnityEditor;" needed for those
Also, I think your script needs to extend to "Editor" instead of "MonoBehaviour"
No
The issue is a semicolon closing a method, leaving it without a body
And a misspelling of Rect
yeah right
Ok I will check and write if it helped
ok, I am back, I'd like to make a 2D multiplayer camera that follows the player. Right now, the camera is a child of the player and when the player spawns, the camera does not follow the player or the player is looking at the wrong camera
important question with pun 2....
I have applied IPunObservable. and I did the sendnext and recieve next.. but now I have come to realize that those work ONLY FROM THE OWNER OF THE PV, like the values get synched from owner of the instance that has the variable, is there a way to make the value update from other non owners as well?
also is fusion fully documented now??
Anione that work with photon online?
Hello, Someone know how to Synchronize parameters of Photon Animator view in C# please ? I try to get the component then use SetParameterSynchronized() but I have error message. thx and good day
Hello, there are problems when developing a network game using Mirror Unity. I want to make a connection via a local network, but I realized that sometimes there are problems when you cannot connect to the phone distributing the Internet. I used different connection methods, but this error always clearly indicates that something else needs to be done, has anyone met such a problem? There is a solution? What could be the possible reasons for such work?
If photonView.ismine
Learn about that concept, you can have 1 camera in the scene but once you add multiplayer you need to make sure each player is being followed by the camera by telling the camera that they photonview is theirs.
Hi, I'm completely new to Unity multiplayer.
I need a direction on where to start.
My requirement is to make a game that can
- Have a lobby filled with player created public rooms. (Auto matchmaking not required)
- Players can host/join room.
- Works on steam, but shouldn't be limited to steam (possible to reuse for other platforms)
From what I googled, Mirror + Facepunch seems to be my best choice?
@clear aspen https://doc.photonengine.com/en-us/pun/current/demos-and-tutorials/pun-basics-tutorial/intro
Photon Unity Networking framework for realtime multiplayer games and applications with no punchthrough issues. Export to all Unity supported platforms, no matter what Unity license you have!
But photon have a pricing, should I be worried about it?
i have fixed it already (just now), sorry!
i dont think so, the free version works pretty well
idk tho, i suppose it depends on the scale
Is the usage of Unity.Networking covered here?
Ok, I need a solution to a problem where, although so simple, I cannot get it to work.
The problem is to destroy a gameObject(with a PhotonView) across the entire network.
My current approach is to use an RPC method to the MasterClient, here is the code for it:
Call: view.RPC("destroyCollectable", RpcTarget.MasterClient, col.gameObject);
RPC Functioncs [PunRPC] void destroyCollectable(GameObject collectable) { PhotonNetwork.Destroy(collectable); }
This approach seems to work fine when there is only 1 player in the game, that player being the MasterClient, however, if another player joins and tries to destroy the GameObject, it creates one of two errors: cs Failed to 'network-remove' GameObject. Client is neither owner nor masterClient taking over for owner who left or cs Exception: Write failed. Custom type not found: UnityEngine.GameObject
As for the first option, I was led to this post (||https://forum.unity.com/threads/photon-failed-to-network-remove-gameobject-please-help.371499/||), which comes to the conclusion that the MasterClient cannot destroy GameObjects anymore and that that is outdated, if that is the case, what approach should I take? Any help would be greatly appreciated!
In case it isn't obvious, I'm using Photon PUN2 as my networking solution
Hello i have the following problem:
Im using a VPN and unity isnt able to connect with any API ("could not connect to host error"), ive tried with different APIs dont know what the issue is, can access the package manager just fine.
First happened when i tried to connect to the Playfab API but now i realize it happens always, everytime i request for web service
maybe the services/APIs block your vpn provider's proxy servers
what's the "intended" way to do multiplayer dev in unity. I love unity as an engine but i struggle to justify it as compared to other engines in terms of multiplayer dev. Biggest issue is running mulitple instances of a game without dodgy 3rd party addons. Hell even monogame is so much more convinient in that sense.
when you destroy an object that has a photon view you only need PN.destroy... dont use an rpc
if you want to destroy an object that's not yours then in the rpc add an if (PN.localplayer.ismasterclient)
ok, so I looked into photon, but there's Fusion, Quantum, Realtime, and even Legacy of BOLT/PUN to choose from.
What are the differences and which should I use?
I dont know
I just know that with PUN2 free asset that you got in unity asset store you can create multiplayer game
you need to study these another tools to check their functions
or even ask for someone that can help you 🙂
There is a sheet somewhere on the site that describes the differences, but it depends on what kind of game you're making they are all different it's not really one over the other.
That being said PUN2/Bolt are considered legacy and are being replaced with Fusion
(which is better)
What is PN? If its PhotonNetwork, therre is no such definition for localplayer
PhotonNetwoek yes, I was writing the answer using my phone 😁
but, there is no definition for localplayer, and anyways, im already sending the RPC only to the MasterClient, aren't I?
There is, you need to derive from monobehaviourpuncallbacks
oh
Yes and the libraries you are including, pun and other ones
yeah, but why do I need this line anyways
Cause each library has a different set of methods and classes that you'll need
and right now I can't really do anything cuz this error fills up my screen: cs Exception: AllocateViewID() failed. User 1 is out of viewIDs. It seems all available are in use.
but, I'm sending the RPC only to the MasterClient, right?
Show me your code
Everything relevant should be here
And you don't always have to send it to the master client
i don't, but wouldn't sending it make it easier??
In the rpc... Use the is master client condition
ok... I'm neew to RPC, how can I send it to every player?
Depends on what you're trying to do, in the case of destroying the game object you only need the master client yes
Rpc work on every client by default
so, I just exclude that argument?
Before the destroy command just put the if
Give me 10 mins, @maiden sentinel ill go to the computer and explain
kk
also, I'm getting this error:cs Exception: AllocateViewID() failed. User 1 is out of viewIDs. It seems all available are in use. Yeah.
sure
what is the best way to make multiplayer game in unity with high quality?
hey guys
I'm trying to wrap my head around security around client to server communication, this is my question in a nutshell
relating to an inventory system (as an example).
A user logs in, and now has access to read data from their inventory, rewards, etc. All the subscriptions happen to all the data (or it is all loaded in at once and polling occurs).
In our scenario, the player then picks up a potion. This is then stored locally on the client RAM and eventually triggers a request to a server that has write access to the database, the database validates (?) the data and writes it to the database.
my question is, how does the server know the client is telling the truth?
ie can a malicious user deconstruct the client, after authorization, and send potentially send the server false data?
Or am I incorrect in that being an attack vector, and can the server trust the client?
I tried to add client prediction to my game, I didnt add reconciliation yet, but I think this isnt supposed to happen. The model is the player with client prediction and the green model is the latest known server position.
with the above, bottom line questions are:
does a server trust a client after auth has happened, or does the server still have to validate information?
can a client be deconstructed such that a user can log in, get access tokens to the DB, and then send arbitrary values to the database
- No, the server never trusts the client, everything important like shooting and movement is supposed to be authoritive
- idk
what about something persistant
like an inventory item
So when a player adds a potion to their inventory system, what is the workflow? generally speaking. I'll write my best guess below
- Client caches data locally.
- An event is emitted when this action happens, from the client to the server
- Server validates and persists information
- Client polling ensures eventual consistency
Ig it's like this
- Client sends keypress to server
- Client displays predicted message
- Server processes keypress
- Server sends message to client and validates
Np np
hello, what could be causing that web request calls dont work on the editor play mode, only on build
BestHTTP on asset store
hello everyone, I'm developing a game on unity with a mirror and I want to make the server call a function that will work on all clients and the server as well. I know the ClientRPC decorator, but it is called only on all clients, but I also need it called on the server. please tell me how this can be done?
Yo anyone able to help with Pun?
Yes
can someone help me with photon latency
i am not sure where i go with this. i have a game set to host & client mode for Multiplayer using Photon. This works fine but i want to set this logic to a headless server. I got a virtual linux server up and running and as far i can see it works but i cannot see the Server in the lobby while that is locally no problem. Is there a specific step to do?
the game is starting in server mode via arguments and it should be visible. is there a way to get the debug from unity into the server console?
I forget if there is some special setting somewhere in Unity that you have to enable, but I know you can get Console.WriteLine to work
Might work by default, but I remember having some troubles at some point
That's for custom logging, but if you just build the headless server in development mode you should get error logs
Ah thx. That's a start
hm, write to line is not shown in the server console
hm how can i print output to a console like bash/etc when i run a build?
ok as far as i can see it is not possible to get messages to the server console. but instead into the player log
but how can i access the player log on a server?
ah i see. have to find them on the server system
hm, does anyone having trouble starting a linux build on a server? my windows build runs.. but at linux it does hang at Unable to load player prefs
i made a picture. on the right is the windows log, on the left the linux log
i underlined the parts that may have something to do with the linux build not running
Hello. I want to make a multiplayer card game and currently having troubles with choosing networking solution. So I want to have one server hosted by me that controls different rooms for the players. Can PUN server do that? Or is it only for player-hosting? What should I use? Thanks!
@quasi pike You could probably have it very easy and robust via having the game as a backend
And players sending commands with http requests
It'd be infinitely scalable
A request would be something like:
{
"GameId" : 324687,
"CommandType" : "PlayCard",
"CommandParams" : {
"CardIndex" : 5
}
}
But I don't know if the requests will be expensive
Your game state would be a database entry in some database or redis
Your function app would pull the game entry, update some data, and write it back also returning the new state of the game to you
The good part about all this is you not worrying about hosting an "instance" for a game
Because a game would just be a database entry
The bad part is having to move around the game data for each request
There has to be some ways to cache it where its processed and maybe forward the same user there all the time
Or avoid having the need to store the game state in a database at all
.
I wonder how would some else answer this question
so i get this crash report finally.
somebody a clue if this is somethin linux specific (when working with photon)
Im using Netcode for GameObject and host move normal but when host move the client move too and client cant move how i can fix this? how i can give every client move script
What is the limiting factor of concurrent users in multiplayer games today? Is it the expected limited bandwidth of the clients?
Excluding any AOI, compression or smart packet handling?
Engineering effort, probably.
If you have a single container/vm/instance without any firewall/LB, you could theoretically handle 65k concurrent connections, but you'll likely run into resource issues far before you'll run out of ports: CPU processing, disk/database access, memory depending on what's needed per client.
If you are scaling out (multiple instances that can handle a smaller number of connections per) then you're essentially only limited by engineering effort (to get the instances talking to each other or a database if needed) and cost (instances of servers cost money, bandwidth costs money, data costs money, and most importantly - salaries cost lots of money).
Guys, does anyone experiencing problems with Vivox? I'm able to authorize, but not able to Join any channel. Getting instantly disconnected.
Can someone help me with the my unity transport code. I'm getting a event queue error when more then one person joins
ServerManager
Server Client ``` using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ServerClient
{
int playerNumber;
bool isConnected;
string playerAlias;
float playerXPos;
float playerYPos;
public ServerClient(string newPlayerAlias, int newPlayerID)
{
playerAlias = newPlayerAlias;
playerNumber = newPlayerID;
isConnected = false;
playerXPos = 0f;
playerYPos = 0f;
}
public void initNewClient(string newPlayerAlias, int newPlayerID)
{
playerAlias = newPlayerAlias;
playerNumber = newPlayerID;
isConnected = true;
playerXPos = 0f;
playerYPos = 0f;
}
public void updateClientPosition(float newPlayerXPos, float newPlayerYPos)
{
playerXPos = newPlayerXPos;
playerYPos = newPlayerYPos;
}
public void updateClientData(
bool updatedConnectionState,
string updatedPlayerAlias,
float updatedPlayerXPos,
float updatedPlayerYPos)
{
isConnected = updatedConnectionState;
playerAlias = updatedPlayerAlias;
playerXPos = updatedPlayerXPos;
playerYPos = updatedPlayerYPos;
}
public void clearClient()
{
playerAlias = "No player";
isConnected = false;
playerNumber = -1;
playerXPos = 0f;
playerYPos = 0f;
}
public bool isClientConnected()
{
return isConnected;
}
public int getPlayerID()
{
return playerNumber;
}
public string getPlayerAlias()
{
return playerAlias;
}
public float getXPos()
{
return playerXPos;
}
public float getYPos()
{
return playerYPos;
}
}
also if there is any way i could optimize the code and have it run better would help
it depends on too many factors (clever design, some engineering), usually the bottleneck is data throughput and that hasn't improved much per node in the past 20 years... so modern games scale horizontally nearly without limit but for persistent shared worlds, nothing has changed much
hi im trying to send a http json request to link sqlite db using nodejs to unity
var formContent = new StringContent(newUser.ToJSON(), Encoding.UTF8, "application/json");
HttpResponseMessage response = client.PostAsync(baseUrl + "/api/login", formContent).GetAwaiter().GetResult();
string responseStr = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();```
is this done by sending json request or url encoding request
Does anyone have any good resources on architecture for sharing code between the client and server?
Putting all logic into the server and just having a dumb client which simply does presentation seems very straight forward but it will fail when latency increase and it also wont allow for any type of client side prediction.
Would it be crazy to run a local server for each client which handle all client side logic and then correct itself after the actual server?
have a look at the architectural descriptions of photon fusion and photon quantum, they are both interesting solutions to low latency multiplayer. Prediction can be unnecessary or much simplified if you have a game design that hides latency well, things like lock-on/explicit targeting as in WoW vs incidental targeting as you see in first person shooters. Ultimately even if you have the server run all the prediction, you can still provide a client with any information it may need to steer and correct its own simulation, basically you can have have both run in parallel and checking for consistency at intervals and smoothly correcting if necessary.
Thank you! I will take a look at them 👍
My approach is (assuming you have the networking & serialization of data taken care of) for a very carefully managed player state object that you can send either way. When my clients connect, the server strips any "secret" information out of the state, and sends it to the client so they can play. When they make non-important changes (ie, nothing they could advantage themselves with) they are free to just edit the model on the client side. When they want important changes (ie - redeem a chest or randomly select a reward or something) they send a request to the server, which verifies they're able to and validates other aspects of the request, edits the model, and sends it back to the client, which can either discard the model entirely and use the new one, or merge them together.
So - you have an entirely serializeable player model that has methods to strip the secret stuff on the outgoing copy, strip the potentially hacked information on the incoming copy, and methods to merge them depending on where you are.
Having entirely serializable models sounds like it could be really useful, thank you for the feedback!
Sure. I'm using MessagePack for C# (for serializing to byte[] for networking), Newtonsoft.Json (for serializing to JSON for my database) and Ruffles rUDP for networking.
At some point I might write a blog article or something going over my stack.. seems like a pretty common need and it took a lot of learning on my own to do it.. and it wasn't super complicated or anything
hey i have a problem with UnityWebRequest doing a POST. not sure if this is the best place to put it
so in postman i have a POST request with this signature, no body, and it 100% works with a valid auth token. no problemo. but when i try to make a UnityWebRequest.Post, no matter how i seem to configure it, i either get a 401 or a 403 back. the 401 i think is because i'm putting the auth header in the wrong place but when i put it where i think it should be, i get a 403 which makes no sense to me
https://paste.myst.rs/2q1i166o here's a paste link with a bunch of the code i've tried, most of it commented it out. it all seems to fail no matter what i try though
a powerful website for storing and sharing text and code snippets. completely free and open source.
anyone? i'm dying here
i literally can't stop working until i get this working
Whenever I had problems with unity web requests, it was usually unity not adding a user-agent header, so I had to add one manually. Not sure if that's your issue though
my postman doesn't seem to use one
In your screenshot above it has one
okay. it works via swagger and it looks like it doesn't use one
i can try though. do i just make up a user agent name?
does anyone on this planet have experience with this? i literally just want to POST an empty body
it shouldn't take two days of research, trial/error and literally just guessing at this point to structure a query that i got working in 30 seconds in swagger and postman
I just put unity for the name
yeah that's not my problem
its my own API and i'm not checking for the user agent and it didn't work when i tried it for s+G's
is anyone here proficient with Mirror and wouldnt mind spending some time answering questions and clarifying some stuff to help me understand how it works? (and would be ok with helping over VC)
@weak plinth Don't cross-post. Ask the actual question.
i tried to write my question.. it would be 1000x easier to explain it in vc
Try
No one knows if they'll be able to help with your specific issue unless you actually ask
Do you actually think people will commit to VC with you before you can even formulate a proper question?
im just trying to understand how the server comms with the client and vice versa
Networking is a big topic to get through
i made multiplayer games on another platform for 9 years, and trying to learn on a new platform is tough. im trying to make connections between the two platforms and how it would work to make it make sense to me
for example: im used to scripting with dedicated Server scripts and Dedicated client scripts that communicate to each other through Events (similar to Commands with mirror)
so i dont get where the Server code should be written, and why
same with client code
There’s no such thing as dedicated clients
What networking solution are you using?
that was just an example of how it was done on the other platform i was using
with unity im using Mirror
Give me an example of something you want to do and I’ll explain how it’s done
something as simple as a player shooting a projectile. When the Lmouse button is clicked, how does that client communicate with the sever to let them know to insatiate the projectile prefab, add a velocity etc, and then transmit that to the clients
is it all done in the same script?
server (if i understand right, this will give some level of protection against exploits?)
Yeah
I’ll explain a hybrid example
On the Player script, when the player clicks shoot, the player script(which inherits from NetworkBehaviour) will send a [Command] (this just means the code will be executed on the server). Now on the server the code will execute and spawn the projectile. It will also have to call NetworkServer.Spawn on the projectile so all the players can see it. You could put a NetworkTransform on the projectile (to sync the position) but to be honest, you don’t need to, just use the same movement script and it will roughly align on all clients
@weak plinth
so where is the server code written?
The server code is in the [Command]
When you call a method with the command attribute on a client, it is instead executed on the server
so its all in the same Cs script?
Yes
ok thats the confusing part to me
a bit more than i did 30 mins ago
It takes about 30 minutes and will clear up all your misunderstandings
Everything under USER MANUAL is essential to read
because how i did for the past 9 years was;
client has a player script, and when they click to shoot it will fire an event
-server listens for the designated event and when called on, will execute code (in a seperate "server script"). this will then instantiate the object on the server, add velocity etc