# Rounding of a combat system - and I missed a varible :(

This topic is 1793 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi All

Im trying to create a simple combat system that will work in the background (the player has no direct influences and can't see whats going on, but DOES receive reports and battle outcomes).

The system is all number based and im just stuck with the best way to round it off. Im a one man team so don't have the privilege of running my thoughts by someone off hand  and Ive been going round in circles on this the last few days.

Anyway my game is WW2 based and I have air raids attacking the UK (Blitz/Battle of Britain type jobby) . Im currently working on the mechanism for Flak/AA vs the airraids.

I have a variable for the number of guns firing at the planes.  I then have a damage roll 1 -12.

I then have possible damage subtractors - does target have a smoke screen (no visural sight)? is it night time? - then spotlights come in to it.

Then multiply the total damage roll by the number of guns at the target....giving total damage to the airraid.

I then put a divide  on the total damage depending on the size of the airraid....for example  The target might have 800 AA guns, but if the airraid is only 5 planes its highly unlikely all 800 guns will be able to see or fire on that target. where as an airraid of 1000 planes covers much more area of sky and all 800 guns might be able to fire at some point.

All nice and simple so far and im happy up till around this point.....

I then get the hitpoints for the type of bomber that makes up the raid, divide the total AA damage by the bomber hitpoints to gauge how many bombers have been hit, then I can do a couple more calculations to work out how many have been damaged or destroyed.

The problem is at no point have I  used the variable which says how many bombers are actually in the raid (minor oversight!). So 10 bombers might be destroyed and another 25 bombers might be damaged but the raid has only 5 bombers.....and this is the problem.

Im struggling to figure out where to put or handle the Varible that says how many bombers are actually in the raid.

Ive considered just putting a randomize on it so the number of bombers that get hit by flak is randomized before the hitpoints are divided up, but you then have  too much possibility that all the bombers that get damaged, would actually be destroyed in that instance (quite unrealistic).

Maybe the solution is to implement the randomize on the number of bombers hit and just  raise the bombers hit points or/and nerf the D12 damage roll to a D6?

Any ideas?

Regards,

John

##### Share on other sites
Maybe only the planes in its range get hit but all recieve the same amount of damage.

##### Share on other sites

Without making significant changes to your system, I might say that if 10 bombers were destroyed and 25 damaged but there's only 5, then the bombers were clearly decimated by the defenses. At least the thing to do would be to ensure that you only report that the 5 bombers that were attacking were all destroyed. If it's the sort of result from 800 guns, you could maybe look at the 10 & 25 numbers as a number of simultaneous hits and the results of compounding damage. It would depend on how you want to report things.

Or maybe, if 5 bombers are included in an attack that includes 95 other fighter planes and you know a total of 30 planes of any type are destroyed, then for each plane destroyed select at random which type it is. For this example, you would need to do 30 calculations. For the first calculation get a random number from 1 to 100. A number from 1 to 95 means you lost a fighter. Say you loose a fighter plane. The second calculation get a number from 1 to 99 and then a number from 1 to 94 means a fighter is destroyed. And so on. You'll want to do a loop through like that so that as each plane is destroyed it can't be destroyed again.

Your system sounds like you want to handle things at a high level. If you don't want the entire battle decided based on strength vs defense with various modifiers applied on either end (and there's reasons for going this way), you might want to look at changing things to work on a unit to unit basis.

Edited by kseh

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 17
• 14
• 10
• 9
• 11
• ### Forum Statistics

• Total Topics
634097
• Total Posts
3015505
×