Archive:
Ok today’s the day. My button spawns a duck. That required:
GameState
to be able to track in-game events, as well as query themRoomControlledObject
interface, so they’re not visible ALL THE TIMEI couldn’t decide how to handle the new Duck’s pickup. Normally, I’d knock up a BP, set a load of Player State
directly, and start coding. Then I remember the Attribute Effect
system I wrote a while back. It needed a tweak to apply Gameplay Tags
from a pickup, but that was easy enough.
Tomorrow; I’ll get the Player Controller
to poll the Player’s active Tags for xxx.Duck.Carrying
and block the Jump. Death can remove the Tag. Room transition can award the Duck. It should end up being quite tidy!
Made a bespoke class for Duck pickups, and added code to the Game State
that tracks which Ducks have been collected. Room Entry / Exit is handled correctly, Ducks know when to disappear, and collected Ducks should kill themselves when the map loads.
Polished up the first little cut-scene: timing is improved, and there’re some sparkles in the air when the Duck appears.
The afternoon was spent putting a standing desk together and rearranging my office. I’m not expecting to stand all that often, but it’s nice to have the option. Unfortunately, my USB cables are a little short. One popped out the back of the PC and broke the port on the motherboard. Shakes fist at the sky
The Player Controller
can poll the Player State
for Gameplay Tags
and abort an Input Action
if they’re present. Aborted actions can trigger a rumble on the joypad, and fart out a little audio noise. When you’re carrying a Duck, jump is blocked, and the pad rumbles to let you know. Wheee!
While I was in there, I changed the “B” button to be a generic cancel. If the player’s jumping, it’ll cancel the Jump. If they’re carrying the Duck it’ll “drop” it by asking the player state to remove the relevant Gameplay Tag
. To stop the Duck constantly polling, I added OnTagAdded
& OnTagRemoved
delegates to Player State
. Anything can bind to these and be sent the Gameplay Tag
that’s been added/removed, and respond accordingly.
Bob’s your Uncle. “Carry Ducks”, that the player can drop, are in and working. The only thing that’s missing is the GameMode
handling the reward when you go through a door.
Oh yeah, I stood at my desk a couple of times today. Change is as good as a rest, and all that.
The rooms in the first game were stateless. This was a side effect of them being unique scenes. When you entered them, under the hood a new scene loaded, and as a result everything was at the default position. Objects tied to in-game events polled the global state – a load of booleans (true or false values), for questions like: “Has Player Done X” – and then sorted themselves out accordingly, mostly by deleting themselves, but occasionally by moving to their “final” location.
This time, all the rooms are in the same level, meaning objects will be in the configuration that you left them when you exited. I was getting the “reset” for free in the first game, and I had to decide which way to go in this time.
I decided to honour the original and make the rooms reset when you enter them, but the interactive elements I’ve made to-date needed an extra bit of logic. I’ve done this for the switches and moving platforms, but it brought up a couple of niggles. The worst being that the GameState
isn’t loaded in time for the initial room checks on map load. So I did a quick hack to get around that, until I properly handle save games.
I also made pressure switches, moving platforms that respond to them, and variants that enable/disable switches when they’re in a certain position. Oh, and the Duck is getting collected when you exit the room.
I’m calling it, this room’s officially DONE.
Friends:
If you like any of my work, please consider checking out some of the fantastic games made by the following super talented people: