Sign in to follow this  
PHPCoder

game formula

Recommended Posts

The basic version an MORPG I am working on is nearly done. You won't be able to do a lot, but the main part of the game will be done, including the Market and Attacking. Then hopefully a Mail, Guild, and Attack and Defense History system. But right now, the main issue for me is creating a formula to decide: *who wins the battle *soldier's deaths (casualties) *how much gold is won / lost Right now, I have been able to simplify the three main components of a battle down to Attack, Defense, and Attack Points. Attack is already pre-calculated in the database from soldiers, weapons, siegery, etc. and Defense is already pre-calculated in the database from soldiers, armor, fortifications, etc. Attack Points are given to players every 30 minutes, or they can also purchase Attack Points for real cash. In a battle, the minimum you can use is 1 and the maximum is 10. I was thinking that maybe attack points could tell what percentage of your attack you use in a fight. Let's say Player 1 (the attacking player) has 600 attack and he uses 5 attack points. 5 / 10 = 0.5, 0.5 * 600 = 300. So at the cost of 5 Attack Points, they use 300 Attack Force. But then, the Defender has 700 Defense. So no matter what amount of Attack Points they use, they will always lose if the defender has more defense than player 1 has attack. Then I thought to calculate casualties on the losing party's side by taking the 700 Defense - 300 Attack = 400 / 200 = 2, if it was a decimal we could round it. Gold will be lost by the losing party and awarded to the winning party. Which I am at loss on how to do. I would just hope the losing player doesn't lose more gold than they actually have. So how might I go about calculating gold loss? And does the rest of this attack processing plan seem logical?

Share this post


Link to post
Share on other sites
Just to throw a couple of ideas at you:

  • Instead of just comparing the two values, so the result of the same battle is always the same, use a random test where the probability of the attack succeeding is attackPower/(attackPower+defencePower). This makes the game less predictable and stops the strongest nation/guild/player being completely unbeatable.
  • I like your idea of attack points allowing the attacker to choose how much 'effort' to put into the attack.
  • Say the random number is between 0 and 100, and there is an X% probability of the attack succeeding (as defined above), and if the number (call it N) is less than X the attack succeeds. The imbalance if the attack succeeds is then (X-N)/X, and if it fails it is (N-X)/(100-X) (in the defender's favour, obviously). The imbalance is now between 0 and 1 in one side's favour. Use this as a multiplier for the losses and gold-steal.


I wonder if this should be in Game Design ...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Sounds like you are describing a Lanchester Combat Model.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this