/
Physics driven loot dropping & pickup.

Physics driven loot dropping & pickup.

This document explains the need for a physics driven loot system.

What loot currently does:

  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 on a looping bone-animation 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.

Why it needs improving:

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.

Physics Driven Scattering (ie: Loot Pinata)

Intended Design:

  • When enemies are destroyed or chests are opened = release their loot as one or more 2D sprite objects which contains a physics collider that will allow it to bounce off walls, the floor, and static dungeon objects and finally come to rest on the floor.

  • Some objects such as treasure will be small and comprise of multiple2D sprites. (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 for a set amount of time.

 

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 the Player Character or UI location:

  • When it picked up by the player character. One of two things should happen.

    • 1) The sprite travels to the player character and then vanishes upon contacting the player character. Examples:

      • Treasure, Materials, and Essence will travel to the player character.

        OR

    • 2) The sprite changes properties to become a UI object (Or just transition to the UI sprite layer) and then travels to its associated UI Element. Examples:

      • Health Pickups travel to the health display.

      • Keys travel to the key display


  • 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) = Global Int: Value Treasure

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

  • Essence (Purple Color) = Global Int: Value Essence

  • Materials (Green Color) = Global Int: Value Materials

  • Keys = Tired to Global Int: Chest Keys

Loot UI Destination Locations (In location and Unity Gameobject:

  • Treasure (Gold Color) = Travel to Player Character

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

  • Essence (Purple Color) = Travel to Player Character

  • Materials (Green Color) = Travel to Player Character

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

Locations on screen:

 

Proposed “Exposed Values” for the Designer in the components inspector:

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

  • Spawn Position = An XYZ 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 that contains all the art assets for the visual object. This object will be spawned the number of times associated with the loot. ie: 1 object for a key. 5-10 objects for treasure.

  • For each loot object = Number of Spawned Prefab Object 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.

  • Distanced Traveled = How far away from original position it travels.

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

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

Value Name

Value Type

What it does?

Value Name

Value Type

What it does?

Spawn Position

Vector3

Spawn position of Loot sprites

Inactive Time

Float

The time in seconds that a pickup that has just spawned cannot be picked up. ie: 1 = 1 second. 0 = Instant.

Spawn Prefab Object

GameObject

A prefab made by the designer that contains all the art assets of the spawn.

No of spawns per unit

Int

The number of prefab spawns per unit.

Gravity Force

Float

How intense does the object fall to the floor.

Number of Bounces

Int

Number of bounces the sprites have before coming to a stop.

Distance Traveled Min

Float

How far the sprites travels - The minimum distance.

Distance Traveled Max

Float

How far the sprites travels - The maximum distance.

Travel Time Min

Float

Min Time in seconds it takes from spawn to stop moving.

Travel Time Max

Float

Max Time in seconds it takes from spawn to stop moving.

Dungeon Wide and Player Character Values

  • The radial size of the collection radius Measured in XYZ position units as a float.

Value Name

Value Type

What it does?

Value Name

Value Type

What it does?

Pickup Radius

Float

The distance in Unity units as to when pickups near the character are collected.

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.

Loot Being Picked Up Values Table

Value Name

Value Type

What it does?

Value Name

Value Type

What it does?

Type of Destination

Int

0 = Player Character

1 = UI Position

Travel Time Min

Float

The min time it takes to travel from being triggered to be collected to its final destination.

Travel Time Max

Float

The max time it takes to travel from being triggered to be collected to its final destination.

Travel Curve Angle Intensity

Int

The degrees of an angle that dictates the curve the sprite travels moving from ground to end location. eg: 0 is a straight line. 45 degrees give it a larger curve.

UI Destination Position Object

GameObject

The UI Object that the sprite travels to if the type of destination is a UI position

Pick Up Trigger - Playmaker FSM Location

GameObject

The object attached to a Playmaker FSM component

Pick up Trigger - Playmaker Event Name

String

The event that’s triggered on the associated Playmaker FSM component

Destination Arrived Trigger - Playmaker FSM Location

GameObject

The object attached to a Playmaker FSM component

Destination Arrived Trigger - Playmaker Event Name

String

The event that’s triggered on the associated Playmaker FSM component

 

Related content

Navigating Dungeon Floors
Navigating Dungeon Floors
More like this
Production Doc - Dungeon Floor Object Hierarchy
Production Doc - Dungeon Floor Object Hierarchy
More like this
Player Movement Controller - Dungeon Movement
Player Movement Controller - Dungeon Movement
More like this
Dungeon Environment Assets - Wings
Dungeon Environment Assets - Wings
More like this
Locked Chest Encounters
Locked Chest Encounters
More like this
Level Tile Designs
Level Tile Designs
More like this