Hi, a year ago, working with the following multiplayer project using socketio and nodejs [https://github.com/AlexanderDykov/Unity-NodeJS-Game], everything worked perfectly. But now I find that the position between client-server-client does not work well.
The code is that:
Send position to the server when player is moving:
Recive position by Server and send to anothers gamers:
Problem:
(server)
(client)
I cant convert this to vector 3. (parsing x string to float get error). And thats positions are wrong ( real position is x: 1,57 and y:4,23).
SOcketIO is deprecated and now unity use another system for make multiplayers games¿?¿?¿?¿?
Please try the proyect that i link in the head of post for know about i´m talking. TY
hi, I took a look at your code and I think the best option is converting your data into a string then emit it to the server, I mean you can pass the data in string type instead of float because on the other hand when you are getting the data it is a string anyway
Same problem here. I don’t want to convert to string or multiply by 1000, this is no solution for me because i don’t want to change the JSON object on server side.
Hey, same or similar problem here. I also try it to multiply or divide it by 1000. During my debugging I have seen, that a big number will displayed as a exponential number and this can not be resolved by JsonUtility.FromJson(data) ? I enable Debugging for SocketIO:
[SocketIO] Raw message: 42[“userid”,{“name”:“”,“password”:“”,“user_id”:1,“email”:“”,“session_id”:“42fd7c09-adeb-948e-d267-f236de35b5d4”,“msgTime”:1579129255999}]
and after socketIOEvent.data.ToString(); i get:
NM: rec: userid: {“name”:“”,“password”:“”,“user_id”:1,“email”:“”,“session_id”:“42fd7c09-adeb-948e-d267-f236de35b5d4”,“msgTime”:1,579129E+12}
So data is transmitted in right way but loosing precision during internal execution in SocketIOComponent… On some other test floating point is ignored and just interpreted as integer like 1.00005 is after getting it in my class something like 100005