Note that there are some explanatory texts on larger screens.

plurals
  1. POSimulating sports matches in online game
    text
    copied!<p>In an online manager game (like <a href="http://www.hattrick.org/" rel="nofollow noreferrer">Hattrick</a>), I want to simulate matches between two teams.</p> <p>A team consists of 11 players. Every player has a strength value between 1 and 100. I take these strength values of the defensive players for each team and calculate the average. That's the defensive quality of a team. Then I take the strengths of the offensive players and I get the offensive quality.</p> <p>For each attack, I do the following:</p> <pre><code>$offFactor = ($attackerTeam_offensive-$defenderTeam_defensive)/max($attackerTeam_offensive, $defenderTeam_defensive); $defFactor = ($defenderTeam_defensive-$attackerTeam_offensive)/max($defenderTeam_defensive, $attackerTeam_offensive); </code></pre> <p>At the moment, I don't know why I divide it by the higher one of both values. But this formula should give you a factor for the quality of offense and defense which is needed later.</p> <p>Then I have nested conditional statements for each event which could happen. E.g.: Does the attacking team get a scoring chance?</p> <pre><code>if ((mt_rand((-10+$offAdditionalFactor-$defAdditionalFactor), 10)/10)+$offFactor &gt;= 0) { ... // the attack succeeds </code></pre> <p>These additional factors could be tactical values for example.</p> <p>Do you think this is a good way of calculating a game? My users say that they aren't satisfied with the quality of the simulations. How can I improve them? Do you have different approaches which could give better results? Or do you think that my approach is good and I only need to adjust the values in the conditional statements and experiment a bit?</p> <p>I hope you can help me. Thanks in advance!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload