21
\$\begingroup\$

I'm designing a small 2D top-down open-world survival-ish game with a magic spell system. The way it works so far:

  • The player receives a "wand" at the beginning of the game
  • As the player encounters new items and enemies, they gain spells to help them use those items/defeat those enemies

The problem I'm having is designing a way to cast the spells. At first, I just bound different spells to keys 0-10, but very soon the number of spells overwhelmed it, and you also have the problem of lower level spells not being used in the late game but still being bound to the most useful keys.

So, what's the best way to make a user-friendly spellcasting system? I can overhaul the way magic works in my game if needed.

EDIT: Just to clarify, I'm developing for PC in real time with large variation in spell type and purpose, although this question should apply to all platforms.

\$\endgroup\$
  • 6
    \$\begingroup\$ Gonna need some more information here. Real time or turn based game? Total number of spells likely to exist, and total number that a player will care about. What level of variation exists in spells - Are we talking fireball vs lightning bolt? Or fireball vs 'talk to plants' \$\endgroup\$ – Scott Jan 22 '18 at 5:03
  • 10
    \$\begingroup\$ Have you played magicka? You could just have base elements and let people do whatever they want with them. \$\endgroup\$ – John Hamilton Jan 22 '18 at 5:59
  • 3
    \$\begingroup\$ What popped to my mind would be a system similar as Doom (2016) or Prey (2017), hold a key, time slow down/stop, and choose your weapon/spell in a circular menu, however, it is more aimed at a controller input, and may be less than optimal in a keyboard/mouse configuration \$\endgroup\$ – DrakaSAN Jan 22 '18 at 10:05
  • \$\begingroup\$ @DrakaSAN selecting something in a wheel with mouse movement is a pain. Brütal Legend had me ragequit because of that. \$\endgroup\$ – Quentin Jan 22 '18 at 13:15
  • 2
    \$\begingroup\$ Why do you have so many different low-level versus high-level skills? Phrased differently, can none of the spells be upgraded rather than a whole new skill? \$\endgroup\$ – Anoplexian Jan 22 '18 at 16:53
32
\$\begingroup\$

There's no "best" way. The game design in your case is intimately connected with the UI design.

However, given your setup, I'll lay out (haha get it) some advice.

You're right about the lower-level spells being on the most convenient keys can be a problem. I would recommend something along the lines of Diablo 2 and 3 where you assign spells to keys in an interface. That way the user chooses which spells he wants to be readily accessible.

How those keys are set up will depend on the details of your game. Diablo 3 rigidly only allows 6 spell choices; choosing wisely is one of the important things players do in that game.

Diablo 2 allows all the function keys (and maybe more; I haven't played it since they made a ton of changes), so the player has many more spells accessible. In fact, any spell can be cast by opening the skill tree and selecting it with the mouse. That's more cantankerous and not useful in quick-reaction situations, so again the player is making choices about what is easily accessible.

\$\endgroup\$
  • 1
    \$\begingroup\$ +1 my first thoughts was the Diablo line of spell books (and to a lesser extent, World of Warcraft). Books with spells and bars that you can customize. \$\endgroup\$ – WernerCD Jan 22 '18 at 19:00
  • \$\begingroup\$ The system in The Elder Scrolls Online (TESO) is likewise, but different. Each character can assign 4 normal abilities and 1 ultimate on a action bar. The type of action bar and actions you can choose are limited by your weapon type. There are general actions that work with all weapons and specific actions that can only be used if a certain weapon is equipped. A player can cycle between 2 weapons and as such has 2 action bars with 5 spells each. TESO allows for different staffs as well, restoration staff, lightning staff, etc… And for each staff different abilities can be learned. \$\endgroup\$ – Wolfgang Schreurs Jan 22 '18 at 19:55
23
\$\begingroup\$

Almo's advise to allow the player to assign spells to hotkeys according to their own preference is good. You can increase the number of spell slots if you allow modifier keys like Ctrl and Shift to access additional hotkey bars (but keep in mind that when the player has one hand on the keyboard in the typical WASD position and the other hand on the mouse, any numbers beyond 5 become awkward and beyond 7 become impossible to reach while also holding Ctrl or Shift).

Alternatively you can use a hotkey bar cycling system. Allow the player to set up multiple hotkey bars and have keys which cycle through the bars the player configured. That way the player can easily use different hotkey configurations for different situations.

But you might also want to think about less orthodox input methods.

Mouse gestures, for example. Represent each spell with a symbol. In order to cast the spell, the player draws that symbol with the mouse. You can reduce the complexity by combining it with hotkeys. For example, use a hotkey to select the element and then use a gesture to select how that element is used. However, recognizing mouse gestures reliably is not easy to program, and you have to implement it well to really judge if it is usable. I would only recommend you to try this when you are either 99% sure you want to go this way, when you have enough budget that burning a few hundred man-hours on this isn't an issue or if there is good 3rd party technology for this available for your technology stack.

Another option is to assign spells not just to single keys but to sequences of keys. Magicka is an interesting example. The game has over a thousand different spells, but they are cast with just 8 hotkeys. Simple spells are just one hotkey followed by a click, more complex ones have longer combinations. A frost ball is thrown with the sequence DQRClick and the mighty "Blazing Arcane Steamball" with DSQFQFFClick. No, this system does not have a very beginner-friendly learning curve (and making the entirety of it available to the player after just a brief tutorial makes it worse). But mastering this system by figuring out the best combinations for each situation feels very rewarding for most players. After a while players memorize the sequences for their favorite spells and can cast them from muscle memory.


But if all of this is still not adequate to cover the variety of spells in your game, look into ways to reduce the number of spells available to the player at any given time. When you have spells which are "not being used in the late game", then why does the player even have them in the late game? When a late-game spell is simply a better version of an early-game spell and makes it obsolete, then it could just replace it completely in the user-interface.

There might also be some spells which are so situational that they don't deserve a hotkey. Those might be used from a menu. Monitor your testplayers and see which spells get used very rarely and usually not in time-critical situations (long-lasting buffs, for example). Ban those to the menu. A spell which is just used as part of the story might not even be a spell in the game-mechanical sense. When you have a "lift frog-shape curse" spell and exactly one person in the game who got turned into a frog, just have the player-character cast it in a cutscene.

\$\endgroup\$
  • 2
    \$\begingroup\$ I'd also name "In Verbis Virtus", where you have to actually "spell" the "spells" to generate the magic \$\endgroup\$ – frarugi87 Jan 22 '18 at 14:11
  • 1
    \$\begingroup\$ Note that if a higher level version of a spell costs more resources than a lower level version, people may want to have access to the lower level version to cast it to conserve resources if they don't need the higher level effect. Something to consider if you want to obsolete lower level spells completely when a player gets a higher level version of the same thing. \$\endgroup\$ – IllusiveBrian Jan 22 '18 at 16:53
  • \$\begingroup\$ As an example of the Mouse Gesture method, I offer Ōkami \$\endgroup\$ – David Starkey Jan 23 '18 at 14:15
  • \$\begingroup\$ "In order to cast the spell, the player draws that symbol with the mouse." This is what I was thinking, it can be hard and you might use the wrong spell but you get to associate a symbol with the spell and it allows as many as you want/need. \$\endgroup\$ – Feathercrown Jan 23 '18 at 16:36
  • \$\begingroup\$ Arx Fatalis is also a good example of mouse gesture for spell casting. You have to draw every rune of whatever spell you want to cast. \$\endgroup\$ – Morb Jan 24 '18 at 12:37
9
\$\begingroup\$

In addition to the old classic, coming from fighter games - key combos. The better the spell, the longer the combo. This has the added benefit of feeling like casting, and a high level spell actually requires a bit more mental power.

If the mouse is an option then Legend of Grimrock has a nice idea - a 4x4 or 5x5 square board (can't remember). The combos are clicked on this board, as if you're drawing a spell.

\$\endgroup\$
6
\$\begingroup\$

A different angle is to eliminate

the problem of lower level spells not being used in the late game

Two sample approaches to this are:

  • All spells scale throughout the game; e.g. the spell that throws a puff of fire in the beginning of the game is the same spell that throws raging firestorms at the end of the game.
  • Progression can come in the form of upgrades to spells. Firepuff was a brand new spell, but later on when you get fireball, it replaces firepuff. And when you find firestorm, it replaces fireball.
\$\endgroup\$
  • \$\begingroup\$ This is what I was going to recommend. If you no longer need a useless spell, why keep it at all? Some sort of fusion system would also work. Once you've learned two specific low-level spells, they can merge together to create a new spell. If you have lots of spells, this is a way to get rid of some spells faster than you earn them, to keep things clean. \$\endgroup\$ – Ed Marty Jan 22 '18 at 16:23
  • \$\begingroup\$ Another tack is to give lower level spells properties that allow them to retain some late-game usefulness. I'm thinking of a specific magic system in a game I played, where lower level spells are faster to cast, cost less mana, but do less damage. So you'd sling a few high-level spells to bring an enemy down to critical health, then quickly chain together some low-level casts to finish them off before they could heal. This winds up resolving combat faster than taking the time to cast another high-level spell. \$\endgroup\$ – Bruno Jan 24 '18 at 1:45
3
\$\begingroup\$

This answer might not be the one you want but I would suggest that you reduce the number of available spells to a number which can be bound to a your available hotkeys. Whats the point in having 100 spells which aren't any different from another? If you have a fireball which costs 5 mana (or whatever ressource you use) and deals 10 damage or a magic projectile which costs 10 mana and deals 20 damage, these spells aren't really different. Try to design spells which serve a different purpose and upgrade earlier spells to keep them relevant in terms of damage/cost.

If you want a special aspect or effect which is different from any other spell in your game then that should get your player another spell. Of course these can overlap but try to create spells which serve new purposes or solve different problems (or the same problems using a different approach) instead of adding new spells which are just upgraded versions of your old earlier spells.

Additionally you could check out Transistors skill system: https://transistor.gamepedia.com/Functions

Each "Function" has some effect (like damage, slow, charms enemies) and some way of targeting enemies (projectile, player dashes and hits enemies in the way, area of effect...). But you only have 4 different slots which you can assign these skills to. These slots are bound to 4 different keys which is easily manageable. As you gain more than 4 Skills you can combine them to get more powerful Skills which apply both effects. Therefore you get interesting combinations, let the player have enough different skills to solve different problems all while only using 4 keys.

With different problems or different ways to solve them I'm thinking of the following (just some examples):

  • Problem: Huge/Strong enemy

Solution: Deal damage based on health of enemy (deals more because the enemy has very much health)

  • Problem: Huge number of small enemies

Solution: Area of effect damage

  • Problem: Player needs to escape or kite enemies, player needs to evade Attacks

Solution: Some teleport or dash spell

\$\endgroup\$
3
\$\begingroup\$

I've played a fair share of multi spell games where you have to be selective out of the roughly hundred spells to your availability.

For keyboard only control, I would have LOVED a sort of windows tab system where I can quickly scroll through my preset combos, defence, repair, press alt tab, click on window or alt tab through it.

enter image description here

In games like diablo and skyrim, there are plenty of cool spells i'd love to have used more, but using them was too elaborate when traversing a dungeon, diablo with the skill tree you had to remember exact spot, skyrim with the powers menu or the overly cluttered favorites menu.

To be able to quickly scroll in an already familiar way through presets would be a boon.

ALT + Tab, 2, alt + tab, click, 3 is quick to do, and would help being to use all the cool stuff you code into your game.

If you feel adventurous, you could add speech control. Train an ai to recognise several speech patterns for your spell, have it part of the game as a mini game to train people to vocalise the spells properly to learn the spells for them to function. How awesome would it be to fus do rah against your computer and something would happen.

\$\endgroup\$
  • \$\begingroup\$ "How awesome would it be to fus do rah against your computer and something would happen." - it would definitely be awesome for any of your roommates :). Nevertheless, speech recognition isn't something new. The technology is around for ages. Yet I have never see any game use it successfully. \$\endgroup\$ – Philipp Jan 22 '18 at 16:57
  • \$\begingroup\$ hence my comment if you feel adventurous. With the recent advencements in AI it might actually be doable as an implementation. \$\endgroup\$ – Tschallacka Jan 22 '18 at 16:59
  • \$\begingroup\$ Understanding individual words isn't hard. The recent AI advances are about understanding freeform sentences. The problem was never recognition. The problem was that it was just an awkward input method. And by the way: Alt+Tab is a system shortcut on Windows. You can not prevent it from making the operating system leave your game application. You might want to change it to something else. \$\endgroup\$ – Philipp Jan 22 '18 at 16:59
  • \$\begingroup\$ Alt tab doesn't let me tab out of skyrim. I need to hit the windows key to be able to escape skyrim. It's overwritable. answers.unity.com/questions/1398007/… not advised, but still. You could do ctrl tab or something. shift tab. whatever is comfortable for gaming. \$\endgroup\$ – Tschallacka Jan 22 '18 at 17:02
  • \$\begingroup\$ @Philipp I've had speech-recognition software have trouble understanding single words like "no". \$\endgroup\$ – Acccumulation Jan 22 '18 at 19:14
3
\$\begingroup\$

The default solution (most used, most widespread, most known to players) is a spell slot system.

You have a series of visible slots on the UI (between 2 and 10), which are assigned to default keys. In a game dialog the user can select which abilities are assigned to which slot. That game dialog always looks more integrated into the game than the Settings menu (where you change sound, graphics and key bindings). Examples are countless, but here's one from Spellforce III:

Hotkeys Q, A, W, and S are visibly bound

It's crucial that you don't let the user bind spells directly to hotkeys with this approach. The user binds spells to spell slots, and spell slots are bound to hotkeys. Keybindings are part of the setup and configuration experience, depend on the player and device, and are changed 0-2 times during the entire game. Switching spells is part of the gameplay, depends on the character and character progression (and is therefore part of the save state), and will be done 10+ times during the game.

There are plenty of alternative options, be it literal musical chants, combos, mouse patterns, voice recognition, or even something Kinect-based. But almost all of them prevent a player from letting a game rest for a year and then picking it up again with a old save, because too much learning and specialized knowledge is needed to play.

\$\endgroup\$
0
\$\begingroup\$

I can see 3 ways you can choose from:

  1. Categories the spell system. Make a category for spells like this: Fire Spells contain Fireball, Firewall, Firewave, Firestorm, Firefall, etc., Cold Spells contain Ice Blast, Frost Nova, Blizzard, Frozen Orb, Glacial Spike, etc. and so on for Lightning spells, Earth spells, Water spells, Undead spells, etc. You could use the TES: Skyrim's category type: Destruction spells, Conjuration spells, Alteration spells, Illusion spells, Restoration spells.
    This way you can set a key 0..9 to open up a category of spells and then use 0..9 to pick the spell in that category. So for instance if number 2 opens up the Cold spells and the forth spell there is Frozen Orb then by pressing 2-4 you cast a Frozen Orb. It would be good to have Q and E for instance, or some other two keys for favourite spells. it would be also good to be able to order the categories and order the spells within the categories making it user friendly for each user.

  2. Use a smart system that is set by the user. Allow the user to set up favourite spells to the 0..9 keys. If you are using the mouse it's good to have a possibility to have a primary spell assigned to the left mouse button and an alternative spell assigned to the right mouse button; it's nice to be able to assign spells of your choice to those buttons. You could use the scroll wheel to scrolls through spells that could be assigned to the left or right mouse button for instance. You could create a radial popup menu for the middle mouse button (click the scroll wheel) with several customly favourited spells.

  3. Embed a hand-drawn spell system. (mouse gestures) I saw this in one game the name of which I unfortunately no longer remember. Each spell is represented as a symbol that can be hand-drawn in one mouse click (I mean you press the mouse button and hold it - draw the symbol without releasing it, release when the drawn-symbol equals the symbol of the spell). Symbols can be letters that form a closed line or some made-up chars, for instance: letter 'O' - for "Obmolior" (latin) - 'put in the way as an obstruction' that will create an anti-spell shield in front of you or some counter-curse obstacle that will prevent you from being hit by spells. This system, however, is quite difficult to create and embed into a game.

\$\endgroup\$
0
\$\begingroup\$

At first, I just bound different spells to keys 0-10

Rather than binding individual spells to keys, you might bind functionality to keys.

For example, rather than having three separate keys for fire, ice, and lightning attacks, you can have a single key for elemental attack, which automatically selects the most effective element for the target.

\$\endgroup\$

protected by Alexandre Vaillancourt Jan 22 '18 at 13:46

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.