Network

Blitz3D Forums/Blitz3D Beginners Area/Network

boomboom(Posted 2004) [#1]
Hi, When sending data in a stream, how does the client know what todo with it? such as how could it know is '32' is a forward command or a turn command?

this is what i do not get from looking at network examples. Do you have to put some leading characters in the variable before sending, such as TR_32 (Turn Right 32) and then read the leading characters to see what the string does?


Ross C(Posted 2004) [#2]
Make your first character in the string a byte number. Then depending on this number, the rest of the packet will contain different meaning of info.

pa$ = received packet

if asc(mid$(pa$,1,1)) = 1 then
    ;read data as positional data
elseif asc(mid$(pa$,1,1)) = 2 then
    ;read data as rotational data
end if


I would send all the rotational and positional data in the one packet. It means that if you receive a positional update packet then you lose a rotational packet update, you might have more trouble, than if you lose it all. Hope that helps a little :)