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);
}









share|improve this question


















  • 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

















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);
}









share|improve this question


















  • 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















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);
}









share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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
















  • 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



















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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





































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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




















































































Popular posts from this blog

Schultheiß

Verwaltungsgliederung Dänemarks

Liste der Kulturdenkmale in Wilsdruff