Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Tarlash on Mon 05/01/2004 14:42:18

Title: Curling matches
Post by: Tarlash on Mon 05/01/2004 14:42:18
I'm doing curling manager in AGS. I did employing, training, motivation etc.
but I completety don't know how to do matches, because I don't want just sum all statistics ;D
Title: Re:Curling matches
Post by: Scorpiorus on Mon 05/01/2004 18:01:00
hehe, curling manager in AGS? Very interesting idea. :)
Well, if it's a manager (not a simulator) then summing up the statistics would be the right way. So, basically, firstly you could calculate the result of the match (or maybe of one of its rounds, since it's a curling) then play appropriate animation. I'm not quite familiar with curling rules but afaik the match consists of several rounds or something like that, so you can calculate each round (relatively) independently then play appropriate animation, like:

//team IDs like for character script names
int Team_Blue=-1;
int Team_Red=-1;

int Team_Blue_Score=0;
int Team_Red_Score=0;

//holds winner and loser teams respectively.
int winner=-1;
int loser=-1;

//calculates round loser and winner:
function CalculateRound() {

//decide a winner and a loser team:
if (CompareTeamsSkills/Statistics(Team_Blue, Team_Red) == 2) {
winner = Team_Red;
loser = Team_Blue;
Team_Red_Score++;
} else {
winner = Team_Blue;
loser = Team_Red;
Team_Blue_Score++;
}

}

//plays a cutscene of current round
function PlayRoundAnimation() {

//cutscene here
StartCutscene(...);
AnimateCharacter(winner, ....)
AnimateCharacter(loser, ....)
EndCutscene();

}


//that function starts the match (setting teams, resetting score, etc)
function StartMatch(int TeamID1, int TeamID2) {
//setting teams:
Team_Blue=TeamID1;
Team_Red=TeamID2;

//resetting scores:
Team_Blue_Score=0;
Team_Red_Score=0;

int round = 1;
while (round < 5 || something else) {

CalculateRound(); //calculate current round
PlayRoundAnimation(); //play current round cutscene

//here you can block the script and let player adjust tactics
GuiOn(SOMEGUI); // where SOMEGUI is a pop-up modal gui

round++; //goto next round;

}

}

obviously it's not a complete code but just some directions to follow maybe.

~Cheers
Title: Re:Curling matches
Post by: Tarlash on Tue 06/01/2004 12:35:43
It could be, but I want avoid that you train only one skill and win match. :(
Title: Re:Curling matches
Post by: Scorpiorus on Tue 06/01/2004 14:25:59
Quote from: Tarlash on Tue 06/01/2004 12:35:43
It could be, but I want avoid that you train only one skill and win match. :(
You need to get one value for each team which determines its chance to win. The simplist formula may look like an average:

int win_chance = (skill1 + skill2 + ..... + skillX)/X;

where X - total number of skills.

If for example blue team has three skills:
- reaction
- agility
- fitness

then computating its win_chance will be:

win_chance = (reation+agility+fitness)/3;

next you compare win_chance variables of both teams (using a random factor) and make a decision who wins the round.

You can have a different (more complicated) formula, I just provided an example.

~Cheers
Title: Re:Curling matches
Post by: on Sun 18/01/2004 00:07:28
Or you could weight certain skills more than others, so that "Brushing Skill" may be more important than "Skating Skill" depending on which character is doing what.

I just started with AGS, and I'd love to see how an arcade type game like this might work.  Any projections on when you'll be done?