Hello.
This is my first thread here on the forum, and I’ve tried to search for similar subjects, but without luck ![]()
I’ve made a few games using unity, but right now I’m working on my first online game.
It’s in the tower defense genre - but with some twists of cause ![]()
Now, the way I do it is that two players see the same battle from each of their device (Android, iOS or flash-Facebook).
But my problem is that the same thing doesn’t happen every time since I use the Time.deltaTime function.
The way I do it is that I check if the monster is within reach of a tower, and if it is I’m spawning a bullet and makes it look at the monsters position, and move it farward. I then check if the bullet is close enough to the target for it to explode.
So the problem is, that if the frame rate is different on the two devices, so when the bullet or monster is moved, the distance is multiplied with the Time.deltaTime, to get a steady flow - but then the bullet or monster might be just a tiny bit closer to the target when the function is called, and therefore the exact same thing doesn’t happen each time.
Here’s an image showing the problem:

The game is made in the way so the two players can watch the turn at different times - so a server that handles the calculations isn’t really an option.
When I started the project, my first thought was not to use Time.deltaTime, since that would make it possibly to get the exact same result every time. But of cause that just makes the game slow.
So, this might be a “normal” problem, but since I’m not that used to Multiplayer games I hope some of you could help me out ![]()