A framework for the combat system

Avatar

By Sanglorian 11 Dec 2017 09:19

Champion · 491 comments

I think one of the key remaining elements of Tuxemon that we need is a combat system. I've made a few suggestions in the past, but it occurs to me that they could be quite overwhelming. There's a large number of suggested components, and not a lot of information about what is more or less important.

So here's what I think are the basics of a system, that would provide a good play experience but be straightforward to implement.

Please let me know if this is useful, or if there's a better/different way to approach it that I can help with. I'm not a programmer, but I've tried to make it as useful to a programmer as possible.

When an individual tuxemon is first created

The system should return two pieces of information about the tuxemon:

  • Its species (i.e. Memnomnom, Lambert, etc)
  • Its level

The program then looks up two details about that tuxemon species:

  • Its Body Type
  • Its Subelement

Body Type gives a starting value for each Stat (Speed, Melee, Ranged, Armour, Dodge, HP) and a list of techniques by level.

Subelement gives modifiers for some Stats and a list of techniques by level.

Stats

The program adds the Body Type's starting value for a Stat to the Subelement's modifier, if any, for a final "Species Stat".

The Species Stat is modified by the individual tuxemon's level, according to the following formula, to determine the final "Baseline Stat" for that tuxemon.

Final Stat = Species Stat * (level + 7)

Techniques

The program assembles a list of every technique on the Subelement and Body Type of that tuxemon, and orders them by level.

The individual tuxemon knows the four highest-level techniques that are still below the tuxemon's level, or up to four if there are fewer than four that meet the criteria. 

When an individual tuxemon increases in level

When a tuxemon receives enough Experience Points to increase in level, the remainder carries over.

The program checks if the tuxemon meets the requirement to Morph (evolve). If so, an animation and a sound effect play. The player can cancel the Morph by pressing B. Otherwise, when the animation ends the tuxemon Morphs.

The program checks if the Morphed tuxemon has a new Subelement or Body Type.

Regardless of whether the tuxemon Morphed, all Stats are recalculated to reflect the new level (and the new Subelement/Body Type, if relevant).

The program then checks if the tuxemon's Subelement or Body Type have any techniques of that level. If so, the tuxemon learns the technique(s) if it has fewer than four, or is asked which it would like to forget if it has more than four (including the one just learned, if desired).

The program then checks if there were enough remaining Experience Points to level up again. If so, it repeats.   
 

When combat begins

Combat is made up of any number of rounds. Each round involves the same order of the same seven steps. Items and techniques can be set to take place at any point in the Order, but customarily items will take place in Order: 3 and techniques in Order: 4 or Order: 5.

If both players have chosen an action that occurs at a particular point in the Order, the relative Speeds of the current active tuxemon determine which happens first.

Note, if a tuxemon is knocked out in a round, its replacement does not get to use a technique in that round. However, if the player chose a different action (e.g. using an item), that still takes place.

If a tuxemon is knocked out, XP is allocated at the end of the current Order number.

Order: 0 - Choosing actions

Simultaneously, each player chooses one of the following options:

  • Use a technique of their active tuxemon - and chooses the technique at this time
  • Attempt to retreat
  • Use an item - and chooses the item at this time
  • Switch the active tuxemon for another on their team - and chooses the target of the switch at this time

When in doubt, the NPC AI will use a random technique of their active tuxemon.

When both have selected, Order: 1 takes place.

Order: 1 - Attempts to retreat

All retreats against wild tuxemon are successful. No retreats against trainers are successful. 

Order: 2 - Switching tuxemon

All switching of tuxemon is successful. 

When a tuxemon is switched, keep Conditions stored but remove all Stat Increases/Decreases.

Order: 3 - Using an item

Order: 4 - Fast Techniques

Order: 5 - Non-Fast Techniques

Order: 6 - Conditions

Conditions, if any, are processed at this point.

Use of a technique

When a technique is used, the program runs through the following process:

  • It checks the Type of the technique against the Type of the target to determine any resistances and weaknesses. If the Type is "Aether", it takes the Type of the tuxemon using it.
  • It checks the Target of the technique and plays the animation of the technique over the Target IF any Effects are successful.
  • It checks what Enemy Effects the technique has, if any, and processes each of them in Power order.
  • It checks what User Effects the technique has, if any, and processes each of them in Power order.

Processing an effect:

Basic Effects and Stat Increases/Decreases are automatic. Their Power determines how potent they are.

Conditions are only automatic if they have a Power of 100%. Otherwise, their chance of success equals their Power. 

Damage:

Where a technique has the "damage" effect, the target of the effect takes damage (i.e. their Current HP is reduced) according to the following formula. Use Melee and Armour respectively if the category of the technique is Melee, and use Ranged and Dodge respectively if the category of the technique is Ranged. The user of a technique can be the target of damage from the technique. 

Rounded to the nearest integer: level * Final Melee/Ranged Stat * (Damage Power * (level+100)) * other multipliers * random number between 0.85 and 1.15)/target's Armour/Dodge stat

The "other multipliers" are whether the target's Type gives them resistances or weaknesses against the technique's Type. If yes, halve the damage (resistance) or double it (weakness).

Stat Increases/Decreases:

An individual tuxemon's Stat Change for each Stat can range between -99% and +100%. If it would exceed these bounds, it just goes to the maximum.

These modify the Baseline Stats for the tuxemon until the battle ends or the tuxemon is switched.

Conditions

Some Conditions end or have a chance of ending at the end of a round. This is checked in Order: 6. All conditions would also end at the end of combat.

Some Conditions trigger or have a chance of triggering at the end of a round. This is checked in Order: 6. In some cases, the consequences of their activation will be in the following Round.

If a Condition triggers, play its animation over the affected character.

Avatar

By Sanglorian 11 Dec 2017 09:28

Champion · 491 comments

Tuxemon

Taxonomy:

  • Element: Which of the five elements it belongs to.
  • Body Type: Which Body Type it has
  • Subelement: Which Subelement it has
  • ID: Which number it is in Tuxepedia
  • Blurb: What details show up in Tuxepedia
  • Species Name: What little tag describes it

Techniques

Taxonomy:

  • Element: Which of the five elements it belongs to. If "Aether", it instead takes the element of its user
  • Category: Melee or Ranged, which determines which stat it uses and which enemy stat it targets
  • Order: When in the turn it occurs. Standard is "5", but some are "4"
  • Target: Which side the animation plays over.
  • User Effects: Which riders are added to the technique, affecting the user
  • Enemy Effects: Which riders are added to the technique, affecting the enemy
  • Animation: What GIF plays when the technique is used

Most effects would have a Power level, which would mean different things based on the effect. This allows for higher and lower damage, higher and lower healing, higher and lower odds of conditions taking place, etc.

Specifications:

All Powers would be between 0% and 100%.

Starting Set:

The universe of options that I've proposed would allow us to create 50-100 viable techniques, I think.

Example:

Name: Worry

Element: Aether

Category: Melee

Target: Enemy

Order: 5

User Effects: (none)

Enemy Effects: Damage (Power: 20%), Flinching (Power: 33%)

Body Type

Taxonomy:

Specifications:

Body Types have a score for each stat, between 2 and 6. Together, the six Stats should add to 24.

Body Types should have a technique at level 1, and then any number of additional techniques at that or other levels. they should avoid the standard Subelement technique levels of 5, 14, 25 and 38. As a rule of thumb, it should be five techniques at these five levels: 1, 9, 19, 31 and 45.

Starting Set:

  • Hunter
  • Landrace
  • Varmint
  • Humanoid
  • Serpent

Example:

Name: Hunter

Species Stats
Speed    5
Melee    6
Ranged    2
Armour    2
Dodge    6
HP    3

Techniques
Level 1: Worry
Level 9: ?
Level 19: ? 
Level 31: ?
Level 45: ?

Subelement

Specifications:

Subelements should modify at least two Stats, and the modifications together should add to 0. No Stat should receive worse than -1 as a modifier, meaning that a +2 or greater can only be accounted for with multiple -1s to different Stats. 

Subelements should have at least one technique, and they should avoid the standard Body Type technique levels of 9, 19, 31 and 45. As a rule of thumb, it should be four techniques at these four levels: 5, 14, 25 and 38.

Starting Set:

  • Inferno
  • Watery
  • Stone
  • Plant
  • Robotic

(Roughly matching the five Elements).

Example:

Name: Stone

Species Stats
Speed    -1
Armour    +1

Techniques
Level 5: Shell
Level 14: ?
Level 25: ? 
Level 38: ?

Effects

Any effect could be listed as a user effect, affecting the user of the technique, or as an enemy effect, affecting the opponent.

Most effects would have a Power, meaning different things based on the type of effect.

Starting Set:

Basic Effects: These are resolved immediately.

  • Damage: How much damage the target takes. The effect's Power is the damage multiplier.
  • Healing: How much the target heals. The effect's Power is how many HP are healed.

Stat Increases/Decreases: These last until the tuxemon is switched out, faints or the battle ends. Multipliers are additive. For example, if I have a technique that increases my Speed by 20% and I use it twice, my Speed increases by a total of 40%. If someone then uses a technique that decreases my Speed by 40%, my Speed returns to its original value. 

  • Speed Increase: How much the target's Speed stat increases by. The effect's Power is the multiplier.
  • Speed Decrease: How much the target's Speed stat decreases by. The effect's Power is the multiplier.
  • Etc for all other stats

Conditions: These last until the battle ends, unless they are resolved earlier.

  • Poisoned: Whether the target gets the Poisoned condition. The effect's Power is the chance it occurs.
  • Flinching: Whether the target gets the Flinching condition. The effect's Power is the chance it occurs.
  • Confused: Whether the target gets the Confused condition. The effect's Power is the chance it occurs.
  • Frightened: Whether the target gets the Frightened condition. The effect's Power is the chance it occurs.
  • Grabbed: Whether the target gets the Charmed condition. The effect's Power is the chance it occurs.

Conditions

Taxonomy:

Conditions would have:

  • Effect: What the condition actually does
  • Animation: What GIF plays when the condition activates. It plays over whichever character is subject to the condition.

Example:

Name: Charmed

Effect: A 50% chance that in the next turn you cannot select any technique that targets the enemy. If that's all of them, then you do nothing for the turn.

Avatar

By Sanglorian 11 Dec 2017 09:30

Champion · 491 comments

Room for expansion

  • The option to set Stats for a particular tuxemon species, instead of by Body Type and Subelement
  • Crits
  • Retreats having a chance of failure
  • Multiple Body Types/Subelements/Types for a particular species
  • Multiple Types for a particular technique
  • More Body Types/Subelements/Effects/Conditions to choose from
  • More animation options. Animations could manipulate sprites, play in the middle of the screen, be larger than the 64x64px standard, etc.
  • Playing a tuxemon species' Call as a sound effect at certain times
  • More options for targetting effects, including persistent effects that affect a side of the battle or both sides of the battle rather than particular tuxemon
  • Life stages, so Unmorphed tuxemon have lower stats and Morphed tuxemon have higher ones
  • Tastes, which would give individual tuxemon some higher stats and some lower stats
  • Stat Experience, so training certain stats (by fighting powerful tuxemon) makes them better
  • Combat Codexes and teaching, i.e. learning techniques from items and from other tuxemon who know the techniques. I actually think this is quite important to emphasise the plot points about openness and sharing vs commercialism and limited access, but it's not necessary for a functional game
  • Instead of forgetting a technique as new ones are learned, tuxemon could go to Centres to switch out which four techniques they have "ready"
  • Multi-battles, e.g. two against two or three against three
  • Limits to uses: Each technique could require recharging or have PP, or otherwise be limited from being used many times.
  • Accuracy: Each technique could have a chance of success, instead of always happening as is the current situation.
  • Non-standard Powers for effects: Instead of the Power of an effect being a fraction or an integer, it could refer to something else. For example, "number of enemies", "number of times this technique has already been used", "HP remaining", "percentage of HP remaining", "HP lost", "level of the user", "maximum HP", "one-eighth of maximum HP", etc.
  • Conditions that end under different circumstances
  • A more controlled way of doing Stat Changes, e.g. with stages

Avatar

By Qiangong2 13 Dec 2017 06:33

Member · 23 comments
Sanglorian wrote

Room for expansion

  • The option to set Stats for a particular tuxemon species, instead of by Body Type and Subelement
  • Crits
  • Retreats having a chance of failure
  • Multiple Body Types/Subelements/Types for a particular species
  • Multiple Types for a particular technique
  • More Body Types/Subelements/Effects/Conditions to choose from
  • More animation options. Animations could manipulate sprites, play in the middle of the screen, be larger than the 64x64px standard, etc.
  • Playing a tuxemon species' Call as a sound effect at certain times
  • More options for targetting effects, including persistent effects that affect a side of the battle or both sides of the battle rather than particular tuxemon
  • Life stages, so Unmorphed tuxemon have lower stats and Morphed tuxemon have higher ones
  • Tastes, which would give individual tuxemon some higher stats and some lower stats
  • Stat Experience, so training certain stats (by fighting powerful tuxemon) makes them better
  • Combat Codexes and teaching, i.e. learning techniques from items and from other tuxemon who know the techniques. I actually think this is quite important to emphasise the plot points about openness and sharing vs commercialism and limited access, but it's not necessary for a functional game
  • Instead of forgetting a technique as new ones are learned, tuxemon could go to Centres to switch out which four techniques they have "ready"
  • Multi-battles, e.g. two against two or three against three
  • Limits to uses: Each technique could require recharging or have PP, or otherwise be limited from being used many times.
  • Accuracy: Each technique could have a chance of success, instead of always happening as is the current situation.
  • Non-standard Powers for effects: Instead of the Power of an effect being a fraction or an integer, it could refer to something else. For example, "number of enemies", "number of times this technique has already been used", "HP remaining", "percentage of HP remaining", "HP lost", "level of the user", "maximum HP", "one-eighth of maximum HP", etc.
  • Conditions that end under different circumstances
  • A more controlled way of doing Stat Changes, e.g. with stages

I think this is good so far.

One thing, retreats should always fail if it is in a trainer battle. Also, conditions should be checked before the moves are run. For instance, if you are frozen or paralyzed, you would want to know that before using a move rather than after. I feel that having to forget a technique would be better than just having the option of switching moves out as it makes you think more about which moves you want added, and which ones to discard.

We should also have some way to record the amount of progress you made in the game. It may only be possible after we finish writing the game, but every Pokémon game has it, so I think we should have it as well.

I like the idea of a codex. You could have during a side quest, or after beating certain trainers, extra "codexes" could be found that give special moves (like HMs and TMs in Pokémon). One side quest could be to give an NPC a codex that teaches a certain move, or you "bribe" one of the villains with a special codex to gain access to a certain area.

Stat experience, in my opinion, should only happen if you use a certain berry that upgrades that stat. Battles use all of a Tuxemon's powers, so each stat should gain experience.

Avatar

By bitcraft 14 Dec 2017 23:13

Champion · 166 comments

Thank you for this detailed writeup!  I will have to go through this again, but from my first review of this, I am pretty confident that the game can reasonably accommodate this right now.  From a programmer's perspective, I don't see many large obstacles for the mechanics of combat.

Where I believe we will have issues is the large amount of data which needs to be recorded and organized.  Maybe we can get some input from people who have contributed to the JSON DB entries.  We will have to record more info about monsters to support progressions, body types, etc; their comments can help us make it easier to contribute game data.

Maybe ShadowApex can update us on the wiki/jsondb sync scripts.  One comment I have about that is I wonder if we are using the wiki more because the JSON is difficult to use?  Am I just imagining things?

Avatar

By tamashihoshi 15 Dec 2017 08:32

Champion · 251 comments

About the additional json data: i havent put any Monster information in json yet, afaik shadowapex did that for me so far. And lori puts information into the wiko for me. Thank you both for that!

The monster maker page is a good start but i usually dont know what values are good/bad. A stat Distribution system would be nice to determine Monster stats.

I can't help any more right now... But you can do with my submitted stuff anything you want. If things go well, ill be back in the future...


We'll meet again, don't know where, don't know when. But I know we'll meet again some sunny day!