- Home /
How do I send a simple Vector3 over a network?
How do I send a simple piece of data such as a Vector3 over the network? I don't want to replicate an entire player or anything along those lines, but rather just get access to a single piece of data being updated continuously from another computer, and sent to my game manager class to handle that data as I see fit.
More info on what I am trying to do:
I don't want to set up a host/client relationship, this is not that kind of multiplayer game. One player should not be hosting the relationship between the two. Rather I just want two clients to know of each others player position for as long as they are connected, which may end at any time, and a new player may come along. The closest thing I can think of for this is the networking of Journey, if that helps.
My thoughts are that a master sever will need to be created separately from the clients, and it would handle the data transfers, but for the first implementation, a static connection between two IPs would be fine.
If you provide any code in your answer, C# would be preferred over js. I am using a trial version of pro, and the final product, if made, will be made in pro, if this matters.
I have looked through a variety of tutorials and questions, but haven't quite found what I am looking for. Although I could also simply be approaching this incorrectly...
Edit: I am making some progress with some RCA functions (I think), and creating a simple server (different from the clients).. I could still use some help on this though! :)
Note: This is my first time asking a question on this forum, but I have read many. If I am unclear in my request, let me know! :)
Answer by pakizip · Feb 06, 2013 at 09:30 PM
"Over a network", would you mean over WWW? If the answer is yes, well you can create a simple web server PHP or other language and write a simple script with GET and POST (is the easiest way).
You can find more informations here: http://answers.unity3d.com/questions/11021/how-can-i-send-and-receive-data-to-and-from-a-url.html
And for server side programming: http://davidwalsh.name/web-service-php-mysql-xml-json
Sorry for my english, have a nice day.
Pakizip.
I mean to another person playing the game in Unity on a different machine. This could be done with an external (not in Unity) server, which might end up being the solution, but what I really need is for one client to be able to communicate to another client directly in Unity, perhaps after being given an IP from the master server?