3rd person camera, character movement, inventory, and clothing system

Welcome to Sandy Acres
This is a small project game I am currently developing in Unreal Engine 4 to gain experience in implementing gameplay features. The game’s setting is currently loosely set in a post-apocalyptic ‘zombie’ scenario. The final vision for this game will combine action combat, base-building, and RPG elements. The primary goal for working on this game is to increase my proficiency in Unreal Engine 4 and C++, as well as familiarizing myself with game development workflow in general and asset creation.

Third Person Controls
This is a demo of a third person control scheme. The camera follows the player, however it freely rotates with the middle mouse button and the mouse’s movement. The combat system also includes aiming which is done by right clicking to aim-at-mouse on screen. Character movement is accomplished with WASD for 8 direction movement.

Third Person ranged attacks
The aim-at-mouse functionality was an interesting challenge to implement for this third person control scheme. Simply rotating the character to face the position of the mouse hit on the landscape wasn’t the correct option, since the player’s aim would be slightly offset from the cursor, especially when aiming to the left or right (picture a top down oblique view, with a line extending from the character’s feet to the cursor; the bullets would pass above the cursor since the gun is on a different vertical plane than the feet). To solve this I decided to use trigonometry to calculate the rotational offset so that the character’s gun always points in the cursor’s direction; however, there are other ways to solve this problem. Attacks are done simply with a line trace that extends from the gun’s muzzle in the direction of the character’s rotation to check for hits.

Melee attack
Melee attacks are implemented with hitboxes on the melee weapons. During an attack swing, overlaps with enemies are checked to see if the weapon has “hit” anything, and damage is applied accordingly.

Item, loot and inventory system
The item system is implemented with structs that store item properties; i.e. name, image, value, weight, etc. This way, item data can easily be transferred, either to an actor in the world representing that item, like a gun on the floor, or into the player’s inventory. This also makes it easy to display what is in the player’s inventory by accessing the properties to display on screen, like the name, weight, value, image, and quantity of an item.

Modular Clothing
This was accomplished by first creating meshes in Blender that all share the same rig and animations; i.e. body, jacket, pants, etc. They are then imported into UE4 sharing the same skeleton, and switched out during runtime.

Spline mesh actors with world aligned textures
In addition to gameplay features, I also wanted to be able to efficiently build the map and it’s scenery. Fortunately, UE4 has a robust material editor. Using multi-layer blended textures that are world-aligned, scenery objects can be created that will blend in better with its surroundings. Also, large items like walls or roads can be made of smaller repeating meshes without worrying about aligning texture seams.

Click and drag to move
This is an alternative camera movement control scheme, which allows the user to click an area on screen that becomes “fixed” to the mouse cursor in order to move the user’s view around.

Leave a Reply

Your email address will not be published. Required fields are marked *