Rise of the Human Race (ROHR)

tech.png

Destroy your friends’ AR troops from the comfort of your own couch!

ROHR is a competitive augmented reality multiplayer tower defense game in which two players compete to rule over planet Earth.

Technology:  AR - Unity 3D - Photon - Vuforia - Android -

Premise:

Set in the future, Rise of the Human Race depicts a point in earth's timeline where Aliens have taken over the planet and enslaved the entire human race. In an attempt to regain control of Earth, humans start a revolution!  Aliens and Humans must now fight to reclaim what they think is rightfully theirs. 

How it works:

ROHR is a two player tower defense game. The players log into a 1v1 game and are randomly assigned roles of either defender (alien) or attacker (human).

Aliens build and defend using towers, while humans assemble military men and mercenaries to attack.

Each team has a point system that fits their species.

The Alien currency is human souls - i.e. The more you defend, the more souls you capture, and can therefore upgrade your machinery. Some of the upgrades include non-attacking machinery such as radars which can attract more humans and collect more souls, thus increasing the defender's purchasing power.

The Human currency is Dollars that are used to hire more mercenaries. Dollars are collected over time, as long as the army is alive, but also by destroying towers which earns bonus points allowing the army to sell the remains as scraps.

Challenges: 

ROHR is not turn based, so it's all happening live in real time, which means some issues needed to be addressed in development such as:

- Lag compensation to account for the delay between the players and the server

- Responsive AR real time defense building - The game allows the user to drag and drop items that he/she needs based on the party they are playing

- Synchronization between 2 devices in real time.

Method:

Most of the basics of the game were built using Unity3D, meaning the customization of what a player is and what they are able to do in a multiplayer environment, the drag-and-drop mechanics according to the party’s space, as well as the map and the overall structure of the game were all built using Augmented Reality specific elements.

Almost all UI elements were developed using Next-Gen User Interface (NGUI) in order to create a user-friendly environment. NGUI is a powerful and affordable next-generation UI system with a low memory footprint and high performance. It follows the KISS principle. On one hand it provides a great UI for users, and on the other hand it provides simple and clean code for developers. The Game and the NGUI are both made using C#.

Finally, the augmented reality part of the project is very straightforward. Vuforia SDK was integrated in Unity and used to enable AR gameplay. 

Synchronization and Lag – Use of Photon

Photon had two main roles:

- Joining parties on the same server in order to communicate

- Providing accurate and synchronized clocks to help in the accounting and compensation of lag

Using Photon-Unity Networking, the game connects players to a server that they both communicate with. The feedback (which represents for example the positions of towers or humans) from both players, is sent to the server that in turn sends that feedback to the other party. The server makes sure that all players in the same game are connected and communicating with each other regardless of their number. Data, thus, is synchronized. 

Overall, there is a master/non-master view that allows the server to know the direction of the flow of the feedback. This view can be seen in this game as defender/attacker. More specifically, in this game the defender is defined as the Master and the attacker as the non-master.

Photon introduces a powerful functionality for synchronization known as RPC, short for Remote Procedure Call that allows a user to call a method on another user’s computer.

RPCs are important in this game when accounting for bullets. Since there will be a lot of bullets that are being spawned and sending 10 to 20 location updates for each bullet will exhaust the network. However, we don’t need to send this amount of data because bullets will go in a certain direction and their location can be computed by a simple equation, given their spawn position, time, direction and projectile speed.

In order to provide the user with the best experience, the game focused on compensating for lag to create a smooth interaction that the player can enjoy. This involved the implementation of two lag compensation techniques, namely interpolation from the last known position and prediction of object positions.

Namely, in ROHR the compensation for lag was performed in two ways: 'Lerping' (linear interpolation) and Position Prediction. The first is responsible for soothing the movement of players.
Suppose player A has a lower ping to the server than player B. When player B moves, it will take less time for player A to get the data about the coordinates of player B and by the time player A gets the updates, the position of player will suddenly change creating a non-user friendly experience. However, a critical point which is supposed to be handled carefully was the fact that we can linearly interpolate the current location based on the most recently received location.

In addition, prediction was used in order to give the user a view on how the bullets are being shot. In doing so, the game takes into account the initial position of the bullet, its direction, its speed, and its strength. It then calculates where the bullet will be at time t and if it will damage/kill the human it collides with.

Future outcomes

The technical knowledge attained through this project, has opened up multiple solutions for common problems in AR real-time games and applications. 

The next steps would be to take this project into a multi-player platform where more than just 2 players can join in.


Previous
Previous

MathsOp

Next
Next

Future Consciousness