2D Versus is a multiplayer arena topdown shooter game I started developing to experiment with Unity 3D’s HLAPI networking system (High-level API) which was released with Unity 5.
The High Level API (HLAPI) is a system for building multiplayer capabilities for Unity games. It is built on top of the lower level transport real-time communication layer, and handles many of the common tasks that are required for multiplayer games
While the transport layer supports any kind of network topology, the HLAPI is a server authoritative system; although it allows one of the participants to be a client and the server at the same time, so no dedicated server process is required.
The game uses my 2D Shooter Bullet and Weapon system asset (which I sell on the Unity Asset Store). I had to make a few modifications to it to support multiplayer, but it wasn’t too difficult after I got to grips with Unity’s HLAPI networking system.
The game can handle multiple players over the internet with little to no lag at all. The video below is the very first true multiplayer test I ran with a few of my friends. There is no master server setup – I basically started the game on my end, did some port forwarding on my router, and got the other players to connect to my external IP and the port I was hosting on.
The game has a simple UI when you first join (or when you respawn) that allows you to set up your player name. Other features include:
- Weapon selection / bullet pattern system (Grenade launcher, rocket launcher, assault rifle, pistol, shotgun)
- Score/leaderboard in-game UI
- Synchronized systems via HLAPI multiplayer system – scores, bullets, player positions etc are all synchronized, and a custom tween/easing solution is in place to ensure movement of other players is as smooth as possible over the network
Most of the graphics I re-used from artwork I created for my 2D Shooter/Weapon system asset, and I spent a bit of time drawing the avatar/character you see in the demo above with Photoshop, adding a bit of basic animation to him.
There are a bunch of obvious bugs that could do with sorting out, but it’s already a ton of fun, and reminds me of old classic topdown and side scrolling shooters like Crimsonland or Soldat.