Unity 2D multiplayer server sync question
up vote
0
down vote
favorite
Hy, I have a pretty simple multiplayer 2D shooting game and I have a little problem. I am able to flip my character locally, but I don't know how to do it on all clients. Can you help me?
My functions look like this at the moment
public void OnChangeFlip(int FlipPoz)
{
transform.localScale = new Vector3(Mathf.Abs(transform.localScale.x) * FlipPoz, transform.localScale.y, transform.localScale.z);
}
public void Flip()
{
transform.localScale=new Vector3(transform.localScale.x*(-1),transform.localScale.y,transform.localScale.z);
}
unity3d multiplayer
add a comment |
up vote
0
down vote
favorite
Hy, I have a pretty simple multiplayer 2D shooting game and I have a little problem. I am able to flip my character locally, but I don't know how to do it on all clients. Can you help me?
My functions look like this at the moment
public void OnChangeFlip(int FlipPoz)
{
transform.localScale = new Vector3(Mathf.Abs(transform.localScale.x) * FlipPoz, transform.localScale.y, transform.localScale.z);
}
public void Flip()
{
transform.localScale=new Vector3(transform.localScale.x*(-1),transform.localScale.y,transform.localScale.z);
}
unity3d multiplayer
1
Are you using UNet, Photon or something else for your networking?
– Skdy
Nov 8 at 11:26
Generally everything related to multiplayer works the following way: client wants to flip, or shoot, or jump, etc. so client sends a request to the server, the server determines if that client is allowed to do the action and in case he can the server updates that client and sends the updated information to every client.
– Nika Kasradze
Nov 8 at 12:20
client: hey server, I want to flip; server: you want to flip? flips the client; server: hey all clients - this guy has flipped!
– Nika Kasradze
Nov 8 at 12:23
I know how it should work in theory.. but I don't know how to code it. It should be very easy to update the flip position to everyone, but I don't know how to do it. I think I am using UNet (for sure I am not using Photon, I tried it before) My code uses code lines for network like this: using UnityEngine.Networking; public class PlayerController : NetworkBehaviour Network.Destroy(GameObject.Find(name));
– Vlad6001
Nov 9 at 7:08
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Hy, I have a pretty simple multiplayer 2D shooting game and I have a little problem. I am able to flip my character locally, but I don't know how to do it on all clients. Can you help me?
My functions look like this at the moment
public void OnChangeFlip(int FlipPoz)
{
transform.localScale = new Vector3(Mathf.Abs(transform.localScale.x) * FlipPoz, transform.localScale.y, transform.localScale.z);
}
public void Flip()
{
transform.localScale=new Vector3(transform.localScale.x*(-1),transform.localScale.y,transform.localScale.z);
}
unity3d multiplayer
Hy, I have a pretty simple multiplayer 2D shooting game and I have a little problem. I am able to flip my character locally, but I don't know how to do it on all clients. Can you help me?
My functions look like this at the moment
public void OnChangeFlip(int FlipPoz)
{
transform.localScale = new Vector3(Mathf.Abs(transform.localScale.x) * FlipPoz, transform.localScale.y, transform.localScale.z);
}
public void Flip()
{
transform.localScale=new Vector3(transform.localScale.x*(-1),transform.localScale.y,transform.localScale.z);
}
unity3d multiplayer
unity3d multiplayer
asked Nov 8 at 10:05
Vlad6001
32
32
1
Are you using UNet, Photon or something else for your networking?
– Skdy
Nov 8 at 11:26
Generally everything related to multiplayer works the following way: client wants to flip, or shoot, or jump, etc. so client sends a request to the server, the server determines if that client is allowed to do the action and in case he can the server updates that client and sends the updated information to every client.
– Nika Kasradze
Nov 8 at 12:20
client: hey server, I want to flip; server: you want to flip? flips the client; server: hey all clients - this guy has flipped!
– Nika Kasradze
Nov 8 at 12:23
I know how it should work in theory.. but I don't know how to code it. It should be very easy to update the flip position to everyone, but I don't know how to do it. I think I am using UNet (for sure I am not using Photon, I tried it before) My code uses code lines for network like this: using UnityEngine.Networking; public class PlayerController : NetworkBehaviour Network.Destroy(GameObject.Find(name));
– Vlad6001
Nov 9 at 7:08
add a comment |
1
Are you using UNet, Photon or something else for your networking?
– Skdy
Nov 8 at 11:26
Generally everything related to multiplayer works the following way: client wants to flip, or shoot, or jump, etc. so client sends a request to the server, the server determines if that client is allowed to do the action and in case he can the server updates that client and sends the updated information to every client.
– Nika Kasradze
Nov 8 at 12:20
client: hey server, I want to flip; server: you want to flip? flips the client; server: hey all clients - this guy has flipped!
– Nika Kasradze
Nov 8 at 12:23
I know how it should work in theory.. but I don't know how to code it. It should be very easy to update the flip position to everyone, but I don't know how to do it. I think I am using UNet (for sure I am not using Photon, I tried it before) My code uses code lines for network like this: using UnityEngine.Networking; public class PlayerController : NetworkBehaviour Network.Destroy(GameObject.Find(name));
– Vlad6001
Nov 9 at 7:08
1
1
Are you using UNet, Photon or something else for your networking?
– Skdy
Nov 8 at 11:26
Are you using UNet, Photon or something else for your networking?
– Skdy
Nov 8 at 11:26
Generally everything related to multiplayer works the following way: client wants to flip, or shoot, or jump, etc. so client sends a request to the server, the server determines if that client is allowed to do the action and in case he can the server updates that client and sends the updated information to every client.
– Nika Kasradze
Nov 8 at 12:20
Generally everything related to multiplayer works the following way: client wants to flip, or shoot, or jump, etc. so client sends a request to the server, the server determines if that client is allowed to do the action and in case he can the server updates that client and sends the updated information to every client.
– Nika Kasradze
Nov 8 at 12:20
client: hey server, I want to flip; server: you want to flip? flips the client; server: hey all clients - this guy has flipped!
– Nika Kasradze
Nov 8 at 12:23
client: hey server, I want to flip; server: you want to flip? flips the client; server: hey all clients - this guy has flipped!
– Nika Kasradze
Nov 8 at 12:23
I know how it should work in theory.. but I don't know how to code it. It should be very easy to update the flip position to everyone, but I don't know how to do it. I think I am using UNet (for sure I am not using Photon, I tried it before) My code uses code lines for network like this: using UnityEngine.Networking; public class PlayerController : NetworkBehaviour Network.Destroy(GameObject.Find(name));
– Vlad6001
Nov 9 at 7:08
I know how it should work in theory.. but I don't know how to code it. It should be very easy to update the flip position to everyone, but I don't know how to do it. I think I am using UNet (for sure I am not using Photon, I tried it before) My code uses code lines for network like this: using UnityEngine.Networking; public class PlayerController : NetworkBehaviour Network.Destroy(GameObject.Find(name));
– Vlad6001
Nov 9 at 7:08
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53205441%2funity-2d-multiplayer-server-sync-question%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Are you using UNet, Photon or something else for your networking?
– Skdy
Nov 8 at 11:26
Generally everything related to multiplayer works the following way: client wants to flip, or shoot, or jump, etc. so client sends a request to the server, the server determines if that client is allowed to do the action and in case he can the server updates that client and sends the updated information to every client.
– Nika Kasradze
Nov 8 at 12:20
client: hey server, I want to flip; server: you want to flip? flips the client; server: hey all clients - this guy has flipped!
– Nika Kasradze
Nov 8 at 12:23
I know how it should work in theory.. but I don't know how to code it. It should be very easy to update the flip position to everyone, but I don't know how to do it. I think I am using UNet (for sure I am not using Photon, I tried it before) My code uses code lines for network like this: using UnityEngine.Networking; public class PlayerController : NetworkBehaviour Network.Destroy(GameObject.Find(name));
– Vlad6001
Nov 9 at 7:08