RPG Magic System

Accname

2D-Graphics enthusiast
Reaction score
1,462
Hey guys.

I have been thinking alot about RPG's lately. I was thinking about an own magic system for a multiplayer RPG, possible an MMORPG, I think it would be really cool but incredibly complicated to code.

So I ask you guys what you think about it, would you like to play a game like this? Is it too complicated for use? Too much effort for the casual gamer?

Every player has a Spellbook. The spellbook can hold a certain number of spells. The number of spells you can have in your spellbook at any point in time is limited by your level as a wizard.
You can select a certain number of spells from your spellbook as "prepared" spells. The more powerful those selected spells are the less spells can you select. Every spell which is "prepared" can be used by you at any point in time.
You can deselect a prepared spell and prepare a new spell anytime and everywhere, but it takes some seconds in which you can do nothing else, you are completely helpless and unprotected and very very vulnerable to attacks.

You get spells by writing your own. There is a GUI coding system which you can use to create your very own spells.
When you write a spell you will get a scroll. You can copy this scroll into your spellbook which will destroy the scroll. You can give scrolls to other players to share a spell you wrote.

Writing spells is structured like this:
  • Each spell consists of several (unlimited) "actions".
  • An "action" consists of a "trigger" and several (unlimited) "commands".
  • A trigger is one of the following:
    • Instantly {when the spell is cast; each spell needs at least one action with this trigger}
    • Time has passed in seconds (int) {since the action was enabled}
    • Every (int) seconds
    • Reaction: A game object dies / vanishes / is removed
    • Reaction: A game object does an Action
    • Reaction: The state of a game object changes
    • Reaction: A missle got in range of a target
  • All actions of the spell are initially disabled except for the actions with the trigger "Instantly"
  • A game object is for example:
    • A missle used for a spell / attack
    • A unit of any kind (Player character, NPC, monster, summoned being, etc)
    • A doodad, a lifeless object
    • An item
  • A "change of state" of an object is for example:
    • Took damage
    • Was healed
    • was hit by a buff
    • a buff was removed
    • Lost mana
    • Restored mana
    • Got revived from the dead
    • Died
  • Commands can be for example:
    • Create missle (with ID, design, movement pattern, collision, speed, etc)
    • Summon unit (with ID, type, AI-Script, status, etc)
    • Query unit/missle/doodad info
    • Set local variables
    • Play Sound/Visual effects
    • Change state of unit/doodad (Damage, Apply buffs, kill instantly, move instantly)
    • Give AI commands to missles or summoned units (only those created by this spell!)
    • Enable / Disable spell action
  • The mana cost / casting time of a spell depends on the complexity and length of its code.
  • All additional actions / missles created / units summoned / etc will make the spell more costly
So every player has to really think about his own spells. Write them with care. Find the best balance between power and cost.

I think this would be great for a competitive MMORPG.

What do you guys say?
Too complicated?
Too much?
Any feedback?

Thanks in advance.


Edit: Some example spells:
Every variable starting with "udl_" will be a "user-defined-local" and saved permanently until the spell is finished.
Every variable starting with "tmp_" will be a temporary local variable and freed when the current code block is left.
Poison damage over time buff:
Code:
Define
{
    RANGE = 32
    DAMAGE_PERCENT = 0.01
    DAMAGE_TYPE = DMGTYPE_POISON
    DAMAGE_INTERVAL = 3.00
}
 
Action1
Trigger: Instantly
{
    // Get mouse pointer position for owner of casting unit
    Set tmp_point = get_mouse_location( get_owner( CONST_CASTER ) )
    // Get random unit in range of 32 of mouse pointer position; this unit is the target for the poison spell
    Set udl_target = get_random( get_units( tmp_point, RANGE ) )
    // Enable damage function
    Enable: Action2
    Enable: Action3
}
 
Action2
Trigger: Every DAMAGE_INTERVAL seconds
{
    // Damage dealt will be 1% of max-hp of target
    Set tmp_damage = get_status( udl_target, MAX_HP ) * DAMAGE_PERCENT
    // Damage dealt will be of poison type
    damage( udl_target, DAMAGE_TYPE, tmp_damage )
}
 
Action3
Trigger: Unit dies
{
    if ( TRG_UNIT == udl_target)
    {
        Disable: Action2
        Disable: Action3
    }
}

Simple instant heal spell:
Code:
Define
{
    HEAL_CONSTANT = 125
    HEAL_FACTOR = 0.25
}
 
Action1
Trigger: Instantly
{
    heal( CONST_CASTER, HEAL_CONSTANT + get_status( CONST_CASTER, MAX_HP ) * HEAL_FACTOR )
}

Simple Fireball (missle following target)
Code:
Define
{
    MISSLE_DESIGN = DESIGN_FIREBALL
    MISSLE_LIFE_TIME = 30.00
    MISSLE_SPEED = 4.25
    MISSLE_SIZE = 16
    DAMAGE_TYPE = DMGTYPE_FIRE
    DAMAGE = 225
}
 
Action1
Trigger: Instantly
{
    Set tmp_point = get_mouse_location( get_owner( CONST_CASTER ) )
    Set udl_target = get_random( get_units( tmp_point, RANGE ) )
    Set tmp_target_loc = get_location( udl_target )
    Set tmp_spawn_loc = get_location( CONST_CASTER )
    Set udl_missle = create_missle( tmp_spawn_loc )
    set_design( udl_missle, MISSLE_DESIGN )
    set_timed_life( udl_missle, MISSLE_LIFE_TIME )
    set_speed( udl_missle, MISSLE_SPEED )
    set_collision( udl_missle, COLLISION_CIRCLE, MISSLE_SIZE )
    command( udl_missle, move_to_loc( tmp_target_loc ) )
    Enable: Action2
}
 
Action2
Trigger: Missle reached target
{
    if ( TRG_MISSLE == udl_missle )
    {
        kill( udl_missle )
        damage( udl_target, DAMAGE_TYPE, DAMAGE )
        Disable: Action2
        Disable: Action3
    }
}
 
Action3
Trigger: Missle dies
{
    if ( TRG_MISSLE == udl_missle )
    {
        Disable: Action2
        Disable: Action3
    }
}
 

Slapshot136

Divide et impera
Reaction score
471
honestly I would like to try it out - the only concern I have is some sort of standardization as far as buffs, damage types (super effective?), intercepts/pathing, etc. - and I would probably not penalize spells for looking pretty/sound effects, even if that does mean longer code - not quite sure how to implement that...
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
I would add default special effects and sounds which come with the missle models and damage effects.
The user can add additional special effects and sounds but these will be penalized because otherwise they will just spam the screen and lag other players out.

Buffs are basically periodic effects. You could make a spell which looks like this:
Code:
Define
{
    RANGE = 32
    DAMAGE_PERCENT = 0.01
    DAMAGE_TYPE = DMGTYPE_POISON
    DAMAGE_INTERVAL = 3.00
}
 
Action1
Trigger: Instantly
{
    // Get mouse pointer position for owner of casting unit
    Set tmp_point = get_mouse_location( get_owner( CONST_CASTER ) )
    // Get random unit in range of 32 of mouse pointer position; this unit is the target for the poison spell
    Set udl_target = get_random( get_units( tmp_point, RANGE ) )
    // Enable damage function
    Enable: Action2
    Enable: Action3
}
 
Action2
Trigger: Every DAMAGE_INTERVAL seconds
{
    // Damage dealt will be 1% of max-hp of target
    Set tmp_damage = get_status( udl_target, MAX_HP ) * DAMAGE_PERCENT
    // Damage dealt will be of poison type
    damage( udl_target, DAMAGE_TYPE, tmp_damage )
}
 
Action3
Trigger: Unit dies
{
    if ( TRG_UNIT == udl_target)
    {
        Disable: Action2
        Disable: Action3
    }
}

This would be an example code for how a "Poison-DoT" buff could look like.
The spell will take a little bit of mana at the beginning (very little), and then take some mana every 3.00 seconds.

I would probably need some way to disable the spell by default after some time. Probably I could just make the spell stop when the mana of the caster has run out. Then, if the player forgets to add a "clean up" action like the "Action3" in my example it is his own fault when he will periodically lose mana.
 

camelCase

The Case of the Mysterious Camel.
Reaction score
362
I had this idea a few weeks back.. Lol.
It's okay, no one can claim copyright infringement =P

Since my idea is slightly different.
 

OMGOMGOMG

UMBWGMG (Unidentified Human Being.)
Reaction score
28
I think this would be a bit too much for other players, but I absolutely love being able to have unlimited power to what I can and can't do.

However: This is one small problem with this: You could make the most powerful spell with no mana cost. So, here's a solution: If the spell is a level 5 spell, then there should be a set amount of mana points cost. (E.G. 1000+(Mana Defined By Player) = total mana cost.

This is an idea to make the (game) less OP.

There is another small factor that would be hard to go around. You would need a trigger that creates the triggers/joins those triggers togethor in order for the spell to work properly. But I, for one, will not player a MMORPG that does not include side things such as woodcutting, firemaking etc. So the MMORPG might not be in my interests, I would surely recomend it to people.
 

camelCase

The Case of the Mysterious Camel.
Reaction score
362
No, mana costs should be calculated by the game based on the effects of the spell ;)
If you can parse a script, you can parse a skill-script. If you can parse a skill-script, you can attach values to each node of the parse-tree and math them up to a value.

Values could be mana, cooldown, cast-time, etc.
 

OMGOMGOMG

UMBWGMG (Unidentified Human Being.)
Reaction score
28
@AccName: Where did you get this idea from anywho...
I would add default special effects and sounds which come with the missle models and damage effects.
The user can add additional special effects and sounds but these will be penalized because otherwise they will just spam the screen and lag other players out.

...

I would probably need some way to disable the spell by default after some time. Probably I could just make the spell stop when the mana of the caster has run out. Then, if the player forgets to add a "clean up" action like the "Action3" in my example it is his own fault when he will periodically lose mana.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
The mana cost / casting time of a spell depends on the complexity and length of its code.
Said it in my initial post. The mana cost and cast time depend on the complexity of the spell. Every line of code adds to the mana cost and cast time (can add zero to mana cost and cast time too) besides that you have the option to increase cast time to reduce mana cost and vice versa, but only to a certain extend.
I was working on this for over a year now, always thinking about how to improve it and how the underlying engine would have to look like.

The nice thing would be that experienced players could craft spells and give them to less experienced players in form of scrolls. They could potentially sell them for a nice price.

And one could make it, that certain lines of code only become available to a player at a certain level. So you have to play for a while to get the full power of magic.

And it doesnt neccessarily need to be an MMORPG, maybe a pure PvP game but with magic.
Or if it is an MMORPG then, of course, there would be other aspects to the game play as well.
 

Varine

And as the moon rises, we shall prepare for war
Reaction score
803
The amount of options available seem less entertaining than if there was fairly standard options, like the type of spell, effects and side effects, etc. All the customization of what it DOES, minus the ability to define the trajectory, model, materials, etc (the visual effects), which could be procedurally generated based on the spell's definition.

It seems like a somewhat more advanced system than the spell creator in the Elder Scrolls games. Is that an accurate depiction?
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
In elderscrolls you had very limited options. You could either make it a spell cast on yourself, a projectile flying in a straight line, or a spell cast on a target right in front of you.
And all you could do was heal, buff or damage with a certain element. That was all.

In my idea you can do anything with this. You can make a special effect show with no damage whatsoever, just colors dancing on the screen, if you like.

Or you could do music by playing various sound effects at certain points in time. It doesnt always have to be fighting.

You can summon an elemental monster, make it move to the enemy, then, when it dies it will spawn MORE elemental monsters, and when those die they will deal splash damage. Totally possible with this system.

The idea is, that the players are given nearly unlimited options. Then, they are pitted against each other in a fight to death. Each player has a certain number of his very own spells and it is his duty to use them to their full effect.
The vast range of possibilities would make it interesting. You can never know what one of the players will use next. They could surprise you with the most ridiculous spells.

For example firing missles to intercept missles of your enemy. Anything, really.
 

Slapshot136

Divide et impera
Reaction score
471
For example firing missles to intercept missles of your enemy. Anything, really.

this is the stuff that would make it awesome, but at the same time hard to code for unless there was some sort of "standard" missile system (from which you could get the target for the interceptor missiles)
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Yeah. I would add alot of default stuff.

For example, every game-object (missles, units, etc) have a "Location"-object.
Locations are static for each game-object, its always the same object and only changes its intern variables to represent the actual position.

When you give a move command to a missle (or summoned unit / anything) and you issue it to move to a given location, then it will practically follow the target, if the location is that of a game-object.

That way it would be very simple to create homing missles.
And you can clone locations if you dont want it to be homing.

For example:
1). get location of unit
2). clone location
3). issue move command to clone
=> not homing
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top