Nikhil Kashyap Portfolio
  • Home
  • Portfolio
  • Writing
  • Film
  • Blog

ISLES OF WAR (LAUNCHED OCTOBER 2013)
ROLE : TECHNICAL DESIGNER | 
DISNEY INTERACTIVE, JULY 2012 - APRIL 2014 | TEAM SIZE  = ~50
GAMEZEBO REVIEW

BATTLE AI

There are two types of battles - Sea Battle and Island Battle. AI consists of two key elements :
1) Enemy Flagship Movement - The target for enemy flagship is simply the closest player ship. All the other ships simply follow the ship in front. 
2) Fire Prioritization - Firing of both player and enemy ships is automatic based on weapon fire rate. Fire priorities for player ships against structures are managed using static data fields for each the structure types. When an enemy ship or structure has multiple player ships that can be fired at, the ship with the lowest health is chosen.

SEA BATTLE

Picture

ISLAND BATTLE

Picture

ENEMY FLAGSHIP MOVEMENT

We shall delve into the movement of the enemy flagship for a static target using a Unity Simulation.
ShipMove.cs
File Size: 2 kb
File Type: cs
Download File

Picture
Picture
Picture

STAGE 1

Picture
Picture
Picture

​The 'following' flag is set for all ships other than the flagship. Every ship needs to start turning to ensure it's target is in broadside firing range. The buffer distance needed to turn can be computed based on the turning firing speed. However, when the distance between the flagship and it's target is greater than (firing range + buffer distance), the ship needs to get to it's target as soon as possible, which means it moves directly towards the target.

STAGE 2

Once the target enters the buffer zone for turning, we need to determine whether to turn left or right to bring the target into broadside firing range.
Picture
Picture
In order to do so we first compute the cross product between the ship's forward vector and the direction vector from ship to target centre. Next we compute the dot product of the perpendicular with the ship's up vector to determine the side the target is at.
Picture
Picture
And finally we check the angle the ship's forward vector is making with direction vector to determine whether the target is ahead of or behind the ship. A combination of left or right, and ahead or behind tells us the quadrant the target is in and therefore the direction to turn.
Picture

STAGE 3

Picture
Picture
And in the final stage, when the target is in range the ship simply continues to move forwards without turning so that the target stays in firing range for maximum duration.

LINK TO PAGE 1 - BATTLE OVERVIEW
Powered by Create your own unique website with customizable templates.
  • Home
  • Portfolio
  • Writing
  • Film
  • Blog