Ezilon.com - Target Your Audience, be Seen in Your Region

Coding for a PHP game.

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

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.

andy206uk's picture
DeveloperModerator

He has: 1,754 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.

Andyk

Blog of a Web Designer
Give a man a fish and you feed him for a day. Teach him to use the Net and he won't bother you for weeks.

andy206uk's picture
DeveloperModerator

He has: 1,754 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.

Andyk

Blog of a Web Designer
Give a man a fish and you feed him for a day. Teach him to use the Net and he won't bother you for weeks.