town capture simulator

MSTK said:
Wait a sec...does this consider the option of promotions? Because a unit you've attacked until 1 HP with one unit may emerge with 2 HP later...

Yes it does. That is one of the reasons you are asked the experience level of defenders (conscript to elite) and the only reason why you are asked whether the defender is from a militaristic civ: both of these factors affect promotion chances.

I don't consider attacker promotions as at the moment I don't simulate blitz attacks and therefore these promotions, although nice, have no impact on taking the town.
 
I just noticed that if an attacker starts with 1 HP ( as opposed to falls to 1 HP during the attack) the programme gives him a chance to retreat. I have fixed this now.

new version

This doesn't make any difference (hopefully) unless you wish to simulate attacks with 1 hp fast attackers, in practice not a common event.
 
I may have a go adding blitz, but it isn't entirely straightforward. I'm currently not quite sure how blitz works. I think armies have considerably modified attack strength as well and that would also need to be allowed for. In addition it is a little problematic to work out when or if to attack for a second time with an injured blitz unit.
 
I have taken a bit more time out from actually playing civ to tweak this a little more, adding blitz attack.

blitz version

The way attacks work in this simulation is that attackers are put on an arrayList in the order in which they are added, and then this list is iterated through, attacking the the strongest remaining defender ( calculated as HP x Power) until all the defenders are dead. I have changed this now so that attackers with blitz can keep attacking until they have used up their blitz lives. It was pretty simple to implement this, although getting the graphs and stats to still add up was more of a headache (I hope it works). The tweaks stuffed up the graphs a lot at first but seem OK now. Please tell me if it doesn't work.

Anyway the thing is blitz attackers will carry on attacking as long as they can. Therefore if an attacker who started with 15 HP goes all the way down to 1HP in the first attack, it will still try to attack again. I don't really like this, as I suspect that nobody really plays like that. It would be simple to institute a rule for blitz attackers only to attack if they have xHP left, and I think this would be better. If anyone has any suggestions I will consider them.

For myself, I hardly ever have any blitz units, so the exercise is a tad academic. Still fun though.
 
Offa said:
Anyway the thing is blitz attackers will carry on attacking as long as they can. Therefore if an attacker who started with 15 HP goes all the way down to 1HP in the first attack, it will still try to attack again. I don't really like this, as I suspect that nobody really plays like that. It would be simple to institute a rule for blitz attackers only to attack if they have xHP left, and I think this would be better. If anyone has any suggestions I will consider them.
If I understand you question correctly, you are trying to program your simulator to determine when to attack with the remaining units. Depending on how you've set this up (I'm not a Java programmer), you could break up blitz units in several different "simulated" units based on the number of attacks allowed. Give them all the total HP for the blitz unit. After the first blitz unit attack, readjust the remaining units to the left over hitpoints and stick them back in the stack of eligible attackers. Repeat until all blitz attacks are used up. Most real players would not attack with a 1HP army if there are other, healthy units, but they might attack with it as the last attacker if they were desperate to take the city. The resulting percentage of taking the city would given them an indication of how desparate they are willing to be to attack with their 1HP army at the end of the turn.

If I'm way off base, sorry. And sorry for digging up the thread, but I just found it thanks to recent references from GOTM.
 
ControlFreak said:
If I understand you question correctly, you are trying to program your simulator to determine when to attack with the remaining units. Depending on how you've set this up (I'm not a Java programmer), you could break up blitz units in several different "simulated" units based on the number of attacks allowed. Give them all the total HP for the blitz unit. After the first blitz unit attack, readjust the remaining units to the left over hitpoints and stick them back in the stack of eligible attackers. Repeat until all blitz attacks are used up. Most real players would not attack with a 1HP army if there are other, healthy units, but they might attack with it as the last attacker if they were desperate to take the city. The resulting percentage of taking the city would given them an indication of how desparate they are willing to be to attack with their 1HP army at the end of the turn.

If I'm way off base, sorry. And sorry for digging up the thread, but I just found it thanks to recent references from GOTM.

Thanks for your interest ControlFreak. Blitz attackers are presently represented by a Unit object. This could be broken up but I am reluctant to do so as it could be messy. I think I could change things to order attackers to attack in order of strength, which would kindof have the result you are after. Even this isn't entirely simple as at present the algorithm just has to iterate once through the list of attackersto realize the attack is over, and this would be a bit more complicated. At present defenders are reordered to keep the strongest remaining on top (as in the game) but attackers are used in the order they are added (which allows you to see which is the best order of attack). I might have a play with this again though, as frankly it is almost as much fun as playing civ for real.


If anyone fancies it, here is the code as a text file.
 
Really nice Offa!! I appreciate your work on this.

You knew there was a question coming.....Is there a way to add a remove unit button? For instance, if I add 6 defenders and should have only added 5. I'd like to remove it without doing it all over again. But it would probably take you longer to code it than it would for the time that it would take me to click clear, and add them back again. So nevermind.... :D
 
Tubby Rower said:
Is there a way to add a remove unit button? For instance, if I add 6 defenders and should have only added 5. I'd like to remove it without doing it all over again. But it would probably take you longer to code it than it would for the time that it would take me to click clear, and add them back again. So nevermind.... :D

Ask, and you shall receive :) .

blitz combat with remove buttons
 
Thanks a heap Offa!!
 
Hello.

This program seems great but I can't get it to work on my PC (WinXP sp1). I have installed the latest JRE but when I double-click the .jar file, I only get a blank page and my computer starts to crawl... Any help?
The funny thing is, I once used an older version of the simulator on a Win98 computer, and it worked perfectly. I miss it!
 
morchuflex, I wish I could help. It does work on my machine with XP(2002 home, service Pack 2). Presumably it has something to do with your Java installation, a dark art to me.

I can only hope that someone more expert in Java can help you.
 
ok - so I'm bumping a really old thread here, but I was just introduced to this wonderful tool by Chamnix, and I wanted to say "thank you!"

Worked great on my PC, and is really helpful. Thanks for you hard work on this Offa!
:salute:
 
nice tool homie, can you run it at the same time as civ 3?
 
I rejigged this nearly 3 years ago, but never got around to uploading the new version.
It is really just the same as the old version but it has a save option. If you use this you can save results, which should open nicely in Word or Excel etc.

The file has been renamed with a .txt extension so that I could upload it (I don't seem to have any zipping programmes left on my PC). Therefore it needs to be renamed with a .jar extension to work (right click it to save target as "combat.jar", type of file: all files).
 
Back
Top Bottom