Post by BeasTie on Dec 16, 2012 22:32:19 GMT -5
Local Branching by Bloodbane
Intro:
Some beat em up games have multiple paths or branches such as Final Fight 3 and Peacekeepers. The branch types varies from local branches, global branchies to action based branches. I'll give brief explanation about some of them:
a. Local Branch = Branch that gives option to alternate path(s) in which all paths lead to same level. IOW this branch doesn't alter main path.
b. Global Branch = Branch that gives option to alternate path(s) in which each path leads to different levels. IOW this branch alters main path.
c. Time based Branch = Branch that gives option to alternate path(s) which is activated by time. Doesn't matter if it's local or global branch.
d. Action based Branch = Branch that gives option to alternate path(s) which is activated by certain actions. Doesn't matter if it's local or global branch.
Although I haven't tried it, I'm sure all mentioned above is doable in OpenBoR (possibly with script). The one I'm going to explain here is local branch.
Procedure:
Before I start, please read basic tutorial about 'setting branch' in other thread cause the basics of branching have been explained there.
As a start, I'll post example of level set with branch set:
...
file data/levels/level1.txt # <-- branch location
file data/levels/level2a.txt
file data/levels/level3a.txt
... (It's not typed like this, it means there are more levels here)
end
branch 2b
file data/levels/level2b.txt
file data/levels/level3b.txt
... (It's not typed like this, it means there are more levels here)
end
Actually the last end is redundant but I type it to empashize that levels ends there.
Anyways, take a look on levels. There is a 'branch' before level2b which brings to that level. There's 'end' before that 'branch' to end game.
As you can see, taking branch in level1 brings player to level2b while finishing level1 normally brings to level2a. Simply put there are 2 main paths here, one is signed with 'a' and the other with 'b'.
Now, what should we do if we want to change level set above so the 2 main paths converge in one level, say level3? or make local branch?
See diagram below:
/-> Level2a -\
Level1 -| |-> Level3 - ...
\-> Level2b -/
One simple idea is by duplicating level sets so both paths contain same levels except for alternate ones. Unfortunately this idea is waste of levels not to mention it become more redundant if there are more local branches like above. Even worse, number of levels and scenes in a set is limited to 100 so obviously this idea is bad.
The other idea is by forcing players to go to level after level2b (level3) when level2a is finished.
See diagram:
file data/levels/level1.txt # <-- branch location
file data/levels/level2a.txt --
branch 2b |
file data/levels/level2b.txt |
file data/levels/level3.txt <-
... (It's not typed like this, it means there are more levels here)
end
From the diagram you can see that this idea is efficient not wasteful like previous one. This is what we used here.
How are we going to do it? the answer is script. This is the script:
jumptobranch({name}, {immediately});
{name} can be any branch in current set, but you can't jump between sets because it is against current game logic.
{Immediately} can be 0 or 1. When set to 1, you will go to that level immediately, or, you will go to that level when current level is completed.
This function is used with its flag set to 0, meaning the branchname defined in the function will be accessed after level is completed, in this case level2a. Since we want to bring players to level3, we put a branch there like this:
file data/levels/level1.txt # <-- branch location
file data/levels/level2a.txt
branch 2b
file data/levels/level2b.txt
branch 3
file data/levels/level3.txt
... (It's not typed like this, it means there are more levels here)
end
Branchname is 3 so the function becomes:
jumptobranch("3", 0});
Now where to put this? since this function changes level to go to in level2a, it must be 'put' there. One way to put it is by making an invisible entity with this function like this:
Don't forget to declare this entity in models.txt of course.
After we have this entity, we must spawn in level2a. It can be placed anywhere in that level but make sure it is spawned otherwise it won't work.
If you have set those properly, local branch is ready to use. Whichever path you choose (level2a or level2b) brings players to level3.
Limitation: If there's another branch type in level2a, there could be conflict. To avoid it, simply spawn the entity above late in the level or before level ends normally.
Another thing to note is this trick is best used if level2a can only be cleared normally (kill all enemies, defeat bosses or timer hits 00). If level2a can only be cleared by touching branch or other script based branch, it's recommended not to use this to avoid conflict.
Extra: The technique above can also be used if the local branch goes to room or dead end. Example: rooms in 5th stage of Final Fight 3. The extra work you need is making clone version of the level where the branch was.
Intro:
Some beat em up games have multiple paths or branches such as Final Fight 3 and Peacekeepers. The branch types varies from local branches, global branchies to action based branches. I'll give brief explanation about some of them:
a. Local Branch = Branch that gives option to alternate path(s) in which all paths lead to same level. IOW this branch doesn't alter main path.
b. Global Branch = Branch that gives option to alternate path(s) in which each path leads to different levels. IOW this branch alters main path.
c. Time based Branch = Branch that gives option to alternate path(s) which is activated by time. Doesn't matter if it's local or global branch.
d. Action based Branch = Branch that gives option to alternate path(s) which is activated by certain actions. Doesn't matter if it's local or global branch.
Although I haven't tried it, I'm sure all mentioned above is doable in OpenBoR (possibly with script). The one I'm going to explain here is local branch.
Procedure:
Before I start, please read basic tutorial about 'setting branch' in other thread cause the basics of branching have been explained there.
As a start, I'll post example of level set with branch set:
...
file data/levels/level1.txt # <-- branch location
file data/levels/level2a.txt
file data/levels/level3a.txt
... (It's not typed like this, it means there are more levels here)
end
branch 2b
file data/levels/level2b.txt
file data/levels/level3b.txt
... (It's not typed like this, it means there are more levels here)
end
Actually the last end is redundant but I type it to empashize that levels ends there.
Anyways, take a look on levels. There is a 'branch' before level2b which brings to that level. There's 'end' before that 'branch' to end game.
As you can see, taking branch in level1 brings player to level2b while finishing level1 normally brings to level2a. Simply put there are 2 main paths here, one is signed with 'a' and the other with 'b'.
Now, what should we do if we want to change level set above so the 2 main paths converge in one level, say level3? or make local branch?
See diagram below:
/-> Level2a -\
Level1 -| |-> Level3 - ...
\-> Level2b -/
One simple idea is by duplicating level sets so both paths contain same levels except for alternate ones. Unfortunately this idea is waste of levels not to mention it become more redundant if there are more local branches like above. Even worse, number of levels and scenes in a set is limited to 100 so obviously this idea is bad.
The other idea is by forcing players to go to level after level2b (level3) when level2a is finished.
See diagram:
file data/levels/level1.txt # <-- branch location
file data/levels/level2a.txt --
branch 2b |
file data/levels/level2b.txt |
file data/levels/level3.txt <-
... (It's not typed like this, it means there are more levels here)
end
From the diagram you can see that this idea is efficient not wasteful like previous one. This is what we used here.
How are we going to do it? the answer is script. This is the script:
jumptobranch({name}, {immediately});
{name} can be any branch in current set, but you can't jump between sets because it is against current game logic.
{Immediately} can be 0 or 1. When set to 1, you will go to that level immediately, or, you will go to that level when current level is completed.
This function is used with its flag set to 0, meaning the branchname defined in the function will be accessed after level is completed, in this case level2a. Since we want to bring players to level3, we put a branch there like this:
file data/levels/level1.txt # <-- branch location
file data/levels/level2a.txt
branch 2b
file data/levels/level2b.txt
branch 3
file data/levels/level3.txt
... (It's not typed like this, it means there are more levels here)
end
Branchname is 3 so the function becomes:
jumptobranch("3", 0});
Now where to put this? since this function changes level to go to in level2a, it must be 'put' there. One way to put it is by making an invisible entity with this function like this:
name 3Br
type none
shadow 0
anim idle
@script
jumptobranch("3", 0);
@end_script
delay 10
offset 1 1
frame data/chars/misc/empty.gif
Don't forget to declare this entity in models.txt of course.
After we have this entity, we must spawn in level2a. It can be placed anywhere in that level but make sure it is spawned otherwise it won't work.
If you have set those properly, local branch is ready to use. Whichever path you choose (level2a or level2b) brings players to level3.
Limitation: If there's another branch type in level2a, there could be conflict. To avoid it, simply spawn the entity above late in the level or before level ends normally.
Another thing to note is this trick is best used if level2a can only be cleared normally (kill all enemies, defeat bosses or timer hits 00). If level2a can only be cleared by touching branch or other script based branch, it's recommended not to use this to avoid conflict.
Extra: The technique above can also be used if the local branch goes to room or dead end. Example: rooms in 5th stage of Final Fight 3. The extra work you need is making clone version of the level where the branch was.