Matija
Morkin Member
The Turtle Moves!
Posts: 1,696
|
Post by Matija on Jul 30, 2004 7:50:08 GMT
And to make things even neater, lords with their bonuses could be added into as and ds calculations.
In fact, now that I think of it, perhaps the as and ds should be the cumulative strengths of attacking and defending armies on the spot, and calculated causalties then distributed back among the defenders.
This would have major impact on gameplay, since an armyless lord sourrounded with huge friendly armies (here's how to do allies in battle) wouldn't necessarily get killed in the first round (I would give the chance of an armyless lord being one of the causalties as, say, 100 / all cousalties.
|
|
Natmus
Morkin Admin
Fight the power!
Posts: 4,518
|
Post by Natmus on Jul 30, 2004 8:19:28 GMT
There should be a check to avoid dividing by 0 army total, when a lord commands no army. d'oh! Also, the ratio mechanism should do something to avoid fractions in the casualties calculation. True, I missed that check. The ratio aspect should be in that check, of course.
|
|
Natmus
Morkin Admin
Fight the power!
Posts: 4,518
|
Post by Natmus on Jul 30, 2004 8:31:01 GMT
And to make things even neater, lords with their bonuses could be added into as and ds calculations. Matija, I have some time ago suggested something like what you propose here, but this was primarly a bughunt for the code that gave mixed armies double casualites compared to pure rider or warrior armies. I think we have found that and can solve it in reasonable time. Totally redesigning the battle algorithm should be J-Y's decision, and I'm not about to think about that before he raises the subject. But for what it's worth, your ideas seem pretty good
|
|
Matija
Morkin Member
The Turtle Moves!
Posts: 1,696
|
Post by Matija on Jul 30, 2004 8:49:29 GMT
I'll work out the algorithm when I have a little more time.
|
|
Natmus
Morkin Admin
Fight the power!
Posts: 4,518
|
Post by Natmus on Jul 30, 2004 13:28:18 GMT
Another thing that just occured to me is that when the algorithm calculates the number of enemy lords present "$enemyLords" it doesn't distinguish between single lords and those with armies.
Even so, this number is used in dividing the damage done my any single army in the kills function, so a current possibility is to put a lot of unarmied lords (if you have them) suicidally into combat to spare the real armies fighting a battle.
|
|
Ringthane
Public Area Guest
Ardet nec Consumitur
Posts: 5,446
|
Post by Ringthane on Jul 30, 2004 13:59:53 GMT
Yes, I did that to Chris once...
|
|
Matija
Morkin Member
The Turtle Moves!
Posts: 1,696
|
Post by Matija on Jul 30, 2004 19:43:43 GMT
It seems to me the new procedure is not correct:
//For each lord, fight any enemy lords present while($dbRow = mysql_fetch_array($result)){ //Build up list of allies - we don't want to fight them - Include self and neutrals $exclude = "(" . $_SESSION["user"]->getUserID() . ",0,"; foreach($allies as $allyID => $allyName){ $exclude .= $allyID . ","; }
$exclude . = ")";
//Get details of any enemy lords present //first, generate list of allies and neutrals $query = "SELECT GML_ID FROM GML_GameLords"; $query .= " WHERE GML_USR_ID NOT IN " . $exclude; $query .= " AND GML_GAM_ID = " . $_SESSION["currentGame"]->getGameID(); $query .= " AND GML_KilledBy_GML_ID = 0"; $query .= " AND GML_Row = " . $attackingLord->getRow(); $query .= " AND GML_Column = " . $attackingLord->getColumn(); $query .= " AND GML_ID <> " . $attackingLord->getLordID(); $query .= " ORDER BY GML_Garrison, RAND()";
$result2 = mysql_query($query) or die(mysql_error() . "<p>$query</p>Failed to retrieve enemy lords");
//Need to know how many enemies present, as damage attacker inflicts will be spread between the enemy lords $enemyLords = mysql_num_rows($result2);
if($enemyLords >= 1){ $attackingLord = new CurrentLord($dbRow["GML_ID"]); //create attacking lord object $attackingLord->setInBattle(1); //used in hand of battle report $attackingLord->updateValues();
The $attackingLord object seems to be created only after the nuber of enemy lords is determined, yet its row and coulmn properties are already referenced in that query (result2). BTW: the commentary //first, generate list of allies and neutrals seems also to be wrong - it is the list of enemies.
|
|
Matija
Morkin Member
The Turtle Moves!
Posts: 1,696
|
Post by Matija on Jul 30, 2004 19:56:52 GMT
In the old script, $attackingLord was defined just after the while statement.
|
|
Matija
Morkin Member
The Turtle Moves!
Posts: 1,696
|
Post by Matija on Jul 31, 2004 18:47:25 GMT
A typo: in vassal lords query S_SESSION is used instead of $_SESSION.
|
|
Freiegeister
Morkin Member
'Blasphemy is a victimless crime' - Dawkins
Posts: 1,126
|
Post by Freiegeister on Jul 31, 2004 22:55:29 GMT
Exactly, it should be more causalties for attacker and less for defender. Until the wall is breached, when the situation should be reversed. But I'm at a loss as how to determine that. Perhaps when the defending army gets reduced by half? I always assumed you would get the citadel bonus as long as you had a garrison. An idea. Only the garrison defends, and any lords at the citadels allied with the garrison do not enter the battle. (If all lords got the defensive bonus you would get a lot of stalemates were no one would be game to siege) Give the garrison a bonus: for example 5:1 as a defensive bonus and maybe 3:1 attacking (Does anyone have historical figures for losses in sieges?). Lose the garrison and there is no advantage and a citadel acts like a village for bonuses. It would mean you could hole up in a citadel to rest and set a garrison to defend. A maximum defensive army of 2500 is fair as there can only be so many men on the wall. You would have to reinforce each turn to hold out against a large attacker. There could also be a minimum size to be able to withstand a siege, say 500 men for a citadel. Any less and the citadel would simply be overrun.
|
|
|
Post by celebaglar on Jul 31, 2004 23:34:10 GMT
An idea. Only the garrison defends, and any lords at the citadels allied with the garrison do not enter the battle. Give the garrison a size multiplier: for example 5:1 as a defensive bonus. Lose the garrison and there is no advantage and a citadel acts like a village for bonuses. It would mean you could hole up in a citadel to rest and set a garrison to defend. A maximum defensive army of 2500 is fair as there can only be so many men on the wall. You would have to reinforce each turn to hold out against a large attacker. So you'd need an army of 25,000 just to deal on an even keel with a standard garrison? A garrison which could be topped up every turn from the lords present and would therefore act like 25,000 men every turn? Wouldn't that make anyone who can recruit 10-15 lords virtually invincible?
|
|
Freiegeister
Morkin Member
'Blasphemy is a victimless crime' - Dawkins
Posts: 1,126
|
Post by Freiegeister on Aug 1, 2004 1:01:42 GMT
So you'd need an army of 25,000 just to deal on an even keel with a standard garrison? A garrison which could be topped up every turn from the lords present and would therefore act like 25,000 men every turn? Wouldn't that make anyone who can recruit 10-15 lords virtually invincible? It is a bit like that at the moment were someone to put 10 lords in a citadel. By limiting their effective strength, you would only need 12,500 men to be at even odds. Which would be the equivalent of giving say a 25% defensive bonus to a group of 3 lords defending a citadel. (3 lords +1 garrison) x 2,500 * 1.25 = 12,500 or 4 lords + garrison with no defensive bonus. The idea is that the size of the defence is capped as well as having a haven where a tired army could rest. Take a siege involving two armies of 5 lords (the defenders would also have a garrison of 2500). The attacking army would have 12,500 men against the 2,500 garrison for an even battle given even tiredness and courage, while 12,500 men sat out the battle. But if all lords were involved with a 25% defensive bonus, it would be 12,500 against 18,650. If it was 10 Lords it would be 25,000 against 34,375. I like the odds of pitting 25,000 against 12,500 defenders rather than 34,375. 10 lords each killing 250 men would b enough to breach the citadel. If it still seems too weighted in favour of defenders, decrease the garrison size increasing the chance that it would be beaten. Different citadels could even have different bonuses, making some undefendable and others unassailable; and as a penalty for losing the siege, all defenders could lose an amount of courage. For keeps, you could cap the garrison at 1000, making them unholdable against a massive army.
|
|
|
Post by celebaglar on Aug 1, 2004 2:01:16 GMT
It is a bit like that at the moment were someone to put 10 lords in a citadel. Not really. I played a game where about 26 armies defeated 22 in a citadel. Under the system you propose, this would become impossible. But is this realistic? You have 10 armies at the citadel, but while they can rest they can't assist in the defence? Sure, they wouldn't be able to man the walls, but they could be stationed outside, preventing the enemy from assaulting the citadel itself. That's a huge amount of damage. Under the current conditions it could only happen if the attackers were at least HI and the armies were full. The defense to this is simple. Use the spare 12,500 to hit the attackers once before they hit the citadel, then they'll never be able to breach it. To be honest, I think the system would feel contrived, and you'd need a set of tables to work out just what to do where. I guess I can't treat an attack on a stronghold as a siege. In an assault, not many people within would be able to rest. In a siege, things are mostly peaceful, because the besieging army doesn't actually attack, so it too can rest and avoid casualties. I do agree that it would be good to cap the defensive capacity of strongholds, but I would do this by limiting the size of army that would get a defensive bonus in a fight, not by limiting the size of the army able to fight on one side or another.
|
|
Matija
Morkin Member
The Turtle Moves!
Posts: 1,696
|
Post by Matija on Aug 1, 2004 4:54:46 GMT
The thought to limit the number of defending troops that would receive stronghold bonus occured to me as well (or was it already discussed?)
And dont't forget there will be diseases.
|
|
Matija
Morkin Member
The Turtle Moves!
Posts: 1,696
|
Post by Matija on Aug 1, 2004 5:33:18 GMT
For those who are familiar with PHP:
Is query result an array? Can array functions be used on it? Reset, specifically?
If not, how does one return to the beginning of a query result? Or are queries uni-directional?
(I'm trying to figure out an alternative battle routine)
|
|