In VFC there is the concept of pivot, which is an element that has a virtual relative location to other elements of the game. The main elements that I will need to map with VFC in NetRumble are
-
Player ships
-
Asteroids
-
Projectiles and other input?
Player Ships
For the player's ships, currently, each player is responsible for it's own ship: local player is the authority on the death of their own ship and for sending the updates to all other players.
Since ships can move along through different consistency zones I'm thinking about having the host be a central authority and notify when players change relative zones. This is probably only needed when the players are moving closer to each other since that's when we have to tighten the consistency requirements. So, in practice, the Host player will always be in the tightest zone of all other players so it can judge effectively where other players are.
Asteroids
The asteroids are controlled at the Host player who updates it's state and sends the information to all clients.
This should be the easiest pivot I'll have to implement since it's already centralized and all the calculus will be done at the host. I believe this is a good starting point to implement VFC in this game.
Projectiles and other input
The way the input is handled is this game might be a bit of an obstacle to the implementation of the VFC model. The input is interpreted by every participant in the game the same way, and expected to result in the same output. However, this might not be true due to latency fluctuation, lost packets, and so on. This is usually a nice approach when we are applying it to an RTS (Real-time Strategy) game because these have a tolerance for higher latency. Since NetRumble has more affinity with FPS-style (First-person shooter) I believe this problem should be solved differently.
My idea, in order to improve this too optimistic behavior, is to tag the projectiles with a game time (elapsed time), position, direction and speed (these two can be combined in speed_x and speed_y) and send it out to other players (according to VFC consistency requirements defined). Then, each player will calculate the actual position of the projectile when he receives that kind of packet depending on the speed of the projectile and direction.