My idea for a network library

BlitzMax Forums/BlitzMax Programming/My idea for a network library

hi Wave,

Woops, I didn't see that my id=0 suggestion was already in :-)

To get back to your suggestion to use a different method for sending/receiving variables, perhaps for now your current method is the best, after reading this discussion again.

But, you could make an exception for player movement though.
What I mean is network prediction. It is something I suggested for Blitzplay as well. In this concept, prediction is done automaticly by the network library.
pseudo code:

main loop
 for p.player = each player
   if syncposition(p\id)=false
     playerposition=calculatePrediction(p\id)
     positionentity myplayer, playerposition[0], playerposition[1], playerposition[2]
   else
     playerposition=getPosition(p\id)
     positionentity myplayer, playerposition[0], playerposition[1], playerposition[2]
   end if
 next

end main loop


What I mean with the above example is that sometimes the network library does not send/receive playerpositions, but calculates the position based on previous player positions. It predicts. The statement after the 'else' DOES receives the actual player coordinates.

How often the library predicts or not, can be then set using a constant:
PREDICT = 5 means the library predicts every pass, except pass 0. So changing this value into 10 means that the library predicts more, but syncs less.