Titles like Fortnite, Minecraft, Clash of Clans, and Asphalt have shown that MMOs and regular multiplayer games will be a staple on the Google PlayStore and Android phones of the future. Gamers are willing to give handheld devices a chance, and I am not talking about the switch. These titles’ ridiculous success has proved that online multiplayer games are now more than just possible on an Android phone.
It couldn’t have come at a better time. Free market mechanics have pitted Qualcomm, Apple, Google, and Samsung against one another as they rush out faster and cheaper 64-bit chips. It is ushering in better hardware for Android gaming, and battery capacity continues to increase as bevels are hidden on screens that were already up to the task.
The possibilities for gaming on an Android phone are uncharted. There is the talk of controllers and VR headsets on the horizon. It’s all coming together for mobile Android gaming.
Tool for Developing A Multiplayer Game for Android
Languages
The most popular languages for Android game development are Java and C#, but with enough programming know-how, you can make a game in any apt modern language. There are all kinds of frameworks and IDEs to help you. Android Studios is a big one. It works with Java. Unity can be used with NodeJS and Redis or Firebase. Async JavaScript is a lot more fun than PHP. Kivy allows you to code in Python and has facilities to make native SDKs using this you can implement GPGS.
TCP/IP vs UDP
Any stack you use is going to include several technologies. A lot of multiplayer games use TCP/IP, UDP, or a combination of the two. These are different protocols that mediate how packets are sent on the internet. Put simply, UDP packets are unordered and “unreliable”. In practice, unreliable means you might lose 1% – 2% of packets. TCP takes care of everything. It orders and accounts for all the data in a super convenient and easy-to-read stream. If a packet goes missing, the TCP protocol will ask for it again solving the problem. It takes care of the control flow and makes sure that there is never too much data, or data is sent too fast.
All of this being said, you shouldn’t use TCP when making multiplayer games for all the reasons above. TCP sends a stream of packets. It queues data and then sends it, hiding all the complexity for everyone’s sanity. Problems start to arise when a very small amount of data sits in a packet unsent, or when a packet is dropped and TCP can’t order all the packets it has received until the new req packet arrives.
UDP is a much lighter addition to the IP protocol. You have to write a lot of the logic yourself and tell it about connections, break up the packages, and mediate how fast they are sent. UDP is a simple protocol. It sends data from one port to another using IP and the rest is up to you. It won’t stall if a package doesn’t arrive and for this reason, it’s the best option for multiplayer Android gaming.
Server Considerations for Multiplayer Games for Android
There are dozens and dozens of approaches. Notable is the client-server model or peer-to-peer model. Irrespective of how you go about it, at the center of hosting a multiplayer game live on the server.
Multiplayer means communicating in real-time with multiple clients. Luckily, a modern computer can do two or even a million things at once. Your server needs to be able to send and receive a lot of information concurrently.
Concurrent is just a fancy computer science way of saying multiple things happening at the same time. Why does it matter? Think about it, when rendering a sprite movement on multiple screens the computer needs to update its position and have that update take effect for all players at the same time, or it isn’t going to be a very fun or fair game.
Conversation is about speaking and listening, so one of the first things need to do with your server is, open a port to listen for incoming connections from clients. To have anything resembling a good user experience, clients can never be left waiting for things that are supposed to happen at the same time or asynchronously. This is done with threads.
Avoiding Lag
A server needs to be designed to flawlessly scale to handle the current amount of players. How many concurrent players per server and per match? To thread or not to thread? Developers from Melior Games spend a lot of time with these questions before building Android gaming servers.
A common design pattern is to group or wrap all the threads (players) and arrange them into lists ( lobbies ). Once all the game’s participants have correctly referenced it’s easier to directly send the right information to the right clients/games/players.
Once this data is accessible remember to asynchronously manipulate it between all the threads and render it everywhere at once. Everyone can wait at once, but no thread should ever wait alone.
Some inspiration from recent Android Multiplayer Games
Fortnite Battle Royal
Fortnite’s addictive battle royale mechanic had players explore a cartoony post-apocalyptic world, build walls, and occasionally ride bullets. The online multiplayer experience on an Android phone is comparable to the PC or console experience, with all the loot and skins we have come to expect from modern online gaming.
The supremely popular battle royale game’s mobile version hit another impressive milestone, earning Epic Games a cool $300 million within the first 200 days on the IOS app store. In November 2018 it was reported that Fortnite had over 8 million concurrent players. Today there are 150.
PUBG
The Original Battle Royal Game, expressively named, PlayerUnknown’s Battleground launched on 23 March 2017. Original is contentious, but PUBG is approximately 4 months older than Fortnite. For this reason and several others, PUBG players are more leet than fortunate players.
As is becoming the trend, PUBG followed up their intense and prolonged success on PC by releasing a console version and finally a version for mobile phones.
PUBG managed to maintain a year-long streak of hosting over one million concurrent players for a year on Steam. The game’s player count peaked at 3.2 million players in January 2017. Today, the game struggles to surpass a million players in 24 hours.
Apex Legends
Trending hard in the meme pool, Apex Legends is the latest battle royal absolutely killing it on console and PC. A video released by the official Apex Legend YouTube channel announced that the game has over 50 million registered players and has already clocked a cool 170M respawns. Stats that don’t really make sense, that’s like a little over 3 respawns a player. The key takeaway is it’s wildly popular.
A mobile version of Apex Legends could be on the cards. There is enough attention to justify it. Some crafty hackers kicked the rumor mill into overdrive when they released malware dressed up as an Android version of an Apex Legends game. Unfortunately, an Android version of the game is still a baseless rumor. But please. Waiting in lines is much better with an FPS in your pocket.
Key Takeaways From These Multiplayer Android Games
The industry standard for titles released on mobile is taking shape. In the past, we have seen some novel proofs of the concept, but only recently have there been competing, no compromise, cross-platform games on Android. The key takeaway, I think, is Android game developers need to deliver a comparable experience to what people have come to expect from consoles and PCs. There are over 20 ‘Words With Friends’ clones on Facebook Messenger and endless in the PlayStore. The bar has been raised for Android phones.
- Scale to support millions of daily users.
- Comparable to console graphics
- On-Screen Controller
- Built on the Android Gaming Platform Playable on Recent Devices (and iOS)
Multiplayer mobile gaming is a billion-dollar industry that shows no signs of slowing down. Several widely successful games have broken records for concurrent players. As mobile hardware catches up, and the perceptions of mobile gaming change we march directly into a dank handheld game future. I am excited.