#archived-networking
1 messages ยท Page 105 of 1
why doesn't it sync?
Did you add photon transform view component?
for the ball
ok
And yes both player @jovial pike
do i have to change something in the script?
no ig
thx
Get your next game design project organized - Sign up to Milanote for free: https://milanote.com/blackthornprod0621
Udemy Multiplayer course: https://www.udemy.com/course/beginners-guide-to-multiplayer-game-development-in-unity/?couponCode=86D7C0073D7CD59B6C07
0:00 - Intro
0:3...
You can follow along this tutorial
if (!this.photonView.IsMine)
{
if (m_UseLocal)
{
tr.localPosition = Vector3.MoveTowards(tr.localPosition, this.m_NetworkPosition, this.m_Distance * (1.0f / PhotonNetwork.SerializationRate));
tr.localRotation = Quaternion.RotateTowards(tr.localRotation, this.m_NetworkRotation, this.m_Angle * (1.0f / PhotonNetwork.SerializationRate));
}
else
{
tr.position = Vector3.MoveTowards(tr.position, this.m_NetworkPosition, this.m_Distance * (1.0f / PhotonNetwork.SerializationRate));
tr.rotation = Quaternion.RotateTowards(tr.rotation, this.m_NetworkRotation, this.m_Angle * (1.0f / PhotonNetwork.SerializationRate));
}
}
i never opened this script
why is there an error?
maybe i have to use photonView.IsMine in my move script?
I will try it
if (pv.IsMine && ptv.photonView.IsMine)
can i use this?
ptv = GetComponent<PhotonTransformView>();
ptv is my photontransformview
no it doesnt work
Use if(!view.IsMine)
return;
ok
You gotta add a photon view component
i have
A photon transform view component
And animator view if you have any animator
Animation*
void FixedUpdate()
{
if (pv.IsMine)
{
float horizontal = Input.GetAxis("Horizontal2");
if (Input.GetKey(KeyCode.I))
{
RaycastHit2D hit = Physics2D.Raycast(gameObject.transform.position, Vector2.down, rayCheckDistance);
if (hit.collider != null)
{
rb.AddForce(Vector2.up * jump, ForceMode2D.Impulse);
}
}
rb.velocity = new Vector3(horizontal * speed, rb.velocity.y, 0);
Flip(horizontal);
if (Input.GetKey(KeyCode.K))
{
gravityScale = 5;
}
else
{
gravityScale = 1;
}
rb.gravityScale = gravityScale;
}
}
Rigidbody2D rb;
PhotonView pv;
PhotonTransformView ptv;
void Start()
{
rb = GetComponent<Rigidbody2D>();
pv = GetComponent<PhotonView>();
ptv = GetComponent<PhotonTransformView>();
}
If using rigidbody, use photon rigidbody view
No
ok
You only need photon view
Then what's the error?
then it should be working right?
Build and test it out
ok
now it doesnt even start
Are you following along with the tutorial? @jovial pike
that was the problem
what do i have to do to fix it?
it's still having that error?
ok
ig you should re do everything and follow along with the tutorial because there are many things i.e wrong In your code
but can i use isMine on the ball?
you want the ball to be controlled by player?
ismine is used when you don't want your player to move others' player
its stated in the tutorial
No dont
but you cant controll the ball
Transform view syncs the transform to all the clients on server
bruh, watch the tutorial I sent you abovr
Ya if its a moving camera
I did everything that he did in the video
if (pv.IsMine)
{
float horizontal = Input.GetAxis("Horizontal");
if (Input.GetKey(KeyCode.W))
{
RaycastHit2D hit = Physics2D.Raycast(gameObject.transform.position, Vector2.down, rayCheckDistance);
if (hit.collider != null)
{
rb.AddForce(Vector2.up * jump, ForceMode2D.Impulse);
}
}
Is anything missing?
you doing everything in playmode?
yes
Photon PUN: I need to sync the player that is just entered in the room, so inside the OnPlayerEnteredRoom how can I call an RPC specifically aimed to that new player?
i think my problem is that i have two player objects and not one.
Bro, ig you need to instantiate player when joining
Not with scene
ouh
in the ConnectToServer Script?
OrCreateRoom Script?
public override void OnJoinedRoom()
{
PhotonNetwork.LoadLevel("SampleScene");
PhotonNetwork.Instantiate("Player", spawnLocationLeft.transform.position, Quaternion.identity, 0);
}
like this?
Hello Everyone,
I was thinking if it's possible to control a standalone application using my mobile phone (offline - no internet)
Like I create a scene in Unity with a cube, make it a standalone app and then maybe change the color of that cube using my phone. My phone can have the same application. Just that everything should be offline. I want a way to communicate with the standalone application using my phone.
Are you ok with going via LAN? Bluetooth?
Are the cube app and phone on the same LAN?
Are they in different places geographically?
LAN networking doesnt require internet
But going to different houses or to a different coubtry does
It will require going over the internet, and there isnt much yiu can do about that
@icy thorn yes bluetooth/lan works. It would be in the same space. Just like how we have a controller for a PS4 system.
Could you help me with this?
whats the problem
show me your code for room creating/joining you can herte on dm
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Photon.Pun;
public class CreateAndJoinRooms : MonoBehaviourPunCallbacks
{
public InputField createInput;
public InputField joinInput;
public void CreateRoom()
{
PhotonNetwork.CreateRoom(createInput.text);
}
public void JoinRoom()
{
PhotonNetwork.CreateRoom(joinInput.text);
}
public override void OnJoinedRoom()
{
PhotonNetwork.LoadLevel("SampleScene");
}
}
omg
i switched the join and create button
now it loads longer
but the second screen isnt loading at all
when pressing join
why are you ccreating room in join room?
You should use PhotonNetwork.JoinRoom(joinInput.text)
you also should have before it all ConnectToMaster function
sorryu
connectusingsettings
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using UnityEngine.SceneManagement;
public class ConnectToServer : MonoBehaviourPunCallbacks
{
void Start()
{
PhotonNetwork.ConnectUsingSettings();
}
public override void OnConnectedToMaster()
{
PhotonNetwork.JoinLobby();
}
public override void OnJoinedLobby()
{
SceneManager.LoadScene("Lobby");
}
}
This Script is in my Loading Scene
ah you are using lobby system, so I dont know how it is going
i really dont need a lobby
I thought it wouldnt work without a lobby
omg it works
its laggy but it works
so what was issue?
the Create in the joining method
but i really thought i have changed it
I have one short and last question :S
yeah sure
I think because you have already player placed in scene
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
public class LeftSpawnPoint : MonoBehaviour
{
public GameObject spawnLocationLeft;
void Awake()
{
spawnLocationLeft = GameObject.FindGameObjectWithTag("SpawnPointLeft");
}
void Start()
{
SpawnPlayer();
}
private void SpawnPlayer()
{
PhotonNetwork.Instantiate("Player", spawnLocationLeft.transform.position, Quaternion.identity, 0);
}
}
no i instantiate them
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
public class RightSpawnPoint : MonoBehaviour
{
public GameObject spawnLocationRight;
void Awake()
{
spawnLocationRight = GameObject.FindGameObjectWithTag("SpawnPointRight");
}
void Start()
{
SpawnPlayer();
}
private void SpawnPlayer()
{
PhotonNetwork.Instantiate("Player2", spawnLocationRight.transform.position, Quaternion.identity, 0);
}
}
move you instantiate function to OnJoinRoom callback and it shouldbe ok
this i for the right spawner
thx
and why you have two different prefabs for players?
because they have different movement scripts
i controll one with "w a s d" and the other with "i j k l"
really?
you can also have only one prefab but two different movement scripts and apply for the same player but at start disable one.. then you can enable them determining if one of them is master client
depending on in if one of them is master client
I consider your game will always have max two players, right?
yes
thats a good idea
I will do this in way I described but I dont say your solution is bad or something
treat it just like a tip ๐
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Photon.Pun;
public class CreateAndJoinRooms : MonoBehaviourPunCallbacks
{
public InputField createInput;
public InputField joinInput;
public GameObject spawnLocationLeft;
public GameObject spawnLocationRight;
public void Awake()
{
spawnLocationLeft = GameObject.FindGameObjectWithTag("SpawnPointLeft");
spawnLocationRight = GameObject.FindGameObjectWithTag("SpawnPointRight");
}
public void CreateRoom()
{
PhotonNetwork.CreateRoom(createInput.text);
}
public void JoinRoom()
{
PhotonNetwork.JoinRoom(joinInput.text);
}
public override void OnJoinedRoom()
{
PhotonNetwork.LoadLevel("SampleScene");
PhotonNetwork.Instantiate("Player", spawnLocationLeft.transform.position, Quaternion.identity, 0);
PhotonNetwork.Instantiate("Player2", spawnLocationRight.transform.position, Quaternion.identity, 0);
}
}
ouh wait
yep but with this code it always will instantiate two players
no matter if second one has joined
and the other problem is that he cant find the spawnLocations
because its not the right scene
and when second player will join the another two players will spawn
ouh
then i have to use your ideo
*idea
so i give my prefab player both scripts an when he spawns i will disable one of the scripts
slove first of all problem with player spawning - give them temporary fixed locations in code
then workaround the spawnpoint system
ok thx ๐
solution for you problem is just to move your code
spawnLocationLeft = GameObject.FindGameObjectWithTag("SpawnPointLeft");
spawnLocationRight = GameObject.FindGameObjectWithTag("SpawnPointRight");```
this into another place ๐
ok
you already say what is the solution for it
.
remember, code is executed from top to the bottom
so
- Load a scene
- Load spawnpoints
- Spawn the players
viola
i will set a bool variable on my spawn script. and i will set it in my CreateAndJoinRoom script to true.
can i do that
you dosent have to
ouh ok
nope
after LoadLevel i can instantiate the spawnpoint and player
in playable scene you can place fixed spawnpoints
after loading scene in OnJoinedRoom
You can get these spawnpoints with your code from Awake function
then
Instantiate players
you still didnt get it? ๐
and I think it is the moment when you should stop coding, get a walk, comeback and work it around
๐
I do it everytime when my mind is blowing, but instead of getting a walk I am going to my proper job
when i'm sitting on something i work on it until it works
I've been trying to get my photon working all day
but i will make it
and thanks for you help
do you mean i can put spawn points in my lobby scene and use dontdestroyonload to keep it there when loading my game scene?
i have
i will try something
but my problem is i dont know how i can find the GameObject in my CreateRoom Script
i cant use this
how
spawnLocationLeft = GameObject.FindGameObjectWithTag("SpawnPointLeft");
spawnLocationRight = GameObject.FindGameObjectWithTag("SpawnPointRight");
thx
public override void OnJoinedRoom()
{
PhotonNetwork.LoadLevel("SampleScene"); // FIRST SWITCH SCENE
spawnLocationLeft = GameObject.FindGameObjectWithTag("SpawnPointLeft"); // NOW WHEN WE ARE ON CORRECT SCENE WE CAN GET THE SPAWN POINTS
spawnLocationRight = GameObject.FindGameObjectWithTag("SpawnPointRight");
PhotonNetwork.Instantiate("Player", spawnLocationLeft.transform.position, Quaternion.identity, 0); // SPAWNPOINTS ARE NO MORE NULL REFERENCE SO WE CAN USE THEM
PhotonNetwork.Instantiate("Player2", spawnLocationRight.transform.position, Quaternion.identity, 0);
}```
yes
he cant find the player
PhotonNetwork.Instantiate("Player", spawnLocationLeft.transform.position, Quaternion.identity, 0);
this is the line 38
or maybe he isnt finding the Spawnpoint. i cant really tell
xD bruh
okey just put positions in code
oki
I will take a look later how I have it solved with spawnpoints
you can just Debug.Log both and see if it finds it or not? If you debug log the spawnLocationLeft and it returns null, that might be your issue, otherwise its the Player object
thx but i found a solution
Just dont hesitate to let others know ๐
can you help me with another problem?
i just used Vector3(x, y, z) instead of setting a spawnpoint with references
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Photon.Pun;
public class CreateAndJoinRooms : MonoBehaviourPunCallbacks
{
public InputField createInput;
public InputField joinInput;
private GameObject Player;
public void Awake()
{
DontDestroyOnLoad(gameObject);
}
public void CreateRoom()
{
PhotonNetwork.CreateRoom(createInput.text);
}
public void JoinRoom()
{
PhotonNetwork.JoinRoom(joinInput.text);
}
public override void OnJoinedRoom()
{
PhotonNetwork.LoadLevel("SampleScene");
Player = GameObject.Find("Player");
DontDestroyOnLoad(PhotonNetwork.Instantiate("Player", new Vector3(-3, -5, 0), Quaternion.identity, 0));
if (Player.activeInHierarchy)
{
DontDestroyOnLoad(PhotonNetwork.Instantiate("Player2", new Vector3(3, -5, 0), Quaternion.identity, 0));
}
}
}
is there another way to check if the first Player was instantiated.
yes it its
GameObject spawnedPlayer = PhotonNetwork.Instantiate(...);
if(spawnedPlayer==null)
Debug.LogError("Player IS NOT SPAWNED!");
for ex
what is the basic idea of having an authoritive server with photon... how woould i implement that ... like just the basic idea
What you mean, an explanation of what a server is doing?
the basic idea of a NON authoritive server would be
-> user presses W -> user moves char -> server synchronizes
the basic idea of an authoritive server would be
-> user presses W -> sends request to server -> server checks if possible -> server synchronises the result
so how does it work to implement the authortive server in photon
is there a tutorial or anything
like "hackers" just tell the server 10 times per frame that they jumped => fly "hack"... its just the server didnt check if they are allowed to jump yet
hope it got more clear what i mean
Hm, I mean as long as your game is written correctly, how should a "hacker" be able to tell the server that they jumped 10 times if your code prevents you from jumping? just wondering
as soon as the code is on client side you cant tell anymore if its a reworked code or not ...
if you have authoritive server it doesnt matter anymore if its reworked or not
you allow on the server the normal gameplay and "everything" (there is always something not perfect)
else gets blocked
If someone really takes the effort of doing this, well, credits to them ๐ but yeah, if you want to have it 100% proof, photon themselves say that a full autority server isnt their thing, but you can always just check the values the players position is sending and check for weird offsets and stuff
photon themselves say that a full autority server isnt their thing,
How do you mean that
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!
last section
public override void OnJoinedRoom()
{
PhotonNetwork.LoadLevel("SampleScene");
if (once == true)
{
GameObject Player = PhotonNetwork.Instantiate("Player", new Vector3(-3, -5, 0), Quaternion.identity, 0);
DontDestroyOnLoad(Player);
once = false;
}
else if (Player != null)
{
DontDestroyOnLoad(PhotonNetwork.Instantiate("Player2", new Vector3(3, -5, 0), Quaternion.identity, 0));
DontDestroyOnLoad(Player);
}
}
ok where is now the difference between photon bolt and normal photon?
he only instantiate the first player
for both players
you are setting your once stuff only on one client
even if you are false you are only a bit off to be true
like 1 bit... ... was a joke... yeaah
Welcome to network gaming, if your ocnnection sucks or your friends' connection or both, it will lag. Also depends on your whole game how much data you are sending over the network
I dont know about your network, but laggy is either network connection, too much data or photon is giving free service which will limit bandwidth
there is written photon bolt requires unity 5 and not unity 4 -.. do you know how to check what i got?
i got the free standalone
version of unity
Which unity version?
i got pc mac linux standalont 2020.3.9f1 Personal
What do you mean with "do you know how to check what i got"?
like idk if my unity version works with photon bolt
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!
Well i guess its a minimum requirement.
It might be just old
so ye another question came up...
why do so many use the low level api PUN when bolt is available...
like selfmade room management is always a source for errors and problems and a high level api gives you much more stuff by default
tbh, I dont know. I guess most tutorials just start with photon out of the box and not bolt, just a guess
Is it better to use frameworks/services like Photon server f.ex. for MMO games or just build your own backend? I guess services takes care of a lot of the infrastructures like load balancing f.ex. which makes it convenient
If you are not a network expert, dont even think about doing your own hacky network thing ๐
should I remove Photon from my project if I no longer use it?
Should I remove my garbage from my car if I dont need it? you dont have to, but it will make things messy ๐
ok thx
i have a garbage folder outside of my unity project where i keep stuff and ideas that i may need in future
but i mean the Package Photon
for some reason i thought my unity would run slower if i kept it in my project
unused classes will be thrown away from the compiler anyway so : no
While it's easier to get higher quality networking through the higher end Photon products, they require you to learn more stuff to make sure you are using the facilities provided by the framework. Recommending a more complex product to someone who doesn't know what problems they are trying to solve is probably not ideal.
From Photon Bolt's description:
Bolt is the perfect product for professional developers and experienced teams. It provides all these teams need to build the next PUBG or Fortnite.
Bolt is rather not suited for beginners. Developing a multiplayer game requires profound coding knowledge especially in case of an authoritative game server architecture.
IIRC Photon Quantum is gated from the public partially for similar reasons, as there are even more things going on and it's expected that you work with ExitGames to some extent.
Users looking into Photon Bolt should probably look into Photon Fusion too btw.
is there a good way to set up a chat system using mlapi
When i use photon pun my active ragdolls break like this anyone know why?
update the ragdolls parts aren't synced
its a bit weird
anyone know why this is happening with photon?
are you using photon transform view?
on the parent gameobject or every part of the body?
every part
I tried only the parent as well and its still broken
should I use photon transform view?
or photon transform view classic ?
both works the same way ig
It doesn't work tho
could anyone help me with an issue i've been having? when another player connects to the game, player 1 controls player 2's character and vice versa. i'm using photon
Hey, I am making a game with photon pun and the player is able to join rooms and while waiting in the room before a game starts, the player gets to an other scene. But if the player leaves the room and joins a new room, I need a function that will be called because the Start function is only run at the first scene start. How can I do this?
I've started my FPS project a while ago and it's pretty developed at this point but the problem is I was using PUN whole this time. Now that I've realised bolt is a thing, do you think switching PUN to bolt will be hard?
To sync an active ragdoll, I think I would come up with a replacement of the PhotonTransformView. Or at least I would suggest to write one component which aggregates the complete ragdoll into one update / byte[] and then send it along with the rest of the values (via OnPhotonSerializeView). The benefit would be that you have one component which produces a fixed result. A snapshot, which is what you want to sync.
Also, you have to disable the active ragdoll system on the clients just showing the remote character. Otherwise the local machine will apply a ragdoll solution and it "fights" the incoming updates.
And this leads to the other solution: You could possibly skip syncing the ragdoll and just have every client calculate the movement, according to local and incoming movement.
Putting a PhotonView on each node is adding a lot of useless overhead and you only sync positions and nothing more. When you write your own component, you can send velocities and other useful data (as you see fit).
Your scripts need to check whether the character/unit is something you control locally or not. To decide if key/controller input must be applied or not...
The PUN Basics Tutorial covers this, by the way.
If you re-load the scene, Start will be called again. In doubt, you may want to load another scene in-between (something empty)?!
PUN is not syncing re-loading the same scene. That's a known limitation...
i have an (if view.IsMine) statement for the character's script, but that only stopped both players controlling both.
thank you for your help :)
I would recommend switching to Fusion, if you want to switch to a more capable solution. It's our upcoming package and aims to make things easier than Bolt and PUN do.
i love the hobbes profile picture btw
Hehe, thanks. I hope Bill Watterson does not sue me ๐
that only stopped both players controlling both.
That's odd.
You should test what happens if only one player joins the room. Does it control the instance you instantiated for this player?
if only one player joins the room, the player character works completely fine
as soon as another joins, when you try to look around/move, your character doesn't but you can see from the other screen that those inputs are being applied to the other player's character
if that makes sense
well, i get that something is odd but .. it does not make sense ๐
it's not just that you forgot to click the window to make it the one to get input from the machine? (sorry, stupid question...)
yeah it's really weird - and, no, i'm certain it's not because i forgot to click! but it would have been funny if that was the issue haha
i think i'll start a new project and chalk that first one down to experience. if it doesn't work on the next project, i'll come back and see if anyone has any ideas
Do both players use PhotonNetwork.Instantiate() to get an instance of a prefab?
I am very confused
I dunno how to rly do that
Read about manual synchronisation via IPunOvservable interface
In PUN2 I have two cubes stacked. When I have one cube on top owned by one person, and the bottom one owned by another person. The cube on top begins slightly moving on its own even though the bottom object isn't moving. This doesn't happen when both objects are owned by the same person. Anyone have a solution? I've been on this for 5 hours trying all sorts of things.
Any help would be extremely appreciated
Hey, I am using Photon Pun to make a fast paced pvp 2D platformer.
I was wondering what approach to the networking do you recommend when syncing movement.
For assigning the controls, check if the photon view is theirs by using photonView.IsMine
You're probably just getting a photo view in general, not their photon view specifically
Hello, im using Photon 2 (PUN) to make a multiplayer game. Im trying to get all the rooms in a lobby then put them in a grid. I got it working, but i want it to refresh when you open the main menu scene. So I want to call the "OnRoomListUpdate" using the "PhotonNetwork.GetCustomRoomList" function, but i dont know what to put in the "sqlLobbyFilter" parameter. I just want to display ALL the rooms in the current lobby, what should i put in the "sqlLobbyFilter" parameter?
tbh for refreshing the list, I just have it call PhotonNetwork.LeaveLobby() and then immediately call PhotonNetwork.JoinLobby() but I'm sure there is a better way to do it lol
also you probably wouldn't need to put anything important in the lobby filter
Just calling GetCustomRoomList will call the onroomlistupdate
so as long as all your room listings are handled in OnRoomListUpdate, I believe it'll just automatically refresh all the rooms like it does the first time
otherwise the leavelobby and join lobby is always an option I've never had trouble with'
Well I guess the lobby thing wouldn't be the best if you're having players in specific lobbies for specific reasons
in my case I just have a main area where I list the servers and you don't invite people to your lobby etc
ah, i see. The GetCustomRoomList needs this parameter or else it givs me an error. Ima try the leave and join lobby thing. 1 sec
but I guess the lobby really is just a place beforehand so you can always have them be in a room together etc
@cunning sluice Thanks a ton! I just moved the join lobby function from my loading scene to my main menu scene. Now the rooms refreshes when i load in. Thanks for the help!
Hi, does anyone have any experience with matchmaking and MLAPI, im trying to use the MLAPI Relay but after building and running and setting the network manager to use the relay, im not sure where to go from here. The details on the wiki are sparce, so any pointers would be grealy appreciated ๐
Only info I can give you is that Dapper Dino has a video on it. Search Dapper Dino Unity Multiplayer 2021 (he has an older series on Mirror)
Mirror is similar to MLAPI, right?
I'm getting this error, which is weird because it doesn't show anywhere how my scripts caused that error.
it only takes me to photon's script
my scripts are nowhere to be seen here
let's see if rebuilding the solution helps
or whatever this button does
Are you changing ownership in script?
Does this happen when masterclient changes or something?
Oh it doesn't happen anymore?
I don't know yet
I'm making a new build
just to be sure
but it was occuring when I was automatically joining an existing lobby
or room
ah....
still the same
It started happening when I changed my joining script
let me make a ss
What was the change?
Hmm, maybe there is a timing bug there. Are you on the latest version of PUN?
How are you spawning objects? Do you have scene objects with photonviews?
How are you joining that room?
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.
Issue with loading/syncing the scene perhaps, which could cause missing photonviews?
Does it error before OnClick_StartGame()?
yes
and the error shows for the person that is trying to join
and before startgame() no scenes are switched
I would probably look into what viewids are being processed in that photon code
Would also start the process of eliminating everything that isn't necessary to see where the issue might be
You might get better troubleshooting steps in the Photon discord
I tried finding one, but those are usually small
Yes, but full of Photon employees ๐
I couldn't find the official one
You are in it
Yea mention it in the post
well.. it's my time to sleep anyways
will see if I can fix it tommorow
thank you for your help
the staff is AFK love it xD
It's not always about quantity and speed, but quality ๐
uhhhhh
Do you have a link? Im just a bit confused lol
IIRC they actually don't have a code example in the doc. Odds are it's clearer to just open the transform sync component to see how it's done
In PUN2 I have two cubes stacked. When I have one cube on top owned by one person, and the bottom one owned by another person. The cube on top begins slightly moving on its own even though the bottom object isn't moving. This doesn't happen when both objects are owned by the same person. Anyone have a solution? I've been on this for 5 hours trying all sorts of things.
Any help would be extremely appreciated
I'm using SceneManager.LoadScene(0) to reload my scene, but just before doing that, I first close my TcpClient connection using .Close(), however, after the scene reloads, if I create a new TcpClient it works fine but a NetworkStream does not work, it doesn't give me any errors but it also doesn't send or receive any data for some reason. Does anyone know how to fix this issue, or reload a scene in a way which completely resets any socket state? (The socket is closed before reloading and a new one is made later so there should be no problem)
I'm also 100% sure it isn't a problem with the server.
Worth noting that the only things Unity can affect are its engine objects. Any C# change is merely a side effect of it through garbage collector. If you are holding references to stuff somewhere, you might not be fully releasing stuff
Hmm I see, thanks
I'll test some things out in the morning and make sure the socket connection is actually being terminated properly
Wait my probelm s cause my rigidbodys aren't being synced right?
I think so
I already have an (if view.IsMine) statement at the beginning of my player script. unfortunately, all that did is stop one player from controlling both characters
hey what if i use only hubs on layer 2 what will happens on my network
This is likely the physics engine and the network updates getting in a fight over where things should be precisely.
It's enough if the network updates of a remote-owned cube put it minimally into the local cube to freak out the physics. Stacking is problematic in networked physics.
It may be enough to turn on isKinematic on the remote cubes but it might be better to have both cubes controlled by one player (and one physics engine).
Hello, i have a very very strange problem. I upgraded my mirror project from 2019.3 to 2020.3.4 and there is one very very strange issue.
When i click "host & client" in the mirror default HUD, my game scene is launched and my player is supposed to spawn in my spawnpoint , this is the case BUT he is strangely bounced forward, exactly as if another player was at the exact same position so the new player is bounced forward to avoid them to intersect. But the problem is that there isn't another player ! When i try to go back on the spawnpoint by moving my player, there is exactly an "invisible" collider (same size as my player collider) which avoid my player to go on this position. But once again, there isn't any other player.
Thats realy strange, since the only cause is that I've upgraded to 2020.3
In the hierarchy there isn't ANY object here, nor in the wireframe scene view. It's totaly wtf. Even if i unactive all the object except my player i can't go in this position...
Anybody have an idea for this very strange problem ?
So if I for example wanted to use the host as the go-to for the physics simulation, how would I prevent the other clients from creating their own physics on the object? When another client moves the cube, do I send that information to the host and then back to my client?
Would it be best to get an authoritative server?
Hi, im new to networking, and i wanna make a game like Operation Tango. Does anyone know how to make the two player only lobby with password kinda system? Or can recommend a good Tutorial? I looked into it and it confuses me what to use (MLAPI, Photon, Mirror, etc)
Hey! I just started making games as well. I am making a multiplayer 3D puzzle game and i have been using Photon. Itโs pretty easy to use and there are a lot of tutorials. Iโd recommend looking up โunity photonโ on YouTube and just kinda looking around. Depending on what game you make can vary the tutorial. Hope this helps lmk if you need any more ideas or have questions
Yes, you'd essentially have to send all actions / input to a server, then get updates. Admittedly, PUN 2 is not well suited to achieve that. Our upcoming network solution is better at that and for a commercial product, I would recommend Photon Quantum...
Thanks!#
Alright thanks!
Hi
Could anyone please help me with UDP connection?
I am trying to create a remote for my standalone application. Created a UDP client to send values, it works fine on editor but not working on build.
logcat shows no error. But I am not receiving any data send by the sender (mobile application)
Thanks in advance,
is it a reasonable task to Play two instances of the game while still in the Editor, for the sake of multiplayer testing?
It's not possible, if that's what you're asking.
You need to build it and run the build and editor together.
It is possible, just depends on the sdk you use
Photon quantum and photon fusion both have this as a built in option
thank ya,' that's good of a solution for me
I definitely plan on looking into Photon soon, but at the moment I'm just tinkering with someone who's curious about linking in a simple API with .NET
You can also checkout ParrelSync which allows you to run two editors of the same project at the same time.
oh wow, this looks useful! thank you
Is there a callback function when the user connects and disconnects from the internet? At the moment I'm using an update loop to check if the user is able to reach the internet and if so it does some code.
I have a error that says
InvalidCastException: Specified cast is not valid. PUN2_RigidbodySync.OnPhotonSerializeView (Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/PUN2_RigidbodySync.cs:37) Photon.Pun.PhotonView.DeserializeComponent (UnityEngine.Component component, Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:544) Photon.Pun.PhotonView.DeserializeView (Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:534) Photon.Pun.PhotonNetwork.OnSerializeRead (System.Object[] data, Photon.Realtime.Player sender, System.Int32 networkTime, System.Int16 correctPrefix) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1860) Photon.Pun.PhotonNetwork.OnEvent (ExitGames.Client.Photon.EventData photonEvent) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:2231) Photon.Realtime.LoadBalancingClient.OnEvent (ExitGames.Client.Photon.EventData photonEvent) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3356) ExitGames.Client.Photon.PeerBase.DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer stream) (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PeerBase.cs:898) ExitGames.Client.Photon.EnetPeer.DispatchIncomingCommands () (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/EnetPeer.cs:565) ExitGames.Client.Photon.PhotonPeer.DispatchIncomingCommands () (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PhotonPeer.cs:1863) Photon.Pun.PhotonHandler.Dispatch () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:221) Photon.Pun.PhotonHandler.FixedUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:147)
public class PUN2_RigidbodySync : MonoBehaviourPun, IPunObservable
{
Rigidbody2D r;
Vector3 latestPos;
Quaternion latestRot;
Vector3 velocity;
Vector3 angularVelocity;
bool valuesReceived = false;
// Start is called before the first frame update
void Start()
{
r = GetComponent<Rigidbody2D>();
}
public 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);
stream.SendNext(r.velocity);
stream.SendNext(r.angularVelocity);
}
else
{
//Network player, receive data
latestPos = (Vector3)stream.ReceiveNext();
latestRot = (Quaternion)stream.ReceiveNext();
velocity = (Vector3)stream.ReceiveNext();
angularVelocity = (Vector3)stream.ReceiveNext();
valuesReceived = true;
}
}
// Update is called once per frame
void Update()
{
if (!photonView.IsMine && valuesReceived)
{
//Update Object position and Rigidbody parameters
transform.position = Vector3.Lerp(transform.position, latestPos, Time.deltaTime * 5);
transform.rotation = Quaternion.Lerp(transform.rotation, latestRot, Time.deltaTime * 5);
r.velocity = velocity;
r.angularVelocity = angularVelocity.magnitude;
}
}
void OnCollisionEnter(Collision contact)
{
if (!photonView.IsMine)
{
Transform collisionObjectRoot = contact.transform.root;
if (collisionObjectRoot.CompareTag("Player"))
{
//Transfer PhotonView of Rigidbody to our local player
photonView.TransferOwnership(PhotonNetwork.LocalPlayer);
}
}
}
}```
This is my code for syncing rigidbodys ^^
Anyone know whats wrong
hello, Im working on my enemy detection, I wonder in a light 2D mmorpg what's the best way ?in my current system, I have a player list in the scene and my enemies have DetectPlayer fonction. But it means all enemies checking a list of Playerscript every second. Is it a good way or is it too heavy ? thanks
@echo garnet
May I asked why View ownership is transferred on collison?
Also make sure to ping me because I have this server muted
i am using mirror for my multiplayer and for some reason I can't connect to my friend (not on lan) with his ip address, is there a way I could connect with him and play?
does anybody know how to make a kill counter using photon? i use raycasts to take damage to others btw. the raycast instantiate a bullet image that becomes a child of an object.
trying to make a pause menu in unity using photon, but whenever i press the menu button to go back it i get these errors and the menu stays on the loading screen:
and when i double click on it, it takes me to this code:
i dont see where the menu is being destroyed, can anyone help me?
lol i think i have followed the same tutorials as you have
I'm working on a mobile game, right now focused on Android and i have the basics of a level creator, every level is encoded as a base64 string, up to 80 characters long, and i want a way to let people share their levels with others, i only need to store that single string, and possibly some metadata about likes and dislikes of the level, which can just be 2 integers stored alongside it, im looking for a service that would let me store this data in a central repository to easily and quickly grab from, if possible for free, or atleast for very cheap
any recommendations/resources?
no idea
i rly dunno lmao Im tryna to sync rigidbodys so I copied a script I found
where does it say?
actually I just removed that u can just ignore that
I still dunno what this means tho InvalidCastException: Specified cast is not valid. PUN2_RigidbodySync.OnPhotonSerializeView (Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/PUN2_RigidbodySync.cs:37) Photon.Pun.PhotonView.DeserializeComponent (UnityEngine.Component component, Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:544) Photon.Pun.PhotonView.DeserializeView (Photon.Pun.PhotonStream stream, Photon.Pun.PhotonMessageInfo info) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonView.cs:534) Photon.Pun.PhotonNetwork.OnSerializeRead (System.Object[] data, Photon.Realtime.Player sender, System.Int32 networkTime, System.Int16 correctPrefix) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1860) Photon.Pun.PhotonNetwork.OnEvent (ExitGames.Client.Photon.EventData photonEvent) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:2231) Photon.Realtime.LoadBalancingClient.OnEvent (ExitGames.Client.Photon.EventData photonEvent) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3356) ExitGames.Client.Photon.PeerBase.DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer stream) (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PeerBase.cs:898) ExitGames.Client.Photon.EnetPeer.DispatchIncomingCommands () (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/EnetPeer.cs:565) ExitGames.Client.Photon.PhotonPeer.DispatchIncomingCommands () (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PhotonPeer.cs:1863) Photon.Pun.PhotonHandler.Dispatch () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:221) Photon.Pun.PhotonHandler.FixedUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:147)
Guys how come yesterday i used networkBehaviour and it said it was obsolete but still ran fine but now today i keep the same stuff and it isnt running at all?
Are you using UNET?
idk how to use other things and no one really answers my questions they just say look at the api
There are tonnes of tutorials for Mirror and Photon
Few good ones for Unity's new solution. MLAPI
using UnityEngine;
using UnityEngine.Networking;
public class PlayerSetup : NetworkBehaviour {
[SerializeField]
Behaviour[] componentsToDisable;
Camera sceneCamera;
void Start()
{
if (!isLocalPlayer)
{
for (int i = 0; i < componentsToDisable.Length; i++)
{
componentsToDisable[i].enabled = false;
}
}
else
{
sceneCamera = Camera.main;
if (sceneCamera != null)
{
sceneCamera.gameObject.SetActive(false);
}
}
}
void OnDisable()
{
if (sceneCamera != null)
{
sceneCamera.gameObject.SetActive(true);
}
}
}
like for example how would i make that now days?
Firstly, get a new solution
ill use mlapi
Ok, it's pretty new but I liked it when I tried it
There's a couple of good tutorials for it too
ok thankyou ill look at it it wouldnt be hard to re do that script in mlapi right?
You need a different using directive, and I think in MLAPI IsLocalPlayer is capitalised
Aside from that, that script should work
MLAPI
networkBehaviour?
so i change networkBehaviour to mlapi
No
It's NetworkBehaviour, but yes
ok do you know what the tag is?
?
using unity.MLAPI?
You do need to install it though, it's not built in
Learn how to install the MLAPI package on Unity, including instructions for 2019.4+, 2020.x, and 2021.x. The package installs as MLAPI Networking Library.
oh ok thankyou!
@echo garnet it says that there is an invalid cast on line 37 of that script.
Could you send the script again by any chance and outline what is line 37?
velocity = (Vector3)stream.ReceiveNext();
this is line 37
this is the script
Should it be a vector2?
@echo garnet if it's a Rigidbody2D then yes, that's probably the issue :)
alrighty ill switch to vector2
{
Rigidbody2D r;
Vector2 latestPos;
Quaternion latestRot;
Vector2 velocity;
Vector2 angularVelocity;
bool valuesReceived = false;
// Start is called before the first frame update
void Start()
{
r = GetComponent<Rigidbody2D>();
}
public 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);
stream.SendNext(r.velocity);
stream.SendNext(r.angularVelocity);
}
else
{
//Network player, receive data
latestPos = (Vector2)stream.ReceiveNext();
latestRot = (Quaternion)stream.ReceiveNext();
velocity = (Vector2)stream.ReceiveNext();
angularVelocity = (Vector2)stream.ReceiveNext();
valuesReceived = true;
}
}
// Update is called once per frame
void Update()
{
if (!photonView.IsMine && valuesReceived)
{
//Update Object position and Rigidbody parameters
transform.position = Vector2.Lerp(transform.position, latestPos, Time.deltaTime * 5);
transform.rotation = Quaternion.Lerp(transform.rotation, latestRot, Time.deltaTime * 5);
r.velocity = velocity;
r.angularVelocity = angularVelocity.magnitude;
}
}
}```
this is the code does it look good?
it looks good
but i got a question did this error show up for lines 38, 36 ?
I believe angular velocity for RigidBody2Ds is just a singular number, I'll open unity and check
Confirmed,
AngularVelocity for Rigidbody2Ds is a float
and rotation should also be a float
I dunno what u rly mean by that
But i assume that switcing to vector2 will work
@echo garnet
latestRot should be a float not a quaternion
also instead of sending transform.position and transform.rotation you should send r.position and r.rotation
Because transform.position is a vector3 not a vector2, and transform.rotation is a quaternion while r.angularVelocity is a float
Wait hold up I'll fix the script in Visual Studio for you
@echo garnet
using UnityEngine;
public class PUN2_RigidbodySync : MonoBehaviourPun, IPunObservable
{
Rigidbody2D r;
Vector2 latestPos;
float latestRot;
Vector2 velocity;
float angularVelocity;
bool valuesReceived = false;
// Start is called before the first frame update
void Start()
{
r = GetComponent<Rigidbody2D>();
}
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.IsWriting)
{
//We own this player: send the others our data
stream.SendNext(r.position);
stream.SendNext(r.rotation);
stream.SendNext(r.velocity);
stream.SendNext(r.angularVelocity);
}
else
{
//Network player, receive data
latestPos = (Vector2)stream.ReceiveNext();
latestRot = (float)stream.ReceiveNext();
velocity = (Vector2)stream.ReceiveNext();
angularVelocity = (float)stream.ReceiveNext();
valuesReceived = true;
}
}
// Update is called once per frame
void Update()
{
if (!photonView.IsMine && valuesReceived)
{
//Update Object position and Rigidbody parameters
transform.position = Vector2.Lerp(transform.position, latestPos, Time.deltaTime * 5);
transform.rotation = Quaternion.Lerp(transform.rotation, latestRot, Time.deltaTime * 5);
r.velocity = velocity;
r.angularVelocity = angularVelocity.magnitude;
}
}
}
This should be fine
I was wondering if UI (healthBar, minimap etc) is A GameObject I have to add to the game scene, or if I have to place it in the Player GO ?
Is it possible to schedule network requests on background threads rather than main thread? I'm currently using coroutines but am experience bursts of lag when many requests are being sent
I know Unity has a Job system to do true multithreading but I don't understand it enough yet to determine if it could be used for networking
Not really networking specific, but I would separate these sort of things into their own gameobjects. UI objects are not really part of the entity they represent.
@spring craneok then, I Instantiate this UI in the same Fonction of my player ?
Yea that is fine. I generally manage them separately
is making fast and reliable networking for a 2D pvp shooter game as an indie dev that impossible?
can anybody help me with why i cant leave a room in photon
this is my code:
//this VOID is called when the UI leave button is pressed btw
public void Leave()
{
PhotonNetwork.LeaveRoom();
Debug.Log("left room");
}
public override void OnLeftRoom()
{
PhotonNetwork.LoadLevel("mainMenu");
Debug.Log("switched scene");
base.OnLeftRoom();
}
it doesnt switch scene
the game just freezes
hey, I'm new to networking and I've been watching some mirror tutorials. But some things seem weird to me. I sort of understand how client sends messages to server and vice versa. But in all tutorials they seem to be going for a messy approach where the client and server code are on the same script. i understand this is because there can be a client and server together, but why can't this be split apart to different scripts? does anybody have a different way of doing this?
Client and server code are on the same script because both the client and server have their own instance of that GameObject, so if you'd like to think of it this way, the player is technically communicating with itself, but just on different instances of itself. So if I have movement code controlled by the client, you ask the server to move that same client, but instead it's the server's instance. You could create a GameManager script that has a singleton that allows your client to pass in your current client's id, then the GameManager does the server request. But just make sure that the client code is always on the client itself, and ANY networking code is on a NetworkBehaviour object
Hey does anyone know off the bat how I should go about making it so that in my multiplayer game that everyone downloads an asset bundle? like for custom player clothing and whatnot
I'm using socketweaver for the actual multiplayer
doesn't work
it gives me errors
saying it can't convert float to quaertion
on this one transform.rotation = Quaternion.Lerp(transform.rotation, latestRot, Time.deltaTime * 5);
and how float doesn't cotain a defintion for magitude on this line r.angularVelocity = angularVelocity.magnitude;
A float does not have a magnitude, nor can a singular float on it's own be a Quaternion
this is my script for syncing rigidbodys but it still just doesn't work ```public class PUN2_RigidbodySync : MonoBehaviourPun, IPunObservable
{
Rigidbody2D r;
Vector2 latestPos;
Quaternion latestRot;
Vector2 velocity;
Vector2 angularVelocity;
bool valuesReceived = false;
// Start is called before the first frame update
void Start()
{
r = GetComponent<Rigidbody2D>();
}
public 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);
stream.SendNext(r.velocity);
stream.SendNext(r.angularVelocity);
}
else
{
//Network player, receive data
latestPos = (Vector2)stream.ReceiveNext();
latestRot = (Quaternion)stream.ReceiveNext();
velocity = (Vector2)stream.ReceiveNext();
angularVelocity = (Vector2)stream.ReceiveNext();
valuesReceived = true;
}
}
// Update is called once per frame
void Update()
{
if (!photonView.IsMine && valuesReceived)
{
//Update Object position and Rigidbody parameters
transform.position = Vector2.Lerp(transform.position, latestPos, Time.deltaTime * 5);
transform.rotation = Quaternion.Lerp(transform.rotation, latestRot, Time.deltaTime * 5);
r.velocity = velocity;
r.angularVelocity = angularVelocity.magnitude;
}
}
}```
my ragdoll still break to pieces
and i feel like giving up on the project i've been stuck for days
its stuck like this
just broken
I have a error that says InvalidCastException: Specified cast is not valid.
On this line velocity = (Vector2)stream.ReceiveNext();
try to receive it as Vector3 not Vector2
I don't know I had similar problem with this error when I dont even made a changes in serializing values and unity restart was the solution
Is it possible to schedule network requests on background threads rather than main thread? I'm currently using coroutines but am experience bursts of lag when many requests are being sent. I know Unity has a Job system to do true multithreading but I don't understand it enough yet to determine if it could be used for networking
Context: every one of my NPCs runs this code when it's their turn to talk in a conversation
void Update()
{
int index = -1;
if (conversation != null)
{
if (!conversation.processing)
{
if (conversation.currentSpeaker.Equals(this.id))
{
Debug.Log(this.id + " getting response");
conversation.processing = true;
StartCoroutine(getResponse(conversation));
}
}
}
else if (Datastore.Instance.id2conversation.TryGetValue(id, out index))
{
conversation = Datastore.Instance.conversations[index];
}
}```
IEnumerator getResponse(Conversation conversation)
{
WWWForm form = new WWWForm();
form.AddField("id", this.id);
var www = UnityWebRequest.Post("http://" + Datastore.Instance.host + ":3000/generate", form);
yield return www.SendWebRequest();
if (interrupted) yield break;
if (www.isNetworkError)
{
Debug.Log(www.error);
}
else
{
if (www.GetResponseHeaders().Count > 0)
{
var jsonData = JSON.Parse(www.downloadHandler.text);
string stringData = jsonData["audioContent"]["data"].ToString();
byte[] rawdata = AudioHelpers.ConvertToByteStream(stringData);
AudioClip clip = AudioHelpers.ConvertToAudioClip(rawdata);
this.audioSource.clip = clip;
this.audioSource.Play();
this.animator.SetBool(this.talkingBoolHash, true);
Debug.Log("Response Recieved");
yield return new WaitForSeconds(clip.length);
if (interrupted) yield break;
this.conversation.currentSpeaker = jsonData["nextSpeaker"].ToString().Replace("\"", "");
this.conversation.processing = false;
this.animator.SetBool(this.talkingBoolHash, false);
}
}
}```
Does Photon PUN automatically reassign the Master if the current one leaves?
Vector 3 didn't work before either
try to ask on PUN discord server
i recommend photon realtime
instead
once you get your head around that and write your own wrapper it is a lot better
i have used both
super friends party uses pun and it was a nightmare compared to realtime
hi gys how i can make gRPC Server incloud unity by ASP.netCore
Can u send a link?
Uhh me?
depends on your programming knowledge but with an intermediate skill set it is less annoying than PUN
sent DM
can someone who knows what they're doing with MLAPI and networking please vc with me cause i have a problem which is very strange and alot of people have tried helping with no success
hi, i am using photon 2 and whenever i want to do an action that affects all players i have to do it this way, do you know a shorter way? ```
//Activa y desactiva coche
public void SetActiveCoche(bool _active)
{
if (PhotonNetwork.IsConnectedAndReady)
{
photonView.RPC("SetActiveCocheRPC", RpcTarget.MasterClient, _active);
}
else
{
SetActiveCocheRPC(_active);
}
}
[PunRPC]
public void SetActiveCocheRPC(bool _active)
{
Debug.Log(_active + "coche");
}
//Activa y desactiva cube
public void SetActiveCube(bool _active)
{
if (PhotonNetwork.IsConnectedAndReady)
{
photonView.RPC("SetActiveCubeRPC", RpcTarget.MasterClient, _active);
}
else
{
SetActiveCubeRPC(_active);
}
}
[PunRPC]
public void SetActiveCubeRPC(bool _active)
{
Debug.Log(_active + "cube");
}```
Post an actual question, you will get a better response, nobody wants to ask you about your issue because that is committing before knowing.
Might I also point out, that you are not in the best place for help regarding MLAPI, they have a Discord server
so i'm using fizzysteamworks and mirror attempting to make multiplayer
i have made it so that i can make a host, and join the host through steam on another device
and i have a basic movement script that moves both player prefabs randomly around a cerrtain area
problem is that the players' transform is not synced between the host and client, even after adding a networktransform component to the player prefab
How would a non player object spawn a bullet?
Which networking solution?
Mirror
Ive already through that. So I need to spawn the bullet from a method from the network manager?
So the enemy then calls this method, in order to spawn a bullet?
You'd call a method to spawn the bullet on the server
And this method has to be in the NetworkManager script?
No, I think it just has to be a Command, sent from any script derived from NetworkBehaviour
I'm sure there are plenty of tutorials online for this though
Well there a plenty of tutorials for spawning objects from the player object, but now for spawning objects from non player objects
The problem is with authority. Non player objects cant for some reason spawn new objetcs
But commands can be set to ignore authority
Except for when u use ignore authority
Yes. Ive read some things about avoiding to use this
Hi there ! Is there anyone that knows UNet well ? I have a problem.
UNet is deprecated
You should really use a different solution, like Mirror, MLAPI or Photon PUN
I know that. Its a simple project that I want to learn something new.
Don't learn UNet, it is deprecated
What's the point of learning something, that is no longer supported or used?
You right. But it's a project that is about to finish. And i faced with a problem.
Thanks for answering and help here. I tried a few communities but no one answered.
Let me show the code.
The problem is this. I copied that :
How can i implement my item customization for a LAN game.
I made a local one that player can choose some items like weapons in main menu and when enters to local scene, my warrior reads item index from PlayerPrefs class and Instantiates it and sets parent. For example sets sword for a hand. It works right in local scenes but in UNet story is different.
You know getting item index is something that should execute in client. Client should tell the server hey it's index of my item and server lnstantiate and assign that in all other clients.
How can i implement these process ? I used Command and ClientRpc but didn't work.
{{ description }}
{{ description }}
{{ description }}
You've not even started adding in multiplayer functionality to those classes?
These are what I did for local one and It's work well. But in UNet story is complex
Let me show UNetItemAssign class.
Honestly, I am gonna give you one piece of advice, stop using UNet immediately and switch to a newer networking solution, you don't look that far into this certainly not to the point where it's painful to switch
You are shooting yourself in both feet, by using old deprecated systems, that nobody wants to support
Mirror, MLAPI and Photon PUN are all great systems, with great communities of people willing to help
You right. But its just a university project and I should submit it in a few days. That's my fault that I choose a deprecated system. But anyway I have to finish that.
{{ description }}
{{ description }}
Every time a player joins to server it should tell index of items and other players send him their itmeIndexes.
Hi
So, I'm using MLAPI now cuz UNet has been deprecated...
Everything is fine except that there is no NetworkDiscovery component for mlapi, and according to the docs: "MLAPI does not provide Network Discovery. The UNet Network Discovery is a standalone component that can be used with any networking solution. You can use the UNet Network Discovery to discover a broadcasting MLAPI host and then connect to it with MLAPI."
But so ye I'm confused now how will I use UNet's NetworkDiscovery with mlapi if UNet is deprecated?
Ping me when you answer ^
I wish there was a MLAPI playfab party transport protocol in here: https://github.com/Unity-Technologies/mlapi-community-contributions
Someone should totally make it ๐ would totally love that person. (i'm not good enough)
https://mirror-networking.gitbook.io/docs/guides/server-hosting/aws so i followed this tutorial but i dont think my ports on the aws server are actually open any ideas?
only difference is im using telepathy atm, but neither that nor KCP have been working
re
how can i make a player counter using photon?
Like : 2/8 players in game
question with pun RPCs serious issue... I have buffered RPCs they work on any player if they leave room then rejoin... but if the master client leaves then joins again they don't work... anyone who faced such a problem ?
I believe that's how mirror and MLAPI work. If the host is no longer hosting your RPC's are gonna have a bad time
You'd have to renegotiate who is the "server" and who are the clients...which sounds tricky to do at runtime
how would i check the ping of a player? ( using mirror )
There's NetworkTime.rtt which is the round trip time
I'll look into it, thank you
what should l change or add in this script so all client see when a player shoot a bullet photon pun
l will try it
lol
can anybody please help me i have an object im setting a inactive and it is working on one screen but not the other
using photon pun2
I would avoid rely on the buffer and just send the current state to players when they join
Unless you have some specific use case, it seems like a hack to replay bunch of stuff just to replicate dumb state
I believe there are conditions in which some buffered RPCs are cleared, so I would look into that. Documentation likely has something about this.
Which based on your issue, likely are related to the owner or target of the RPC not being around anymore
Are you syncing that state?
I don't think PUN tracks active state by default
Sorry I fell asleep... But I managed to solve the problem using an event
pun or realtime @frozen hull
anyone notice the unity web requests are kind of slow
my azure api is a bit slow from unity
:/
if you want to know how many players there are in a session that is builtin to photon
Yep
PhotonNetwork.CurrentRoom.Players
more specifically PhotonNetwork.CurrentRoom.Players.Count
for the player count
So i can use something like countValue.text = PhotonNetwork.CurrentRoom.Players.Count
;
Thx
im using mirror and for some reason when i try getting a script on the player prefab it says its null(when it is there). could it be that i ask it too early? or any other reason?
Doesn't appear to be a networking question, but that should do it, unless the Destroy needs to go after the SetActive
put the panel.SetActive(true); before Destroy(gameobject)
when u destroy the gameobject u also destroy the script that is on it
so the next line doesnt go off
does anyone know what Can not Instantiate before the client joined/created a room. State: PeerCreated means?
and for some reason when i start the game, my player doesnt spawn
not sure if ^ is the reason for that or not.
how get l change this scrip so the deathpanel show before my player with the script on this destroy it
oh.. Unity is renaming mlapi now to netcode for gameobjects https://github.com/Unity-Technologies/com.unity.netcode.gameobjects
Can't create network objects before you have joined or created a room.
I guess that clarifies the situation in the long run
Yes, see this for the announcement with more information: https://forum.unity.com/threads/announcements-mlapi-becomes-netcode-for-gameobjects.1147601/
How exactly do I fix that, cause I'm still not sure what that means tbh
The client has several states. You can't create networked objects in certain states. To fix it, you just don't spawn objects until the state is a valid one
PUN provides several callbacks you can listen to for state changes and there are properties you can check to make sure you don't spawn objects in a bad state
where can i check the states?
@weak plinth Just spend some time exploring the API https://doc-api.photonengine.com/en/pun/v2/class_photon_1_1_pun_1_1_photon_network.html
There are properties like InRoom and NetworkClientState
guys, can someone tell me, why it might not work? Or i do something wrong?
{
// string sty = SceneManager.GetActiveScene().name;
string try2 = Application.dataPath + "/Records/" + "Dungeon2" + ".txt";
using (var uwr = new UnityWebRequest("link", UnityWebRequest.kHttpVerbPUT))
{
uwr.uploadHandler = new UploadHandlerFile(try2);
yield return uwr.SendWebRequest();
if (uwr.result != UnityWebRequest.Result.Success)
Debug.LogError(uwr.error);
else
{
Debug.Log("upload");
}
}
} ```
i have no errors, but no result and it works good
``` public IEnumerator DL()
{
//Download
string sty = SceneManager.GetActiveScene().name;
string try2 = sty.ToLower();
UnityWebRequest dlreq = new UnityWebRequest("link" + try2 + ".txt");
dlreq.downloadHandler = new DownloadHandlerFile(Application.dataPath + "\\Records\\" + sty + ".txt");
UnityWebRequestAsyncOperation op = dlreq.SendWebRequest();
while (!op.isDone)
{
//here you can see download progress
Debug.Log(dlreq.downloadedBytes / 1000 + "KB");
yield return null;
}
if (dlreq.isNetworkError || dlreq.isHttpError)
{
Debug.Log(dlreq.error);
}
else
{
Debug.Log("download success");
}
dlreq.Dispose();
yield return null;
}```
What is not working, do you get any debug.log? Give us some information "might not work" is not the best thing to go from
I'm stupid, sorry ๐ i had Debug.LogError(uwr.error), but i thought that i have Debug.Log(uwr.error), so error "HTTP/1.1 403 Forbidden" maybe problems with permissions, right?
yep, its access permission error
i still dont see the errors?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
namespace Com.LuxStudios.FieldsOfBlood
{
public class Manager : MonoBehaviour
{
public string player_prefab;
public Transform spawn_point;
private void Start()
{
Spawn();
}
public void Spawn ()
{
PhotonNetwork.Instantiate(player_prefab, spawn_point.position, spawn_point.rotation);
}
}
}```
Well it looks like you are spawning without any regard to the network state, so if that script is present in a scene where the network state can be offline, you would get that error
Or not in a room. PUN will tell you, as you have discovered ๐
Again, use the properties and callbacks to explicitly wait for the state to become valid
wdym "not in a room"
In a PUN room
Can not Instantiate before the client joined/created a room.
hold on
it works now
and i dont think i did anything
but now i cant sprint, and move my camera up and down
hi guys! i am using photon. How can i make player rb to act more sharper for others? When players jumps and descends it slows down before reaching the ground. It looks too smooth. transform view is disabled.
how do you control the velocity/gravity of this player?
void Movement()
{
movementX = Input.GetAxis("Horizontal");
movementZ = Input.GetAxis("Vertical");
moveVec = Vector3.ClampMagnitude(orientation.right * movementX + orientation.forward * movementZ, 1.0f) * speed;
moveVec += Vector3.up * rb.velocity.y;
rb.velocity = moveVec;
}
void Jump()
{
if (inventoryMode)
return;
isOnGround = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);
if (isOnGround && velocity.y < 0)
{
velocity.y = -2f;
}
if (Input.GetKeyDown(KeyCode.Space) && isOnGround)
{
rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
isOnGround = false;
}
}
so you always set the movevector to be rb.velovity.y. Do you change it anywhere or is it just physics based?
just physics based!
And where do you set the movement for the network player? long time ago I was using photon, but what is actually handling the transform for others
there is photon view (main) component attached and also rigidbodysync script that was in tutorial
i changed now rigodbodysync script to default photon rigidbody view component and it looks better. Strange
i dont know the difference
Maybe its just some settings you can set there
yep, i guess i need to tweak this script if i want to use it
thanks
never looked into it, but yeah, maybe there is a smoothing included or something weird
So Iโm trying to make multiplayer right now using mirror and fizzysteamworks. Iโve successfully made a host button, and the ability to join from a separate pc and separate steam account, when I join it shows both players, but the movement is not transferring between client and host
Does the player prefab have a NetworkIdentity and NetworkTransform?
Hello, i am using mirror and i have a lobby/room system to allow my player to join a room and ready-up then the game launch, but i can't manage to allow player to join the game once it's "launched".
I try to see through the differents mirror scripts the differents method called when the player successfully join the room and when he can't join the game.
The main difference between both case is that OnServerConnect isn't called on player trying to join the game once it's launched (maybe this is the reason why they can't join the game), whereas OnClientConnect is successfuly called.
Can somebody help me ?
Anyway to make it into a single method without using mutliples RPCs? (pretty new to photon)
how can l change this script so it update when player leave game
inherit from MonoBehaviourPunCallbacks
then override the OnPlayerLeftRoom method
example:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using Photon.Realtime;
public class Name : MonoBehaviourPunCallbacks
{
// ...
public override void OnPlayerLeftRoom(Player player)
{
// put code here
UpdatePlayersList();
}
// ...
}
wait what
l'm try to update text when player die
// put your code here and get rid of the line below
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using Photon.Pun;
[RequireComponent(typeof(TextMeshProUGUI))]
public class PlayersConnectedUI : MonoBehaviour
{
TextMeshProUGUI connectedText;
private void Start()
{
connectedText = GetComponent<TextMeshProUGUI>();
}
private void Update()
{
connectedText.text = $"{PhotonNetwork.CurrentRoom.PlayerCount}/{PhotonNetwork.CurrentRoom.MaxPlayers} Players Connected";
}
}
like this
i guess that can work (but youll be updating the text every update
)
here's a way but it only updates when a player joins or leaves
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using Photon.Pun;
using Photon.Realtime; // for 'Player'
// inherit from M-B-PunCallbacks
[RequireComponent(typeof(TextMeshProUGUI))]
public class PlayersConnectedUI : MonoBehaviourPunCallbacks
{
TextMeshProUGUI connectedText;
private void Start()
{
connectedText = GetComponent<TextMeshProUGUI>();
}
private void UpdateText()
{
connectedText.text = $"{PhotonNetwork.CurrentRoom.PlayerCount}/{PhotonNetwork.CurrentRoom.MaxPlayers} Players Connected";
}
// these are some callbacks that M-B-PunCallbacks give
// see docs on photon website
public override void OnPlayerLeftRoom(Player player)
{
UpdateText();
}
public override void OnPlayerEnteredRoom(Player player)
{
UpdateText();
}
public override void OnJoinedRoom()
{
// prob good idea to update when join room
UpdateText();
}
}
thank
one thing Player is not reference in my project
you need the
using Photon.Realtime;
on top
l have it on top and it say no suitable method found to override
instead of MonoBehavior in the class line after :, put MonoBehaviorPunCallbacks to inherit from it
look the Player player is not working and update text not working
l only want it to update text when player leave
rename the Update method to โUpdateTextโ
itโs errorinf because the method doesnโt exist
Update is a unity-reserved method (from M-B-) that is called every update frame so you shouldnโt really use itโฆ
like this โUpdateTextโ();
private void UpdateText()
{
// keep the code inside of it
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using Photon.Pun;
using Photon.Realtime;
public class PlayersConnectedUI : MonoBehaviourPunCallbacks
{
TextMeshProUGUI connectedText;
private void Start()
{
connectedText = GetComponent<TextMeshProUGUI>();
}
private void Update()
{
connectedText.text = $"{PhotonNetwork.CurrentRoom.PlayerCount}/{PhotonNetwork.CurrentRoom.MaxPlayers} Players Connected";
}
public override void OnPlayerLeftRoom(Player player)
{
โUpdateTextโ();
}
private void UpdateText()
{
// keep the code inside of it
}
}
i meant to change the name of the method
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using Photon.Pun;
using Photon.Realtime;
public class PlayersConnectedUI : MonoBehaviourPunCallbacks
{
TextMeshProUGUI connectedText;
private void Start()
{
connectedText = GetComponent<TextMeshProUGUI>();
}
// v here v 'Update' is a Unity-reserved method name
private void UpdateText()
{
connectedText.text = $"{PhotonNetwork.CurrentRoom.PlayerCount}/{PhotonNetwork.CurrentRoom.MaxPlayers} Players Connected";
}
public override void OnPlayerLeftRoom(Player player)
{
UpdateText();
}
}
stop change that emoji
what a script that l can add in my game which leave room and join the same/create a room
photon pun
Plenty of Photon PUN tutorials online, nobody will give you script
I was wondering how ready MLAPI (https://docs-multiplayer.unity3d.com/) is opposed to Mirror.
This site provides Unity Multiplayer documentation, references, and sample code tutorials.
Not for anything complicated, just a small game I want to make for my friends and myself.
anyone know why when i join a server with clients they just clip into the floor and bounce?
using UnityEngine;
using MLAPI;
public class PlayerMovement : NetworkBehaviour
{
public CharacterController ChrCtrl;
//Run lines every frame
void Update()
{
if(IsLocalPlayer)
{
MoveCharacter();
}
}
//Move the player
void MoveCharacter()
{
Vector3 move = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
move = Vector3.ClampMagnitude(move, 1f);
ChrCtrl.SimpleMove(move * 5f);
}
}```
heres the code im using
oh wait im dumb
just realized im clamping it at zero
wait a minute
its clamped to the correct positio
but on the server its still bouncing
on the client its just fine
now im really confused
nvm its working
I have a StateController that gets attached to each one of my NPC's that controls everything from moving to the actions they're taking.
There is no hot join.
Is there an easy way to convert that to be supported via Mirror? I was hoping I could just put a [Server] tag on the update where UpdateState gets called. But Im not really sure currently. Any help would be great.
this might be a pretty noobish question but ... im trying to build an authorian server by hand right now and i am struggeling. Should i build it timer based or tick based and how do i properly send the movement inputs of the clients towards the server when they are not running on the same tick speed?
or if anyone has a good tutorial on that topic i would love to read or watch it
@scenic fulcrum
State(t) + Inputs(t) -> State(t+1)
Tick based
Hmm, clients running different tickrates?
Hmm, that'd make the movement prediction weird no?
but how do i catch them? I mean, lets say my game runs at 120 fps, so 120 updates per second and my server has a tickrate of 10. I cant just snapshot my inputs 10 times a second and send them over and sending a list of all inputs and their length seems complicated and way to big for a package that gets send often
If you wanna do snapshot interpolation, client should constantly keep two ticks
last two
And interpolate
Client will be viewing the past though
can you explain this to me ?
you have a client time right?
and you have the tick times
you interpolate between last two ticks using client time as interval
on the client? yeah. I dont have them on the server as of now because it simply ticks 10 times a second without any timing stuff (as of now) im still new to network development
or something based on client time, if you client time is in the future
hrm im having a hard tme to understand what you mean, can you write me a simple theoretical example ? :/
also thanks for taking the time to help me!
you should have the server time as a float as serverTick * constantDeltaTime
oh yeah i have a constant TIME_PER_TICK
whic his currently 100ms
in a simple world, what if my client has pressed 50ms of "move right" and 50ms of no input ... how would i transfer it over to the server?
I am kinda busy now, we can voice chat later
sure, would love that!
Hi, I have a little problem. I'm using Playfab's leaderboard system to hold my data. When I load up the game and click on a button, it Debug.Logs all the scores in the console. The first time is fine, but when I select the button again, it Debug.Logs twice. And then a third time if I press the button again and so on. How can I make it so that it only Debug.Logs once? When I hit the button I run the Login function that let's me login into the sever then run GetLeaderBoard(); right afterwards. It gets the information just fine, but it duplicates it and I have no idea why
Photon Fusion question - for anyone who happens to know:
According to the docs:
Fusion automatically calls OnInput() on all SimulationBehaviours implementing the INetworkRunnerCallbacks interface and over which the client has Input Authority - hence the name.
And yet I have a script:cs public class PlayerMover : SimulationBehaviour, INetworkRunnerCallbacks
That has input authority. I know it does because this prints true in both Spawned() and in FixedUpdateNetwork():
print($"We have input authority? " + Object.HasInputAuthority);```
And yet OnInput is not running on the script.
What else should I be checking?
So maybe the docs are just a lie right now, but I got it working with:
if (Object.HasInputAuthority)
{
Runner.AddCallbacks(this);
}``` in `Spawned()`
should i use dots Unity for rts game online 2d guys ?
Hi, I have this issue with networking,
I run my game at Unity and at builded game, I have a ball and 2 players, the ball acts differently on the Unity(Host) and the builded game(Client), it doesn't act same. What can that be about? Network Transform or I dont really know help me ๐
Hey guys, I'm using a springjoint on my client to move my player. For an unknown reason, i'm only able to shoot a player attached 1 of 5 times. It feels like if the collision wasn't fixed at the same spot than my playermodel.
I'm using Mirror btw.
Any idea ?
Sounds like you're subscribing on an event each time you click the button.
Subscribing?
Aha, usually Added through .AddListener(Method) or += Method
Is this outdated for unity 2019.1.10f?
Which part do you mean is outdated?
Im asking if it works on unity 2019.1.10f. Sorry for the confusion
Which one? MLAPI? HLAPI?
Any of it
Im stepping into networking and I wanted to check which things I should read first
https://blog.unity.com/technology/choosing-the-right-netcode-for-your-game
This one is still mostly up to date. All of the listed solutions work for 2019.1 as far as I know. MLAPI got acquired by us and is currently an experimental package and is our in-house networking solution for GameObjects/MonoBehaviours.
I have to create a target window ( UI element with the target name + health ) for multiplayer rpg game. Someone can advise me a way to do this, because I stuck for this morning.
Anybody have experience with MLAPI and this NetworkRigidbody script? https://github.com/Unity-Technologies/mlapi-community-contributions/tree/main/com.mlapi.contrib.extensions/Runtime/NetworkRigidbody
Yes
I would think so. Thanks for the script Luke! ๐
I was having errors replicating a simple rigidbody player, but I solved it. Somehow I left the "Interpolation time" on the NetworkRigidbody at zero, which in turn caused it to not work properly at all.
Simple error, but hard to spot when I'm completely new to networking in games.
Just one of those times where asking for help cause you to find the error yourself
Oh I see, it's 0 by default if you add it to a GameObject right?
Yes!
Maybe there should be a tooltip or warning about a value of zero, but that may be just be me being a bit of a noob
Yeah and I think we can give that a better default value, I'll take a look tomorrow.
Thanks! Now that it's working I'm really impressed with how simple it is to set up ๐
Good work
i have a question about OnPlayerLeftRoom and OnPlayerEnteredRoom in Photon
this is my text for "OnPlayerEnteredRoom" :
public override void OnPlayerEnteredRoom(Player newPlayer)
{
base.OnPlayerEnteredRoom(newPlayer);
Instantiate(logText, logImage.transform);
logText.text = newPlayer.NickName + " has joined the room.";
logText.color = Color.green;
}
and this is the text for "OnPlayerLeftRoom" :
public override void OnPlayerLeftRoom(Player otherPlayer)
{
base.OnPlayerLeftRoom(otherPlayer);
Instantiate(logText, logImage.transform);
logText.text = otherPlayer.NickName + " has left the room.";
logText.color = Color.red;
}
but for some reason "LogText" .text = "Nickname has left the room" when the person joined and vice versa. idk why and if you do pls tell me! ๐
Hello. I use Mirror networking in my game. The game is first person, but I don't know what to do to hide the player model for the owner. If anyone knows the solution, please help. Regards.
Have a script, derived from NetworkBehaviour, that lets you check if this isLocalPlayer, if it is the local player, disable the mesh renderer
Thank you for your answer. I have small doubts whether it will work, because it seems to me that only the host mesh will be invisible not only to him, but also to the other players. Anyway, thank you for the answer.
With isLocalPlayer? The local bit gives it away
I will use this method. If it doesn't work, I'll keep looking for the answer.
Hey something out of topic but im just curious, can you see what functions the driver for your network card exports and use said functions from within a driver of yours?
I have a question my photon view transform doesnt work can someone send a working code
Does the script where its movin the chracter have to be in update to use the photon view
Which service would be better for backend? I have to have a simple google sign in and a leaderboard.. firebase or playfab?
I guess playfab will go a little further for you out of the box. I'd expect a little more setup and coding on the firebase side.
Hi all. what is the best way to make p2p game?
so player1 will create room(and host it on his device), others can see that room in lobby, and join him
thanks
Photon
And tutorial from blackthornprod
Pls help me
I cant make progress
Post problems and questions, nobody will give you code
Welsh cow are you part of unity team?
No
Ok
Cause why you so rude
Rudeness is in the eye of the beholder, Techy12 provided unhelpful details and asked for code, which is not how this Discord works
If they want help, they should provide errors and full scripts in paste sites so that people can assist them
i am not very good at it sorry
Report him
Feel free to report me, but the moderators would say the exact same things as me, you're now going wildly off topic
No report techy 12 I mean
pls stop the wels cow
There's no need to report him, Techy just needs to provide details about the problems they're having, that's all
do you have expierince with photon
can you help me
No I mean if he got a problem donโt have to blatantly take it out on him it is very disrespectful he has barely been in this chat
Just go, you're not helpful
And so arenโt you
I don't have experience with Photon, but if you provide details about the issues you're facing, others can help you faster
I donโt see you helping him
pls thanks for the tips that it doesnt work pls stop
ok
You say this when I point out that you are being rude
<@&502884371011731486> Can this Shadow guy be dealt with, just incoherent rambling at this point
All I said, was that to get help you must ask questions and provide details of the issue, that's all
Whatever a community moderator does I donโt care if you canโt help donโt talk,simple!
How can I help, when the guy literally said "help me" and gave no details of errors? You can't help someone with a problem that they haven't asked about.
he is helping me with providing the right way how this server works
Really? He said 4 fucking lines, not one single error was in those lines
Not one single line of code was provided
ok we get it now
He doesnโt need to provide codes for transform views
So maybe you both need to check #854851968446365696 to understand how to ask questions
What code is there to provide
God knows, but they could have said more than "it doesn't work help me"
Ok idc imma drop it
we get it i can give better information p[ls both of u stop
or go do it in a dm or something
i am going to try by giving better info
Asking for more details is the appropriate response. Bad questions don't need to be reported to anyone. Not engaging with bad questions at all seems worse to alternatives.
Yes
Where is all this aggression coming from? I'm just trying to tell you these things and leaving it at that.
ok so my photon view component isnt working i dont know what the problem is it isnt showing on another device if i move my character with photon view component on it its in a resources folder the prefab so that isnt the problem its also shows when join the player can you see but you cant see it moving.
this is my movement code:
@minor escarp Check #854851968446365696 for how to send long code snippets. Photon View component doesn't sync position in itself, other components like the transform view component do additional syncing.
Donโt use photon view for 2d games
I make your own script and use synchronisation states
You can check out photon documentations on that
yeah i forgot in my message transform
Hi, I'm using mirror with eos and I dunno why but when using online and offline scene slot, it spams null reference error how do I fix?
do you have more info
When using epic online service with unity and using mirror's example scene "tanks", on default settings it works fine but when I add offline scene to offline scene slot and game scene on online scene slot in network manager it spams me null reference error as soon as the game scene loads
And then my unity freezes
do you have any other errors
otherwise check if everything is fine with the component
so no blank spaces
i dont know much about mirror
photon how to make your own script and use synchronisation states
Perhaps you should watch a few youtube tutorials
Because nobody will answer questions that are as generic as these.
But in short, you can implement OnSerializeView (I believe this is the name of the callback) so you can either write (from the client that owns the object) or read data.
does anybody know how to sync text in photon unity across all players
i tried syncing it with photonMessageInfo and sync the names in the text but it didnt work(it didnt sync(It showed different names on different clients))
look into RPCs maybe?
Hey everyone, basically i can't figure out how interest groups work in photon and can't seem to make this work
The "OtherTeamLights" RPC is supposed to disable the lights of this player only on players that are part of the other interest group (ie on the other team)
hi , i need help with unity photon pun , its a bit of a special case so it will be easier if you can dm me, this problem is about having a UI showing a int into a text for each player but idk why only 1 player reiceive the data and the int so for him it show (1 / 5) for other it show (0 / 5) :/
has anyone used OVLcloud before for VPS?
What networking solution should i use if im looking to make a rouge like mmo type game (I need something thats well documented)
also does anyone know if unity's own multiplayer solution is ready to be used?
there are probably 3 main ones -
photon, mirror and the new MLAPI that is the official unity solution
it is still quite new(so not many tutorials/info yet)
any one of them would be fine for whatever you will need.
unitys solution is ok to be used i think but its not 100% ready and tested yet so you decide.
do you think unity's solution will be better for long term support?
yeah probably. if you are just starting out make a simple multiplayer game in it for now but don't go all in. if you are a beginner and not familiar with learning through documentation i might wait till theres more info out there so you wont get discouraged. multiplayer especially is hard. i started learning mirror 2 weeks ago and am having some trouble lol.
take what im saying with a grain of salt tho im not the most experienced
yeah i was kinda getting discouraged from mirrors api I've been using them for a couple weeks
unity has amazing api for scripting so far though so if its similar to that I think ill give it a try
I'll definitely make a new project to test it out though
gl
but yeah mirrors documentation is kinda meh sometimes like sometimes in the code summarys it says somehing else then what it says on the website lol
yup, same boat as you
im about 4 months on unity now
although only recently started putting every hour i have into it
cool cool
but i feel more confident the more i do things
yeah I'm definitely feeling that
rn trying to do architecture for card effects in a hearthstone clone im making in mirror and its not easy :D
oh cool, I've never played any card games
I'll look into it, thanks for the recommendation
np
