Home > Forums
|
Multiplayer Forums
Unanswered Posts | Active Topics
Board index » Games » Featured Games » Age of Conquest (AoC) » Support » AoC API & Code Samples
| Author |
Message |
|
gdizzle
|
Post subject: Combat Posted: 27 Sep 2007, 09:17 |
|
| Peasant |
 |
Joined: 27 Aug 2007, 10:27 Posts: 49
|
|
Is the code for combat posted? Cant seem to find it...
_________________ <img src="http://sig.aevumobscurum.com/sig/gdizzle.png">
|
|
| Top |
|
 |
|
battlecow
|
Post subject: Posted: 27 Sep 2007, 12:37 |
|
| Freeman |
 |
 |
Joined: 25 Jun 2007, 22:52 Posts: 175
|
|
I would say no. At least I never found it.
_________________
|
|
| Top |
|
 |
|
noblemaster
|
Post subject: Posted: 27 Sep 2007, 17:16 |
|
| Game Developer |
 |
 |
Joined: 17 Apr 2005, 02:34 Posts: 5169 Location: Honolulu
|
The combat core (there are some integrity checks beforehand to make sure no one is cheating):
Code: // attacking a foreign empire long soldiersLeft; long shipsLeft; // find strengths long attackerStrength = soldiers; long defenderStrength = ((long)target.getMilitary()) * target.getStrength() / 100; attackerStrength = (long)Math.pow(attackerStrength, 1.019); defenderStrength = (long)Math.pow(defenderStrength, 1.019); // find winner if (attackerStrength > defenderStrength) { // attacker wins soldiersLeft = soldiers; shipsLeft = ships; if (attackerStrength != 0) { soldiersLeft = soldiersLeft - (soldiersLeft * defenderStrength / attackerStrength); shipsLeft = shipsLeft * 9 / 10; // 90% ships survive } } else { // defender wins soldiersLeft = target.getMilitary(); shipsLeft = ships; if (defenderStrength != 0) { soldiersLeft = soldiersLeft - (soldiersLeft * attackerStrength / defenderStrength); shipsLeft = shipsLeft / 4; // defender captures 25% } } "soldiers" is the attacking force. "ships" is the number of ships involved. "target" is the defending province. The province strength: Code: /** * Returns the strength of the privince [0..x] in percent. * * @return The strength of the province. 100 * corresponds to 100% which is the default. */ public int getStrength() { int strength = 100; // strength is cummulative if (isFortified()) { strength += 80; } if (getTown() > 0) { strength += 50; } if (hasKing()) { strength += 30; } return strength; }
_________________
|
|
| Top |
|
 |
|
gdizzle
|
Post subject: Posted: 04 Dec 2007, 03:20 |
|
| Peasant |
 |
Joined: 27 Aug 2007, 10:27 Posts: 49
|
|
OK - I was a little busy for the last couple of months and didnt see the reply. Thanks for posting this!
2 questions:
1. Is there any particular reason the strengths are taken ^1.019 (am I reading this right)? It seems like a pointless operation in what you posted since you compare them directly anyway.
2. This is half along the lines of a feature request, but it is a little more technical than what they post there. How difficult would it be to add a term to the defensive bonus for morale and economic spending?
I imagine functions like target.getMorale() and target.getEcon() already exist.
I would say the morale bonus should be (target.getMorale() - 80). So max it would be +20 if morale was 100, and it could be -80 if morale is zero.
I think this would be appropriate as far as realism goes for obvious reasons but I can explain if necessary.
The spending issue would be actually an attacking bonus. Highly developed provinces with lots of econ are easier for troops to take because they have good infrastructure. (and it is easier to pillage too!)
So, if econ were rescaled to a range from 0-20, the bonus would be (10-econ).
Obviously the normalization of both of these proposals would need to be examined. but something on the +- 20% level seems reasonable.
Let me know if this discussion should move over to feature requests.
_________________ <img src="http://sig.aevumobscurum.com/sig/gdizzle.png">
|
|
| Top |
|
 |
|
battlecow
|
Post subject: Posted: 04 Dec 2007, 07:47 |
|
| Freeman |
 |
 |
Joined: 25 Jun 2007, 22:52 Posts: 175
|
gdizzle wrote: The spending issue would be actually an attacking bonus. Highly developed provinces with lots of econ are easier for troops to take because they have good infrastructure. (and it is easier to pillage too!)
I wouldn't agree here. Highly developed provinces would have also an improved defence (City walls and moat...). Therefore I could say, we should have a bonus for the defender.
_________________
|
|
| Top |
|
 |
|
noblemaster
|
Post subject: Posted: 04 Dec 2007, 08:27 |
|
| Game Developer |
 |
 |
Joined: 17 Apr 2005, 02:34 Posts: 5169 Location: Honolulu
|
gdizzle wrote: 1. Is there any particular reason the strengths are taken ^1.019 (am I reading this right)? It seems like a pointless operation in what you posted since you compare them directly anyway. To give very large armies an advantage... gdizzle wrote: 2. This is half along the lines of a feature request, but it is a little more technical than what they post there. How difficult would it be to add a term to the defensive bonus for morale and economic spending?
Not difficult at all - I'll need a poll though 
_________________
|
|
| Top |
|
 |
|
gdizzle
|
Post subject: Posted: 04 Dec 2007, 13:11 |
|
| Peasant |
 |
Joined: 27 Aug 2007, 10:27 Posts: 49
|
Quote: attackerStrength = (long)Math.pow(attackerStrength, 1.019); defenderStrength = (long)Math.pow(defenderStrength, 1.019); Just to make sure I'm reading this right - there is no effect of the power in determining the winner, however, it comes in again when figuring out the remaining troops? Ie the bigger difference in troop numbers means the more from the winner survive? Quote: soldiersLeft = soldiersLeft - (soldiersLeft * attackerStrength / defenderStrength);
_________________ <img src="http://sig.aevumobscurum.com/sig/gdizzle.png">
|
|
| Top |
|
 |
|
noblemaster
|
Post subject: Posted: 04 Dec 2007, 13:25 |
|
| Game Developer |
 |
 |
Joined: 17 Apr 2005, 02:34 Posts: 5169 Location: Honolulu
|
Quote: Just to make sure I'm reading this right - there is no effect of the power in determining the winner, however, it comes in again when figuring out the remaining troops? Ie the bigger difference in troop numbers means the more from the winner survive?
correct 
_________________
|
|
| Top |
|
 |
|
krac
|
Post subject: Re: Combat Posted: 29 Jun 2009, 10:45 |
|
| Serf |
 |
Joined: 22 Jun 2009, 06:52 Posts: 11
|
I'm a little disappointed with the battle calculations. It's just too straight for my taste. Something like a 5% defender bonus seems like a good idea. I agree with adding Morale/Economy effects - I think Economy should be slightly positive. I'd also add a Population effect ...and complicate them with each other. If I was coding the game,  I'd want to come a little closer to approximating the complexity of outcomes in warfare. So not only would I add those effects, I'd throw in a random factor at each level too. I think the fact that attacks would be less certain and much less calculable would be a very good thing! While I'm at it, I'd also love to see any revisions that reduce the Risk-ish nature of accumulating huge armies. Ie creative ways to expand troop maintenance costs and/or reward players that conserve and use troops efficiently. For example, troops costs exponentially rising with the distance from the king. (A brilliant idea you'd be borrowing from the Conqueror on-line game.)
|
|
| Top |
|
 |
|
Revol
|
Post subject: Re: Combat Posted: 29 Jun 2009, 12:09 |
|
| Peasant |
 |
Joined: 18 Oct 2007, 13:06 Posts: 66 Location: Germany, Wendland
|
|
hi krac, you just need to make a concrete feature request and start a poll about it. From my point of view though I like the more precise calculations as they are now. The game is more strategic as random plays a lesser role.
_________________ . "What do I think of Western civilisation? I think it would be a very good idea." (Mahatma Gandhi)
|
|
| Top |
|
 |
|
King_Howard
|
Post subject: Re: Combat Posted: 29 Jun 2009, 12:53 |
|
| Investigator |
 |
 |
Joined: 22 May 2008, 13:29 Posts: 713 Location: The 23rd plane of the Abyss
|
agreed... skill is preferable to luck in my opinion 
_________________ let them hate me... as long as they fear me
|
|
| Top |
|
 |
|
krac
|
Post subject: Re: Combat Posted: 29 Jun 2009, 14:38 |
|
| Serf |
 |
Joined: 22 Jun 2009, 06:52 Posts: 11
|
|
haha. Guess I could start a long debate by saying that I quite agree, but think a little uncertainty brings more strategic thinking to the fore. Instead, I 'll merely suggest there's a wargame<-->boardgame axis here.
|
|
| Top |
|
 |
|
Biohazard
|
Post subject: Re: Combat Posted: 29 Jun 2009, 17:41 |
|
| Moderator |
 |
 |
Joined: 28 May 2006, 02:55 Posts: 3068 Location: Wigan, UK
|
|
what your saying is you wanna give the defense whom already have a possible bonus multiplier of 2.6, more
you are young and will learn in time to use what you have efficently, doing this allows you to expand beyond all your current abilitys
the dice have been removed, you now play soley on your skill and powers of out strategising your opponate, you get a set amount of moves per turn, it's all about how you use those, sometimes it's just that one right entry that allows you to have the edge over the enemy
if you fail to develop these skills there are three paths open to you
1, leave as you know you'll never get there (SPLITTERS!) 2, hang around with puppy dog eyes hoping someone will throw you a bone 3, join stars or srg and spam, then see how to really play as those they've previously offended rip your land apart
_________________
Show me force and reep what you sow
|
|
| Top |
|
 |
|
lucjan
|
Post subject: Re: Combat Posted: 30 Jun 2009, 18:18 |
|
| Investigator |
 |
 |
Joined: 03 Feb 2007, 03:52 Posts: 2794
|
Biohazard wrote: 3, join stars or srg and spam, then see how to really play as those they've previously offended rip your land apart Joining one of those groups is a death sentence for you in any game that isn't inhabited solely by them and mains. Just thought I'd clarify that.
_________________

This is the **** internet! I will behave any way I damn well please! ~Anonymous
|
|
| Top |
|
 |
|
King_Howard
|
Post subject: Re: Combat Posted: 01 Jul 2009, 11:28 |
|
| Investigator |
 |
 |
Joined: 22 May 2008, 13:29 Posts: 713 Location: The 23rd plane of the Abyss
|
woot! i give bio a  and luc a 
_________________ let them hate me... as long as they fear me
|
|
| Top |
|
 |
Who is online |
Users browsing this forum: No registered users and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum
|
 |