Ork Commander

About the game

‚Ork Commander‘ was a recreational project where the player had to build a base and equip his units with the appropriate equipment. Whether the army of the player was effective against the attackers or not depended on the provided equipment. The goal of the game was to destroy the enemy base. The project was realised in the Unity3D engine.

My tasks

My tasks were the implementation of a rasterized construction system associated with an user interface as well as a direction-controlled road system. We decided that the construction area of the player should be predetermined to a limited area. That’s why I decided to initialize every point in the grid of the construction area as a gameobject. In addition to this object a sprite was created which was then used to visualize collisions with other objects.

Show code
for (int x = 0; x < m_FieldLength; x++)
   for(int z = 0; z < m_FieldWidth; z++){
      m_TileGrid[x, z] = Instantiate(m_1x1Tile, new Vector3(0.5f + x, 0.0f, 0.5f + z), m_TilesAndSpriteRotation) as GameObject;
      m_TileGrid[x, z].layer = 14;
      m_TileGrid[x, z].tag = "ConstructionTile";
      m_TileGrid[x, z].name = "Tile ID: " + x + ";" + z;
      m_TileGrid[x, z].transform.SetParent(tmp_THolder.transform);
      m_SpriteGrid[x, z] = Instantiate(m_SpriteObject, new Vector3(0.5f + x, m_Höhe, 0.5f + z), m_TilesAndSpriteRotation) as GameObject;
      m_SpriteGrid[x, z].transform.SetParent(tmp_SHolder.transform);
      m_SpriteGrid[x, z].name = "CollisionSprite ID: " + x + ";" + z;

In case of a collision between a point in the grid and an object in the world, the associated sprite was marked as non-buildable and a corresponding entry was placed in the logic of the building area.

Show code
if(Physics.CheckSphere(spherePos, 0.40f)){
   m_PlacementLogic[x, z] = (int)m_TileTypes.building;
   m_SpriteGrid[x, z].GetComponent().sprite = m_CollisionSprite;
m_SpriteGrid[x, z].SetActive(false);

Building a structure was controlled via raycasts. The raycast was used to determine at which point of the grid the placement was attempted.

 if Physics.Raycast(m_MouseRay, out m_MouseObject, Mathf.Infinity, m_MouseDetectingLayers))

In an area around this point was then checked whether the placement of the building was possible or not. The size of the area depended on the size of the building.

The directional road system was a much heavier task compared to the construction system. In addition to the requirement of the directional control it was also necessary to move the units correctly on the roads, that the units were routed into buildings and that streets were adapted to neighboring streets.

I implemented the direction control in a way that a road was marked with a special type in each direction. This type was either a wall, an entrance or an exit. The adjacent streets were then adapted to the newly placed street depending on its types.

Show code
switch (p_Direction){
   case 0:
      if (script.GetNorthWay() == m_DoorTypes.wall)
      if (script.GetSouthWay() == m_DoorTypes.wall)
   case 1:
      if (script.GetEastWay() == m_DoorTypes.wall)
      if(script.GetWestWay() == m_DoorTypes.wall)
      Debug.Log("INVALID DIRECTION");

The correct routing of the units was controlled by the road system. Each unit polled the system for information about the next road. The unit moved forwards after the system returned a positive message.

Show code
public bool IsThereAWayForward(Vector3 p_Position){
   int x = (int)p_Position.x, z = (int)p_Position.z;
   Doorways_Script Script = m_Doorways[x, z];
   if (z + 1 < m_MainConstructor.m_FieldWidth && Script.GetNorthWay() == m_DoorTypes.exit &&
   m_Doorways[x, z + 1].GetOccupationStatus() == false &&
   m_Doorways[x, z + 1].GetSouthWay() == m_DoorTypes.entrance)
      return true;
   return false;

Proper forwarding to buildings was controlled by triggers. If a unit moves into the trigger of a building the building checks for available capacities. If capacities were available the unit was directed into the building.

Show code
void OnTriggerEnter(Collider other){
   if (other.tag == "Unit" && !other.GetComponent().m_AlreadyEquipped){
      if (selectedBody!=null || selectedLeftHand!=null ||

Working on this project was one of the most difficult and nerve-wracking experiences I had in my studies. Nevertheless, the result motivated me a lot. In retrospect, I would research for more information about systems and not develop them „from the gut“.

Diese Diashow benötigt JavaScript.

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:


Du kommentierst mit Deinem WordPress.com-Konto. Abmelden /  Ändern )

Google Foto

Du kommentierst mit Deinem Google-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )

Verbinde mit %s