RPG Maker Forums

Related topics


Solid understanding on writing ATB(Active Time Battle) system plugins


Thorough Comprehension on writing ATB(Active Time Battle) system plugins(Possibly upcoming)


Goal


Shares my experiences and understandings on writing a basic ATB system plugin and their addons, meaning easy, simple and small cases will be the focus.


Targeting Audiences


Those having some battle related javascript coding proficiency(inexperienced junior plugin developer having written several easy, simple ans small battle related plugins without nontrivial bugs), and:


1. Basic knowledge to the default RMMV battle flow implementations


2. Basic knowledge on how the fundamental ATB system concepts work on the user level


Contents


I. Fundamental ATB system plugin implementation concepts


1. ATB Frame Update


2. ATB Wait Condition


3. Battle Turn Clock


4. Battler ATB Clock


5. ATB Flow Overview


6. Summary


II. Differences between the default RMMV battle flow and the ATB flow


1. Stuffs to be gone in the default RMMV battle flow to become the ATB flow


2. Stuffs to be edited in the default RMMV battle flow to become the ATB flow


3. Stuffs to be added in the default RMMV battle flow to become the ATB flow


4. Summary


III. Ways to write the easiest, simplest and smallest ATB system ever


1. Clarification


2. Stuffs to be implemented


3. Writing DoubleX RMMV Minimalized ATB from scratch


4. Summary


IV. Ways to write a basic ATB system having all core functionalities


1. Clarification


2. Stuffs to be implemented


3. Writing DoubleX RMMV Popularized ATB Core from scratch


4. Summary


V. Comparisons between DoubleX RMMV Minimalized ATB and DoubleX RMMV Popularized ATB Core


1. Shortcuts taken in writing DoubleX RMMV Minimalized ATB


2. Testing various ATB Wait Conditions


3. Summary


VI. Ways to write an easy, simple and small ATB system addon


1. The Core Addon Approach basics


2. Interactions between the core and an addon


3. Some easy, simple and small ATB system addon examples


4. Summary


VII. Ways to study some other ATB system plugins


1. Ellye's ATB(also includes CTB option)


2. YEP.24 - Battle System - Active Time Battle


3. Summary


VIII. Summary


With the framework's set, let's get started. I'm going to talk about Fundamental ATB system plugin implementation concepts:

Spoiler



ATB Frame Update



Spoiler



While you know the battle system is run per frame, you may wonder what's the difference between Battle Frame Update and ATB Frame Update.


Basically, the difference is that, the former will always run while the latter won't run when the ATB Wait Condition's met, and the former's universal to all battle systems while the latter's unique to ATB systems.


The latter mainly does the following(these details will be explained later):


1. Runs each battler's Battler ATB Clocks


2. Runs the Battle Turn Clock


3. Set a battler that becomes able to execute actions to be the Action Execution Subject when there's none


4. Setups an actor that becomes inputable when there's none


5. Updates all actors' atb bars(unless you don't even implement actor atb bars)


Bear in mind that the action execution itself's updated by the Battle Frame Update but not the ATB Frame Update.



ATB Wait Condition

Spoiler



Unless one can flawlessly implement executing more than 1 actions at the same time, no ATB system can have absolutely no waits, meaning every ATB system has an ATB Wait Condition determining if a Battle Frame Update should run an ATB Frame Update.


Usually, the ATB Wait Condition's 1 of the below:


1. Wait when the ATB Frame Update can be run without inducing bugs(situations like having a message displayed can induce bugs if the ATB Frame Update's run)


2. Wait when an action's animation's playing as well


3. Wait when an actor's picking the action's targets as well


4. Wait when an actor's picking a skill/item as well


5. Wait when an actor's can input actions as well



Battle Turn Clock

Spoiler



Unless you're going to abandon the whole battle turn number concept entirely, you'll need a global atb clock to run it, as its implementation used by the default RMMV battle system won't work in any ATB system anymore. It's because both the party and troop have the action input phase and action execution phase in battles, and its turn number mechanics's built around it, while no ATB system will ever divide a battle that way(details will be explained in Differences between the default RMMV battle flow and the ATB flow). As the battle turn clock must be run by the battle itself, a Battle Turn Clock will be needed to run it.


The Battle Turn Clock normally uses 1 one of the below 2 units:


- Frames. Each battle turn consists of a specific number of ATB Frame Updates


- Actions. Each battle turn consists of a specific number of executed actions


For both units, when that specific number's reached in a battle turn, the battle turn number will be increased by 1 and the Battle Turn Clock will be reset.



Battler ATB Clock

Spoiler



In an ATB system, each battler has an independent action input phase and action execution phase, as well as an ATB refill phase, meaning each battler needs to have an independent Battler ATB Clock.


The Battler ATB Clock's usually used in 1 one of the below 2 ways:


- Checks if the battler should be able to act. When it's true, that battler can input then execute actions, and the Battler ATB Clock will be reset afterwards; When it's false, that battler will need to wait until the aforementioned check returns true.


- Checks if the battler's inputted actions should be executed. When it's true, that action will be executed and then that battler can input actions again; When it's false, that action will need to wait until the aforementioned check returns true.


For both ways, the battler's speed must be used to run that Battler ATB Clock, as the essence of an atb system is to make the some battlers act faster and more frequently than the others. Using the default RMMV settings, the battler's speed's determined by that battler's agi. This also implies that the skill/item invocation speed's mostly useless in the 1st way of using the battler atb clock.



ATB Flow Overview

Spoiler



Consider the below simplified flowchart:



Spoiler




Basically, the ATB system only has 2 battle phase - Not Executing Actions and Executing Actions, and 3 battler phase per battler - Refilling ATB, Full ATB, Executing Actions.


The ATB system battle phase's divided that way because of the below 2 of the most fundamental Scene_Battle based foundations(too advanced to be explained here):


1. Only 1 battler, the Action Execution Subject, can execute actions at a time.


2. Only 1 action, the Currently Executing Action, can be executed at a time.


So it's vital to check if any battler's already executing actions before letting any other battler that can execute actions to execute them.


On a side note: Some addons need to add some more battler phases in order to work, but those will be covered later.


The below explains how the simplified ATB flow works:


Battle Frame Update

Spoiler



It'll always run per frame(technically there are some exceptions but let's ignore them now for the sake of simplicity) and is always run by Scene_Battle(It can't be run by BattleManager.update or the ATB Wait Conditions will be restricted to wait when an actor's inputable, which will be explained in Differences between the default RMMV battle flow and the ATB flow).


The Battle Frame Update will first check if the ATB Wait Condition's met.


If that's the case, the ATB Frame Update will be run.


Otherwise the Battle Frame Update will continue to execute any executing action.


If the action execution reaches its end, the Action Execution Subject's Battler ATB Clock will be reset, and the battler will be marked as Unactable(impossible to be the Action Execution Subject right now) and shift from Executing Actions to Refilling ATB(And the battle phase will shift from Executing Actions to Not Executing Actions as well).

ATB Frame Update

Spoiler



It won't run if the ATB Wait Condition's met.


It'll first update each battler's Battler ATB Clock.


If a battler's Battler ATB Clock becomes full, that battler will make actions, be marked as Actable(possible to be the Action Execution Subject right now), and shift from Refilling ATB to Full ATB.


Then the ATB Frame Update will check if any action's executing. If that's not the case, exactly 1 Actable battler that has finished inputting actions will become the Action Execution Subject and shift from Full ATB to Executing Actions(And the battle phase will shift from Not Executing Actions to Executing Actions as well). For either case, the action will begin/continue to be executed.


If the action execution reaches its end, the Action Execution Subject's Battler ATB Clock will be reset, and the battler will be marked as Unactable(impossible to be the Action Execution Subject right now) and shift from Executing Actions to Refilling ATB(And the battle phase will shift from Executing Actions to Not Executing Actions as well).


Recall that the action execution itself's updated by the Battle Frame Update but not the ATB Frame Update. The latter just marks that the former needs to/need not update action executions by manipulating the battle phase.


The ATB Frame Update will then check if any actor becomes inputable, and will setups the actor command window for that actor if that's the case and no other actors are inputable.


Finally, the ATB Frame Update will update all actors' atb bars. Nothing else will be updated in most cases to boost time performance(too advanced to be explained here).







Summary

Spoiler



1. The ATB system consists of 2 battle phase - Not Executing Actions and Executing Actions, and 3 battler phase per battler - Refilling ATB, Full ATB, Executing Actions.


2. The Battle Frame Update, which updates the action execution itself, will always be run per frame, while the ATB Frame Update won't run when the ATB Wait Condition's met.


3. The ATB Frame Update runs each battler's Battler ATB Clocks and the Battle Turn Clock, and sets an Actable battler that has finished inputting actions to be the Action Execution Subject when there's none.


4. A battler becomes Actable when that battler shifts from Refilling ATB to Full ATB, becomes the Action Execution Subject when that battler shifts from Full ATB to Executing Actions, and becomes Unactable when that battler shifts from Executing Actions to Refilling ATB, which occurs when that battler has finished executing the Currently Executing Action.







That's all for now. The remaining parts will be covered later :)

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,034
Messages
1,018,446
Members
137,820
Latest member
georg09byron
Top