- Home /
Multiplayer - simple example with no collider
I am trying to get this simple multiplayer example working . Each player will see their own score in the top left and the opponents score in the top right. if they press '1' they will decrease the opponents score, if they press 2 they will increase their own score.
The two specific problems I have: 1. All the examples I have seen would have player 1 score on the left and player 2 score on the right. ie the server has a world view that all players see (I want player 2 to see their score on the left) 2. I cannot get the logic to get the other players score to decrease, as the only mechanism I understand to pass that information between the clients is for the client to detect a collision with an object (ie bullet) spawned by the other client.
I have looked through a number of good tutorials that show how to create a simple lobby, spawn players etc. All the easy to follow examples, however, have a physical representation of the player on the screen which produces a projectile, which causes damage to the other player when they detect a collision. The problem I have is that I have none of those things and I just can't figure out what to do!
Time to relearn unity
It just a matter of sending and receive package of data. One player send message to other player. They receive the message and do something. As a matter of code, you gotta learn
@NoDumbQuestion thanks for the comment and link. I have looked at that multiplayer example and it does not cover what I am looking for. The message passing between the two clients is through an intermediate object that can be detected as colliding by the client who is taking the damage. In my example client1 pressing a button does not spawn an object, and as far as I can see UNET does not have any way of directly passing messages between clients.
How about using for standard network solution like Photon PUN. It is peer-cloud-peer.
It have 2 feature:
Sync data: anytype of basic data like float, int , vector3
Event(RPC): you can just send event call other player to increase their score or yourown score.
Edit: Everything is controlled by client. Nothing is control by server so this might be the best solution for you.
Pretty much simple since there was only 2 main function of network.
@NoDumbQuestion Thanks once again. I haven't looked at Photon PUN yet, I have been just slogging through Unet hoping to get the result I want. What you describes sounds exactly like what I need, no server control to complicate things. I will start looking into it and report back here (in a few days) if I have success.
Your answer
Follow this Question
Related Questions
Remove players and close server in Unity Multiplayer Game 0 Answers
UNET Networking: Changing Players texture 0 Answers
PUN - Choose random Hero for player 0 Answers
How to display IPv4 Address in game 0 Answers