Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[Design] Sidescrolling spellcasting mechanics...halp!

Discussion in 'General Discussion' started by AndrewGrayGames, Sep 24, 2014.

  1. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,822
    For the sidescrolling puzzle/action platformer I've been working on in my game dev livestreams, Sara the Shieldmage, I'm finally at the point where I need to develop one of the game's core mechanics: the spellcasting system.

    For my mechanical prototype, I'm going to be creating the spell, Summon Block. It's the least flashy, but by and far the most practical of all of Sara's Shield Magic. It creates a luminous block of magic force that can be moved on, or can be used to absorb a projectile. Later abilities give the ability to weaponize this block by pushing it in a direction (it's a magical construct, so friction may not apply to it in all circumstances!) The block lasts only a small amount of time before it dissipates and requires recasting!

    I spent last night doing quite a bit of brainstorming, and watching YouTube videos of various sidescrollers with magic systems (e.g. Zelda 2: The Adventure of Link, Shovel Knight) And I came up with a few paths I could take:

    1. Casting a spell consists of firing a spell projectile at a location. The spell resolves into a more useful form when A) the spell reaches its maximum distance, B) the spell hits a solid object, or C) the spellcasting button is released by the player. A mana charge is removed immediately when the key is pressed.
    2. Casting a spell makes the effects manifest immediately, a set distance from the player. A mana charge is removed immediately when the key is pressed. (I've had problems with this in The Hero's Journey, so this probably won't happen, but I can't yet rule it out, either.)
    3. Spells can only be cast if you're near a certain block/spells only resolve if they strike certain blocks. A mana charge is removed immediately when the key is pressed (This is sort of similar to Portal, in that you can only create portals on the white walls.)
    4. Spells can be cast at a target location, but when a particular spell hits/is forced to manifest, it creates a small magic effect, and creates a magically charged area. A subsequent spell will morph the effect into a new form and alter the scintilla. Mana charges are consumed when the spell casting button is pressed. (Pretty much, the Son of Nor approach. The reason I consider it, is it's really well thought-out, and even though someone else is doing it, it's a possibility.)
    Since Sara the Shieldmage is a sidescrolling puzzle/action platformer, with some RPG elements, I want to afford the player the most control possible in any given situation. To me, that would make options 1 & 4 good ones in general.

    However, options 2 and 3 have precedent in other games, so they're totally viable options as well, and possibly simpler ones to implement. Given my lack of resources, I don't dare disregard them.

    So, I'm looking for some advice on in what way would be the best to do this. Have I missed an 'easy', but flexible option for controlling magic effects?
     
    Last edited: Sep 24, 2014
    GarBenjamin and calmcarrots like this.
  2. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    Based on how you described the block being used (jump on it, push it, block with it) it seems like option 2 would make the most sense. Instead of immediately manifesting though it would probably look better if there was a slight delay where a "summoning block" animation/particle effect plays. Of course you'll need to check that the target cast area is not occupied by a physical object already in existence.

    Option 1 would work well for more offensive spells I think. For 1C I immediately think of Zelda's fireball in super smash bros. Cool for attacks but I think it would be really annoying to block with it. Additionally if you are going to "weaponize this block by pushing it in a direction" you would probably want to create it nearby.
     
    AndrewGrayGames likes this.
  3. RockoDyne

    RockoDyne

    Joined:
    Apr 10, 2014
    Posts:
    2,234
    As far as block spawning mechanics go, you could spawn it nearby, spawn it at a target position, spawn it nearby and give it momentum, spawn a carrier that spawns a block after hitting something, or it's just context sensitive.

    Spawning with momentum is probably the most likely to be interesting for combat and puzzles.
     
    AndrewGrayGames likes this.
  4. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,822
    Good points all.

    I guess another thing I considered too, is it might be interesting to spawn the block someplace not nearby, perhaps to trigger pressure switches, or to simply drop onto enemies as an early way of dealing with them.

    Of course, spawning a block wherever would fundamentally break the jumping system; you could spawn a block shortly beneath you as you're falling, hit the block to be temporarily grounded, and then jump again. Of course, said mechanic could be really really interesting too, but I also suspect I would need to properly train the player to recognize those options, such that it's not a case of the mechanic having a huge burden of knowledge.

    That, and I've already implemented a [n]-jump system in my mechanical prototype. (Theoretically the player could make Int.Max jumps. But, that would be ridiculous.)
     
  5. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,822
    I hadn't considered that possibility.

    I'm probably going to give spawning nearby with no momentum a try tonight. That seems the easiest possible thing to do, and will let me get some good basic art in for the summoned block. Maybe firing the block to a distant location is actually an upgraded variant of the spell, more for an endgame use?
     
  6. Grimwolf

    Grimwolf

    Joined:
    Oct 12, 2013
    Posts:
    296
    What kind of controls are you using? Keyboard/Mouse, Touch?
     
  7. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,822
    Fully-remappable Mouse and Keyboard. Endgame is to publish to PC and Linux, with a Webplayer demo.
     
  8. Grimwolf

    Grimwolf

    Joined:
    Oct 12, 2013
    Posts:
    296
    In that case, I liked Trine's approach; basically just use whatever key to activate the spell, move a ghost of the object/spell around the screen with the mouse, then release the key to place/activate it in that spot.
    Other spells, like a projectile, could just fire linearly toward the cursor location.
     
    AndrewGrayGames likes this.
  9. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,822
    I wound up going with this suggestion for the time being. I'm figuring out the quirks with it (I had to add a rigidbody, such that summoned blocks don't just hang out in mid air and remove the need to jump), but this got me going in a positive direction. I just have to figure out some minutiae. Thanks Grimwolf!