Coding for a PHP game.

They have: 15 posts

Joined: Dec 2006

I'll try to keep this simple and short:

I'm building a php driven game. Basically, players do certain things in order to gain more points. They can then challenge each other to a battle. The higher the points the person has, the more chance they have of winning the battle.

How would I determine who wins/loses in a battle? There must be a simple way to do this, but I'm clueless as to where to start.

Thanks.

He has: 1,758 posts

Joined: Jul 2002

Jeees... that's not exactly something simple. Wink

Basically, it comes down to maths. Obviously, the number of points they have will affect the likely hood of winning, so at a basic level, you could do a top trumps style comparison - whoever has the highest number wins. But that makes it a bit one sided.

To add an element of fairness, I would perhaps throw a random number into the mix. So you take the two scores, add a random number to each one and then add the score to the random number, compare the two totals and whoever has the highest wins.

Only problem is that there's no real fun in that. Personally I would make it so that users increase their scores by betting their points against each other.

i.e. if you both bet 10 points, the looser looses 10 points and the winner gains 10 points.

Andy

He has: 1,758 posts

Joined: Jul 2002

Of course, if you want to get really complex, you could also give each user multiple attributes (i.e. strength, speed, agility, defense) and each could have a different impact on the battle.

Andy

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.