ProudNet features an automatic traffic control function (throttling) that helps limit network congestion and server crashes even at the severe networking condition and secures the most pleasant networking experience when signaling speed is good.
ProudNet provides 11.2 Transmitting the latest message only and 11.1 Prioritizing message transmission functions.
Besides, 6.11 Detecting transmission overflows can be a good alternative solution too.
11.1Prioritizing message transmission
ProudNet provides a function that prioritizes message transmission.
The policies around prioritizing message transmission are as followed.
When there are messages that haven't been transmitted to the network line and piled up as pending in the transmission buffer, the messages with the highest priority(Priority 1) get transmitted first then those of lower priority(Priority 2). The lowest priority messages (Priority 3) get transmitted when the transmission of Priority 1 and 2 messages are completed.
11.1 Prioritizing message transmission can be used at the following events.
Voice Chatting
Voice chatting normally requires an immersive size of messaging. But the traffic caused by voice chatting shouldn't affect the game play. You can fix this issue by simply setting all messages related to the game play to be the highest priority over voice chatting.
Realtime Content Downloadable Game
You can develop a game that allows a quick installation then downloads all necessary media data during the game play. By prioritizing the messages related to the game play to be higher than those of downloadable data can significantly improve the performance.
Synchronizing the position of massive numbers of characters
The biggest interest you may have as playing a game is your playable character and another character you are fighting against. Which means synchronization with the characters that directly interact with your character is much more important than those do not. Therefore, setting higher priority for characters in combat or close in range with your character than other messages would offer much pleasant gaming experience.
The parameter that calls for RMI, Proud.RmiContext has a member variable, Proud.RmiContext.m_priority. All it takes is to set the priority of message transmission in this variable. The priority of message transmission is one of values of Proud.MessagePriority.
Proud.RmiContext.ReliableSend,Proud.RmiContext.UnreliableSend is a global variable. It is recommended to separately create Proud.RmiContext object instead of editing m_priority directly.
11.2Transmitting 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.
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. Proud::RmiContext rctx = Proud::RmiContext::UnreliableSend; // 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);