0 reviews
  • Add Review
  • Subscribe
  • Nominate
  • Submit Media
  • RSS

Game Mechanics Part 12

  • LMPGames
  • 07/02/2023 03:35 AM
  • 550 views
Game Mechanics Part 12

Welcome to our twelfth blog on game mechanics! Today we're going to be getting into some minutiae and talk about several small RPG Maker mechanics that are almost always done wrong, we'll discuss damage formulas and how I am utilizing them, and we're going to be discussing minigame mechanics.

so, let's jump in.

_________________

Sweating all of the small stuff

If you have been around RPG Maker long enough, you know that there are some game systems that commonly suck among RPG Maker games. This isn't because the game developers did these systems wrong; they are bad because RPG Maker itself does them horrible and fixing them is sometimes a pain in the ass.

These are systems like escaping from battle, the attack hit system, enemy balance, and status effect interaction.

In the Legend of Emilar, I will be attempting to address all of these annoyances, though getting them to work the way they should is hard in RPG Maker because the coding behind these systems is not sophisticated enough.

While I could try to update the code, I think, for the time being, it isn't worth the amount of effort it would take so I will be trying to fix these issues through plugins, adjustments to formulas through some YanFly plugins, and other small-scale changes. A plugin may be made/used on a case by case basis as needed.



Can't I just escape?!

Escaping from battle in an RPG Maker game can be an exercise in futility. Unless the developer has taken some time to work out a decent formula, escaping is almost an impossibility.

In Emilar there are going to be some modifications to this system. First an foremost, escaping will generally be an almost guaranteed success, but there will be some situational impacts as well.

First, if you are facing off against more enemies than you have party members, that will impact your escape success. If you are facing off against twice your party size in enemies, it will impact your chances writ large. If you are facing off against enemies that have a higher combined agility rating than your party, this will impact your escape success.

If you are fighting two or three enemies and these enemies are slower than your party, escaping should be quite easy.

Each of these conditions is not exclusive. If you are facing off a small group of enemies, but those enemies are faster than your party; your chance of escape is going to be a bit lower.

I don't have any hard values, but here is how I envision this breaking down:


More enemies than party members

Each extra enemy (if you have two party members and they have 3, that is 1 extra) reduces your chance of escape by 1%. If there are twice the number of enemies compared to battle party members, the amount is increased from 1% to 5% for each enemy.

If they out number you greater than 2 to 1, even by 1 enemy; the amount is increased from 5% to 8%.

If you match their numbers or out number them, no change is made to the base success chance.


Enemy team agility

If the enemy team is as fast as or slower your team; no penalties or bonuses are added.

If the enemy team is slightly faster (up to 25%?), a small penalty of 2% will be applied to your escape chance for each enemy in the enemy team. This per-enemy penalty is designed to be very disruptive if fighting larger enemy groups.

If the enemy team is moderately faster than your party (up to 75%?), a penalty of 8% will be applied, not on a per-enemy basis.

If the enemy team is double or higher your party speed, a penalty of 12% will be applied, not on a per-enemy basis.


Enemy levels

Enemy levels will factor into this calculation as well though the impact will be less substantial. However; in a close contest, it could be the deciding factor if you are able to escape or not.

If the combined average enemy level is lower or around the same as your party's, no penalty will be applied.

If the combined average enemy level is somewhat higher than your party's (within 2-3 levels), a penalty of 5% will be applied.

If the combined average enemy level is higher than your party's (over 3), a penalty of 8% will be applied.


Enemy type

Enemy type will also factor in here too. Most normal bosses will prevent your escape. Optional and super bosses should generally present your with no issues when escaping unless that specific enemy has abilities or traits that hinder you from doing so.

Normal enemies will get a base 0.5% chance of preventing your escape for each enemy in the team.

Variant enemies will get a base 1% chance of preventing your escape for each enemy in the team, even if the other enemies are not also variants. So be on the look out for variant enemy teams that have multiple enemies.

so what does this all mean? Let's whip up some examples.


Example 1
Let's say you are fighting 5 enemies with three party members. Three of the enemies have low agility, one has normal agility, and the last has an about average agility leaving your party agility score at 50 and the enemy's at 64. Let's also say that the average enemy level is 4 levels higher than your party's. All of them are normal enemies.

Following the rules set out above, your chance of escape would be reduced from ~80% to ~57.5%. -2.5% for the enemy type penalty. -8% for the enemy level penalty, -10% for the enemy agility penalty, and -2% for the enemy team size penalty. That is a total penalty of -22.5%.

While you may be able to escape, it might take you a try or two under those circumstances.


Example 2
For this example, let's say your are fighting a single enemy with two party members. It has an average agility, but it is 10 levels higher than your party's average. This enemy is also a variant.

Considering the above, here would be your penalties:
-1% for enemy type
-8% for enemy average level

so your final escape chance would be ~71%. So pretty decent chance of an escape on the first attempt. But, let's hold on a moment and make this a bit more interesting.

Let's say that at the start of the fight you are confident that you can beat the enemy so you go in pretty hard. Then about halfway through the fight, the enemy uses an ability that spawns in four minions. Now you aren't so sure you can win; you have used up a good deal of your healing items in fights up to this point and are running low on MP. While the minions are average in terms of their agility, the extra values pushes the enemy team ahead of yours (45 to 105).

So you decide to try to run, however the new enemies have shifted your chances, dramatically. Here would be your new penalties:

-5% for enemy type
-21% for the number of enemies compared to your party (almost 3 to 1; 8%/enemy w/ 3 extra enemies)
-12% for enemy agility (over double)
-5% for the average enemy level (because the minions are lower level, the average level difference is now 3)

Total penalty: -43%
Escape chance: 37%

So now your chances for escape are much lower than before and you might find yourself trapped for a few turns; given the number of enemies and your party's state, that is all it might take for your party to be taken out.

It may seem silly to put this much thought into such a small and insignificant system, but it won't feel so insignificant when you are faced with the situation posited in example 2 and in that situation, if the escape system is using the normal cracked RPG Maker system, you're going to be very frustrated while trying to escape.

In the instances where you need to escape, but can't or have a hard time doing so, an item will also be available to force you out of battle. It will not be cheap and finding shops that have them will be an uncommon occurrence. You may also find them in chests once in a while.



Why do I keep missing?!

Another common issue with RPG Maker is that the hit rate system makes no sense. It will have you missing attacks 15% of the time when you are not blinded, the enemy has no buffs, or anything like that.

In Emilar the ideal working of this system will be that, barring a higher agility enemy or some other considerations, you will always have a 100% hit rate when no status effects are in play.

Enemy agility will play a small factor in your hit success chance. It should be minimal though and require the enemy to have a substantially higher agility to dodge your attacks on a regular basis.

If you are impacted by a status effect, you will see some of the more significant hits to hit success rates. Blind will drop your hit success by 60%. You will get the occasional hit, but more of your attacks should miss.

If you are hit with Slow, your agility is lowered so that might impact your hit chance. The status itself will also have a minor hit rate penalty of 10%.

There may be other status effects that will impact your hit success rate as well. In addition to that, your magic hit chance can also be impacted. Blind will do so and there will be some specific status effects that will lower this stat as well.

In addition to status effects, battle conditions can play a role too. While I have not nailed down all of the details of the system yet, there will be a battle "weather" system. If you are fighting in light fog, for example, your hit chance goes down. There will be some other aspects to this system we will discuss once I am ready to talk about it and know it is feasible to do.



0 damage?! Fuuuuuu!

If you have played a lot of RPG Maker games, you have probably seen the incredibly annoying "0 damage" message a number of times. What causes this is when your enemy's stats are high enough to nullify your attack damage.

In most cases, this isn't a problem for shorter games where the stat increases per level and gear upgrades are substantial. In longer games, like this one, it is a huge freaking problem. I have a two-fold approach to this one. One of them we're talking about in the damage formula section.

The other one is a scaling plugin from Yanfly. How it works is that it takes your attack power and the enemy's defensive power and then scales them against each other to try and prevent there being no damage calculated. While this plugin is a god send, it is also not quite enough on its own to be utilizable, at least to my liking. The enemy levels plugin also screws around a little bit with this too.



Why didn't Wet remove Burn?!

The last of these smaller systems we're going to talk about are status effect interactions. A lot of the time, this is something that game developers might overlook. If I have a status effect that seems like it should be exclusive to another one, and then I have that other one applied it should remove the original status.

To that end, I am putting some pretty hefty consideration into all of the status effects and the interactions each would have. For example, if you have both types of poison status effect applied, the damage they will do to you each action is increased.

If you are afflicted by Burn and are hit with a fire spell, that fire spell is going to do more damage.

If you are bleeding and then are poisoned, the damage that poison does and the number of turns applied will be reduced.

If you are afflicted with Wet, ice and lightning attacks will do more damage to you.

These are few of the examples.


___________________

Damage, where does it come from?

The humble damage formula. The source of much jubilation and much anguish. It is also something that is hard to get right and easy to mess up.

If you have never dabbled in RPG Maker before, the way all attacks do damage is via a damage formula on the skill. Every type of attack in RPG Maker is a skill, even normal attacks. Items also have a damage formula.

In a lot of cases, damage formulas are not spicy; they are just basic calculations that go something like this:

a.atk - b.def / 2

Not even joking. I have seen that in some form or another in many RPG Maker games and that, in fact, is very similar to the default damage formulas that are used on the example skills.

These formulas can be so much more though, you have a lot of tools to be creative. For example, you can use checks against status effects, game variables, switches, and a number of other Javascript functions to make things much more interesting.

I would suggest, though, to enterprising RPG Maker game devs to use YanFly's skill and status plugins so you can utilize Lunatic mode to do your complex stuff in the note tag boxes instead of in the damage formula as you only get one line and adding in complex logic is hard to maintain in there.

Anyway, in Emilar damage formulas are very spicy. For example, there are a number of level-based formulas for skills. What does "level-based" mean? It means that your class level is taken into account in the formula somewhere. This is done to make sure that weaker skills retain their usefulness as you progress through the game.

Here is an example, the humble Stab weapon skill:

Math.floor((2 * a.level) + (a.atk + (a.atk * 0.50)) - (b.def + (b.def * 0.35)))

So, what the hell is all of this you may be asking. Let's break it down.

Math.floor((2 * a.level) + (a.atk + (a.atk * 0.50)) - (b.def + (b.def * 0.35)))

This is a Javascript Math function. What it does is rounds down to the nearest whole number based on what value you give it. So if you give it 78.98, it will give you 78 back.

Yes, this means that all damage in Emilar is rounded down.


Math.floor((2 * a.level) + (a.atk + (a.atk * 0.50)) - (b.def + (b.def * 0.35)))

This part here is where the level-based nature comes into play. The first part of this section is the base damage. All attacks will have a base damage that is guaranteed to hit. This is to stop the 0 damage attacks from happening and to give the Armor Scaling plugin we talked about earlier a bit more to work with.

The base damage is then multiplied by your level, so the higher your level the more guaranteed damage Stab is going to do.


Math.floor((2 * a.level) + (a.atk + (a.atk * 0.50)) - (b.def + (b.def * 0.35)))

Next up is your damage calculation. Most, if not all, attacks in Emilar will consider your total attack power and then add some percentage of it into your damage. In this case, your attack damage is your total attack power plus another half of your attack power.


Math.floor((2 * a.level) + (a.atk + (a.atk * 0.50)) - (b.def + (b.def * 0.35)))

This section calculates the enemy's defensive power. Similar to your attack damage, the enemy's entire defense power is taken and then another percentage of it is added.

Attack and defense are switched to their magic equivalents for spells, though some spells use both physical and magical stat attributes.

So, let's get an example using the formula above going. Let's say you're level 82 and have 177 attack power. Let's say the enemy's defense is 190. How much damage would you do? Let's find out.

Math.floor((2 * 82) + (177 + (177 * 0.50)) - (190 + (190 * 0.35)))
Math.floor((164) + (177 + (88.5)) - (190 + (66.5)))
Math.floor(164 + (265.5) - (256.5))
Math.floor(173)
173

So you would end up doing 173 damage before the damage variance and any status effects are applied.


Here is another interesting one:

b.isStateAffected(90) ? Math.floor(b.hp * 0.6) : Math.floor(b.hp * 0.3)

This formula is from a "Gravity" like skill. Gravity, also known as Demi, is a common RPG spell that cuts your health down by a percentage. In this case, though, we have a status effect check. It is using what is called a ternary which is basically just a true/false statement written on one line. If the condition is true, the first outcome is used, if not then the second is used. In this case, the condition is "are you afflicted with status effect 90?".

If you are afflicted with that specific status, your health damage goes from 30% of your current HP to 60% rounded down. In this instance you can see why I am rounding damage down as opposed to up or to the nearest whole. If we did either of those, this type of spell could kill you.

By always rounding down, these types of spells cannot kill you because at some point you'll be taking less than 1 damage which will always be rounded down to 0. That said, scaling may prevent the "don't kill" aspect of this formula set up; I haven't tested the two together yet.


____________________

World Systems, fancy name for minigame

In Emilar there will be a number of side-systems that allow you to do stuff that has no real impact on the story, but can help you with side quests, crafting, and other activities. These are called World Systems, but really they are just minigames.

Farming, mining, fishing, collecting, and digging are the planned minigames.
Each minigame requires a specific type of key item to do and there may be certain stages to the game that require more advanced tools.

For example, a standard pickaxe can be used for mining general resources from rocks and stones, but in order to mine Magi-crystals, you need a specific tool.
This will be similar for all of the minigames.

For the most part, fishing and farming are just things to waste some time one.
There may be a few side quests that require you to use these systems. For example, you may need to have a certain level in farming to instruct someone how to cultivate food to help them sustain their village or you may need to find or grow a certain plant for someone.

The fishing minigame will be more of a minigame than an additional system.
Each fish category and size will impact the amount of gold you can sell them for. Some of the more unique fish types may give you buffs when eaten in battle.
Certain quests might require you to catch certain fish, participate in fishing tournaments, etc.

Mining is one of the more utilizable minigames. Crafting is going to be heavily incentivized. The total cost to buy an item vs. crafting that item will be about 3 to 4 times. So while a potion might cost you 150 gold, you can craft it for 25 gold plus the materials needed. This price scale gets larger the more valuable and complex an item is. A Mythril Shield, for example, might cost you 2500 gold, but you can craft it for 275 plus the materials.

Mining is also the most common way to get Magi-Crystals for the secret finder. You might find them occasionally in chests or as rewards in battle, but not in enough quantity to properly utilize the secret detector.

Collecting is kind of a catch all phrase for harvesting (kind of related to farming as well). There will be certain plants and other objects that you can collect materials from over time. Each type of object has its own tool. For example, to harvest leaves for potion crafting you need clippers. To collect wood for making hafts for swords, you need an axe.

Digging is the final minigame and is what it sounds like. Grab a shovel and start digging. I am still working out how digging should work, if there should be a specific type of tile that indicates "HEY, you can dig here!" or if it will be a system where you can dig anywhere and there would be a random chance of finding something.

I am leaning toward the former because that is easier to control balance-wise and I don't need to create some kind of crazy plugin to make that happen. It also allows for me to specifically tell you that something can be found in a location rather than you having to Metroid the game in a second way.

You can find lots of things by digging; gold, items, equipment, maybe even hidden areas (?!).

We will talk more about the crafting system at some point, but you kind of get an idea of the level of detail it will have if you'll be crafting hafts.


Well, that is it for this week. Catch you next week for part 13! Questions and comments below.

Posts

Pages: 1
The formula seems unnecessarily complicated.
Math.floor((2 * a.level) + (a.atk + (a.atk * 0.50)) - (b.def + (b.def * 0.35))) can be rewritten as;
Math.floor((2 * a.level) + (a.atk * 1.5) - (b.def * 1.35)) and it should have the same effect.

Also, how does this formula prevent 0 damage? Your text implies that the level times two part of the formula is a minimum guaranteed damage, but I don't see it. Once an enemy has a defense greater than 1.111... times the attacker's attack, the defense of the enemy will reduce the damage to less than level times two. In order for your formula to have its minimum damage, you have to give the (a.atk + (a.atk * 0.50)) - (b.def + (b.def * 0.35)) part of the equation a minimum of zero.

Mind you, I don't think your formula is bad, but I don't see how it does what you implies it does.
author=Crystalgate
The formula seems unnecessarily complicated.
Math.floor((2 * a.level) + (a.atk + (a.atk * 0.50)) - (b.def + (b.def * 0.35))) can be rewritten as;
Math.floor((2 * a.level) + (a.atk * 1.5) - (b.def * 1.35)) and it should have the same effect.

Also, how does this formula prevent 0 damage? Your text implies that the level times two part of the formula is a minimum guaranteed damage, but I don't see it. Once an enemy has a defense greater than 1.111... times the attacker's attack, the defense of the enemy will reduce the damage to less than level times two. In order for your formula to have its minimum damage, you have to give the (a.atk + (a.atk * 0.50)) - (b.def + (b.def * 0.35)) part of the equation a minimum of zero.

Mind you, I don't think your formula is bad, but I don't see how it does what you implies it does.

First, thanks for the refactorization. I have been working at shortening the formulas and this never occurred to me for some reason; literally had a "omfg what am I doing" moment lol. Makes complete sense now that I am looking at it though.

As for your question, you do have a point. The formulas, as written, don't actually prevent every instance of invalid damage. They do cover most though. I have done extensive static testing outside of the engine on the way I have them formatted, enemy defense values would need to be fairly unbalanced to reduce the damage to 0 in most intended cases.

YanFly's Armor Scaling plugin does a lot of work as well to balance out enemy vs player stats in damage calculations.

The only edge case that will probably happen that I am not handling right now is when you have a low level character fighting against a higher level enemy, one that is high enough to have unbalanced stats; probably would only happen against super bosses and maybe some end-game bosses.

The enemy level system should handle some of that, if you have a low level character it will pull down the average party level which will impact enemy stats somewhat.

There is also a system coming up I will be discussing on how lower level characters will be handled. Long story short, if you have a character that is drastically lower leveled than the average party level, either because it's a new class or a new character you just recruited, they will get a mild exp boost to get them leveled up closer to where they need to be if you enable it.

All of that said, there could still be situations where this will be a problem and I have a contingency plan ready to be put into place if it needs to be; a small plugin to deal with invalid damage totals. I don't want to use it if I don't need to, but if all else fails I will.

It's either that or adding some code to each skill through YanFly's skill core to do it, which I would rather not as it would have to be on each skill and maintaining that would be a pain when the game will have around a minimum of 700 player character skills once everything is said and done if I have calculated things correctly.

Good callouts though, it's always good to get challenged on your designs so that you have to think about the reasoning behind them and defend those choices or find that yeah, changes are needed.
YO, I missed this one or something. Those changes to the escape system are wild but make so much more sense than the broke ass standard RPG Maker escape.

I like that you are looking at stuff that is just dog crap in RPG Maker, generally, and are fixing them with cool as hell ideas. Most RPG Maker devs just throw band aids over the gangrenous parts of the RPG Maker and call it a day.

Worlds systems are the first mechanic I think might be bloaty. Are these really needed? Or are you just adding these in the pad the play time?

What are your plans for how these are going to be used, in real terms. There is so much in the game already, I don't think this stuff outside of material gathering for crafting is needed.

Like fishing and farming? Farming maybe for crafting mats, but I don't see why fishing is here. That said, I usually detest minigames in games so take my cringe with a grain of salt.
author=TrashCanEnthusiast
Worlds systems are the first mechanic I think might be bloaty. Are these really needed? Or are you just adding these in the pad the play time?

What are your plans for how these are going to be used, in real terms. There is so much in the game already, I don't think this stuff outside of material gathering for crafting is needed.

Like fishing and farming? Farming maybe for crafting mats, but I don't see why fishing is here. That said, I usually detest minigames in games so take my cringe with a grain of salt.



I completely understand where you are coming from. The minigames are mainly there for world-building reasons, though some are there for the exploration and crafting systems. I tried to limit the number of these to the ones that I thought made the most sense.

Fishing is really the only one that has no practical purpose right now. I thought it would be interesting to add it in to give players something to do if they wanted to take a break from all of the normal RPG stuff.
Pages: 1