Polo Online.

After 3 nights straight of working on and making Polo Multiplayer and seamlessly adding it to support the Single Player storyline isnt a process that is just implemented and works flawlessly, I had multiple issues with it and am constantly refining it to work better each day. If you're the kind of person that doesn't care about technical side of things, Then this post probably isn't for you.
How It Works
When you first start Polo, the Variable mplay starts at zero. When you open the TCP/IP Connection and host a server, mplay then equals one (True). When mplay equals one, Everything acts a bit differently. The Polo object starts sending data and receiving data once Mplay is set to One. This data is constantly send, updated and looking for a data back from the other player. The data that is sent, (but not limited to):- X Coordinate
- Y Coordinate
- Level Score
- Overall Score
- Player level
- Chat Messages
- etc
Optimizing Polo Online
In the beginning, The data would be sent constantly, even if the data remained the same. So at this point I needed to implement checks on the data and send the data only when it is necessary.
How it worked before is:
Send Polo X and Y Coordinate Constantly
This method is useless when the other player is playing on another level, Whats the point of sending your location data if the other player cant even see you? So how it works now is.If my level = other players level Then Send Polo X and Y Coordinate
This works out much better and doesnt cause as much lag on the clients end. Same went for the players sprite and animation, This information at first was sent Constantly, I then changed this to when a key is pressed to send the data... The same though can apply for this as well, If the player isnt on the level, then why send the sprite and animation information? This data is now only sent when the player is on the same level. Now that I think about it, The data before was being handled in a very wrong way, ALL the data was being sent constantly when logically, the data should be sent when its needed. The same went for Players location. Before:Send Level Send Overall Score
After:If level finished / Started Then Send Level Send Overall Score
As simple as this was to figure out before hand, It takes Trial and error until everything is correct. Im sure theres plently of other things I forgot to cover in making the multiplayer more stable and faster. But like before, These will come to me over time. I hope you enjoyed all this information, and I hope to release more technical posts in the future about Polo.




