Automatic deck optimization - leftylink's thread (locked)

216 posts

Flag Post

I submitted my first patches to commonkey’s tyrant_optimize on November 11th. Since then, I went on to make many other changes to it, including ANP (to make the best raid decks ever) and conquest battleground effects (to make the ultimate conquest tool).

I have been called many things since then. Some hailed me as a hero, or “master programmer” (I’m really not). It makes my heart swell to see my name posted in Fansite comments, though I would say the one more deserving of the credit is commonkey. Others decried my actions, claiming I ruined conquest, and indeed the entire game of Tyrant. That’s too bad, but it’s just fine.

Was I right in releasing this code to the public? Did I act correctly in opening this Pandora’s Box? I’m not sure. I do know that as a coder, I am a supporter of open source. I have benefitted from being able to peruse Moraku’s and Netrat’s source code for their respective simulators, and I use other open source software on a daily basis. And it certainly would not have felt right to keep my improvements to myself and friends only. So I did what I felt was right.

Whether what I did was right or not, I no longer have the time to support such an endeavor. Just as I took the torch from commonkey, I think it is time to pass the torch back on to the next contributor, whoever that may be. commonkey seems to be working on his own repo again, and there has been a little bit of extra work done by andor. Because of the distributed nature of git, everyone who forked my repository on github has a complete copy of all changes I have made, so anyone can pick up where I left off.

I may be back in a few months, but until then, it has been a pleasure serving you. It’s time for me to disappear from the spotlight, back into the shadows (where some have argued that I operate best), and make way for other coders with enormous potential.

 
Flag Post

LEFTYLINK ONCE FLEW HIS PRIVATE HELICOPTER ONLY TO SEE A BURNING BUILDING SO HE LANDED ON THE ROOF AND RESCUED 100 PEOPLE INSIDE.

That’s is why I use Tyrant_optimize-leftylink.

 
Flag Post
Originally posted by catepillar:
Originally posted by leftylink:

I want this post

No you don’t.

He’s still got hold of it.

 
Flag Post
Originally posted by catepillar:
Originally posted by Shadowhopeful:
Originally posted by catepillar:
Originally posted by leftylink:

I want this post

No you don’t.

He’s still got hold of it.

Until I hack his account and delete it for him. Then I get it :D

Unlikely.

 
Flag Post

This post has been removed by an administrator or moderator

 
Flag Post

Why won’t you get Windows to make binaries?? :o

 
Flag Post
Originally posted by Malutor:

Why won’t you get Windows to make binaries?? :o

You don’t want to get me started on that one.

And why don’t you install a Linux distribution for easier code management.

 
Flag Post

for quests when i try to run it the optimizer isn’t recognizing the quests (ex: Step 13). I downloaded the XML file and put it in the same folder as the other files. Is there something else i’m supposed to do?

 
Flag Post
Originally posted by artdz:

for quests when i try to run it the optimizer isn’t recognizing the quests (ex: Step 13). I downloaded the XML file and put it in the same folder as the other files. Is there something else i’m supposed to do?

Did you compile the binary itself? The quests version is not distributed as a binary, so you have to build it yourself.

 
Flag Post
Originally posted by catepillar:
Originally posted by artdz:

for quests when i try to run it the optimizer isn’t recognizing the quests (ex: Step 13). I downloaded the XML file and put it in the same folder as the other files. Is there something else i’m supposed to do?

Did you compile the binary itself? The quests version is not distributed as a binary, so you have to build it yourself.

nope how do you do this

 
Flag Post
Originally posted by artdz:
Originally posted by catepillar:
Originally posted by artdz:

for quests when i try to run it the optimizer isn’t recognizing the quests (ex: Step 13). I downloaded the XML file and put it in the same folder as the other files. Is there something else i’m supposed to do?

Did you compile the binary itself? The quests version is not distributed as a binary, so you have to build it yourself.

nope how do you do this

Most of the relevant information is the first post, if you are having problems with that, I can’t help you too much from here. If you are still interested, you can shoot me a PM and I will see what we can do.

 
Flag Post

I remember now why I prefer Java over C(++) ;)

BTW, managed to compile the leftylink-integration branch it under Win7 64bit (although resulting exe is 32bit), had to add the obj dir, and user the -lboost_chrono flag.

Compiled version available here: https://docs.google.com/open?id=0Bw6sMqI3OVAKWW5tSHllUUZCcVU

 
Flag Post

Step by step guide to compile leftylink’s tyrant_optimize on Windows



If you don’t want to compile your own version, you can grab this http://www.mediafire.com/?j35xhv8xlc7ud2j. Use it at your own risk. Compiled on 12/13/2012.

Some background knowledge You can skip this if you just want instructions.
Leftylink’s code is developed for *nix type systems (which all versions of Windows are not), so you are gonna have to install a toolset that will provide some of the necessary libraries and headers. In this guide, I use mingw-9.5.exe, a self-extracting archive, which includes a nifty tool called “git” that will retrieve all the code we need and “wget” which will get the xml files.


Note that messing with any of the defaults WILL change this process, and I will not cover in what ways those changes will mess stuff up




  1. Download and install http://nuwen.net/files/mingw/mingw-9.5.exe (33.6 MB). If it asks for an extract or install location make sure it says “C:\MinGW
  2. Open a command prompt. For most Windows iterations, it can be found by clicking on the Start Menu → All Programs → Accessories → Command Prompt. See the first image below for a sample command prompt (yours should look similar).
  3. Now type “C:\MinGW\set_distro_paths.bat”. This command tells your command prompt where to search for some of the files and libraries that will be used.
  4. Next, type “git clone git://github.com/leftylink/tyrant_optimize”. This downloads all the code in leftylink’s repo.
  5. Now, type “cd tyrant_optimize”. The previous command created this folder and “cd” means “Change directory”, so we are literally opening that folder.
  6. Type “git checkout leftylink-integration”. This is the branch that you want at the current moment in time (likely to change in the future).
  7. Now we need to make a change to the Makefile. Type in "sed -i "s/-lboost_filesystem/-lboost_filesystem -lboost_chrono/" Makefile". This will add -lboost_chrono to the LDFLAGS, which is necessary for Windows users.
  8. Type in “mkdir obj”. This creates a folder (inexplicably) needed for compilation. (That’s a slight dig a leftylink. :P )
  9. Type “make”. You will see a bunch of text flow back you on the screen. This is normal (and expected). The very last thing you should see is something close to “g++ -o tyrant_optimize obj/cards.o obj/deck.o obj/read.o obj/sim.o obj/tyrant.o obj/tyrant_optimize.o obj/xml.o -lboost_system -lboost_thread -lboost_filesystem -lboost_chronos”. If you see something else, post a screenshot and let us help you. (Google is your friend if you don’t know what a screenshot is.)
  10. Download the necessary XML files. Fortunately the MinGW distro installed in step 1 provides a handy tool to do this. Type in (on separate lines)
    wget -O cards.xml http://kg.tyrantonline.com/assets/cards.xml
    wget -O raids.xml http://kg.tyrantonline.com/assets/raids.xml
    wget -O missions.xml http://kg.tyrantonline.com/assets/missions.xml
    wget -O quests.xml http://kg.tyrantonline.com/assets/quests.xml
  11. Remove the “`” character in the XML files. "sed -i "s/`//" *.xml".


  12. The result should be that in that folder is a “tyrant_optimize” binary which can be run from a command prompt (open with steps 2 & 5 in the future).

    Congrats, you have just successfully compiled (a highly optimized) tyrant_optimize.

    If any of the steps do not work for you, you can post in this thread, and I (or someone else) will do our best to help.



    This is what a command prompt looks like (in Windows XP)

    Changes:

    1. December 9, 2012 MinGW download updated to 9-5 from 9-4.
    2. December 10, 2012 Found out that sed is available via the MinGW download. Updated instructions to use sed instead of write. Added a zip file for easy downloading.
    3. December 13, 2012 Uploaded a new zip including the latest changes. Fix some formatting issues that were bothering me
 
Flag Post
Originally posted by catepillar:
This is what a command prompt looks like (in Windows XP)

Epic :)

 
Flag Post

I don’t know what the hell you people are talking about, but I like it!

 
Flag Post
Originally posted by Tester8372:

Somehow i must have compiled an odd binary… it will optimize decks but only without the -o flag because i suppose it cannot read ownedcards.txt (which in this case contained only 3 cards to avoid a looong error output)

me@M1530:~/optimizer$ ./tyrant_optimize “ogre-spam” “ogre-spam” climb 100 -o -s
" does not seem to be a valid card.d “2” does not seem to be a valid card.
" does not seem to be a valid card.ard "
Error in file ownedcards.txt, the card “1” does not seem to be a valid card.
optim: read.cpp:269: void read_owned_cards(Cards&, std::map<unsigned int, unsigned int>&): Assertion `beg != tok.end()’ failed.
Aborted (core dumped)

i got a huge list of warnings as well while making the binary http://pastebin.com/vJDtn9pc i had to create obj/ and to change gnu++11 into gnu++0x.
i’m on ubuntu 12.04

the gnu++0x is because ubuntu is packing the older gcc. the 0x standard is very close to the 11 standard, so it won’t matter other than editing the makefile.

As for the huge warnings, yes that is normal.

And the issue with ownedcards.txt might be a formatting issue more than anything. It is working for me just fine, and im on Mint 13 which is based on Ubuntu 12.04.

 
Flag Post

Thanks for the answer.
I just copypasted the owned cards from the fansite. I cannot imagine when the formatting went wrong.
Also, the same txt file works ok with commonkey’s exe.

 
Flag Post

@catepillar.

Your guide is great. I got it working.
Notes: Point 10. My last line had a different order, and also had the -lboost_chrono in the line, which you didnt add.
Point 11. Wouldnt do https links, so changed it to http instead and it worked.

Problems: Currently having a problem where it wont let me put in a new deck into custom decks if i want to fight it. I have to ‘edit’ a previous deck (by changing the card, but keeping the deck name)
Am I doing something wrong?

 
Flag Post

think i discovered a bug. Clone experiment doesn’t work on Mission 229. The program just crashes; however, it works fine in numerous other cases. I tried the other missions and it worked fine. I can use other effects like toxic on 229 and it works.

 
Flag Post
Originally posted by FieryPhoenix:

@catepillar.

Your guide is great. I got it working.
Notes: Point 10. My last line had a different order, and also had the -lboost_chrono in the line, which you didnt add.
Point 11. Wouldnt do https links, so changed it to http instead and it worked.

Problems: Currently having a problem where it wont let me put in a new deck into custom decks if i want to fight it. I have to ‘edit’ a previous deck (by changing the card, but keeping the deck name)
Am I doing something wrong?

Very good points. For point 10, the order might be off, it’s really not a big deal, as long as it’s close, and you don’t see some sort of error. And, https shouldn’t work, I dunno why I had that there.

I dunno the exact format of Custom.txt that does work, so leftylink would probably be a better person to answer that.

 
Flag Post
Originally posted by FieryPhoenix:

@catepillar.

Your guide is great. I got it working.
Notes: Point 10. My last line had a different order, and also had the -lboost_chrono in the line, which you didnt add.
Point 11. Wouldnt do https links, so changed it to http instead and it worked.

Problems: Currently having a problem where it wont let me put in a new deck into custom decks if i want to fight it. I have to ‘edit’ a previous deck (by changing the card, but keeping the deck name)
Am I doing something wrong?

Just guessing but do not use TAB between deck name and deck description, only spaces.

 
Flag Post
Originally posted by Akania:
Originally posted by catepillar:
This is what a command prompt looks like (in Windows XP)

Epic :)

Not every knows what a command prompt is…

 
Flag Post

Lefty,

I’m wondering how you feel about this idea: an option that starts the optimizer with climb 100, then switches to climb 1000 once 80% is reached and then climb 10000 when 95% is reached. In my experience, when optimizing against an unknown deck without much of a clue what to use as an counter, this method is the quickest way to find a good counter, but I have to manage it by hand now.

Secondly, I’m wondering if you can make a presumably very simple addition: an option to cut off the sim at a certain percentage (or ANP value). Sometimes I just want a decent deck quickly instead of the best deck slowly.

 
Flag Post

Quick question. What platform is used for testing / developing? I am about to set up a VM for this stuff and normally I would use Ubuntu 12.10, but if there are know issues / suggestions, I am open.

 
Flag Post

Hi,

Do I get it correctly, that if I want to use these cards of mine:

Halcyon’s Cleansing(1)
Kendar’s Legacy(1)
Ophanim’s Blade(1)
Razogoth’s Heir(1)
Tyr’s Hunter(12)

I should rename them in cards.xml AND in every deck it uses them AND in ownedcards.xml ?
Compilation seems to be working for Ubuntu 12.10 though libboost needed some added stuff:
libboost-system1.49-dev
libboost-thread1.49-dev
libboost-filesystem1.49-dev