So I am working on a game that uses Android devices as the controls. The point of the game is to allow a large number of players to interact on one screen. I initially started out using roInput and RESTful HTTP to give the Roku instructions. Then I realized Roku can handle low level networking, it can receive raw UDP packets using roDatagramSocket. I am new to networking, but I thought I'd give it a shot because I knew it would be 10X faster than using RESTful HTTP communication. Not so!
It seems to be something to with roDatagramSocket creating a queue of its received messages, and if the Roku hangs, well then there is lots of latency. Also for my roInputEvent I am using port.GetMessage() where as in my roSocketEvent I am using wait(1, port) , because for whatever reason I never receive any data with port.GetMessage() on my roSocketEvent. roInput seems to drop the messages, if it hangs the sprites will just skip a few pixels, not hang and then process all the data moments later. It also takes a huge performance hit if there are multiple players connected, could it be that the Roku is receiving and then processing ALL the data from the players and thus becoming sluggish? How would I go about only processing whatever data is currently available on each loop through my while statement, instead of ALL data that has been captured since the last while loop?
These are just my best guesses so far as to what is going on.
I would really appreciate any help, I just spent my entire night switching to UDP for the performance, and it seems like a complete waste.