New Feature: Physics driven loot dropping & pickup.

This feature comprises of the implementations needed for “loot” to drop from enemies and for it to be picked up by the player character.

What loot currently does and why it needs improvement:

  1. Loot is currently very static and rigid in appearance. When an enemy dies they drop a single sprite of loot that stays on that tile and floats until collected. There’s nothing dynamic about it.

  2. When loot is collected, it just vanishes and there’s only a very loose connection to associated UI elements such as numbers counting up for a second.

This experience needs to be improved as it’s such a consistent and frequent aspect of playing the game. Right now it doesn’t feel or look rewarding.

Loot Pinata’ing and Physics Driven Scattering:

Intended Design:

  • When enemies are destroyed or chests are opened I’d like for them to release their loot as one or more 2D sprite object/s which contains a physics collider that will allow it to bounce off walls and dungeon objects and finally come to rest on the floor.

  • Some objects such as treasure will be small and comprise of multiple objects. (eg: 1 treasure value = 1 sprite) With high levels of distance deviation away from the originating tile.

    • Other loot objects such as a key will be singular and not deviate much from the original tile. Dropping to the floor quickly and being picked up just as quickly if the player was still standing there.

  • This physics collider will drop the items to the floor in a dynamic way and these loot objects will bounce a few times before coming to rest on the floor.

  • These Loot objects will bounce off and not occupy environmental tile spaces that contain objects like pillars, walls, and tables.

  • Once the loot object comes to rest it will no longer move around until it is picked up by the player. It will lose its Dynamic Physics once it comes to rest.

  • NOTE: Dropped loot should not interact (ie: Bounce off) the player character or enemies. It should ignore them entirely while in motion.

 

Player Loot Collecting:

  • The player character will have a “Loot Collection Radius” around them that will determine how close they need to be to loot in order to collect it.

  • The larger the radius, the more area the player character can pick-up loot without needing to travel to each individual tile.

  • This size radius will be a tweakable value that the player will be able to improve as the player progresses through the game.

Picked up Loot Traveling to a UI location:

  • When loot is picked up by the player, the 2D object sprite that represents that loot will transition into becoming a UI object (Either by just switching its visual layer to that of the UI, or destroying it and replacing it with a UI Friendly object in the same location, whichever is easier to implement.) and then travel from it’s current world location to a pre-selected location on the UI.

  • This pre selected location will correspond to the type of loot that it is. ie: Treasure Loot will travel to the treasure UI location. Health to Health. Etc.

    • I’ll be making an inventory icon on the UI to handle “Miscellaneous Items” travel location.

  • This should have tweakable values such as speed of travel, the “Curve” of travel the loot takes to hit the UI, etc. So the designer can experiment and find the right conditions.

Key Info for helping Developer Implementation:

Loot types and associated FSM global variables:

  • Treasure (Gold Color) = Tied to Global Int: Value Treasure

  • Health (Red Color) = Tied to Global Int: Player Health

  • EXP (Purple Color) = Tied to Global Int: Player EXP Total

  • Keys = Tired to Global Int: Chest Keys

Loot UI Destination Locations (In location and Unity Gameobject):

  • Treasure (Gold Color) = Gameobject Location in Unity is named “Treasure Readout”

  • Health (Red Color) = Gameobject Location in Unity is named “UI Willpower Hearts Manager”

  • EXP (Purple Color) = Gameobject Location in Unity is named “EXP Front of Bar - Location”

  • Keys (Key Sprite) = Gameobject Location in Unity is named “Keys Readout”

Locations on screen:

 

Proposed “Exposed Values” for the Designer:

Loot Dropping Values (This is for each type of loot)

  • Spawn Position = A location associated with a game object so a custom spawning position can be made per enemy / chest.

  • Spawned Prefab Object = Will be associated with a prefab.

  • For each loot object = Number of sprite objects spawned per Number associated with dropped loot.

    • EG for treasure: 2 Treasure = 1 Sprite Object. So if killing the enemy drops 20 loot. It drops 10 objects. Collecting each object will grant 2 loot.

  • Gravity Speed of dropped object = How fast it falls.

  • Number of bounces = How many times it bounces as it dropped.

  • Horizonal deviation = How far away from original position it travels.

  • Time to Valid Pickup = How long (measured in a float / fractions of seconds) until the object can be picked up by the player characters collection radius.

Player Character Collection Radius Value

  • The size of the collection radius

Loot Being Picked Up Values

  • The travel time (measured in a float / fractions of seconds) from the current loot position in the environment to the UI destination position

  • The designated UI destination position.

  • Travel Curve Intensity = A value of 0 would be just a straight line travel. A value of 1 would be 180 degree swing. (In reality the curve will be set around the 45-90 degree mark.)

  • Playmaker SFM event location and name that triggers upon the loot being “Picked Up”

  • Playmaker SFM event location and name that triggers upon the loot hitting the designated UI destination position.