1
\$\begingroup\$

I have been working on Game that consists of 10 Game Objects that have to be sync by the server values. The server decides that which game object will win and then sends command to my side(Client side) but I am not able to match the server values to mine then what can I do to sort out this problem? The track is kind of horse racing track i.e. straight and then circular. Any help would be appreciated :) Thanks in advance

\$\endgroup\$
9
  • \$\begingroup\$ If server send you the values then why are you generating your own to compare? \$\endgroup\$ – Hamza Hasan Jan 19 '16 at 10:34
  • \$\begingroup\$ No I don't compare... I just have to take that speeds to randomize my game objects and nothing....But server sends the speed chunks that I assign to game objects and then the winners don't match from both the sides. :( \$\endgroup\$ – Shraddha Patel Jan 19 '16 at 10:46
  • \$\begingroup\$ Then show some relevant code if you can \$\endgroup\$ – Hamza Hasan Jan 19 '16 at 10:47
  • \$\begingroup\$ It can't be done there are more than 3 classes that m using :9 \$\endgroup\$ – Shraddha Patel Jan 19 '16 at 10:50
  • \$\begingroup\$ Send, receive and assigning code chunks \$\endgroup\$ – Hamza Hasan Jan 19 '16 at 10:52
1
\$\begingroup\$

I wonder how are you trying to sync it, the "best" way to do this is via socket connection.

Also, you have to identify the important info that you really need to sync, FE, im developing an MRTS, i have to sync the units but the client doesn´t care about movement speed, attack points, etc, so, in essence i only need send to the client which unit he has to draw, who owns this unit and where it has to be drawn, so, a huge object called "Archer" in my serverside application would be sent to the server as an Int8 array like [23,1,1851,2434] (Unit id, owner id, X, Y).

Then, your client only has to draw it.

If you use UDP sockets (fast as hell) and condensed bit data you will be able to do real time sync without any problem.

\$\endgroup\$
5
  • 2
    \$\begingroup\$ Not voting down your answer, but your answer is irrelevant. OP can't assign properly the value he/she fetch. Without code, it is difficult to point out \$\endgroup\$ – Hamza Hasan Jan 19 '16 at 10:53
  • \$\begingroup\$ Thanks sir for the reply...me too just doing that way as u said.. just receive the command and by entry and key values the speeds automatically assign to that objects but then too the objects don't match from both the side. Am I doing anything wrong? or server? \$\endgroup\$ – Shraddha Patel Jan 19 '16 at 10:55
  • \$\begingroup\$ Are you sure you are not making calcs in clientside? also, are your objects clearly identificables so, once a packet arrives, they could be updated? \$\endgroup\$ – PRDeving Jan 19 '16 at 11:02
  • \$\begingroup\$ That's why I asked for code :) \$\endgroup\$ – Hamza Hasan Jan 19 '16 at 11:03
  • \$\begingroup\$ Hamza, you are right, there's no info enough, i just pointed out how it "should" be done, just in case OP didn't know how manage real time sync, i never said it's the final solution. As Hamza said, you should post some more info OP, code, chart or flow would be appreciated \$\endgroup\$ – PRDeving Jan 19 '16 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.