Xcom-Clone (Portfolio Project)

Salah Besbes
3 min readMay 17, 2022

Create by Salah_besbes (Project Link)

As a fun of Turn-Base Strategy Game, and as Soon As we have started to learn Unity Game Engine, the( inspiration/idea )of creating my own Xcom2 game version starts to grow and the (idea) gets more and more serious as long we discover the Unity Game engine.

Xcom-Clone is a Turn-Base Strategy Game, Made with Unity, its about 2 players fighting each other, each player holds 4 different class units, each unit have its own weapon.

The player can spend all action points of his units or escape his Turn whenever he wants, so that opponent can player his.

The unit can move to some destination, or do some action, however each action have its cost, and the unit have only 2 action point to spend.

The stats of the unit can be upgraded by picking items found in the ground.

Also Cover mechanic is implemented, in fact, whenever the unit is near some high-Cover or low-Cover it gets some defense value, the more the unit have defense the less it can be exposed to the selected unit of the opponent. If the it does not have cover toward the selected unit of the opponent, it’s called Flunked and it gets 100% aim chance and more critical dmg.

In this game you will found 3 Class, for each Player, Assault, Ranger, Grenadier, each one have its own weapon AK47, ShutGun, Heavy-Weapon respectively. each weapon have its own characteristic.

Each unit, have different health, Armor, and Damage values, the Armor is subtracted from the damage received.

The First player kills all the opponent player’s units wins.

Technologies

In this 3D project I have tried to clone the XCOM game behavior and explore the unity engine features. I have Used:

Patterns:

Grid Map:

  • Grid Map is a 2d List of tile, each tile have some properties, and than I have created a Graph to make it easier to implement A* Algorithm to calculate the shortest path between 2 nodes.

State Machine Pattern

  • I have used State machine patter in the Unit Class so that I give it the current Condition (State) and define its behavior, each state I made is independant from an other and the code is self contained.
    I also used this State Paterrn to define the GameManager behavior and separate between the PlayerTurn and the OpponentTurn

Command Pattern:

  • I have used this Pattern so that the player can do multiple action consecutive on a unit. For example the unit can move to some destination and than when finishing moving it reload automatically.

Custom Event System:

  • I have Used ScriptableObject, Generic Class, Unity event system and Observable Pattern to create my Custom Event System, I have used this system to notify the GameManager, update the UI…
  • Using the ScriptableObject to create an event type and making the UI Listen to that event, the benefit of my event system is that I can create what ever Type of Event and pass any type of params to the callback function, and make the UES know what’s excepting to receive at run Time

Shader Graph:

  • Since I have Used Universal Render Pipeline, I had to create my custom Shader to make some units blink when ever they are fluncked

--

--