Saturday, July 12, 2014

How to get EVE Mentat fully functional in Wine

I thought it would be best to write one more quick post on this subject, this time consolidating my previous two guides into one, complete writeup on how to get this thing working.

1. Install Wine: I personally used the MacPorts install of Wine which includes winetricks, but if you decide to get it right off the official Wine site or from another source, make sure you install winetricks as well.

2. Install .NET 4.0: After you've installed Wine with winetricks, open up a terminal window and type:
winetricks dotnet40
This will install .NET 4.0 into your new Wine prefix, which is a dependency of EVE Mentat. If you already had Wine installed before starting this guide, make sure to run this on a fresh prefix with only dotnet40 installed to minimize the chances of something else interfering with its functionality.

3. Configure the D: Drive: To allow EVE Mentat access to the game client, we need to point it in the direction of the EVE install. Do this by opening up a terminal window and typing:
In the winecfg window, open the "Drives" tab and make a new drive, D: (any letter you choose will work here, just remember to adjust the future folder name accordingly). Select this new drive and in the text field for "drive mapping," enter the path to your game folder (this might be different for Linux users, but this is the default path in Mac OS):
Apply the setting and close out of winecfg.

4. Add a symlink for cache scraping: This can be done through the GUI, but terminal commands can also be used to simplify the process:

cd ~/.wine/drive_c/users/[USERNAME]/Local Settings/Application Data
mkdir CCP && cd CCP
mkdir EVE && cd EVE
ln -s "/Users/[USERNAME]/Library/Application Support/EVE Online/p_drive/Local Settings/Application Data/CCP/EVE/c_program_files_ccp_eve_tranquility" ~/.wine/drive_c/users/[USERNAME]/Local\ Settings/Application\ Data/CCP/EVE/
mv c_program_files_ccp_eve_tranquility d_program_files_ccp_eve_tranquility
This will create a symlink between your cache folders and the Wine prefix, placing these files in the directory that EVE Mentat will be looking for them in.

5. Configure EVE Mentat: Finally, navigate to the directory you have EVE Mentat in and run:
wine EVEMentat.exe
If you aren't importing an existing database, create a new one and set up your API. Once that's all done, go to File -> Preferences and select "Market orders and favorites." Set the path to the EVE client to be:
 D:\Program Files\CCP\EVE 
6. Profit: EVE Mentat should now be fully set up and ready to go, so go ahead and keep trading! Hope you enjoyed the guide and trade safe o7

EVE Mentat FULLY FUNCTIONAL In Wine (Mac OS X + Linux)

Another night of intense troubleshooting has finally yielded results: EVE Mentat's cache scraping feature is functional under wine! I've been up for quite a while, so I will spare you the more gory details and quickly summarize my findings, followed by a quick tutorial on how to set the cache scraping feature up.

After much searching, trial, and error with no positive results, I remembered that I actually know some Python and figured with the amount of time I've sunk in, it couldn't hurt to take a look at the code for Reverence, the Python library written by the famous Entity for cache scraping EVE. I realized that the way Reverence scrapes the cache is by determining the name of the folder through the directory of the application, as the cache folder's name is generated by EVE based on its install location. However, EVE running on Unix runs through Cider, generating its own file structure where its install directory is always:
C:/Program Files/CCP/EVE
Making the folder's name:
The path we specified earlier for EVE's install directory is long and convoluted, on the Z drive:
Z:\Applications\EVE\Contents\Resources\EVE\Contents\Resources\transgaming\c_drive\Program Files\CCP\EVE
Reverence was generating the folder name using this path, coming up with the name:
As you can see, this is a far cry from the short name of the actual folder. In the previous guide, I symlinked this cache folder into Wine, so I figured I would try to change its name to the name generated by Reverence; alas, the solution was not so simple, as the rename operation was denied by the system citing an inappropriately long name.

What to do? The solution turned out quite simple.

First, I opened up a terminal window and ran:
In the "Drives" tab, I made a new drive, D, and I set its Drive Mapping to:
Now, we have a drive D, contains the faux Windows folder structure that houses EVE. Within EVE Mentat, I set the path to my EVE client to:
D:\Program Files\CCP\EVE
EVE Mentat now has a valid client location. Now I need to set up the new folder structure. I navigated to
~/.wine/drive_c/users/[USERNAME]/Local Settings/Application Data
and deleted the symlink I made earlier. I made a new folder called CCP, opened it up and made another new folder called EVE. Next, I ran this command in terminal:
ln -s "/Users/[USERNAME]/Library/Application Support/EVE Online/p_drive/Local Settings/Application Data/CCP/EVE/c_program_files_ccp_eve_tranquility" ~/.wine/drive_c/users/[USERNAME]/Local\ Settings/Application\ Data/CCP/EVE/
Following that command, I renamed the newly created "c_program_files_ccp_eve_tranquility" folder to:
 Simple, right? Opened up EVE, looked some stuff up on the market, imported cache from EVE Mentat and everything was silky smooth.

Hopefully I'll make another post tomorrow on getting this process set up from scratch, but in the mean time, every step you need to make this work is present here.

Good luck everyone, trade safe o7

Friday, July 11, 2014

EVE Mentat ALMOST in Mac OS X (And Probably Linux)


I am now beginning to kick myself over how simple this was. I have been trying for quite a while to run EVE Mentat in OS X so I wouldn't have to switch to my windows partition just to station trade. After much trial and error, I've nearly figured it out.

This was done on OS X Mavericks 10.9.4 with Wine 1.6.2 and EVE Mentat

I will go through the (needless) steps I took as I tried to make this work, so if you want just the results, feel free to skip to the end.

At first, some quick google-fu led me to this post on the EVE-O forums suggesting the Macports install of wine with:
winetricks dotnet20winetricks dotnet30winetricks gdiplus 
I tried it and - surprise - the application quit. The window complained of a settings file, and sure enough, a quick look at the log yielded:
[1] DEBUG MentatException – Creating exception: Failed to load settings file C:\Program Files\EVEMentat\Storage\EVEMentat.settings
Turns out EVE Mentat had been ported to .NET 4.0 since that post was made, so it was completely useless for my purposes. So I tried the first thing that came to mind:
winetricks dotnet40
Who would've guessed:
[1] DEBUG MentatException – Creating exception: Failed to load settings file C:\Program Files\EVEMentat\Storage\EVEMentat.settings
Next I tried making a new 32 bit Wine prefix, this time resulting in an error that .NET 4.0 had not been installed, even though I ran winetricks with the new prefix specified. Not one to be deterred, I continued my search. I stumbled upon an old post I had made on the EVE Mentat website when I tried doing this back in December 2013. I posted the log file (with the same problem regarding the settings file) and received this response from the man himself, Thart:
@JCMD Looks like EVE Mentat unable to load one of its libraries.Please reinstall your .NET, download fresh copy of EVE Mentat and unzip it WITH PRESERVING folder structure.
I must have read this reply a thousand times before the solution occurred to me: what if one of the other modules I was installing was interfering with the .NET 4.0 libraries required my EVE Mentat? Being the daring and adventurous man I am, I deleted my Wine prefixes and started anew. This time, I only ran one command through winetricks:
winetricks dotnet40
Running EVE Mentat in this new prefix succeeded! Next, some final operations to make sure importing orders and market details works properly. Open up a Terminal window and enter the following:
ln -s ~/Library/Application\ Support/EVE\ Online/p_drive/User/My\ Documents/EVE/logs/Marketlogs ~/EVE/logs
After running this command, your Marketlogs should be available for EVE Mentat to use. Next, we need to get the cache scraping feature operational. To do this is simple: in the EVE Mentat preferences, set the path of your game correctly. It should be similar, if not identical, to mine, but make sure that the drive letter in your wine is correct:
Z:\Applications\EVE\Contents\Resources\EVE\Contents\Resources\transgaming\c_drive\Program Files\CCP\EVE
Next up, we need to make another symlink between the cache folders of the Wine install and the Mac one:
ln -s /Users/[USERNAME]/Library/Application\ Support/EVE\ Online/p_drive/Local\ Settings/Application\ Data/CCP "/Users/[USERNAME]/.wine/drive_c/users/[USERNAME]/Local Settings/Application Data/CCP"
Remember to replace [USERNAME] with your actual username. Now, in the preferences for EVE Mentat, make sure you specify the temp folder as well as the game path (the temp folder is called something like "c_program_files_ccp_eve_tranquility").

Now, only one issue remains: every time I try to import orders from the cache, I get an error code -1 that the cache import failed. This appears to be an ongoing issue with EVE Mentat that should be fixed in version 2.0, according to Thart. However, this entire setup doesn't take very long to implement so long as you're not trying to troubleshoot as you do it, so there might not be too much harm in trying out the above steps and seeing if it works for you.

If any of you brave souls manage to get the cache import feature working, be sure to comment! Until next time, fly safe o7

Thursday, July 10, 2014

The State of Industrial POSes in Crius

With the upcoming release of the Crius update, industrial POSes in EVE will be receiving a few sorely needed changes. Among these changes is the transition from a slot system to an activity system: this means that in Crius, rather than needing to install multiple modules to increase the number of slots available for industrial jobs, only one module is necessary, with job cost increasing as more jobs are created.

This leads to the question: "Why install multiple modules if they no longer provide more slots? Why not install just one?" CCP initially answered this question by stating that in Crius, multiple modules of the same type would provide a bonus to jobs running off that module, meaning a POS with several of a type of module would still maintain some sort of advantage over a POS with just one such module. 

However, in a recent forum post, CCP Greyscale confirmed that the stacking bonuses feature was being given the axe. Greyscale cites "the technical challenges involved in implementing it in a fully user-friendly way, and the somewhat limited upsides of the feature" as the reasons such a feature will not be implemented. 

Based on the extremely negative responses of the community thus far, it isn't difficult to see that these "limited upsides" aren't so limited at all, and that this was a feature highly desired by the majority of the industrial community. Why then, is CCP not implementing this change in Crius?

The "technical challenges" CCP Greyscale mentions stem from the train wreck that is the code for POSes in EVE. Many an update has gone by where the community has cried out for changes to the POS system, and CCP has regularly shot down these requests, citing "technical challenges."

CCP's reluctance to add new features to the already existing POS code is understandable: messy code means features become more difficult to implement, bugs are more likely to be present/significant, and all the features will need to be redone once new POS code is written.

But CCP refuses to tackle the bigger problem: many features are shelved because of "technical challenges" arising from this messy code, but the messy code is never redone. The only way to move forward from here, a course of action that has been a long time coming and is, in my opinion, many years overdue, is to completely rewrite the POS code and overhaul the system.

I don't believe we will see any major improvements to the POS system until this course of action is taken, and while the features included in Crius are certainly desirable for industrialists, the effects that these changes will cause remain obvious: it is pointless to install more than one module to run jobs, so industrial towers will be switched to small towers running one single industrial module and possibly several weapon modules, cutting fuel costs and making the game much more boring.

Friday, January 17, 2014

Expanding Your Empire

I have given a lot of thought lately as to why I experienced such amazing profits relative to my liquid capital when I first started trading and how poorly those profits scaled with an increase in capital.  The principal seems sound: what I can do with 100 mil, I should be able to do twice as well with 200 mil.  Why was this seemingly extremely simple concept not translating from a sound idea on paper into a working theory in EVE?  I began to look at exactly what I had been doing to increase my involvement in the market as I grew in wealth and how I could change that to increase my profits and I believe I have figured it out.

Previously, the way I had increased my stake in the market was to increase my investing in a blanket fashion.  Whereas before, I might have been investing 10 mil an item into 10 items, I was now investing 20 mil an item into 10 items.  This pattern continued with slight variations; although I did invest in more items, I continuously put more ISK into the amount I was investing per item as my wealth increased.

That is the reason my profits were increasing at a snail's pace: the correct way to grow as a trader is not to increase amount invested per item, but rather amount of items invested in.

Had I gone from investing 10 mil an item into 10 items to 10 mil an item into 20 items, my profits would have approached, if not achieved, a level twice as high as they previously had been.  The reasoning behind this is simple, once you think about it: if it takes an hour to move 10 units of X at a profit of 1 mil/unit, and I have invested enough ISK to purchase 10 units of X, I should make 10 mil ISK/hour off of X.  If I invest enough ISK to purchase 20 units of X, I should still make 10 mil ISK/hour, but this time for 2 hours.  However, if I invest in 10 units of X and 10 units of a near-identical item Y, I should make 20 mil ISK/hour, 10 from X and 10 from Y.

Though it seems as though investing in double the amount of an item and then going twice as long between updating orders is a sound idea, you have to consider that the real world is not the perfect example I included above, and in reality, there are other people like you, sitting in a station, spinning their ship, and updating their orders to stay on top.  When you invest in an item, you are much more likely to be undercut than you are to have your order completely filled.  Each order I place on the market is generally undercut at least 10 times before being fulfilled completely.  By investing in more items, in addition to having the chance to make more ISK per time, you also have the opportunity to avoid being undercut; if you are trading in item X and you are undercut, you immediately lose the ability to profit, whereas if you are trading in X, Y, and Z, and X is undercut, you continue to profit off of Y and Z.

I have been practicing this method of expansion very stringently the past few days, but today I kicked it into overdrive, and the results were very satisfying.  Today alone, I went from about 2.65 bil to 2.85 bil, a profit of about 200 million ISK.  That's a return of about 7.5%, which isn't bad for one day's investing.  However, this practice comes with a price: with my skills, I have a maximum of 113 orders on the market at any given time.  For the majority of my trading today, I did not have more than 20 remaining orders available to me.  This level of expansion means that in the near future, I may be required to train up my skills in order to be able to make more market orders (or make another market alt to put in a different hub, or both).

All I know is, since beginning to use this strategy, I've noticed definite increases in my profits, so unless something changes in the future or I discover a better method, this is the method I will continue to use as I grow my empire, and it is the method I will recommend to others in their expansion as well.  Good luck increasing the size of your empire and fly safe o7

Monday, January 13, 2014

Of Code and ISK Part II: I Just Wanna Tend the Coffers

After my last post, Of Code and ISK, I received some feedback indicating that although I accomplished what I had in mind, I could have done so much more.  For those of you who don't feel like reading my other post, I assembled a sequence of programs that would allow me to scan the entire market of a station, export all orders to a CSV file, read those orders, perform some analytics, and spit out a list of items that would be profitable to trade.  The downside to this method was that it would take a matter of hours to scan the entire market of a station.

Some of the comments I received led me to the EMDR, or EVE Market Data Relay.  I had been adverse to using this tool previously fearing many a spoofed order or inaccurate data, not to mention difficulty implementing it into my code.

I was so wrong.

I spent a few hours today tweaking my code and have managed to truncate my entire line of software to an HTML file and two Python files (one of which does nothing more than host a local HTTP server to make accessing the HTML file easier).  All I have to do is run both Python files, navigate to my server in the IGB, and refresh the view once in a while to see the latest data on my screen.

For the webpage, I took advantage of the fact that the IGB supports HTML5 by using a button that runs a XMLHttpRequest function to pull my file into a table I have in the page.  This table uses the jQuery Tablesorter to keep everything organized, allowing me to easily read and interpret the data.

I have to say, I am very impressed with how easy to use EMDR was and how much nicer this is compared to my previous method.  I will include some samples of my code to make life a little easier for those of you who wish to make something similar.  This is the Javascript code to parse a file (outputhtml.txt) which is stored in the same directory as index.html and set the contents of the div with id='main' to the contents of the file.
 function doStuff () {
            var oReq = new XMLHttpRequest();
            oReq.onload = reqListener;
  "get", "outputhtml.txt", true);
function reqListener () {
            document.getElementById('main').innerHTML = this.responseText;

If you wish to use EMDR in your Python program, check out the data format guide so you know what you're dealing with.  In case their example didn't make it clear, you're going to be dealing with a series of dictionaries.  In the case of orders, each dictionary will have a key ('rowsets') which contains an array of dictionaries, each of a different item or region.  Simply configure your calculations and have the program output your results to a text file.  Be sure to format them properly in HTML for easy importation into your webpage.  I will also include a method for outputting your data in HTML while linking the name of each item to its market details:
<a href='javascript:void(0)' onclick='CCPEVE.showMarketDetails("+str(itemid)+")'>"+ "</a>"
Finally, a screenshot of my site.  It's nice, clean, and simple, and can be sorted by any column.

And with that, feel free to ask any questions you may have and I will do my best to answer them.  Thanks for reading and fly safe o7 

Friday, January 10, 2014

Of Code and ISK

One of the great things about EVE Online is that a very large portion of the people who play it work in the field of IT.  This results in a huge amount of third party tools (EVEMon, EVE Mentat, Elinor, EVE-Central, most alliance's websites, and the list goes on and on...) as well as a great deal of support for developer's from CCP's end.  The possibilities are nigh endless in terms of the applications that can be developed with some code know-how, some hard work, plenty of Googling, and a vision.

It all starts with an idea.  As most of my readers will know, one of my favorite/main activities in EVE is station trading, which is where I make much of my ISK (and try to put in as little effort as possible).  However, when it comes to the things I've tried coding to make station trading more profitable, I've put in many hours of effort, but I dare say that sometimes, I've enjoyed them more than EVE (looking at you, siege fleets).  One of the most difficult parts of station trading is deciding which items you'll be trading to turn a profit.  A lot of factors must be considered when making the decision, such as the stability of the item, the volume traded, the profit margin, the cost, etc.  The end result is that although a profitable item is not hard to find, one that will give consistent and high returns can be.  Then it hit me: why don't I make a program that will tell me what items offer the highest margins and meet my criteria for items that I want to trade?

I'm no code genius, but I have limited experience in web design (HTML, CSS, PHP, and Javascript/jQuery), as well as software development (Python and some C#).  My original plan was to design my program in a way that allowed the entire thing to be operated from the IGB in EVE.  The program would first scan the market (every item) to put them in the cache, then scrape the cache, calculate the margin for each item, filter the items through some criteria, and finally output the results to a web page that would be readable in the IGB.  My hopes were dashed as I quickly found that such a system would be much more trouble than it is worth.

To begin with, I needed a webpage that I could load in the IGB that would scan the market to load every item into the cache.  Rather than start from scratch, I butchered my code from the order scanner page of masterpiece of EVE market software known as EVE Mentat.  Using that as a starting point, I now had an HTML page that would open the market details for every item in my list.  To make life easier, I set up a simple HTTP server with this script (courtesy of stackoverflow).  Simply save that as a .py file in the same directory as your HTML file (which you should name index.html) and run it.  You can access the file by going to in the IGB.

Now I found myself with a webpage capable of scanning the market, but no item IDs for which to scan.  I downloaded a data dump (which was from Incarna, so I'm probably missing some items but they shouldn't be too big of a deal) from the EVE forums here and through the magic of MySQL pulled out a list of every item in the database which exists on the market (some items can't be purchased on the market, but a quick Google search taught me how to select only those that can be).  This data was placed in the HTML page I had made earlier and when I ran it, it worked!  However, the import turned up over 6000 items, meaning that with a 3 second interval (the minimum I'd need to use to avoid going over the maximum number of market requests I could make, which would make the script continue to run without actually pulling more data), it would take hours upon hours to scan the market.  I solved this by just letting it run while I slept.

At this stage, I was left with the market data for (almost) every item on the market in my cache.  What to do from here?  I used the dumper tool from EVE-Central to scrape the cache and export the market orders for every item into one CSV file.  This process unsurprisingly took quite a while.  However, it also meant that much of the hard part was done, as Python was undoubtedly my strongest language of all those I had used so far, and all that remained was to use it to process the data into a user-friendly format.  Some quick code calculations yielded a script which analyzed the orders for every item, threw out those with no data or those with only one type (buy or sell) of order, calculated the % profit margin for each item (taking my skills into account), and threw away any item with less than 30 mil worth of potential profit currently on the market.  Entity's Reverence library provided me with the means to pull the names for the items from their item IDs.  The results were exported to another HTML file in the form of a table, which using some jQuery magic, gave me the ability to sort the data by column.  I included columns for volume and margin, so I could play with the data as I wished.  I also made each item's name into a link that would open the market data for that item, to make checking on/trading desirable items easier.

I am fairly happy with the end result, and it's not hard to see why; I now have an easy to use table that contains data on most of the items worth station trading.  I only actually went through the list for a few minutes, but in those few minutes I found at least two new items to invest in with profit margins in the thousands of percents that looked very promising.

For the time being, I do not think I will be releasing this file.  Though I love helping the community, which gives me indirect competition, I have never released any of the items I am trading in because I would like to avoid directly competing with my readers as much as possible.  Releasing this file to the masses would make my life absolute hell whenever I try to station trade.  However, I spent about two days making this program, and I did not have available to me (most of) a step by step guide on how to do so.  Anyone with a simple background in code or the ability to Google should be able to recreate a lot of what I've done here simply based on reading the above guide.  Though I probably shouldn't, I have a soft spot for helping people out, so if you have any questions, leave a comment or PM me on reddit (/u/toxicity959) and I will see if I can help you work through whatever problems you may have encountered.

Thanks for reading my blog and keep on developing!  Fly safe o7