Need Help Theorycrafting RPG and MMO Systems, Especially Combat

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I am trying to make an RPG. I'm still stuck conceptually on a lot of issues, though. My main issues are skill trees and combat in general.

    Here is a list of some questions I have, if you can answer any of them, I would be most grateful.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    #1: How do I create custom events? For example, let's say I want to organize my events by input, output, etc. It seems a bit sloppy to put everything in one place, so I was wondering if you can create custom, named events and trigger them through actions. It would look like this:

    Code
    If the user presses the J key, then trigger "Sword_Swing_24"


    Then, you could have the same command multiple times, with different conditions, like so:

    Code
    If "Sword_Swing_24" is triggered, and "Player" is within range of "Enemy", and "Block" animation of "Enemy" is currently playing, then change the animation of "Player" to "Sword Swing - Blocked"


    And at the same time, you could have another command that says:

    Code
    If "Sword_Swing_24" is triggered, and "Player" is within range of "Enemy", and "Block" animation of "Enemy" is not playing, then change the animation of "Player" to "Sword Swing - Strike"


    Obviously there is no 'within range' command, but it's not very difficult to code that part and hopefully you get the idea. Instead of having each command include the "If user presses the J key", the events (such as receiving the input to swing the sword) would have their own names. This might take an extra event or so, but it will be much easier to understand and much cleaner if/when I might come back to the project at a later time.

    PS: I have thought of keeping each of these 'commands' in their own event group, and activating/deactivating to use the command, but that seems extremely sloppy and will no doubt result in bugs down the road.

    TL:DR - How do I trigger a custom, named action which activates an event?

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    #2: How do I handle buffs, debuffs, and skill trees? Let's say I have a buff that gives me a 5% critical chance increase, and one passive from my skill tree which gives all of my attacks a 3% damage bonus. The enemy I'm fighting has a buff that increases damage resistance by 10%, but a debuff applied by me that increases incoming damage by 6%.

    Let's say I have a base chance of 20% to critically hit the enemy, and my critical hits deal 50% bonus damage. Let's say that the attack, by default, would deal 1000 damage. With the application of my 3% damage bonus (base * 1.03) it would be 1030 damage. Then the enemy has a buff that reduces incoming damage by 10%, so with that in mind my damage for that attack is now 927 (1030 * .9). The enemy does have a damage vulnerability of 6% though, so we have to take that into consideration too. That would be 982.62 (927 * 1.06) which I would probably end up rounding to 983, so let's just say 983. Then I have a 25% chance to critically hit, which would mean the damage would be 1474.5, rounding up to 1475 (983 * 1.5). Therefore, my attack has a 25% chance to deal 1475 damage, and a 75% chance to deal 983. That would make my average hit damage of that ability (assuming we care about this, which we might) 1106 damage ((1475 + 3*983)/4).

    So my point is, and my question is, how do I handle that? I understand how to put that into a command, obviously. My question is, how do I think about this? How do I tell the program which buffs and debuffs the two entities (player and enemy) have? How do I take the passive bonuses granted by the chosen skill tree options, and factor that into the equation that deals damage?

    One way I can think of is a giant equation that takes all of the buffs into account, but it only works for things like damage. For example, an attack deals: "base_damage * damage_buff1 * damage_buff5 * skill_tree_passive23" if the player has a buff, passive, etc, then the buff/passive number would be the decimal value of the percent, such as 1.01 for 1%, etc. This sorta works, but if the game has a bunch of buffs, debuffs, and skill tree passives, I can't simply have a five-thousand-character command that tests if every single buff is present or not. In the same way, I cannot have thousands of commands which each have a different equation depending on the thousands (if not millions) of different combinations the buffs could have. That doesn't seem like a reasonable solution.

    Therefore, how would I solve this problem? Would I give each buff and passive a single command each, that if it is present, that it would add itself to the equation? Or perhaps, I would deal the damage in steps, first starting with the base damage, then running through every buff and debuff and modifying the damage until I had fully modified it and checked for all buffs and debuffs? Skill tree use is so common in games, I know there's a way to categorize and apply the different effects, I just can't figure it out myself.

    TL:DR - How do I check for buffs, debuffs and skill tree passives on both the player and the target enemy, and apply them into an equation that calculates the damage the player deals to a targeted enemy?

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    #3: What combat systems would you recommend? What combat systems have already been created using this program, and are there any tips you can offer? First let me start out by saying that my game will be a multi-directional game. It will not be a platformer, it will use MMO-style on-screen button abilities, WASD keys to move, that sort of thing. However, I'm still not sure how the combat should work.

    Some ideas I have entertained:
    • Pokemon-ish, where encountering an enemy takes the player into a separate battle area. I have several reasons I don't think I want to choose this option though. First, if the system is designed like that, you could simply avoid the enemies unless they are invisible and random fight encounters, spread throughout the game. That's not really how I want it to work though. Another problem is, well, I haven't actually played any Pokemon games... that could be a problem. Nevertheless, I do recognize the combat system as a possibility.
    • Turn-based, most likely that's pretty straightforward. The you take a turn, enemy takes a turn, etc. A great example of that system is Star Wars: Knights of the Old Republic (1 and 2). This system has some pretty serious drawbacks though, such as encounters with multiple enemies (which I strongly prefer to fighting a single enemy at a time). Also, the system is a slower type of combat, and (in my opinion) not quite as fun.
    • Real-Time, where players and enemies still have internal attack limits (GCD, Global Cooldown), but can attack at any time the limit is not up (or the ability is not on cooldown). I would definitely prefer this system, but I still welcome any opinions. I favor this system because it easily allows combat with multiple enemies, it is fast-paced and requires the most skill (movement, positioning and timing, as opposed to simply an ability rotation).

    TL:DR - What combat system would you recommend, and do you have any tips on how to implement it?

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    #4: How should I handle the ability usage in the combat of the game? This question assumes that the third option, real-time, is chosen from the previous question. I will most likely use that system, but I do like to hear other opinions and get some different ideas. So I'm thinking of a system that has a global cooldown (like mentioned above) which is pretty much a limit that triggers when most abilities are used, so that you can only attack once every so often. In the game I'm thinking of, the base GCD is 1.5 seconds, which seemed to work out pretty well. There's a stat that decreases the GCD, as well as the cast time of abilites, and the classes' resource regeneration rate. What I want to know is, how do I go about making a cooldown system? Right now, in my current status as a Fusion user, I would take a value (probably make an Active and use it's alterable value) and set it to some high number, then make an Always command which decreases that value by 1, and when the value reaches zero then the cooldown is finished... I know that's a very sloppy way to go about it and I'm sure there is a timer I could use which has milliseconds on it, allowing me to count down exact times. That's honestly the real question, here. It reminds me of the way Unreal Engine works, specifically Unreal Kismet (now known as the Blueprint Editor, I believe). The command system works in command 'blocks', essentially, which have either input nodes, output nodes, or both. So, if you had an event, that event could trigger an action, but also trigger a timer. After that timer finished, it would trigger another event. That's essentially what I need, a reliable timer, precise to the hundredth or thousandth of a second, which I can stop, reset, test for completion, etc.

    TL:DR - Is there a timer object precise to the hundredth or thousandth of a second?

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


    OVERALL TL:DR - Essentially I'm trying to make a single-player RPG game with many MMO elements in it. I have a decent understanding of Fusion (worked with it for about six or seven years, with only a week of official training at the very beginning from people I passed in knowledge in but a few weeks), so I have a general understanding of how to achieve the result I want, once I have a plan in place. The primary issue I find myself dealing with right now is how to think about the problem. What I'm struggling with right now is the concepts that solve the various problems I've encountered when designing the game. I'm confident that, once I understand the solution to the problem, I'll be able to implement it. If that isn't the case, I can always ask a specific question about it here. Right now I just need to understand the concepts that solve the problems. Any and all help is greatly appreciated

  • 1)
    I would recommend using fastloops to do this. You can name your fastloops whatever you like and then trigger them from different points in your code- this allows for easily maintainable chunks of code.
    I'd also recommend enclosing these in groups which you keep disabled, one for each fastloop. If you activate and deactivate that group every time you need to use that chunk of code, it stops fusion reading that block of instructions every single time it runs through the event list, whichwill keep your game running more efficiently.

    2) I'd similarly use a series of fast loop events to do this, making one event per modification to the damage output. You can then elect to split this series of events into smaller groups, which you enable or disable depending on which buffs are active.

    SUPER MEGA BEST CAT ADVENTURES Please login to see this link. and Please login to see this link. live now!

  • #2 The safe way is to have all stats present at your character-entity (wherever it is, server?) and then apply buffs/debuffs to that list. When a hit-check is done those values are factored in. eg. if the enemy is blocking, just send +50 to that unit block stats and then let the check factor it in. graphics should change according to stats or values, not according to an event.

    #3 why not make your own? Fusion isn't restricting the use of numbers.

    #4 if the "timer" value is utilized correctly it's very precise.

    Please login to see this link.

  • I do like your idea for 2, but I'm worried it won't work all the way across the board, because some things could apply debuffs. For example, let's say your skill tree has a passive which gives a 15%/30%/45% chance to apply a six second damage-over-time effect (DoT) dealing X amount of damage each second. Well, calculating the damage is still pretty unchanged (although I'd have to decide whether it checks my stats every DoT tick, or whether it 'remembers' the stats I had when I applied the DoT. I'm leaning toward the latter but it will be more challenging), but when it comes to the percent chance to apply a debuff, that might be a little more complicated.

    As far as stats go, I like the idea of simply applying the buffs/debuffs/passives to the character's stats directly, especially as this reflects a more 'real time' game (updating stats as the character gets buffs/debuffs/passives).


    For 3, I like that idea, but it's a bit hard to pull an entirely new combat system out of one's magic hat. The system would be different, of course, it wouldn't be an exact replica of anything, but I'm not so sure about designing an entirely new combat system, especially with all the great ideas already out there.


    As far as 4 goes, is this the clock object you can access from the event editor, or the Date and Time object? Or is there an actual timer object?

  • yes, that's a valid concern. percentages could be applied at one point to avoid those issues. eg the following order; stats->percentages->debuffs.. if percentages take place before any set value decrease, less number artifacts would occur (depending on your system).

    many systems derive from advanced d&d (or something older) with the ol' strength, dexterity, charisma point system. Eg. as in Skyrim, Fallout, Diablo. Where common traits like dexterity adds to avoid-hit chance and strength adds to melee damage can be found. It's a safe bet and none will rack down on a game using it.

    If you use a levelsystem based on avatar experience and want an equal "slope" to for eg. Diablo or Wow try putting 500, 1500, 3750 into a polynomal pattern finder. It will output a curve formula that is useful.

    Please login to see this link.

    interesting thought
    It's said that the curve of leveling is closely connected to the developingtime for the game or it's extensionpacks. ie the company is cleverly not making the default player finish the game until the next expansion or game is complete. the only proof however are studies of the curves and changes thereof in modern games.

    the "timer" is a value closely connected to the hardware-clock of the local machine, it's reached though typing timer into the fusion expression editor.

    Please login to see this link.

  • Your battle system could be based on the one that Mu uses.

    Basically you character is free walking (WASD) and until you click on an enemy it does not attack. You have a damage range assigned to your attacks already and you can choose the attack type from a toolbar. Each attack has a cooldown before it is used again and the attack itself is automated. The enemies also operate on LoS so they will actively chase you and attack you if in range.

  • Four things. First and foremost, I want to thank everyone for the replies thus far, you guys are great!

    Secondly, tompa, I've been working on a detailed response to your latest post, which I will finalize when I get home tonight.

    Thirdly, lembi, the system you describe is near to (if not exactly) what I want. Your post also reminds me of a very old problem I've struggled with, with a very valuable solution: LoS. While I'm not ready to work though that just yet, I'd love to discuss it when I get around to it. You also raised some other interesting points I'll comment on when I get back.

    That brings me to my final point, which is that I haven't actually done any work on the application itself, the file doesn't actually exist yet. All of this so far is being planned on paper, so I have a clear understanding of the procedures I will use, and (in the case of fastloops) if I discover a miracle object which makes life so much easier, I can START development with those tools instead of having to implement them at a later time. This is also the reason I will (in my reply to tompa) describe the processes, ideas and equations I've already thought of, in case there may be a way to execute them more efficiently and effectively.

    Once again, thanks for all the help thus far, and I should be making those posts in three to four hours.

  • Apologies for the delayed response, the breakdown of the damage equation took a lot longer than I'd thought, even though the main idea and part of the explanation is already on paper.

    The way my system works (inspired heavily by SWTOR) there won't be skill tree passives that add damage to an attack, only ones that increase the damage by a percent. If I did want an attack to deal additional damage, I would likely have the ability apply a DoT effect to the target.

    I have a starting point for my stat types, which falls somewhere between SWTOR and KOTOR (primarily SWTOR). I'll have three base classes for each faction (there will be only two total). Each class will have its own stat ("Mainstat"), then there are secondary stats such as Critical Rating and Power. Stats like Mainstat and Power are factored into Bonus Damage, which is the source of all attack damage. I currently have a rough starting equation similar to how I think it will end up looking:

    DoT effects, at least in SWTOR, don't usually have a damage range, so that will make things a bit better.

    As far as the leveling curve goes, I'll definitely be taking a closer look at that in the coming days, but it's not on the top of my to-do list at the moment. It will definitely use a curve of some sort, but I'm not sure about the details. SWTOR's curve seems a little harsh, at the beginning of the game it's nice and fun to level, but when you get to about level 30 or so it really starts slowing down and you pretty much have to do every quest you can find to level up. That's not how I want this to work, but I agree that some curve is definitely necessary.

    Edited 4 times, last by idnewton: Made changes to the [Code] section to greatly improve readability (September 11, 2014 at 8:17 AM).

  • Your battle system could be based on the one that Mu uses.

    Basically you character is free walking (WASD) and until you click on an enemy it does not attack. You have a damage range assigned to your attacks already and you can choose the attack type from a toolbar. Each attack has a cooldown before it is used again and the attack itself is automated. The enemies also operate on LoS so they will actively chase you and attack you if in range.

    As I previously stated (Post #8) that's the type of system I'm leaning towards, though I still welcome other opinions. As far as cooldowns are concerned, the vast majority of abilities will use them, but a few (such as the basic attack, as well as some others) might not have cooldowns (though of course every ability will trigger the global cooldown, unless it's specifically designed not to). Also, once again, I'm going to take things in the direction SWTOR went, as far as auto-attack goes. While the default attack for each class is commonly referred to in that game as 'auto attack', the game does not actually have the auto-attack feature which uses the default attack unless the player chooses another. I agree with SWTOR's decision to stay away from that, as it makes things feel (at least in my opinion) a little bit more passive and, at times, annoying.

    Damage range, yes. It makes me think of attack range, but those are two separate things, at least the way I see it. I define damage range as the range of a non-targeted aoe attack's damage. For example, you might have an ability which strikes a target, and also deals damage to other targets close to that target. That is known as a 'targeted aoe', because it requires an enemy to be targeted in order to activate. A non-targeted aoe looks something more like an ability where your character smashes or emits magic or some other form of move which deals damage around the player. Or, for a ranged example, perhaps your character has a 'magic storm' type ability, which allows the player to click an area on the ground which is then bombarded with magic. Doesn't require a target, still an area attack, therefore a non-targeted aoe.

    Attack range is a lot more straightforward. Attack range, as I define it, only applies to targeted abilities. Single-target abilities as well as targeted aoe abilities. Each such ability will have a maximum range, such as 30m. Some abilities, like a missile attack or a dash attack, might even have a minimum range. That is how I define attack range. If your character is within the attack range of an ability, it can activate that ability (assuming all other conditions are met, such as sufficient resources). If it's out of range of the ability, it cannot activate the ability.

    Again, as I mentioned in Post 8, LoS (Line of Sight) is a very important system I have not yet solved, but as with the leveling curve, it's not on my to-do list quite yet.

  • For the final post of the night, I'll be giving an example of how I plan to handle attacks in my game. Thanks to the help I've already received, I'm able to conquer roadblocks that have stopped me in the past. However, one seemingly minor detail still stands in the way: factoring in the chance to critically hit. At first, I thought "of course, that's easy, all I have to do is use an "X chances out of Y" condition such as "<crit chance> chances out of 1" (1 = 1.00 = 100%). Unfortunately it's not quite that easy, because I cannot find a way to perform an action when that chance *FAILS*. It'll be more obvious as I show how I plan to make this work.

    Legend:
    <> = Fastloop
    --> = "then" (as in, "if then" statement)
    [] = Input (from the player)
    {} = Perform an action
    & = Signifies another condition or action
    Bold Letters = This line represents a GROUP of events
    Normal Letters = This line represents an EVENT
    Italic Letters = This term represents a scripted (or soon to be scripted) part of the code, such as a targeted enemy or a player's critical chance.

    PS: I'm using "smash" as an example for the name of the ability.

    This following code represents the original way I planned to handle critical hits, but I will point out the flaw afterwards if you do not spot it yourself.


    As mentioned, interaction with friendly targets (buffs, healing, CONVERSATIONS (bane of my existence!), etc.) will come later. For now I'm primarily concerned just with combat with enemies. Once I have a good base code for abilities including damage, cooldown, procs, and other stuff like that, making new abilities will pretty much be smooth sailing. Just copy and paste, change the names, sounds, values, and it's done.

    Two points I want to make. First, since I haven't used the term 'proc' yet, I just want to make sure the meaning is reasonably clear. Let's say your character has a 30% chance to activate a DoT when using a certain attack. You use the attack, the DoT activates. You have 'procced' the DoT. The chance to activate that DoT is referred to as the 'proc chance'. The DoT itself which has been activated is also sometimes referred to as a 'proc', and (though I haven't used the term yet) people sometimes refer to the random chance involved in that proc as 'RNG', which means "random number generator". It refers to the chance involved in percent-possibilities to proc something. For example, you have an attack which hits three times over the span of three seconds. Each time it hits, it has a 60% chance to proc an effect. You use the ability, go through all three ticks, and don't get the proc. That could be referred to as having "bad RNG".

    The second point I want to make is the fundamental flaw in the above code, the fact that my handling of Critical Chance is wrong. At first glance it might look totally fine, but if you think about it for a second, it goes a little something like this. First, you activate your ability, either by clicking on the icon or by pressing a hotkey. The ability is now activated, and runs the fastloop <Ability>. The fastloop <Ability> activates an animation, and when that animation reaches a certain frame, it activates <Ability_Output>. Okay, up until now, we're totally fine. Now comes the problem. I say that if <Ability_Output> is activated, and if Crit Chance chances out of 1, then activate Flag 0 and run fastloop <Ability_Output_BC>. The problem comes when the ability does not critically hit. This event only fires if <Ability_Output> is activated and the Crit Chance chances out of 1 succeeds. What if it doesn't? Well, obviously, Flag 0 is not turned on. However... since it's the same command, that also means <Ability_Output_BC> is never activated. It only activates if the ability critically hits.

    This comes down to a bigger problem which concerns the "X chances out of Y" condition. This event only tests whether it succeeds. If it succeeds, then do action A B and C. But there's no way to test what happens when it doesn't succeed. If you copy and paste the event, and invert the condition (if that's possible, which it probably is) it's not going to have the same random number selected as the other event. Also, as a side-note, I really don't like the idea of activating a flag if it succeeds at the crit roll, then testing for that flag and using separate events to deal damage depending on whether or not that flag is off or on. I couldn't think of a better way to do it, but this method (obviously) was not a satisfactory solution either.

    I'm curious how I could factor a critical chance into the damage dealt. If it was a simple 50% chance, I could use (Base Damage) + (Random(2) * (Crit Damage)), so it would have a 50% chance to deal the crit damage (and my crit damage will be more complicated than a simple static value). Unfortunately, this is reality, and my crit chance will not be a nice neat 50% chance (nor should it). So with that said, I'm open to any ideas related to a variable percent chance to apply a variable percent bonus to a base damage value.


    PS: Is there an expression in the Special (first "object" in the list) category for this, just like there is for the "X chances out of Y" condition? I could see that solving the problem. I'd have a single command, and run the crit roll right inside of the equation, applying it if it wins, and ignoring it if it loses.

  • OK, I started to play around with the Fast Loop object, but I'm not sure I have the right one. It just asks for a slot number, 0-29, and doesn't allow me to name the loop.

    Edit: When you say you are able to name it, are you talking about the loop itself (in other words, "Loop trigger 'smash'") or are you talking about the actual Fast Loop object? (in other words, "(Smash): Loop trigger #0")

  • Do not use the fastloop object, use the built-in fastloops instead.

    My Please login to see this link. (which I actually use), my Please login to see this link. (which I mostly don't use), and my Please login to see this link. (which I don't use anymore pretty much at all really). If there are awards for "'highest number of long forum posts", then I'd have probably won at least 1 by now. XD

  • If you need to run the calculation more than once, whilst using the same random number each time, then generate a random number in a separate event, and save it into a temporary variable, such as an alterable value or a global value.

    SUPER MEGA BEST CAT ADVENTURES Please login to see this link. and Please login to see this link. live now!

  • Do not use the fastloop object, use the built-in fastloops instead.


    Ah, thanks for the tip, I found it.


    If you need to run the calculation more than once, whilst using the same random number each time, then generate a random number in a separate event, and save it into a temporary variable, such as an alterable value or a global value.


    Also, that's a great idea. It might look something more like this, then:


    Also, in case you didn't see this from an earlier post:

    Legend:
    <> = Fastloop
    --> = "then" (as in, "if then" statement)
    [] = Input (from the player)
    {} = Perform an action
    & = Signifies another condition or action
    Bold Letters = This line represents a GROUP of events
    Normal Letters = This line represents an EVENT
    Italic Letters = This term represents a scripted (or soon to be scripted) part of the code, such as a targeted enemy or a player's critical chance.

    PS: I'm using "smash" as an example for the name of the ability.

  • My focus now is trying to tackle the combat system as a whole, as far as organization goes. This doesn't include the player's ability to choose skill tree talents, nor does it include enemy AI and their abilities quite yet, but it does cover all of the values involved in combat. For instance, the character's stat points (like strength), how those stat points combine (with or without curved equations, depending) into the main 'stats' the player sees (like Bonus Damage, which technically breaks down into two different types).

    Right now my primary problem is data storage. For example, the player needs a set of values that tell the game if each buff/debuff/passive is active or not. Well, since there will be nine skill trees (three for each class, three classes total) as well as many different buffs and debuffs, I can't simply have ten active objects and use all of their alterable values to store information simply regarding buffs/debuffs/passives. After all, I would then need another set of X number of objects to hold that same information about an enemy, and so on for each enemy. Therefore, the best option appears to be the String Parser object. Unfortunately, I don't quite know how to use it yet.

    If I understand this object correctly, it will allow me to use Alterable Strings to hold multiple different values. As an example, let's say one Alterable String of the player deals with an entire skill tree. All of the talents in that skill tree are represented in that same string, and the String Parser is used to retrieve that information, and also write to it.


    If my understanding of the String Parser object is correct, it appears that it will be necessary to use this object to design an efficient combat system. If my understanding of the String Parser object is correct, can you briefly explain how it works, or direct me to a tutorial/guide of some sort? Thanks :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!