Pixelvloed
Pixelvloed is een multiplayer-canvas waarbij meerdere deelnemers via het lokale netwerk middels binaire UDP-pakketten op een gedeeld scherm kunnen tekenen.
Pakketverlies
Op de server raak je bij snelle clients tijdens het flippen van het scherm al snel UDP-pakketjes kwijt, omdat de input buffers in Linux nogal klein afgesteld staan. Je kunt zien wat de huidige buffer queue size in bytes is door het volgende commando te gebruiken:
netstat -uanp | grep 5005
De tweede kolom geeft het aantal bytes in gebruik weer. Als dit getal af en toe dezelfde waarde heeft als de output van cat /proc/sys/net/core/rmem_default
, dan raakt je buffer vol. Om dit op te lossen kun je de buffer size aan de kernelkant vergroten:
cat /etc/sysctl.d/local.conf net.core.rmem_max = 1638400 net.core.rmem_default = 1638400
PixelVloed on a raspi zero
You can download the image (450mb gzipped 2gb sd card) here:
http://home.innerheight.com/pixelvloed-raspi.img.gz
PixelVloed @ eth0
At eth0 a beta version of a server written in C is used. Older clients using the protocol used in the github examples can still be used.
Pixelvloed server ip: 100.123.2.173 Pixelvloed server port: 5005
To send pixels to the server udp packets are used. The data send in these packets consists of a header part and multiple data parts. The header part is two bytes wide. The first byte selects the protocol used in the packet. The second byte is the version of the protocol which is not yet used. For each protocol the data send is different. At least the coordinates of the pixel must be send. The maximum size of a packet is 1120 bytes, which are 140 pixels for protocol 0. Below is an explanation of the data for each protocol.
Protocol 0 xyrgb 16:16:8:8:8 | Header | Data pixel 1 | Data pixel 2 | Data pixel ... content | protocol | version | x | y | r | g | b | x | y | r | g | b | ... byte # | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |10 |11 |12 |13 |14 |15 | ... Protocol 1 xyrgba 16:16:8:8:8:8 | Header | Data pixel 1 | Data pixel 2 | Data pixel ... content | protocol | version | x | y | r | g | b | a | x | y | r | g | b | a | ... byte # | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |10 |11 |12 |13 |14 |15 |16 |17 | ... Protocol 2 xyrgb 12:12:8:8:8 | Header | Data pixel 1 | Data pixel 2 | Data pixel ... content | protocol | version | x | y | r | g | b | x | y | r | g | b | ... byte # | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |10 |11 |12 |13 | ... Protocol 3 xyrgba 12:12:8:8:8:8 | Header | Data pixel 1 | Data pixel 2 | Data pixel ... content | protocol | version | x | y | r | g | b | a | x | y | r | g | b | a | ... byte # | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |10 |11 |12 |13 |14 |15 | ... Protocol 4 xyrgb 12:12:3:3:2 | Header | Data pixel 1 | Data pixel 2 | Data pixel ... content | protocol | version | x | y |r|g|b| x | y |r|g|b| ... byte # | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ... Protocol 5 xyrgba 12:12:2:2:2:2 | Header | Data pixel 1 | Data pixel 2 | Data pixel ... content | protocol | version | x | y |r|g|b|a| x | y |r|g|b|a| ... byte # | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ...