The writhing of the code


Hello! Torben here, figured I would write a bit about the development process. This devlog will outline what I did on the project and also some of the issues I faced to achieve it.

Room randomizer

The first order of business was to figure out the concepts, to fit the theme of "Stuck in a Loop" we opted for a 4 room level that circles back around. Of course, the game would get old quickly if these rooms remained the same. So When you leave a room, the previous room gets regenerated, this way they are never the same. The way the room generator works is with some editor scripting, but can also be used to generate at runtime.

  • Objectives: Each tile is marked as an objective.
    • Audio: The audio that should be played from the manager when the button is clicked.
    • Active Texture: The texture to use when the button is clicked.
    • Highlight timer: The duration the above texture will be shown.
    • BGM Change: Queues a background music change when the next loop of the ambience starts.
    • Tile event (ReadOnly): The actual tile event referenced for validating if everything works in the editor.
      • Completed: If the tile event was successfully executed (and in the right order).
      • CompletionIndicator (private): Above the door is an indicator to show if the correct block was triggered.
  • Size: The size of the grid to be generated.
  • Prefab: The default prefab used to generate the grid.
  • Interactable Material: the material the Active Texture should modify.
  • Door: The door to be opened when all objectives are completed.
  • IsCompleted(NotSerialized): Checks if the underlying TileEvents have been completed and returns true if they are.


Audio manager

Since it's the first time I work with a composer and he had no unity experience. I figured making a robust sound system implementation would be a good idea. I made a managed audio source system in Unity, that allows to play a sound with predefined settings from a scriptable object. That way we don't have to worry about sounds cutting each other off, because when that would happen a new source is created to play that sound (of course the sources are cleaned up when they have finished playing).

This system will definitely see further implementation and use, as I am actually quite happy with how this turned out.

Animation / Character controller

Making use of a Dictionary containing lists of Sprites for the animation was way more convenient and easier to set up than using the Unity built in animation system. all I did was use an enumeration state to track which animation should be played, and update the animation when a key is pressed / released.  trying to match the sprite animation with playing the sound from the  footsteps was not as straightforward as I had hoped, as the sounds kept overlapping (I probably could have avoided that with an audio source that's not managed by the manager now that I think about it). 

Furthermore there is no shadow casting for 2D sprites in the scene, soo I tried to come up with a solution by simply duplicating the sprite and laying it flat on the ground, its not actually a shadow but it gets the point across and adds a bit of depth.


Modular player

From a previous project I had noticed that making a single player script gets confusing rather quickly, so this time I opted for a different pattern. The player script is attached to a singleton in the scene to allow easy access everywhere, from that player object I have added all different components. I had at first used the unity load order settings, but I later opted for a more robust IEnumerator approach to wait for the Player instance. This way I can make the script run in any editor without needing to make sure that script has priority. All the sub-components are referenced in the Player script and can thus be accessed everywhere. The Sprite animator is controlled by the Player animator to set the correct animation from the new unity event input system.

Leave a comment

Log in with itch.io to leave a comment.