I am working on a simple 2D shooter game, using a client/server architecture for networking. I will mostly use TRANSFERMODEUNRELIABLE for game state update messages from server to clients, but I would like to send some important event messages (player joined/left game, chat messages, kill messages...) reliably. Is it okay if I change transfer mode to reliable just before these messages, and change it back to unreliable mode right after? Like this:
# variable holding NetworkedMultiplayerPeer object
# initialize nmpeer ...
# I will mostly use this mode
# some code here...
# check if its time to update clients (currently happens every 2nd frame)
if ( NeedPublish() )
# check if some event happened
if ( SomethingImportantHappened() )
# set transfer mode to reliable
# set transfer mode back to unreliable
Also there are two different methods "rpcid" and "rpcunreliableid", is the first one always reliable? If so can I use them while sending raw packets (via putpacket) without changing transfer mode?
Hope the question was clear and not too long, thank you for reading.