Notifications
Article
Futbolito 2D's Journey
Published 2 years ago
72
0
Connecting Android & iOS users.

Multiplayer Challenge

 
In Futbolito 2D, multiplayer is the core of our game. As we wanted the game to be ready as soon as possible and let players from android and iOS to play together, we decided to use google play game services. By doing this we managed to speed up time with the crossplatform connection but we still had two problems "lag" and mobile devices' memory.
 
With mobile devices' memory we shouldn't send a lot of messages to the server because the devices would then be overwhelmed and the game would crash, but by sending fewer updates the movement of the ball seemed slower and jittered a lot. We tried quite a few things and reduced the jitter significantly by making player one's ball the main ball and player two's ball a "shadow" from the main one (it receives player one's ball position and velocity).
 

Controlling the Ball

 
The ball has a simple circle collider and a bounce material so it works correctly when colliding with the walls or the players. Also to avoid the problem when the ball gets “stuck” in between two walls or players and doesn’t move to either left or right we added a function when shaking the mobile device so a random force is applied to the ball and you can continue playing. 
 
We tried quite a few things with the players, making them kick by tapping, or making them kick by sliding. It seemed too hard to achieve so we decided to let them kick on contact with the ball and let the player focus only on sliding them up and down.
 
dv
desarrollo vgim
6
Comments