(Note: Reverb functionality with platform Y-scaling does not work in WebGL build, reverb filter component not supported)

HOW TO PLAY: Point and click; same instructions as included in bottom left, with addition of ability to hover and change X-scale (horizontal double-sided arrow cursor), Y-scale (vertical double-sided arrow cursor, scales with ) and position (hand cursor). Platform colors: blue = kick drum, yellow = hi hat, orange = snare drum, green = toms, purple = piano (D minor blues scale, one octave range)


(Full-ish documentation/post-mortem/etc. below; download links for Mac build, Windows build, and Unity project at bottom)

____________________________________________

For this assignment, my main focus was on taking the SoundToyBasic example project and adding additional functionality - the ability to grab and move platforms, the ability to stretch platforms horizontally, and the ability to expand platforms vertically within a range (which corresponds to a few parameters on an attached SFX Reverb component). With these changes made to the SampleBounce script and its corresponding prefab, I then created five new sample-based platforms which are implemented in the project, with a focus on creating a somewhat playable drum set.

PLAYING: Base functionality is the same as described in the bottom left instructions, with a few added things - hover over the Y-axis borders of a platform and a vertical double-sided arrow cursor will appear. Use this to drag up or down (essentially away from the center) and the Y-scale and reverb parameters will shift accordingly. Similarly, hovering over the X-axis borders will bring up a horizontal double-sided arrow cursor, with which you can click and drag the corresponding end of the platform around as you would during the initial creation. The hover detection is a bit finicky at smaller sizes for all of these, but you can also grab a platform at its center and move it around without changing its scaling! Platforms (in Tab order) play a kick drum, hi hat, snare drum, toms set, and D minor blues scale on piano. See below for a brief demo of an end result:

Please don't spend too much time trying to read through my absolute spaghetti code! Used this project as an opportunity to refamiliarize myself with some aspects of Unity I haven't touched in a good while, and the code ended up suffering from some serious rush and feature creep while I was still getting a handle on those aspects and the overall project structure for the provided base game. (Commenting is also incredibly sporadic!)


See below for more detailed description on included work:

PLATFORMS:

  • These prefabs are all contained within Prefabs > RhythmPlatforms > EvanPlatformPrefabs. All drum set sounds were created using GetGoodDrums' Modern & Massive within Logic, then bounced.
    • Kick (Blue)
      • Different files were created using the same drum at different velocity values
    • Hat (Yellow)
      • Different files were created using hi hat using progressively more open playstyle, progressively higher velocities
    • Snare (Orange)
      • Different files were created using the same drum at different velocity values
    • Toms (Green)
      • 6 samples, 2 per drum (hi, mid, floor), progressively higher velocity from high to low
    • Piano (Purple)
      • Created using EastWest Pianos Gold (Bosendorfer); at the same medium velocity, recorded short sustain of each note within 1 octave of D minor blues scale (D2-D3)

NEW SCRIPTS:

  • CursorManager
    • This started off as a simple singleton to track what the player cursor is currently hovering over/prioritizing, and then change the cursor icon accordingly. While that's still the majority of the code in the actual script, it also ended up becoming a disorganized home for some central activity-tracking variables. Keeps track of what object is targeted by the cursor, what the cursor's current priority is, whether the cursor is currently acting on a target or if the target can be changed (cursorBusy), etc.
    • Would have been ideal to implement cursors as GUI elements instead so they can rotate with the platforms but oh well
  • DragEdge
    • This is attached to the X- and Y-axis colliders that are targeted by the mouse in order to do the X- and Y-scaling stuff. Brings these colliders to the front when hovered over in order to help reduce accidental deselection, communicates with CursorManager. I tried a few methods of scaling, but ended up doing an adaptation of the ProcessMouseInputs function (and the other three functions which are called by it) that seems to work. Y-scaling is more separate, but X-scaling uses pretty much the exact code from TryUpdate in ExtendedPlatformCreator with a few adjustments. Communicates reverb adjustments to SampleBounce using SendMessageUpwards and ratio of current width to minimum width.

CHANGED SCRIPTS:

  • ExtendedPlatformCreator
    • Very messily integrated the hand-dragging effect here alongside the currentPlatform tracking. Integrated this and the initial platform creation functions with CursorManager, added conditions to distinguish between whether mouse inputs are being used for creation or movement.
  • SampleBounce
    • Added reference to SFX reverb component, added mouseover/mouseexit functions to communicate with CursorManager to allow ExtendedPlatformCreator to move existing platforms. Added yScale function that gets called from DragEdge. The reverb isn't exactly processing-efficient; ideally reverb would all be processed on a few mixer groups with different settings that get sent to in varying amounts, but Unity doesn't let you create new mixer groups at runtime (even cloning and renaming one ends up just referencing the same one), so each platform is created with an SFX reverb plugin for its audio source. This works fine for now, but isn't super scalable - for example, if we were to add slight pitch variation to the playback to prevent things from sounding too repetitive, we'd need to create (and later destroy) a new audio source on every hit. Every one of these sources would then be running its own reverb plugin, and this could definitely get out of hand. (Part of why middleware makes things so much easier!)
    • I should really have used logarithmic scaling for the reverb properties but oh well
  • BallSpawner
    • Included a physics check here to ignore layer collision with the colliders used for DragEdge.


There are probably other things that I did, but I've lost them among the chaotic commenting. But yeah! That's the project! Next features would be to add in-game tempo control, ability to add/move ball spawners, and a few more quality-of-life changes.

Download

Download
Evan Wardell_Music and Gameplay Assignment 2_Unity Project.zip 81 MB
Download
EvanWardell_SoundtoyPrototype1_Mac.app.zip 21 MB
Download
EvanWardell_SoundtoyPrototype1_Windows.zip 21 MB

Leave a comment

Log in with itch.io to leave a comment.