Default implementation of
IRPZone
. This class implements the Delta^2 algorithm to save bandwidth.
The idea behind the DPA is to avoid sending ALL the objects to a client each time, but only those that have been modified. Imagine that we have 1000 objects, and only Object 1 and Object 505 are active objects that are modified each turn.
The Traditional method: - Get objects that our player should see ( 1000 objects ) - Send them to player ( 1000 objects ) - Next turn - Get objects that our player should see ( 1000 objects ) - Send them to player - Next turn ...
I hope you see the problem... we are sending objects that haven't changed each turn.
The delta perception algorithm: - Get objects that our player should see ( 1000 objects ) - Reduce the list to the modified ones ( 1000 objects ) - Store also the objects that are not longer visible ( 0 objects ) - Send them to player ( 1000 objects ) - Next turn - Get objects that our player should see ( 1000 objects ) - Reduce the list to the modified ones ( 2 objects ) - Store also the objects that are not longer visible ( 0 objects ) - Send them to player ( 2 objects ) - Next turn ...
The next step of the delta perception algorithm is pretty clear: delta2
The idea is to send only what changes of the objects that changed. This way we save even more bandwidth, making perceptions around 20% of the original delta perception size.
The delta2 algorithm is based on four containers:
- List of added objects
- List of modified added attributes of objects
- List of modified deleted attributes of objects
- List of deleted objects
To make perceptions work, it is important to call the modify method in RPZone, so this way objects modified are stored in the modified list.
@author miguel