Tournament Bracket

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
guo
Metal Slime
Posts: 749
Joined: Fri Dec 04, 2009 9:12 pm

Tournament Bracket

Post by guo »

Hello, and a fine day to you.

I would like to go about scripting a tournament bracket like the following:

Image

But I haven't the foggiest idea where to start.

Some features I'd like to have:
  • Random seeding
    Automatic bracket progression
    A way to resolve matchups that don't involve the player
Here's my general thinking, but please offer suggestions:

Each seed in the bracket is a global variable, linked to an enemy formation, but one seed is the player.
They're randomly arranged on the bracket.
As the player wins his/her battles, they advance up the bracket.
"Enemy" seeds will have their winner determined through a bit of RNG and stat comparisons behind the scenes.
Possibly using "write formation" to further randomly determine the enemies in each "enemy seed", and storing that information for the duration of the tournament (even perhaps afterwards).
I intend to have slice/sprite based information showing the progression of the tournament at each stage.

Any help, suggestions or opinions welcomed. Thanks :angel:
vvight.wordpress.com
User avatar
Spoonweaver
Liquid Metal King Slime
Posts: 6462
Joined: Mon Dec 08, 2008 7:07 am
Contact:

Post by Spoonweaver »

Sounds fun

So what I'd normally do in a situation like this would be to create a lot of random commands and while commands

The first part, seeding;

You should make a while command that basically checks to see if all the globals are full. Something like this

Code: Select all

While &#40;a+b+c+d+e+f+g+h<>36&#41; do, begin
You'll be assigning the formation number to each variable, of 1-8 so those added should be 36
You should be sure to set them all to 0 before starting, just in case.

Next you generate 2 numbers, 1 for place and 1 for team/formation, we can assume 1 means the player, it shouldn't matter too much

Code: Select all

place&#58;=Random &#40;1,8&#41;
team&#58;=Random &#40;1,8&#41;
and then you check, if that team has already been assigned. If not, it assigns it to the place, if it has then the loop ends and restarts, trying another combination. We use a switch to assign numbers to variables.

Code: Select all

if&#40;a<>team,and,b<>team,and,c<>team,and,d<>team,and,e<>team,and,f<>team,and,g<>team,and,h<>team&#41; then , begin
switch&#40;Place&#41; do&#40;
case&#40;1&#41; do &#40; a&#58;=team &#41;
case&#40;2&#41; do &#40; b&#58;=team &#41;
case&#40;3&#41; do &#40; c&#58;=team &#41;
case&#40;4&#41; do &#40; d&#58;=team &#41;
case&#40;5&#41; do &#40; e&#58;=team &#41;
case&#40;6&#41; do &#40; f&#58;=team &#41;
case&#40;7&#41; do &#40; g&#58;=team &#41;
case&#40;8&#41; do &#40; h&#58;=team &#41;
	&#41;
end

and then end the loop

Code: Select all

end
that should seed things.



The other 2 would be much easier
Automatic bracket progression
A way to resolve matchups that don't involve the player

First, you just need to assign a number to another variable that equals that next bracket progression. That's as easy as something like this:

Code: Select all

placeLevelTwo&#58;=Team

To figure out resolving matches, you can set a difficulty level for the teams.
And then run 2 random commands with the second part being the difficulty. And then compare them.

Code: Select all

If &#40;random &#40;1,difficultyTeamA&#41;>>random &#40;1,difficultyTeamB&#41; 
then &#40;runTeamAwins&#41;
else &#40;runTeamBwins&#41;
Last edited by Spoonweaver on Wed Feb 06, 2019 11:51 pm, edited 1 time in total.
User avatar
guo
Metal Slime
Posts: 749
Joined: Fri Dec 04, 2009 9:12 pm

Post by guo »

Thanks SW! A quick response. Looks good so far. I'll do some playing around and see what I come up with.

Cheers.
vvight.wordpress.com
Post Reply