Saturday, 17 January 2015

Elite Dangerous - Trading Tools - OCR - Progress Pt4

Update: You can now support this project at Patreon!



Just an quick update, since this morning, I've been tidying the code, fixing things up to make it work with the actual client, and here's the first basic run....


This is a looping console application, so we press F1 when looking at the navigation console to grab and read the system name, and when docked with the commodities window open we press F2 to grab the station name.

Pressing F11 gives the status of these two strings, and you can press Y/N to confirm the selected names before going any further.

This is the important header information, captured live from the client, the client again can be any resolution, windowed or not, you don't need to do anything special for this, just look at the right pages in the client before pressing the F1/2 button respectively, you keep the focus in your client (so you can be full screen) and my OCR application, in the background, works seamlessly.

Now, the OCR is not quick, nor is it perfect, but here we can see it working, and for my needs this is just the ticket.

Next, the actual commodities, which I'm going to save as XML files all over... And then I need to throw up a reader to take those XML files in and make a database of searchable ccommodities  The main search being you select a commodity you see on screen in large numbers, and the tool will get all the buying stations up in order of the buying price, optimizing that trade for you.

The second search I'd like is to give it say 4 systems, which I see in the client are linked & in jump range even when full, and the tool work out the best trades (top 3 maybe in case there are few of the items) to take between them in a sequence.

Elite Dangerous - Trading Tools - OCR - Progress Pt3

Update: You can now support this project at Patreon!


Having played with my own OCR, I've decided to use Tesseract, however, I'm doing it in an unusual manner.  Because this is all really a learning exercide for me, and to keep the build small, I've put the tesseract API calls into their own EXE, not a DLL, an EXE I can call giving it an image filename and an output text path.

The output is XML, tells me the result and likely text result, handling errors with the image or training data for me and not crashing or causing issues with my application.

This clear division of effort lets me just use the tesseract api example (lepttest) code to do my OCR, whilst I get the skimming of the Commodities actually working.

Then I can revisit the OCR later, or maybe play with my own....

Here's a screen shot of the application "reading" from the screen...


As you can see, this is taking a screen capture of the area of the commodities window live from the client, and it's just updating any commodities it see's in the list...

My capturer also works at any resolution, so you can be fullscreen, windowed, or any resolution in the game, there's no need to be a specific resolution as some other tools require of the Elite client.

I am however struggling with the OCR, I think I need to retrain, or better train, Tesseract for the font used in Elite, but that's a separate problem than my actual tool program, as I've split the OCR out!

Friday, 16 January 2015

The World Reacts to the Mighty Jingles - #4 USA (The Obama Years)

We've all wondered, haven't we, what happens when Jingles releases a new Video?... In this new series I aim to help solve that mystery.... This week, the United States


Check back each Friday at 18:30 UK time for the next thrilling instalment, where might we find Jingles being Enjoyed?

Beagle 2 - Found!

On the 8th May last year I had the sad post regarding Professor Pillinger passing away, at the time we could only say his enthusiasm was a shining star and it got Beagle 2 to Mars.

Very happily, but tinged with a little sadness, we've heard that not only did the Professor get the probe to Mars, but it landed intact...


It does appear the  petals didn't open, quite why we don't know as yet, however, it got there.

Lets hope if Professor Pillinger did go anywhere when he departed this mortal coil, he took a jolly up there and took a look for himself, I'm sure he spotted whatever went wrong.

Wednesday, 14 January 2015

Elite Dangerous - Making my First Million

Elite: Making my first million.... 

Lots of my tool writing for Elite is for market data, this is because I'd like to be able to easily turn a profit trading from the beginning, unfortunately in the year 3301 (when the game is set) they've clearly done away with any form of spreadsheet or useful market analysis... I mean, they give you a tab to check a price against a known other location, but you have to have bought the data and... argh it's all so annoying, when we today have tools to find the best buys why doesn't the Elite galaxy?.. Argh...

So, markets and trading aside, how would I go about making my first million?... Simple, here's how (takes a deep breath).

Start out in your Sidewinder, immediately start doing the short hop cargo & data delivery missions, until you have around 15,000.  This can be anything from 10 to 15 missions, as they generally pay around a grand, importantly though run into and out of the same station over and over, so you build reputation with that station.

Once you have friendly status you will start to see "Can you be the hero" type missions, these are where you are tasked to fly out into space and find things lost to the faction, like "Black Box" recordings from destroyed ships, "Art work" from convoys intercepted on their way to the station, "Rebel Transmissions" from opposing factions.

Accept these missions with relish!

Undock and fly to Unknown signal sources, when you land within them you're either going to find opposing ships, the feds or just the cargo flating around.

Obviously, if it's the cargo, scoop it up and fly home, more about that later.

If it's opposing ships, you can slowly learn to fight back, I do fight and defeat upto Cobra Mk III in my sidewinder, more about my fitting later.

If it's the feds however, and this is important for docking, if you are carrying the cargo more often than not that cargo is listed as "stolen", so if the feds (or a station) scan you you will get fined... Don't get fines!... Run away from the feds as fast as you can, never submit to an interdiction with the cargo on board, and if there are feds around when the cargo is found, wait for them to fly away then collect it up.

For docking, come into the station from frameshift and stay at least 8km away, move around at this distance without approaching the station, and align with the docking entrance.

Then, full power to engines, and boost... Request docking permission... and hopefully as they accept you should be about 5km from the opening going pretty fast... Stay aligned, boost again and get through that opening, the moment you pass the blue power curtains you are inside, you can drop your throttle to zero, remove power to your engines and drop your landing gear... this way you shed your speed quickly... A hard pull up or push down on your controls to turn the ship will also shed the speed you built up.

Hopefully you should be inside and can dock now, handing in the cargo for the mission reward.

But importantly you also want to be running these missions out of a station with a Black Market, because if you're sent off for 2 rebel transmissions, but you find 6!... well you can sell the remaining 4 on the black market, and this makes you a LOT of money, more than the mission!

Ancient Artifacts, Black Boxes, Rebel Transmissions and Rare Artworks are the four main items I've been smuggling this way...

If you're forced to undock with these kinds of cargo on board, get as lined up but far from the opening as you can, accellerate and boost out of the power curtains, then boost again as soon as possible, to speed in a straight line away from the station and avoid getting scanned.  Fed ships out there will be your main worry  rather than the instant death of the station opening up on you.

Now, for my fitting, I run the sidewinder as purchased, but have:

1 Pulse Laser (primary fire group) - fixed
1 Cannon (secondary fire group) - gimballed

Removed Basic Discovery Scanner for 2 x Cargo space.

This gives me a total of 6 cargo spaces, and enough punch on the offensive.  I use the laser to take shields down and then hammer targets with the cannon, with the cannon being a limited ammunition store also it forces me to go hand in my bounties and cargo sooner rather than when it's too late.

Other improvements to the ship have been a better set of power generators, power relays, life support, jump drive etc... everything has been slowly upgraded as I've found better, but my fire power has remained the same.

My engaging tactic is based on the shield status, if no shields I get behind the target and open up with the cannon and laser, if shielded I just lay on them with the laser until it's 1/3 of the way and then hammer them down.

An opponent Sidewinder will take (with no shields) maybe 5 cannon shells to go critical and explode.  Eagles take as little as 3.  Cobra's are harder nuts to crack - but I do crack them.

I can, running this set up, earn 100,000 credits in about 45 minutes, depending on how many bounties I hoover up, but just doing cargo one can easily make 16,000 per excusion.

The best trading run I found required me to have a Hauler (12 cargo slots) and 64,000 credits to buy metals and port them off to another station for 14,000 profits per run.  But I was vulnerable to attack, and it was very boring.  With this sidewinder driven approach, I got to experience a bit more of the universe, I experienced markets, black markets, missions and combat... Much more varied.

What was the rub?... Well, with the free sidewinder insurance I risked only my current haul of bounties and cargo each fight/docking... But even so the upgrades to rebuy the whole ship was very cheap, with a 15 light year jump range, a bunch of power and other best in class units my repurchase price is only 7,436 credits.  More than affordable to enjoy and play the started game.

My next challenge is at what credit balance to make the jump to a viper or cobra?... I have my cool first million... I think the viper might be the way to go for this play style... And start kitting it out.

Tuesday, 13 January 2015

My Mothers Mania

My mother… is mental… There, I said it... She's bat shit, off the trolley mental... What has caused this conclusion today?.. Well in the pantheon of strangeness she's become over the last fourteen years, she's just getting odd, and the oddness is very much of her own flavour.... 

She’s arranging a lunch for my Dad’s 65th Birthday**… She’s asked if we can go… It’s the day after his birthday…  We've said yes... but… and this is a big set of buts…

1.       We don’t know what time it is… nor do we know where it is...

She's said Dad knows he's going to be taken out for a lunch... But he doesn't know where to... Okay, fine... I don't really speak to my Dad day to day, I see him once in a blue moon as he's "so busy", you know looking after his bat shit crazy wife... And I'm 900 & 99 point 99 less of a gossip than my mother is, so even if I knew and I saw him I would be like "RIGHT SEE YOU AT MCDONALDS!"... Would I.... No, I'm 36, not 6.*

When however, I've asked my mother "When and where"... she says... “I’m not telling you, because it’s a secret”…. She does not get that you can't invite someone somewhere and not tell them where it is... We need to fucking know so we know where we’re going retard!

This is just the normal mania she has, next we get cryptic messages…

"it's only a part time restaurant, and for parties over 8 they need the food selection a head of time, get a menu"...

Erm... erm... Where the fuck from?

“Meet at the venue, by one of the two open fires”…. 

Erm... Erm... What time?... And where are the fires again?...

This is basically now a very sad mystery novel...  We have to find a location open part time for meals, with two open fires, which will seat a party of 8 or more, which require such parties to order a head of time...

It is all such a sad joke.... And I can only see it ending in tears (again*).



Coincidently, I'm a little pissed off that I'm not being told anything, because the last time we attempted as a Family to go out for my Fathers Birthday, we went to the Broad Oak pub at Strelley... But they didn't have any food on that day, so we went to another pub in the same chain the Horse and Groom on the B600... Already peeved we've moved venue, I go in (I'm alone at the time), and as I'm watching my Dad is just asking a chap whether a chair is in use, so he can move it to the table and make 4 chairs...

Suddenly, and dramatically my little brother explodes... "I know people here" shouting "They know me, and you're embarrassing me"... My Dad looks at him quizzically... My Brother is upset that my Dad is moving this chair...

Apparently that's an embarrassment... 

So already pissed off my Dad storms out, because my brother has made him look a fool...

My brother leaves with this then fiancée and I'm still stood there... As my mother traipses over the length of the bar crying here eyes out....

My Dad's gone home, without her... He's dumped her and stormed off home...

So I put my mother in my car and take her home...

That was the last family outing I dared go on with them all...

With a mystery venue this time, my mother is already burning my patience stick at both ends...



** For those observant amongst my audience, you might think he's retiring, he's not.  He's been retired since 1994.... So if they mention "retirement"... my plan is to kick my legs out, cross them and fold my arms and lean my head to one side, you know like a dog being shown a card trick.

Monday, 12 January 2015

My XML Library is Kapput

I've been using an XML library of my own devices, based around RapidXML for ages, it has been totally brilliant, utterly useful and completely thread & memory safe for about three years.

Yet today, the trusty dog that it is, has turned around and bit my hand, as I've found a bug, and I'm not sure where the bug comes in, whether in my code or from the underlying RapidXML.

My problem, I load a structure:

<Root>
    <a>0</a>
    <b>1</b>
</Root>

This is fine, however, these turn into my classed "XMLConstruct" and I have three of these:

XMLConstruct
   m_Name = "Root"
   m_Value = null
   m_Children[2]
       [0] = XMLConstruct
          m_Name = "a"
          m_Value = "0"
          m_Children = null
       [1] = XMLConstruct
          m_Name = "b"
          m_Value = "1"
          m_Children = null
          
This is fine, it works, I have my data... But every use previously I created a class "Root" from this, and used that classes "ToXML" function.

However, today I want to just open the XML and "for each node if m_name == 'a' set m_value = '999'".

Sounds simple... Nope, when I do this the XML output I get from the underlying Rapid XML is:

<Root>
   <a>
      <>999</>
   </a>
   <b>
      <>1</>
   </b>
</Root>

This is a mystery to me, I'm going to have to bottom it out, but it's that kind of problem on a Monday morning which annoys me.

More annoyingly, the C# implementation of the same library I'm using, does not do this... The difference between the C++ version and the C# version is the underlying XML library, so I'm suspecting something about the node allocation, or the node use inside Rapid XML being off...