229 Open Daily games
2 Open Realtime games
    Pages:   1   (1 in total)
  1. #1 / 13
    Shelley, not Moore Ozyman
    Rank
    Brigadier General
    Rank Posn
    #40
    Join Date
    Nov 09
    Location
    Posts
    3449

    Since Tom was so good as to implement the import/export of the boards via XML (when did that happen by the way?  I just noticed last week), I felt like I needed to step up and write that hordify script I'd been talking about.

    You can get it here:

    http://prestopnik.com/wargear/WarGearHordify.py

     

    It's a little bit complicated to run python code if you've never done it before, but I am going to attempt to explain it here.

    If you are on windows, you need to download Python (If you are on linux I am going to assume you can figure this out yourself.  Mac users.... maybe someone with a mac can help):

    http://www.python.org/download/

    Get the latest 2.x Windows installer.

     

    To hordify a map, open up WarGearHordify.py in your favorite text editor.  Go to the bottom & look for these lines:
    ##### Hordify
    wgmap = WGMap()
    wgmap.loadMapFromFile('//MyServer/data/wargear development/scripts/SimpleBoard.xml')
    print "Statistics before Hordify\n"
    wgmap.printStatistics()
    wgmap.hordify()
    print "\n\nStatistics after Hordify\n"
    wgmap.printStatistics()
    wgmap.saveMapToFile('//
    MyServer/data/wargear development/scripts/SimpleBoardHordes.xml')

     

    You just need to change the paths in the loadMapFromFile() and saveMapToFile() calls.

     

    Then run IDLE (this came with your python 2.x distribution).  In IDLE type:

    sys.path.append('//MyServer/data/wargear development/scripts/')

    except change that path to wherever you put the WarGearHordify.py script

    an example of a path on a local disk:

    C:\\Python27\\Lib\\idlelib

     

    Now you just need to call the script.  In IDLE type:

    import WarGearHordify

     

    That's it.  You should see some statistics about your map printed to the screen before & after it was hordified & the new XML file should be wherever you told it to be.   The hordify() call can also be made like hordify(2) if you want your hordes continents to be worth 2 (or whatever).

     

    WARNING

    Although I have tested this on a simple map, be sure to make a copy of your map first, and experiment on the copy.  I don't think my script will entirely wipe out your map, but I'm not going to promise anything.

    Edited Wed 4th Aug 22:24 [history]

  2. #2 / 13
    Shelley, not Moore Ozyman
    Rank
    Brigadier General
    Rank Posn
    #40
    Join Date
    Nov 09
    Location
    Posts
    3449

    I wanted to keep the top post relatively short, but I did have more to say, so...

    This script is far from finished. It does work, but there are tons of improvements that I plan on making. Please let me know if you see anything that doesn't work, or features that you would like to see added. Also feel free to hack on it yourself - if you want you can send me your changes, and if I like them I will add them to the code base.

    One change I would like to make is to move the code into a python library. I didn't do that initially because I wanted to make it as simple as possible for people to run.  I would also like to make a wrapper of sorts so that it can be called from the command line for easier use under linux.

    Also, you can see in the hordify functions that I plan on adding the ability to pass two regular expressions to define which territories are included in the hordification process.  Also, I plan on adding a feature to check & warn (and optionally not create) if the continent already exists.  Then the script could be run on existing maps to verify you didn't miss any continents, or to automatically regen the hordes continents if you change a border or territory.

    Edited Wed 4th Aug 22:44 [history]

  3. #3 / 13
    Premium Member Yertle
    Rank
    Major General
    Rank Posn
    #21
    Join Date
    Nov 09
    Location
    Posts
    3997

    ... Soooo ummmm will the final script not require an engineering degree to run? :)


  4. #4 / 13
    Shelley, not Moore Ozyman
    Rank
    Brigadier General
    Rank Posn
    #40
    Join Date
    Nov 09
    Location
    Posts
    3449

    Yertle wrote: ... Soooo ummmm will the final script not require an engineering degree to run? :)

    Damn.  I was afraid that was going to be the response.  Honestly, I don't think
    it's that hard, and anyone that is smart enough to create a decent war gear map
    is plenty smart enough to get this working (and I'll gladly provide
    tech-support).  It's basically 3 steps:

    #) Install Python
    #) Edit the script to point to your file
    #) run the script in python

    But I can see where it looks intimidating to someone not familiar with
    programming.  I do think that if you try this you'll find it easier than making
    hordes by hand, and plus I have a couple other ideas for neat scripts that
    you'll be able to use once I get them done.

    Having said that, I will try to make it easier to use.  Unfortunately, I'm not
    really a python programmer - I've been using this as an excuse to learn Python
    as much as anything.  So if anyone reading does have suggestions as to how to
    make this simpler to use, I'd be glad to hear it.  A couple things I might try:

    * Use something like py2exe to create an executable version of the script.

    * Use something like Tkl to create a GUI (graphical interface) to the script

    * Use something like Pyjamas to compile the python to javascript so that it can
    run via a website

    If anyone has any experience/advice with any of these, please help, because I
    know almost nothing about all of them.

    Edited Thu 5th Aug 21:42 [history]

  5. #5 / 13
    Premium Member Yertle
    Rank
    Major General
    Rank Posn
    #21
    Join Date
    Nov 09
    Location
    Posts
    3997

    I'm confident I could do it, and it does look like you have laid it out nicely...I'm just not going to, especially with the installs and stuff I would have to do :P

    Perhaps others will do it, and I'm sure it could save time, BUT my guess is that most wouldn't use it without a simple one-click-noob "HORDIFY" button. So for general use, it is my guess that it would be a good goal :).


  6. #6 / 13
    Where's the armor? Mongrel
    Rank
    Brigadier General
    Rank Posn
    #53
    Join Date
    Nov 09
    Location
    Posts
    522

    Ciscokid thinks kernel development is easy. Perspective.

    Longest innings. Most deadly.

  7. #7 / 13
    They see me rollin' IRoll11s
    Rank
    Private
    Rank Posn
    #1535
    Join Date
    Nov 09
    Location
    Posts
    632

    Considering how the universe tends to balance out, I bet Ciscokid doesn't know how to swing a hammer without breaking his thumb. =]

    Interesting to see export/import of the XML was implemented.

    Oh and don't get discouraged PH, just because Yertle is too lazy to follow simple instructions...

    Mongrel: "Yeah, If 11s is not eliminated in the first 5 rounds - back to the drawing board." SO TRUE!

  8. #8 / 13
    Premium Member Yertle
    Rank
    Major General
    Rank Posn
    #21
    Join Date
    Nov 09
    Location
    Posts
    3997

    PH?
    11s makes buttons and neat stuff.


  9. #9 / 13
    Premium Member Kjeld
    Rank
    Major General
    Rank Posn
    #15
    Join Date
    Nov 09
    Location
    Posts
    1339

    If it had existed, I would have gladly used the hordify script for this board: http://www.wargear.net/boards/view/874


  10. #10 / 13
    Standard Member Hugh
    Rank
    Lieutenant General
    Rank Posn
    #13
    Join Date
    Nov 09
    Location
    Posts
    869

    Yertle wrote: PH?

    WF username of Ozyman - one of my favorite all-time user profile pics too.  I would like to hear more about the XML encodings of the boards (are they publicly available or just available to the designer?)


  11. #11 / 13
    Shelley, not Moore Ozyman
    Rank
    Brigadier General
    Rank Posn
    #40
    Join Date
    Nov 09
    Location
    Posts
    3449

    Hugh wrote:
    Yertle wrote: PH?

    WF username of Ozyman - one of my favorite all-time user profile pics too.

    I did not realize that was such common knowledge.  Maybe I should just go back to being 'Putin's Head', but I don't think that it is possible to change your name on wargear.

     

    I would like to hear more about the XML encodings of the boards (are they publicly available or just available to the designer?)

    I think you must have to be the designer.  It is one of the options now on the 'Board Designer' page.  If you'd like I could make available some of mine (I created a 'Simple Map' for testing).

     


  12. #12 / 13
    Shelley, not Moore Ozyman
    Rank
    Brigadier General
    Rank Posn
    #40
    Join Date
    Nov 09
    Location
    Posts
    3449

    IRoll11s wrote:
    Oh and don't get discouraged PH, just because Yertle is too lazy to follow simple instructions...

     

    That's all right.  I mostly did this for my own use and edification, but I was hoping to give back to the community.   I guess I overestimated the average geekiness of the wargear mapmakers.

    I did find this website called 'Utility Mill', that allows you to upload python scripts to be run online, so if I can figure out how that works, then I can make an online version of this.   It might take a couple weeks (or months).


  13. #13 / 13
    Shelley, not Moore Ozyman
    Rank
    Brigadier General
    Rank Posn
    #40
    Join Date
    Nov 09
    Location
    Posts
    3449

    Kjeld wrote: If it had existed, I would have gladly used the hordify script for this board: http://www.wargear.net/boards/view/874

    Wow - that is a really nice looking board.  I actually have a kind of similar board (it's mostly hexes) on ToS, that I wanted to bring over, but it also is hordes, and I couldn't bear the thought of going through and adding all the continents by hand, which was really the main impetus behind this script (holy run-on sentence).


You need to log in to reply to this thread   Login | Join
 
Pages:   1   (1 in total)