Well, at least more advanced than what people on scratch normally use.
CURRENTLY UNDER CONSTRUCTION!!!
1. Introduction
You want to make an RPG, right? Well what if you want the battles to be more complicated than *select action* *both sides do action* *repeat*, and add actual timing to it? So you could have one character that shoots faster than the other, while still having normal RPG elements like attack, defense etc. Then read on! And please click this link to help support the creator of this thread: http://www.kongregate.com/games/katana0 … m-war-demo
NOTE: it is possible to use this for a turn-based game, but not recommended. See section 3 for more details.
NOTE2: I just realized that I have forgotten to post the link to the engine, it's here: http://scratch.mit.edu/projects/juststickman/1162572
2. (a bit more than the) Basic idea
Now what makes this thing different from normal engines is timing. Actions are carried out on "game ticks" (concept inspired by runescape). These game ticks use the timer to calculate them, so lag won't affect this engine as much (if you somehow manage to lag in a battle engine anyway >.>). The stats of characters are:
1. attack
You know, the stat that increases the damage you do?
2. defense
You know, the stat that increases the damage you defend?
3. Luck
You know (if you play maplestory), the stat that increases missing chance, and may or may not act like a weaker attack and defense together?
4. Speed
This is the one not really used a lot. It's basically how fast your energy bar charges up (more information about that coming up).
5. HP
Hitpoints. Do I need to say more?
6. MaxHP
The hitpoints cap, for complete RPGs, this has a use. For a battle engine, almost useless.
7. AttackType
Important if you want to edit, as you'd need an if statement for every attack type to play a different animation, play a different sound, use a different formula etc.
And then there are variables within the characters, editing these will have no effect because they change constantly anyway:
1. chargeup
This is how much energy is charged, the speed this is gained is affected by, yes, speed!
2. chatTick
This just makes your chat box disappear after a while. This variable is just for if you're using text-based attacks (Aka you're too lazy to animate something so you just make the character go "SHOOPDAWOOP!" or something).
3. lastTick
This is the reminder for when the last tick was and changes energy accordingly.
The way the engine works is something like this...
<tick increases>
<speed changes chargeup>
<if chargeup is at least 100, attack>
<change stats>
<repeat>
Ok? Ok.
Now, the base formula for calculating damage is this (this is for basic attacks, it may change for something like a defense using attack):
round (0.5*(√((((a*3)-b)*(pick random 1 to (c*2)))*(pick random 1 to d)))
Where...
a is attacker attack
b is defender defense
c is attacker luck
d is defender luck
And all the other (HUD stuff) may or may not be explained later.
3. Editing it
Editing looks and stuff
First of all, there's a list at the bottom of the screen that displays messages. If you look at the list blocks in the scripts, you can find displayed messages. Feel free to edit these and watch the results. If you think the ticks are going to slowly, change the 0.2 in the
if <(timer) > (0.2)>
script in the stage to a lower number. If you think the ticks are going too fast, change it to a higher number. This could be used for slow motion effects if you create a variable.
obviously, you can edit the sprites and their animations.
The HUD is drawn with pen, you could change the colors there, or possibly size/thickness by changing pen settings and multiplying the numbers. The HUD is a placeholder for now, there's only one script and that's a message for the message box.
Working with ticks
In the engine, the tick count is in the top right corner, feel free to change/hide it.
You now know how to change the time one tick lasts. Now you'll learn how to script an action using ticks. This means you can make your entire game using ticks and not just the battle engine.
NOTE: you can create a turn based game based on this making a tick happen every time the player presses a key etc. instead of using time. But that defeats the point of ticks, so you might as well use a normal turn based engine.
Basically, when working with ticks, you need a second variable. This variable will determine how many ticks an action lasts.
For example: you press SPACE to move 1 step for 3 ticks
First, create a variable (I'll call it a for this example). Ticks will be called b for now.
Then, create a script like this:
When green flag clicked
-forever-
if <Key [space] pressed>
{set [a] to [(( b ) + ( 3 ))]
-end loop-
if <not<(a)>(b)>>
{move ( 1 ) steps}
-end loop-
-end loop-
So, what's happening is this (please note that there must be a tick script somewhere else)...
1. The program checks for the key space being pressed
2. If the key space is being pressed, a variable is set to an amount of ticks plus 3 (so that it repeats for 3 ticks)
3. The program checks if a is not more than b (same as greater than or equal to)
4. If this is true, the script is executed.
But there's a problem! That means this will go on until the next tick, no matter what the FPS is! This works for something like {say [ ]} because doing it multiple times will have no effect. If you want it to happen once per tick, you'd have to create another variable, c to check if the action has been executed this tick (yes there is a simpler way to put this together using the same concept but less blocks, this is just to annoy those copying block for block):
-forever-
if <Key [space] pressed>
{set [a] to [(( b ) + ( 3 ))]
-end loop-
if <<not<(a)>(b)>> and <not<( c ) = ( b>>
{move ( 1 ) steps}
{set [c] to [ b }
-end loop-
-end loop-
Or you could go for the simpler way (but this one means that you must put only the script for the action together, not the triggers of the actions like key space pressed, sadly also needing another variable, c):
-forever-
{set [c] to [ b ]}
if <<not<(a)>(b)>> and <not<( c ) = ( b>>
{move ( 1 ) steps}
{set [c] to [ b }
-end loop-
{wait until <(((c) + ( 1 ))=( b)>}
-end loop-
Putting it into an RPG
Now, if you want to put it into an RPG, you have a few choices on what to do. No matter how you edit it, you probably will need to change the stat variables, possibly according to local variables in the character/enemy sprites or another global variable. One thing about this is that if your game has equipment with bonuses, you could set the attack (or other stat, in this case P1-Attack) to the player's attack plus the bonus from the equipment.
1. Put it into an RPG where the battle is separate from the map.
In this, you need to replace most of the when green flag clicked with when I receive enter fight or something like that, and you may need to create a variable called "fightfinished" so that you can put this script into every loop:
if <(fightfinished) = ( 1 )>
{stop script}
-end loop-
And set fightfinished to 1 when somebody dies so that the loops don't go on forever.
2. Make ticks the unit of time
In this version, you don't leave the map to fight, you just disable movement (possibly with a boolean using a variable). In this kind of game, every action would take one tick to remain consistent (or more ticks if it takes longer). For example:
You have an RPG that uses A and D to move.
The key D is being pressed in the RPG. The terrain scrolls 5 steps per tick that D is pressed.
___
And also, with this you could make a day and night system. (look at "working with ticks").
A note on status effects&other attack effects
In most RPGs, there are status effects like slowed, weakened etc. Using what you read in working with ticks, you can use these, increasing a if you want it to last longer. Here's the general idea of what you should do for a few of them (pretty simple for most of them):
1. Poison
Every tick, decrease health.
2. Slow
For the ticks specified by a, reduce speed by a number.
3. Weaken
For ticks specified by a, reduce attack/defense/both by a number.
4. Speed up
For ticks specified by a, increase speed by a number.
5. Attack up
For ticks specified by a, increase attack by a number.
ETC. you get the point.
What's more complicated is attack effects, which would be part of the actual attack. If you look at the stage's script, you'll see that there's a boolean for every attack type (only one), you can add your own with certain effects like...
1. Energy drain
Set enemy speed to a negative number for 1 tick.
2. Heal
Either increase HP by damage you do (or a fraction of it, remember to check for the HP cap!) or increase HP by a set amount inside the if boolean for the attack.
Last edited by juststickman (2010-06-30 15:30:31)
Offline
For people that don't know, √ is supposed to mean square root.
I posted this because Scratch's forum rendering displays the sqrt char wrong and that juststickman's post has that char in it.
Offline
I think this does a poor job of explaining things. Is this meant to be for a free roaming MMO style RPG or a turn based RPG? There is a huge diffrence. Non traditional MMO style RPGs like Runescape have each weapon set at a diffrent speed for attacks and no special battle screens. Traditional video game RPGs lock the player into a sequence where they must fight, die, or run away to return to the main screen. To make use of timing in these games, the Final Fantasy series uses something they call an ATB (active time battle) system.
I think you need to elaborate on how the gameplay should work.
Last edited by archmage (2010-06-30 14:19:49)
Offline
archmage wrote:
I think this does a poor job of explaining things. Is this meant to be for a free roaming MMO style RPG or a turn based RPG? There is a huge diffrence. Non traditional MMO style RPGs like Runescape have each weapon set at a diffrent speed for attacks and no special battle screens. Traditional video game RPGs lock the player into a sequence where they must fight, die, or run away to return to the main screen. To make use of timing in these games, the Final Fantasy series uses something they call an ATB (active time battle) system.
I think you need to elaborate on how the gameplay should work.
I'm not done yet, I have to go to dinner.
Offline
I think you have to say if this is meant for turn based RPGs or something else. This would not really work in a turn based RPG.
Offline
archmage wrote:
I think you have to say if this is meant for turn based RPGs or something else. This would not really work in a turn based RPG.
It can, but that would defeat the purpose of the tick system.
Offline
If you have a wiki account maybe you can contribute to it with your guides.
Offline
yes, maybe I can.
if I had an account...
Last edited by juststickman (2010-07-01 04:31:19)
Offline