Wake Up Devlog Week 6
- Tristan Atkinson
- Oct 28, 2024
- 4 min read
Updated: Apr 20
At the start of this week, I was beginning to have doubts about my item design. Looking at them critically, I began to suspect I could use subtractive design techniques to hone them in to compliment my Game’s core design pillars better.
The issue is that my items were designed to give very small incremental boosts which would incentivise extensive character building with them. While nothing is wrong with this on its own, the focus of my Design Pillars lie in the progression of the Game itself; and to this end I think that giving the Player access to fewer items with greater effects would pull attention away from meticulous character building, and more towards the decisions of rooms progression.
Unfortunately, I was busy for the first 4 / 5 days of this week, so I was worried I would not be able to finish my sprint this week. Luckily for me, the work I had planned for the week took me only a day, due to the shop encounter being FAR easier than anticipated to implement.
I began by removing the ‘Default Pawn’ from the Gamemode, as I wanted to handle Player spawning manually (especially with selectable player classes). I created a Blueprint called “BP_PlayerSpawner” and replaced the ‘Player Start’ with it in each Sub-Level which the Player can walk around.
On Begin Play, the Blueprint checks if a “PlayerCharBase” Object Reference in the Game instance is valid.
If it is not valid, the Blueprint gets a “BP_PlayerCharBase” class reference called “Chosen Class” from the Game Instance, and spawns it with its own transform.
If it is valid, then it sets this Actor’s Class to its own transform.
The reason this works, is because Actors spawned without an owner belong to the persistent level; so at the end of each level, I save an object reference to the Player Character in the Game instance; and since said Player Character belongs to the Persistent Level, it is not unloaded along with the rest of the sublevel I unload, which means I can move it from level to level easily without having to save and load data to new Player Character actors.
I also switched the Level loading and unloading logic to the Game instance. As it is a Game instance, I can run this from any sublevel, and it allows me to easily call the event for saving the Player REF etc. at the same time. This event has soft world reference inputs (one for level to load, one for level to unload) . It is easy for me to drag this event call into a blueprint and set what level I want to move to and from with no additional code.
After this, I created a Placeholder Sub-Level and UI for Room choice. As of present, the room loads a UI with two buttons: one loads the Combat Encounter, and one Loads the Shop encounter.
As I mentioned before, the shop encounter was far easier than I expected. I created a placeholder Sub-Level which consists of a small cuboid for the player to stand on, as well as four of a new Blueprint I made; “BP_ItemSpawner”
On Begin Play, it will run its “SpawnItem” event.
Its spawn item event uses a random float between 0.0 and 1.0 to determine the rarity of the item spawned. (<0.5 for epic, <0.35 for rare, and greater than both for common). It will then spawn an item from the corresponding array (one of “BP_CommonItemBase”, one of “BP_RareItemBase”, one of “BP_EpicItemBase”).
After this, I created a new Child of the interactable base called “BP_RestockShrine”.
In its “OnInteract” event, it gets an array for all actors of the “BP_ItemSpawner” class and puts them into a for each loop. For each element, it destroys their item (done by setting the return value of their spawned item to a variable) and their ‘Spawn Item’ event is run again.
This was pretty much all I had planned for my sprint and I finished it in a day, so I decided to add some more polish to the features surrounding it.
After this, I decided to add a small bit of Player feedback for now I did this in the form of Interaction tooltips. When the Player’s line trace for interacting hits an interactable object, a tooltip will be displayed on the UI. By appending an “Interact Text” string and the “Interact Cost” int converted into a string, each interactable will say:
“[Interact Text] for [Cost] Currency” (Items without a cost only have the interact text)
Additionally, there is a separate text element below the aforementioned tooltip text in a vertical box in the GameplayUI. This text will display an Item’s “EffectText” text when an interactable that is specifically of “BP_ItemBase” is hovered over.
Finally, I added an “InteractFail” Event to Interactable Base. This event is called when the Player interacts with something they don’t have the currency for; this event gets the children of the vertical box I mentioned before in the gameplay UI and sets the colour and opacity of the elements to red for 0.5 secs before changing them back to white.
So when the Player interacts with an Item / Interactable they cannot afford, their Tooltip UI will flash red to give feedback that the Player IS interacting, they just can’t afford it.
The final venture I took was creating an “Item Screen” UI Widget, which would update to display each item the player collects, and offer the item name and effect in a separate window that follows the mouse when the icon is hovered over.
Comments