top of page

Twilight Soldier: Dusk

Twilight Soldier: Dusk is futuristic 3D hack and slash game. The game takes place in a ruined city which is involved in an invasion from the Throne empire who wishes to take over the rare resource found by them. In this project, I contributed my inventory system, crafting system and hotbar/quickslot and two A.I implementations. Aside from those works, I also helped designers or artists to solve their technical problem when building the environment in Unreal Engine 4, the merging of two different map is also my job to prevent the tech side most of the work crashes when migrating to artist's new environment.

Game Engine:

Language Used:

Primary Role(s):

Group Size:

Development Time:

Unreal Engine 4

Blueprints

Gameplay Programmer, AI Programmer, Generalist Programmer

15 (3 Designer, 6 Artists and 6 Programmers)

14 weeks

Inventory System & Crafting System & Hotbar

I created an inventory system and Hotbar functions for the early game development because of document specifics., but got scrapped afterward as designers said no longer needed. The inventory uses 32 slots, the first 16 slots are material based and the rest 16 slots are player's personal slots. Material based slots are only resources to preview how many resources the player has, and the personal slots are for specific items such as potions, tools to be used. Inventory is tied with the Hotbar system that I did. 

​

The window can be swapped between Materials and Backpack. The gif below shows during prototype of what I did with the inventory system, crafting system, Hotbar, including pickups, discard, uses etc.

Each Item type can be customized how many maximum stack for each slot, and maximum amounts that the player can carry as well, including the crafting requirements. 

Hotbar consists of 4 quick slots. The upper slot can be customized by going into inventory and select Bind to lock it there, then the left and right slots are determined by the lower slot's current selected item previous slot or next slot.

Crafting System only uses 1~3 different types of materials to craft an item. The crafting recipe can be easily adjusted from the crafted item's section where you set your desired materials.

Code Snippet </> of retrieving required materials for crafting the item.

Artificial Intelligence

I used behaviour tree for the A.I development. We have 3 enemies type for the game, all the enemies share the same movement type before combat, such as patrolling and detecting player. My partner (Shaun William) who firstly proposed the structure of the behaviour tree and explained to me, where he took care of the base structure of the behaviour tree and fist enemy (First A.I), then I took care of the interruption system where enemy can be infinitely staggered system, Shield A.I and Gunner A.I including combat, shooting, repositioning, blocking etc. 

Gif showing that how gunner retreats using the system below

The following part below is a code snippet of how I design the Gunner A.I retreats when player hits it and the A.I finished staggering.

The way of designing the retreat is that the A.I will check angle of player-facing the gunner, then using the angle to perform sin and cos to form a circle that center is based on the player character. The position calculated technically behind Gunner position first, then it will use ray casting to check out whether the location behind the gunner is reachable, otherwise it will increase the min range and max range which increases the angle to expand the retreating point become wider so even if the backside of the Gunner is obstructed, they will seek out an alternate way such as left side or right side or even the backside of player.

 

Ray casting specifics to WorldObjects and ArenaBarrier which can be blocked

The found path is inversed to check whether if the enemy found a path otherwise, it expands the retreating point by increasing the angles.

Copyright © 2022 by Yee Zhan Quan.

bottom of page