3 ms·
Honestly, it's difficult for me to say. Is this two players over the Internet? More than two players? The movement mechanics matter a lot. I've never seen Tron
by coderdude 16y ago
Honestly, it's difficult for me to say. Is this two players over the Internet? More than two players? The movement mechanics matter a lot. I've never seen Tron or played any Tron games, but if it will play something like this:
http://www.virginmedia.com/images/tron2-431x300.jpg http://www.virginmedia.com/images/tron2-431x300.jpg
Which appears to be kind of like snakes/nibbles then I could see you requiring some of the techniques the article describes. Since players are mostly moving in a single direction for a period of time you could extrapolate their movements by continuing their motion in that single direction until the server is made otherwise aware of where the player decided to move. Then you can reset the player back to the position they were at when they changed direction and then continue them along that path.
However, for when the action gets close-up and quick, where perhaps the two players are twitching back and forth trying to avoid or ensnare each other then yes I can see how lag compensation will be necessary so that the server can accurately figure out where each player thought the other player was when they made their move.
Here are two articles that I think will help you, and they helped me when I was working at this problem:
http://www.gamasutra.com/view/feature/3230/dead_reckoning_latency_hiding_for_.php http://www.gamasutra.com/view/feature/3230/dead_reckoning_la...
http://www.gamedev.net/reference/articles/article1370.asp http://www.gamedev.net/reference/articles/article1370.asp
- zemanel 16y agoyeah i was wondering about creating a single arena with a million square points or more, each player would see a smaller viewport focused on his cycle (snake/nibble), new players would spawn in a empty spot and so on. the server would have to store each point of the trail to calculate collisions. EDIT: the game's not particularly exciting but i'd imagine that being on the same canvas avoiding the trail of potentially thousands of players (plus your own) could be cool EDIT2: also if it was possible to add 3D to it (the ability to turn in the Z axis) could be pretty awesome
- extension 16y agoalso if it was possible to add 3D to it (the ability to turn in the Z axis) could be pretty awesome Hmm.. what would the trails look like? A line is pretty easy to avoid in three dimensions. Maybe rectangles could be extruded from the line segment between the last two turning points. Or you somehow control two light cycles and extrude the line between them.
- zemanel 16y ago"turning on the Z axis" (dunno if i said it correctly, could be also X or Y) would essentially be changing the plane, meaning, the arena would be a cube instead of a 2 dimensional plane. Let's say a couple of players would create a dead end you couldn't avoid by going up, down, left or right, you could rotate the view. For example on a normal snake 2D game, pressing the key oposite and to the direction your'e heading is meaningless, you can't go straight back and your'e already going forward. On a cube those keys could be mapped to 3D rotation. You would still see the game as 2D and depth would be emulated for example with transparency, were close trails are opaque and deeper objects are transparent, so that you could know if you could turn or not, for example on a trail right in front of you. edit: fix typos ps.: of course playing on a cube is only be interesting when you have a lot of players in the game, or else it would be very impractical to corner someone (since you would need to get him wrapped completely)
- extension 16y agoHow would you ever find yourself on the same plane as the other players? Or even on any plane that they had ever been on? If the trails are infinitely thin lines arbitrarily positioned in 3D space then it's effectively impossible to hit them. You could quantize them on some or all of the axes but I would find that less elegant than keeping the game in continuous space and making the trails planar somehow.
- zemanel 16y agono, because everyone's moving in x,y,x integer coordinates limited to the cube's dimension, max x,y,x = 1000 for example, and the server records the coordinates you'be moving along (0,0,1), (1,0,0), (2,0,0). when you move into a coordinate someone (or you) has been, its a collision. although you move 1 point at a time, the line thickness in the Ui may be more than 1 pixel, it's just on the UI level. you start on the usual plain: y | | *--> | z-------x y is the vertical coordinate and x is the horizontal. that's the plane your're seeing on your game client. if you're moving right along the x line, you're increasing the x coordinate (x,y, z) while the others are constant if you press 'D' or 'right', you "turn" the view on the y axis, and then the plane you're on becomes: y | | *--> | x-----z now, y is the (same) vertical but the horizontal has become z, you keep moving right but x value has fixed and now z is increasing. if you press up, you start increasing y, but x, and z are still fixed (since you havent moved on their axis) the server records the x,y,x coordinates you been through (for everyone) and when someone moves into a recorded coordinate, game over man.