1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

town capture simulator

Discussion in 'Civ3 - Utility Programs' started by Offa, Nov 11, 2004.

  1. Offa

    Offa Bretwalda

    Joined:
    Feb 3, 2002
    Messages:
    1,255
    Location:
    Mercia
    For a long time now I have wanted to know the attacking force needed to capture a town. For example how likely are 6 horsemen to take a town defended by 3 spears on a hill. Individual combat calculators help you to get an idea about this but don't really give the answer. Sirp has written a programme which calculates this, but on my computer his utility crashes if asked to evaluate attacks involving many units.

    This is a little Java program that simulates trying to take a town. It seems fiendishly tricky to me to calculate the true chance of taking a town but it is reasonably easy to simulate lots of attempts and work out the chances that way.

    The program lets you specify the attackers and the defenders, and then simulates lots of attempts to take the town. It allows for retreats according to the formula by BomberEscort, and for those irritating defender promotions. I haven't attempted to allow for bombardment, armies or for units that can attack more than once in a turn. The current defender is selected according to the product of power and remaining hit points as I am not sure how the game does this.

    Latest version:

    28 dec 04 version
     
  2. Cyber Dreyk

    Cyber Dreyk Master of illusions

    Joined:
    Oct 30, 2003
    Messages:
    242
    Location:
    Russia
    It's a very interesting, thank you! :D
    But how I can start your utility without installed java on my PC? :(
     
  3. ainwood

    ainwood Consultant. Administrator

    Joined:
    Oct 5, 2001
    Messages:
    30,061
    Sounds promising - but is a .jar file a java archive? Do we need to uncompress it first? :confused:
     
  4. Offa

    Offa Bretwalda

    Joined:
    Feb 3, 2002
    Messages:
    1,255
    Location:
    Mercia
    It is a zipped jar file. The server won't let me upload a jar file, so I had to zip it first. I don't think you need to do anyting special to run a jar file, just double click: at least that works on my machine.

    Here is a screenshot. It is a tad garish, but I could tone it down:

     
  5. Gramphos

    Gramphos Chieftain

    Joined:
    Sep 1, 2001
    Messages:
    1,139
    Location:
    Sweden
    You will have to install JRE (some version) to be able to run java files.

    jar files are run with java -jar filename.jar normally an association is setup on install
     
  6. Offa

    Offa Bretwalda

    Joined:
    Feb 3, 2002
    Messages:
    1,255
    Location:
    Mercia
    I guess I have installed lots of java stuff on my computer so that explains why I can run executable jars with a double click. I only now see that it opens with javaw, whatever that is. I had assumed executable jars would open on most computers: so much for portability. Anyway it runs just great on my machine :p .

    Frankly I only tinker with programs as a bit of fun, it's just a game for me, like playing civ really. Therefore I am a bit ignorant :blush: . If I knew how to I would convert the program to an applet. I suspect that this is easy but I don't know how to do it :crazyeye: .

    Having said all that, I think this will run from windows Internet Explorer, or is that just my machine as well?
     
  7. socralynnek

    socralynnek Civ & Hattrick addict

    Joined:
    Sep 1, 2003
    Messages:
    1,426
    Location:
    Northern Germany
    Hey, interesting tool and good work.

    2 proposals:
    1.One button where only the results are cleared (so I can just add an attacker without having to enter them all again)
    2. Adding a third and fourth row, one for attacking bombardment units, one for defending ones.
     
  8. Offa

    Offa Bretwalda

    Joined:
    Feb 3, 2002
    Messages:
    1,255
    Location:
    Mercia
    Thanks:
    Your first idea is easily done. I agree that re-entering all the units is a drag. It would be pretty easy to have buttons to remove the last unit entered too but might make the interface a bit cluttered. I am also going to increase the allowed limits on the number of simulations as it was running very fast on my machine, 100000 simulations takes a few seconds.

    Re the second proposal, adding buttons for bombardment is of course pretty easy, but accurately simulating it not quite so easy. At the moment I don't know how bombardment works. It would complicate the simulation a fair bit but I might try it at some point.

    Similarly attackers which can attack several times a turn (eg armies, tanks) would be interesting to simulate, if potentially a little complicated: eg how do you work out whether or not to use the second attack and at what point of the battle do you use it.

    More stats about the results would also be possible, if wanted.
     
  9. Offa

    Offa Bretwalda

    Joined:
    Feb 3, 2002
    Messages:
    1,255
    Location:
    Mercia
  10. Offa

    Offa Bretwalda

    Joined:
    Feb 3, 2002
    Messages:
    1,255
    Location:
    Mercia
    Ok I know that no one is reading but I find my calculator very useful so I have buffed it up more. I haven't added bombardment as I can't think of a sensible way in which to implement it that would really simulate what a player does, ie in a real game a player would potentially bombard for several turns to kill more population etc. I haven't added blitz either as it plays little or no role in games I play.

    here is an example simulating an attack with vet horsemen on a hill town defended by 2 fortified spears.



    new calculator

    I think all that needs to be done is unzip the programme which is an executable jar. If there is no java on the computer I think it can be run from IE, but if there is a double click will work. Anyone who wants can have the source.
     
  11. Ambiorix

    Ambiorix Chieftain

    Joined:
    Jan 2, 2003
    Messages:
    371
    Location:
    Belgium
    Installing Java worked best for me.
    Offa, this tool looks really useful, and I'll sure use it in the next COTM, but I'd be very very grateful if you could tone down the colors a bit. :twitch: ;)
     
  12. Offa

    Offa Bretwalda

    Joined:
    Feb 3, 2002
    Messages:
    1,255
    Location:
    Mercia
    Yes it is pretty garish isn't it. I put colours in so I could see what was going on easily, and really should have some subtle shades instaed of these rather violent default colours.

    I will tone it down or just make it all grey.
     
  13. MSTK

    MSTK Chieftain

    Joined:
    Dec 30, 2003
    Messages:
    2,154
    This is a great an useful tool :)

    However, I always have a 50-100 stack of artillery on hand...
    How about adding the option, "Fully Bombarded"? So, it sets all of teh defender's HP to 1.
     
  14. Offa

    Offa Bretwalda

    Joined:
    Feb 3, 2002
    Messages:
    1,255
    Location:
    Mercia
    I did think about putting in bombardment but it would be hard to model what you would do in practice. For example if your first go at bombardment reduced city size to 7, you probably wouldn't attack but would try to bombard again next turn to reduce city size to 6. In addition, I hardly ever use bombardment myself. I guess armies would be nice too but are actually slightly tricky to implement for much the same reason: eg when down to 2hp should it attack? I guess I could make them attack if they figured their chance of winning was say >80%, but it is quite cumbersome to do.

    You can just put the defenders down as having 1HP. You can prevent them from promoting by making them elite, otherwise promotions will potentially make life much harder for your attackers. Another effect of bombardment is reduction in population, which can of course also be calculated.
     
  15. Dom Pedro II

    Dom Pedro II Modder For Life

    Joined:
    Apr 3, 2002
    Messages:
    6,811
    Location:
    Exit 16, New Jersey
    50 to 100 artillery???!! I usually have 50 to 100 units! :lol:

    Anyway, this is really cool since military commanders have access to this kind of information in real life. So it's not like cheating... I don't think so anyway.
     
  16. MSTK

    MSTK Chieftain

    Joined:
    Dec 30, 2003
    Messages:
    2,154
    No, it is never considered cheating to know your odds :)
     
  17. Offa

    Offa Bretwalda

    Joined:
    Feb 3, 2002
    Messages:
    1,255
    Location:
    Mercia
    OK, here it is in pastels. Actually I think it looks anaemic and my wife says it looks military.

    I added a fully bombarded button as well: this sets all the defenders to 1HP elite units (I made them elite to stop them promoting).

    I fixed an error :blush: as well, which was nice of no-one to mention. Retreat chances now work properly.



    pastel combat sim
     
  18. Mistfit

    Mistfit Chieftain

    Joined:
    Apr 5, 2004
    Messages:
    3,798
    Location:
    Northern Michigan
    IMHO the colors are much nicer now. Neat utility BTW.

    My problem was the fact that I'm not intelligent enough to notice the problem:D
     
  19. Ambiorix

    Ambiorix Chieftain

    Joined:
    Jan 2, 2003
    Messages:
    371
    Location:
    Belgium
    Thanks Offa !
    This is the best anaemic military tool I've ever seen ! :D
     
  20. Spart

    Spart Ohhhh Shiny

    Joined:
    Jul 19, 2004
    Messages:
    88
    Location:
    Where ever I want.
    Great little tool, hopefully you will fill it full of options!
     

Share This Page