Eng:RPG Projects

RPG (role-playing game) projects generally feature a single or multiple playable characters who are guided on a quest through a treacherous world full of enemies, usually with the goal of rescuing an abducted character, saving the world, or defeating a great obstacle. RPGs rely greatly on a complex use of statistics (numbers) or an in depth story.

Full-fledged RPG projects are rare on Scratch due to the large amount of time input necessary to build working systems.

World
The world of an RPG is generally expansive and set in a fictional universe. Magic and medieval themes are common, but RPGs can be set in the present or far future. Fantasy themes are also common, as are science-fiction and technology.

The world of an RPG is navigated incrementally by the player, often by traveling to new towns and defeating dungeons as the plot progresses. The world is often projected in a top-down view, but side-scrolling and even platforming can be utilized.

Location Types
Several types of locations are commonplace.


 * Towns - these are locations where the player can rest to heal characters' wounds, purchase equipment, and progress the story through interaction with non-player characters (abbreviated as NPCs).
 * Hubs - some games utilize a "hub", a single town from which the game branches out as opposed to continually traversing to different towns.


 * Dungeons - locations infested with enemy that a player must enter in order to stage a rescue, gain important knowledge, or defeat evil.
 * At the end of each dungeon, players usually meet with some kind of "boss" enemy which is stronger than conventional enemies.


 * Overworld - a world map that connects all towns and dungeons. Generally featured only in games where the player can "free roam" - travel at his or her own will.

Obstacles
Some worlds feature obstacles that can only be removed if the player gains a certain skill, reaches a certain level, defeats a certain enemy, completes a certain quest or solves a puzzle.

Storytelling Structure
RPG games with free roaming often use a town to dungeon structure, where each new town has a challenge or oppressor who must be defeated before progress can be made. These games generally inhibit progress until the current town is cleared.

Other RPGs opt for a linear storyline that the player views but has no control over apart from winning or losing. These games generally disallow the player from revisiting old locations.

Programming a World
Worlds are generally easy to program with scrolling techniques, but the artistic merit of the world depends on the programmer's skill. Worlds are generally divided into "tiles" with different attributes such as water, grass, impassable, toxic, etc. Arrays are used by proficient programmers to denote which attributes belong to which tile, although color sensing can be used. Many RPG overworlds are from a bird's-eye perspective.

Battle
Most RPGs feature an emphasis on combat, through which the playable characters can gain strength or the player of the game can increase his or her own skills. Combat can be initiated as part of plot development or occur randomly while traversing a dungeon or the overworld.

Combat can be presented in a turn-based system or be controlled directly by the player in an action-battle system.

Both the player's and the enemy's stamina is usually represented by a health statistic, which is decreased whenever that player or enemy receives damage through an attack. Combat is ended when one side has no remaining members whose health has not been reduced to zero. The player is then awarded with items, experience, or money.

Turn-Based Combat
In a turn-based system, the game generally transitions to a "battle screen". Turn-based systems usually rely on multiple strategic commands such as the following:


 * Attack - deal damage to an enemy.


 * Defend - decrease damage taken from enemies.


 * Heal - restore an ally's stamina.


 * Magic/Special - use special techniques that deal increased damage, inflict negative effects, or bolster the player's statistics.

Battles themselves often feature various similar elements.


 * Negative effects - these include poison, causing damage to inflicted characters, and stunning, disallowing a character from moving or attacking.


 * Elemental Damage - some RPGs define elements such as water or fire, so that a water attack will cause increased damage to a fire-based adversary.


 * Random effects - this includes the chance to evade an attack or cause increased damage. Negative effects are often random.

Games such as Dragon Quest, Pokémon, and Earthbound feature turn-based combat.

Action-Based Combat
In action-based combat, the combat generally takes place directly on screen, without transitioning to a special "battle screen".

Action battle systems allow the player to have free movement and engage in real-time battle. The player characters are generally guided around the screen and have the capability to attack, shield themselves, and sometimes to jump.

Games such as Ys III and Phantasy Star 0 feature action-based combat.

Strategy-Based Combat
Strategy Role-Playing games (also known as Tactical RPGs) usually play in a board game-like fashion. Players take turns to move different characters or units, attack and move to strategic positions, to either stop enemies or support a character among other possibilities. Formations will need to be carefully thought through, with consideration of different factors such as statistics.

Most SRPGs also utilize a 'Rock, Paper, Scissors' mechanic which would greatly affect how an attack plays out, similar to previously mentioned "Elemental Damage". The most used variant of this mechanic would be "Sword beats Axe, Axe beats Spear, Spear beats Sword'.

Games such as Fire Emblem and Advance Wars feature strategy-based combat.

Programming Battle Systems
This is definitely the hardest part of programming an RPG. It is simplest to utilize procedures which take statistic values and calculate damage, percentage, etc. Statistic data is generally loaded into battle-system specific lists, which are then changed during battle.

In turn-based systems, different actions are generally connected through the use of broadcasts. It is most efficient to script in such a way that any script works the same regardless of who is attacking, being attacked, etc.

Another way to do this is by a 'sequence variable', after a move ends the variable would move on by one, allowing for the next character/enemy to make their move using the 'equal' operator. This is useful when you have multiple enemies or player characters, to help cut down on the amount of scripts used in broadcasts.

Magic techniques, when plentiful, are generally kept in lists and accessed when necessary to retrieve data such as power, element, and cost.

Statistics
In some RPGs such as Dragon Quest, Final Fantasy, and Pokémon, character strengths are measured by statistics. Although statistics are usually characteristic of turn-based combat, action based combat can feature them as well.


 * Health/HP - represents the amount of damage that can be endured before a character is rendered dead, faints, or becomes otherwise incapable of battle.


 * Attack/Strength - reflects the amount of damage a character deals to an enemy.


 * Defense/Resilience - decreases the damage a character takes from an enemy.


 * Magic/Special/Wisdom - reflects how strong a character's spells or non-physical attacks will be.


 * Magic Points/MP - in some games, strong magic techniques will require the expenditure of Magic Points for their use. Magic techniques cannot be used if the cost is not met.


 * Speed/Agility - this determines how far a character can move (in an action-battle system) or how soon in each turn the character's action will take place.


 * Luck/Evasion - this is used to calculate the probability that a character will evade an enemy attack or land a critical hit (a randomly occurring drastic increase of damage).


 * Experience Points/EXP - these points are awarded to the player in the event of a victory and eventually increase the player's Level.


 * Level - this value increases, along with any other statistic(s), in the event that a character gains enough EXP. Higher level equates to stronger characters. Generally, the maximum level is 100.


 * Critical Hit Chance - this value determines the chance that the character will deliver a critical hit, causing more damage to the opponent.

Programming Statistics
Generally, each character's data is stored in multiple lists, so that each list holds all of the same statistic (e.g. all Attack values exist in the same list). The data is then accessed when it is necessary. Because statistics may change during combat (through the use of techniques), statistic changes are generally kept in separate lists.

Often, it is necessary to output statistic values onto the screen, this can be achieved with a text stamping mechanism or simply using the show variable block.

Equipment and Items
Purchased in towns, gained through quests, dropped by enemies, and found as loot or treasure, these can be used to strengthen characters. Equipment is generally used to bolster statistics such as attack and defense, while other items can be used as a substitute for magic or healing effects.

Enemies generally increase in strength as the game progresses, so that players will have to continue to upgrade their equipment.

Common Equipment
Common types of equipment include weapons such as guns, axes, swords, spears and the like, armor, shields, gloves, shoes, and pants.

Common Items
Common types of items include medicine, antidotes to negative effects, items that bolster statistics, and items that deal damage.

Programming Equipment and Item systems
For more complex games with multiple items, item attributes (such as stat increase amount, which stat to increase, how many uses) are stored in large lists which are accessed by procedures when it is necessary. Data from the lists is either read directly using the item of list block or loaded into a variable.

Broadcasts are often used to separate different functions into their own script, whereupon each script edits the battle statistics as necessary.

Items also require some form of list, whether the list viewer is used or a text output system is scripted.

Examples

 * Animal Jam Jamaa Disaster by PrincessPandaLover
 * The Adventure of Filbert Jerkey by Hobson-TV
 * Sanic RPG demo by Catosaurus

Action-RPGs
These utilize stats and equipment, however tend not to have enough of a story to count as an RPG. Players generally go straight into gameplay, and usually do not follow any straight path by story or quests. The aim is usually to loot, get better equipment and items, and move on to tougher challenges. The Monster Hunter series is an example of this.

Visual Novels
These take a similar direction to RPGs in that they are heavily story driven with making choices. Visual Novels can have multiple endings to a story through the different choices the player makes, however other than making choices, they do not feature any other types of gameplay or combat and are more like interactive stories.

Action Adventure Games
Gameplay is very similar to Action RPGs, and may feature a very in-depth storyline. However what distinguishes this is the lack of statistics. There are usually no upgrades to weapons and equipment to bolster statistics (or at least a very limited variety of weapons), no level up system and fights are determined by how the player decides to attack and maneuver around in the area. Statistics have almost no play at all in a fight; however, the player could have a variety of moves. An example is the The Legend of Zelda games, such as The Twilight Princess, and various Sonic the Hedgehog games, such as Sonic Generations and Shadow the Hedgehog.