Unreal Engine/C++
Individual University Project
Development Time: 3 months
Inspired by games like Animal Crossing and House Flipper, this project is a limited simulation tool that allows you to move about decors just about however you would like... well, with some small exceptions. With the furniture available to you, feel free to mess around and place them wherever you please.
This was made as a portfolio piece in my third year in university, showcasing my first experiences with C++, and utilizing object-orientated programming concepts to build a functional, but also accessible game.
Moving furniture is the basis of the game. All that it requires is dragging the object around. If an item is clicked, the game will check the mouse position relative to the world, using cursor hit results, and move the item above this point, and releasing the mouse drops the item.
Double clicking acts as another method of control, as a way to reset the position of the object. Setting a timer of between each click and comparing the time to a variable allows a double click to be determined and registered.
The last type of movement is rotating the object in three axis. Rotating the item itself is simple, just requiring a function to modify the quaternion value, but only doing that would make the item rotate relative to the game world space, making it awkward to rotate at different camera angles. This is resolved by taking into account the rotation of the camera, and finding the difference between it and the desired rotation direction.
One rule of the game is that the furniture are not supposed to overlap one another, or with the walls. If this happens, the game will simply teleport the furniture back to its last position.
There is also a type of furniture that hangs on walls. These inherits from the base script, but includes minor differences, like physics and overlapping rules. These items inversely should always overlap with walls, so an important check is required before placing it. With how collision functions are called in engine, we had to use an intricate way to determine if the wall décor is currently overlapping, by checking if there is any overlapping actors, and if those actors are marked as walls.
Games settings allows for a more comfortable experience for the player. I have included a few modifiable options, mainly key bind changes.
How modifying key bindings work in code is to remove the previously bound key to the action, then binding a new key to this action, effectively replacing the key. Directional inputs such as rotational controls in this game has two input keys per action, so I had to make sure to remap the correct action. This is done by checking the direction of the input as well, so to only replace the key of this direction of the action.
Unreal Engine has two types of scripting available: C++ coding, which was mainly used in this project; and visual scripting through blueprints, a more user-friendly method of building code by arranging nodes in a flowchart. The engine allows for scripts of both styles to communicate with each other, namely by using the function specifier BlueprintCallable to allow for a function to be used in a blueprint. Since the settings menu requires the use of the widget designer, I've decided to make utilize blueprints to help in deciphering user input in changing key bindings.
In order to make the game more easily understandable, I've also included controls to be shown in the user interface. The controls settings would also be applied to this text, modifying the text to show the key bindings to whichever key the player has set to for each action.
There are a multitude of actions available to the player in this game, but not all actions are immediately accessible. This is why I decided to have a more dynamic user interface to show user controls, so to not overwhelm the player with too many options at a time.
Here is an example of how the controls is shown. As clicking is the primary action to be used, a single-line prompt is shown to tell the player to start by clicking in the game. Clicking anywhere on screen rotates the camera, hence camera controls is only shown when the player does so. Finally, clicking an object in the game allows manipulation of the object's position and rotation, and the player will be able to see the list of controls dedicated to this when an object is selected.
As a way to enhance the experience a bit, a slight delay is added to the movement of an item. By adding linear interpolation when moving the object between two points, the motion of the movement becomes less stiff, allowing the visuals of the game to seem smoother.
Lastly, I've also included audio feedback in the game. Similar games did this by adding a clicking sound in picking up and dropping items, so I recorded a clicking sound myself and modulating the audio pitch to differentiate between picking up and dropping. This audio is then played at the location of the item when clicked and released.