Week 5: Play Discoveries


This week, I experimented with the mechanics I added to discover quirks and interesting gameplay that can be made.  Here are some of my findings:


Before I started coding in this project, I already had the idea that moving and rotating platforms could serve as doors and platforms that would be opened by switches (triggers).   Here's the first door in the new scene:



Next, I tried using two triggers linked to one object to be able to move the platform repeatedly in more than one direction.


The two triggers are represented here as the left and right volume icons, as the green collider is disabled in-game so it's hidden.



Here, I use a trigger that the player activates (on top of the red tile) to move a dynamic object that the player cannot reach directly.  



I found this could lead to extensive, complex puzzles that use many triggers.  Now just to get good at playing and making puzzles....


This is the view for the puzzle in-game. Here's the view in the editor with all of the links drawn between objects using OnDrawGizmos:


These red tiles will be represented later with bright button or switch sprites. The dynamic boxes are also red for now to show that they are related to the triggers (this will be useful with playtesting later!)



When testing, I came across a not unexpected, but generally undesirable effect:  If a dynamic box is caught between a moving platform and another collider, the kinematic platform will clip through the box's collider and keep it in place.  This will probably be an effect to be avoided with design (and a future checkpoint reset mechanic).

This can also happen with puzzles, and cause a softlock:



I was also curious about the effect of how rotation of objects could affect a dynamic object.  This thought was in the same vein a the puzzle made earlier, where the player can make progress by remotely manipulating objects using triggers.  I tried making this line of kinematic triangles to make a conveyor belt of sorts that would move the box forward.



When the trigger above the conveyor belt is activated, the objects will rotate. Currently, I cannot rotate to a target of or rotate by 360 degrees, since the object will simply not rotate at all.  I plan on looking into this further later, but for now, I tried using a rotation of 180:



After activating the trigger, the player can push the box smoothly along the belt instead of struggling with uneven points.  I also tried to move the box only by repeatedly activating the trigger, but the triangles would sometimes launch the box backwards.  I think that using an object shape with more points will make a smoother rotation that can move the box all the way past the conveyor belt.



The last thing I wanted to test was how this new move/rotate mechanic could be used within floating boxes.  I thought that the platforms could push the player down manually against the float and be used in puzzles.  To test this, I set up multiple layered platforms that would activate when the player moves into the trigger collision:



Here's what it looks like after the player reaches the triggers at the long red tiles and causes all of the rotating platforms to reset to their original position, as well as move the top platform, allowing progression:


One issue I ran into is that at the bottom tiles, I had to layer two triggers on top of one another since the trigger can only set one rotation or move goal for multiple objects. If I want to have a different destination I need another trigger, and this results in piling triggers on top of one another.

An idea to fix this issue would be to move the transform functionality to each object individually and change the trigger to just take a list of objects to activate, and the exact transformation would be handled in the TransformObject script.  This would allow for me to use just one trigger to activate all of these platforms.  Combining everything into the TransformObject script could also allow me to combine the OnDrawGizmos code more easily and accurately.

However, there is a downside to this change: Rather than a trigger only being able to have one destination, each object only has one destination. This means that I would no longer be able to have objects move, rotate, or scale in different directions (this might also extend to other transformations such as enabling physics or changing color if I added it).


I'm not sure which direction I'd like to go yet, so for now I still have layered triggers.





I made a few coding changes this week as well.  Previously, rotating an object will take a target rotation, and it will be rotated to that degree coordinate regardless of its current position.  I changed it to be an offset that will add to the current rotation, allowing a trigger to rotate an object by a certain amount multiple times.

I also wanted to add a limit to how many times a trigger could be activated.  To do this, I created a trigger counter variable and a boolean to track if the trigger's uses are limited. 

Here are the variable new variable declarations in the beginning of the Trigger script:



Here, I increment the counter that tracks the number of times the trigger has been activated when the player enters the trigger's collision. Note that the green line next to the line number indicates code that has been changed then saved over.



This conditional checks if the number of uses on the trigger have been limited and the current use count, and disables the trigger if both of these are true.




Finally, I updated the OnDrawGizmos method to show this information in the editor for easy access.


Here it is in the editor:




Here's a playthrough of the prototype scene I made for making these play discoveries:

It's definitely a lot longer than the previous tests, since I'm starting to get into actual level design again. The puzzles seem like they will take the longest to solve out of everything in the future...



Here's a summary of my changes this week:

     Discoveries:

  • Use moving/rotating platforms as doors
  • Use multiple triggers on one object for more options
  • Move dynamic objects using platforms moved by triggers
  • Create large puzzles with the above mechanic, with more objects, triggers, and a specific goal
  • Moving & rotating platforms can clip through colliders if they are in the way
  • Use a "conveyor belt" of rotating objects to directly move an object / change terrain to facilitate moving an object
  • Use platforms to force a player against the flow of a floating box

     Code changes:

  • Changed rotation from a target to an offset
  • Added counter to track number of times a trigger has been activated
  • Added a max use variable & a limiter flag that limits the # of trigger activations
  • Updated OnDrawGizmos to show this


I'm excited to keep moving forward with this project, especially since I've begun moving into the design part of it.  Until next week!

Leave a comment

Log in with itch.io to leave a comment.