Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I apologize in advance for my English.I'll try to explain my problem. I am working on new version of the Risk game. I want to change the attacking algorithm to make it more similar to real life war. The sides which have more armies must have the advantage over the weaker side.

These are the original board game's rules below from Wikipedia:

Example of matching up attacking (red) and defending (white) dice; in this case the attacker has won the battle. When it's a player's turn to attack, he or she can only attack territories that are adjacent or connected by a sea-lane to his or her own territory. A battle's outcome is decided by rolling dice. The attacking player attacks with one, two, or three armies, rolling a corresponding one, two or three dice. At least one army must remain behind in the attacking territory not involved in the attack, as a territory may never be left unoccupied. Before the attacker rolls, the defender must choose to resist the attack with either one or two armies (using at most the number of armies currently occupying the defended territory[4]) by rolling one or two die. Each player's highest die are compared, as are their second-highest die (if both players roll more than one). In each comparison, the highest number wins. The defender wins in the event of a tie. With each dice comparison, the loser removes one army from his territory from the game board. Any extra dice are disregarded and do not affect the results.

I think these rules are not very good for real life situations because we know from history that large number of armies have an advantage over the weaker side. I have to create the right balance between the two sides during the war.

Currently I am using the following algorithm

army1 = random.Next(1, 20 + (numberOfSolidersArmy1 / 5));
army2 = random.Next(1, 20 + (numberOfSolidersArmy2 / 5));

Then I am comparing army1 and army2 and decrease the number of soldiers by one of the smaller number's side.

What are your suggestions for a better algorithm?

share|improve this question
    
Questions here usually have a 'correct' answer, but I'm not sure if there is one here. Are you asking for how to improve your current algorithm? Or are you asking for another algorithm that better matches real life war? –  Sprunth Jan 18 '12 at 1:51
    
"I think these rules are not very good for real life situations because we know from history that large number of armies have an advantage over the weaker side." Did you read the rules of Risk? They do have an advantage. Just not an overwhelming one. The reason being that Risk is a game, and if the attacker had even more of an advantage, then whoever won the first engagements, and thus got to build a few more troops, would quickly and easily win. Each victory would make the next that much easier. –  Nicol Bolas Jan 18 '12 at 2:33
1  
In any case, your question as stated cannot be answered. The answer depends on what kind of play environment you want to create. Do you want an early victory to lead to steamrolling? Do you want the defenders to be able to have a chance? You say that you want to match real life more; do you intend to incorporate other factors (terrain, army composition, technology, scouting, etc), or is it just generic troops vs. generic troops? Without these details, there's no correct answer that can be suggested. –  Nicol Bolas Jan 18 '12 at 2:35
1  
Welcome to the site! I'd like to point you at the faq, here: gamedev.stackexchange.com/faq While game design questions are completely within the scope of this site, they really need to drill down into specifics in order to try to present an objectively answerable question. As a general rule of thumb, questions asking for the "best" anything are a poor fit for our Q&A format. :) –  Trevor Powell Jan 18 '12 at 2:54
    
@Sprunth I am asking for another algorithm that better matches real life. –  Ferid Mövsümov Jan 18 '12 at 13:11

1 Answer 1

If you want a more realistic equation, then the Lanchester laws have something for you: http://en.wikipedia.org/wiki/Lanchester%27s_laws

However, they apply differently depending on whether you're simulating hand-to-hand combat or ranged combat, which isn't specified in your question.

A simple way to simulate the linear law is to make the values you compare linearly proportional to the number of armies you use. Roll 1 die for each army, add up the total, and whichever side has the lowest score loses an army. If you're working with large soldier counts instead of small army counts then work out the relative size advantage or disadvantage on one side and multiply that by the random value generated for that side.

share|improve this answer
    
thank you for answer I will try it.. –  Ferid Mövsümov Jan 18 '12 at 17:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.