Page 1 of 1

Need help with combat system for a new rts game

Posted: Sun Feb 26, 2012 6:15 pm
by Klown
Hello:

Its been a while since ive posted. I am building a space rts game. I have 5 ships which have different atk, def, hp, range each. during an attack a player may choose any combination and quantity of the above ships to attack another players fleet with. that being said, im having a hard time coming up with a combat system for multiple units attacking and being attacked at the same time:

example:
attacker fleet is:
scout ship - 10
light fighter - 5
fighter - 0
frigate - 10
cruiser - 0

defenders fleet is:
scout ship - 0
light fighter - 0
fighter - 10
frigate - 10
cruiser - 10

figuring out how to pair the attacks or to resolve the battle as a whole and determine which ships take losses and which do not is mind numbing. if anyone has some very simple or basic formula i could use to pair the attack ships with the defending ships would be much appreciated. just to clarify, i have an idea of how i want to calculate the battle damage, im just having a hard time figuring out how to resolve which ship, fights which ship and how to determine the ships that take losses and how many losses.

Re: Need help with combat system for a new rts game

Posted: Mon Feb 27, 2012 3:54 am
by Jackolantern
Can you tell us a bit more about your game? Is it real-time or turn-based? That will make a huge difference on how this would work out.

Re: Need help with combat system for a new rts game

Posted: Mon Feb 27, 2012 2:50 pm
by Klown
My game is a real time strategy. you can think of it as a space evony. there are 5 units to attack with, which are ships. you build these ships in quantity on your planet, then send them across the game map (galaxy) to attack other players planets where they can encounter the same ships in different quantities. i need a way to determine the battle result and how many losses each side takes, then apply the losses to each sides fleet in the database table to update the battle statistics on the battle report. i already have all systems in place except an actual combat system to determine winner/loser and calculate lost units and apply them. if more information is needed, please let me know im in the process of uploading the game to a free php host and doing very early alpha tests.

-thanks in advance for your advice
-klown

Re: Need help with combat system for a new rts game

Posted: Mon Feb 27, 2012 3:55 pm
by casino
Each unit would need to have some sort of value applied to it such as:

Attack
Defense
(Plasma Defense or maybe some sort of special defense?)


At the very least they would need an attack value and a defense value so that your code can do the math for the amount of units you defeat or lose.

Re: Need help with combat system for a new rts game

Posted: Mon Feb 27, 2012 10:01 pm
by Ark
Jackolantern wrote:Can you tell us a bit more about your game? Is it real-time or turn-based? That will make a huge difference on how this would work out.
Uhmm I'm not sure if it will make a difference, I think he wants a combat system like ogame, the battle finishes inmedeately.