Transmitting the latest message only

Transmitting the latest message only of ProudNet is a function that only transmits the latest message and cancels out all other useless messages.

This function becomes useful when sending the position of game character to other hosts in online game.

The below picture shows the case which the position of character(Pos) is already transmitted when t=1. And, when t=2 and t=3, the character's position are not transmitted and they are piled in host's memory as pending.

And at t=4, the character's position of t=2 and 3 become meaningless and don't need to be transmitted to other hosts since only the position at t=4 would matter. When this happens, it is better to cancel sending the position of t=2 and 3 then just send the position of t=4.

message_unique_id.jpg
Example for sending the latest message only

To use Transmitting the latest message only function, all you need to do is setting the value other than 0 for Proud.RmiContext.m_uniqueID, which is a member variable of Proud.RmiContext that you get when RMI is called. Before the message gets piled in sending queue by RMI call, it automatically deletes other messages with the same Proud.RmiContext.m_uniqueID then places only the latest message. Most commonly used case would be inserting a character's ID at Proud.RmiContext.m_uniqueID.

Since Proud.RmiContext.UnreliableSend is frequently used, we don't recommend you to use it directly. It is much efficient to assign Proud.RmiContext.m_uniqueID after separately creating Proud.RmiContext object.

Below is the example of using Proud.RmiContext.m_uniqueID.

// Bring the copy of RmiContext object for the basic unreliable send.
// Insert Player ID of character being controlled by local host at m_uniqueID.
rctx.m_uniqueID = MyPlayerPetID;
// Transmit message through RMI.
C2CProxy.MyRmiFunction(PeerHostID, rctx, blahblah);