Tag: destructibles

  • Smash it up, smash it up!

    Smash it up, smash it up!

    Property damage is a key part of the superhero genre. If you’re not punching each other through walls or throwing streetlights like javelins, you’re not doing it right!

    This is what I tackled this weekend, specifically picking up and throwing props as weapons.

    Freedom Force did this really well, with a pick up action that allowed you to carry a car or other throwable above your head, during which time other actions were locked out. You could throw it at a target, delivering heavy damage and knockback, and dropping fliers out of the sky.

    The author of the Suicide Squad mod for Freedom Force came up with the brilliant idea of spawning an invisible character to pick up and throw objects to simulate telekinesis. I co-opted this idea into my FFX system.

    City of Heroes sidestepped this with special powers Hurl and Propel that summon a physics object for the characters to throw, due to the technical and design challenges of an MMO. These were basically just ranged attacks with some cosmetic trickery.

    Champions Online followed suit from Freedom Force, in a multiplayer environment.

    In the Unity RPGRules engine I wrote, I had this exact pick up and throw mechanic working. Throwable objects had invisible bars on them, the player could approach an object and pick it up if they were strong enough, finding the best invisible bar to grab.

    But on reflection, this isn’t necessarily the best game design option.

    Pick up and throw is a setup-detonate action. You see the nearby prop and it’s a special opportunity. You then need to orchestrate the right distance, clear line of sight and so on to make it work for the pay-off of big damage.

    The two stage action of pick up and throw with lengthy animations mean that by the time you’ve launched your projectile the target is already hitting you, or defeated. Freedom Force allows you to stop time, whereas Esperanto does not.

    I wanted to make it easier and more fluid to grab an object and throw it.

    Unity RPGRules had a TK status effect that worked like this.

    • If you have a primed object, you throw it at the target
    • If the target is a throwable, you prime that object, and it hovers in mid air until thrown.
    • Otherwise, find the nearest throwable object to the target and prime it.

    I decided to replicate that pattern in Esperanto. As for physically picking up and throwing, with the last point being that you find an object near you. I’d get the character to do a one handed scoop animation followed by a throw.

    I figured the easiest way to present this to the player was as a power you can buy. Amazing Strength now has Throw Object. You can enhance it to allow you to pick up bigger objects.

    This way you can keep your target on your opponent, run near a throwable and just double click to scoop and throw in one fairly smooth movement. I still lok you out of using any other powers while carrying a throwable in your hand.

    A whole big task list came out of this…

    1. Get TK working, so you remotely pick up and prime objects, then throw them.
    2. Make the thrown objects do damage on hit, to both the target and themselves
    3. Add mass and conditions
    4. Get Throw Object working using some settings in the TK effect to glue the object to the characters hand and freeze their animation with their right hand up in the air.
    5. Intercept the animation when you throw to be a throw rather than a pick up
    6. Make sure the object’s physics get turned off while you’re carrying it, and get turned on again for the throw.
    7. Add Visual FX eg hovering TK objects get a customisable particle effect on them.
    8. Get the AI to use this sensibly.
    9. Make sure the character drops the held item if they’re mezzed, killed or knocked back.

    The AI of throwing objects

    I use a method called Utility AI. Each power can evaluate how good it is as a single number, with a chosen target, and then a weighted random roll determines which one is picked. That power is then executed.

    The standard Execute code is:

    • Are we within range? Do the power.
    • If not, run at the target to get into range.

    With Throw Object this becomes more complicated:

    • Am I holding an object? If so, throw it!
    • If not, find the nearest object I can pick up and throw. Is it in range? Pick it up.
    • If not, move towards the nearest object.

    This starts to resemble Goal Oriented Action Planning, a more sophisticated AI technique that deals with chained goals. I’ve managed to shoe-horn this behaviour into Utility AI for now, and its working well enough for a first pass, as the video shows.

    I then had to make a Telekinesis powerset to support the TK status effect, one which felt distinct enough from the existing Force Fields set. Luckily, I had the pieces pretty much in place for:

    • A direct knockback attack.
    • A reverse knockback equivalent.
    • A TK Disarm that pulls the targets weapon to you
    • A short-lived buff to yourself or an ally that redirects all projectiles for the next few seconds. (If you want better protection, look in Force Fields)
    • A simple passive buff that extends your “Reach” so you can use interactable objects from a distance.
    • A TK hold toggle that leaves the target held in mid air as long as you continue to expend energy on them.

    And that was Saturday!

    I need to make a TK villain for you to fight next!