Building the Gameplay Loop

Justin Nearing

We’re already off track getting Designing Core Gameplay LoopDesigning Core Gameplay Loop to spec.

I’ve added skeleton PhaseManager, PhaseController, and SetTonic phases.

Committed the empty, but compiling classes to Git:

Refactor Before Create

I want the SetTonic object to receive a PlayerSetNote event from an AudioPlatform.

This is an AudioPlatform:

Unreal C++ has macros for delegates, which manage functions that fire events:

So I need to get my Audio Platforms to fire the “Player Set Note” event.

Here’s the thing, AudioPlatforms are still pure blueprint:


So, before I start firing the Player Set Note event, I need to create a C++ blueprint component that will be owned by this AudioPlatform blueprint.

As you can see, Audio Platforms are responsible for a lot of things:

Visualize the Musical Note of the Platform

One of the first features I built for the game was a system that converts pngs to a particle system.

This is all captured in Floating Number Particle System

Basically it takes an array of characters [ 'F' , '#' ] , converting each character to a particle system, and displaying those particles above the platform.

Unnecessarily complicated? Yes.

But it’s cool, and that’s been good enough for me.


Play the Musical Note of the Platform

The other thing the AudioPlatform blueprint does is play the audio cue associated with the Note.

First it detects if the platform has collided with the player:


It then does this “visual code smell”:


We switch on F# and play an audio cue mapped to F#: