*Update 4/20 New Release SHK Stocks v1.7 Beta 2* Market Tool

If you’re new to Stronghold Kingdoms or have a question about the game, check here for useful advice.
User avatar
Nublet
Posts: 95
Joined: Thu Sep 13, 2012 6:36 am

*Update 4/20 New Release SHK Stocks v1.7 Beta 2* Market Tool

Post by Nublet »

Development began - 4/11/2013
-Update 4/20/2013 - Posted a New video explaining new version and stuff.

Here is Beta 2 v 1.7 - Download link at bottom of post. ( This program is created to use Microsoft Net 4.5 architecture, Windows 7+, Sorry XP guys :( )
The file download is a self extractable file, just run it and extract it where you can find it will be in a folder called SHK_Stocks

Please test it and provide feedback so I can continue developing it and making improvements.
and of course report any bugs you find or annoyances.

Tutorial Video for v1.6 How to setup OCR for auto importing Prices.
Watch Tutorial on YouTube
Tutorial Video for 1.7 / 1.7a Feature update overview, problems, future content
Watch on YouTube

Current Known Bugs (Beyond my control)
Sometimes the OCR cannot decipher a 9, 5, 8 or 0 and sometimes will not recognize the selected box. This is due to the hard to see text on the potato sack linen background
User will just need to change that value after reloading the parish from the list.
The OCR code is complex, The image is captured and inverted in color and converted to gray-scale so OCR can work nicer. I nearly beat myself to death trying to get it perfect.
- If for some reason you get values that are way off in multiple tabs, select a different parish in the game and then re select the one you were having problems with, this will fix the importing problem almost perfectly. Why? I have no idea, but it does.


-In the works Updated 4/19/2013-
- World selection so you will have separate price databases for different worlds - Done
- Help File
-Update all from game (current parish only) - Done
-Failed character recognized replacement
-Village trading from selection
-Travel time from selected village calculation for best profit (might steal this code from my timed attack program since it converts time to total seconds for comparing ;)
-Overall best profit item regardless of village selected option

-Things I have added today 4/19/2013-
-World selection
If you have a list of parishes already from 1.5 1.6,
Start SHK Stocks and select your current play world, Then goto C:\SHKParishData\Parish and copy all the parish files and paste into C:\SHKParishData\Yourworld_Parish where Yourworld is the name of the world you are playing on.

-Enabled the "Update All From Game" Button
- Added a "Turn off Confirmations" check box so you can get rid of the annoying "blah blah has been recorded"
- You will only have to setup locations one time, and set OCR box up into its main location once. All locations are saved on exit so all you
will have to do next time you open the program is open your parish trade window, select your parish from list and hit update ;)
-SHK Stocks now stays above all windows on screen so you don't have to switch between windows constantly.
-Tweaked the interface so recording of prices is smoother and quicker
-Boxes that are not recorded correctly now change to the color red so they are easy to see and fix.

If for some reason a record don't come out great, just update all from game again or update each column individually with the update button.

Current Version
Image

Grab it here v1.7 Updated 4-19-2013


Thanks all
Nub
Last edited by Nublet on Sun Apr 21, 2013 2:31 pm, edited 16 times in total.
User avatar
Nublet
Posts: 95
Joined: Thu Sep 13, 2012 6:36 am

Re: *New Release SHK Stocks v1.5 Beta 1* Market Tool

Post by Nublet »

A few things:

-You can double click an item in the parish list to load its prices, or click on it and click load
- Clicking the resource button next to the price will give you the best buy / sell for that specific resource reflecting a profit loss or gain and by how much.
- Best price list gives you the entire list of everything and it's best prices buy/sell regardless if you are losing profit or not

-Nub
User avatar
Nublet
Posts: 95
Joined: Thu Sep 13, 2012 6:36 am

Re: *New Release SHK Stocks v1.5 Beta 1* Market Tool

Post by Nublet »

DavidSpy wrote:Glad to see the project has been resurrected, downloading now. :)
Hey David, Can I get a sticky for both programs?

-Nub
User avatar
Nublet
Posts: 95
Joined: Thu Sep 13, 2012 6:36 am

Re: *New Release SHK Stocks v1.5 Beta 1* Market Tool

Post by Nublet »

Development Progress update 4/15/2013
- OCR
---I have successfully achieved reading from the screen and performing an OCR on parish prices, However one problem I am running into is the background image used behind the price values
mess with 9's 6's and 0's I am working on trying to clear that up or writing an algorithm to replace the characters with the correct ones.

I am hoping to achieve this:

When you click the trade button on the parish, my program will click each tab and read the prices of all resources and update them into the SHK Stock program
giving a semi automatic price update of all your parishes you are trading with in the area.
User avatar
thekpd
Posts: 791
Joined: Sat Jan 08, 2011 1:56 am
Location: Rochester NY

Re: *New Release SHK Stocks v1.5 Beta 1* Market Tool

Post by thekpd »

I look foreward to seeing a final result.
I'll download it and mess about with it for sure :)
User avatar
Nublet
Posts: 95
Joined: Thu Sep 13, 2012 6:36 am

Re: *New Release SHK Stocks v1.5 Beta 1* Market Tool

Post by Nublet »

Ok, I am about to release v1.6 sometime today.

This version will include-

Auto import of parish prices per tab (Resources,Food,Weapons,Honor Goods)

User will need to setup location through training the program, basically you need to "Set Resources" then right click and hold your mouse over the Resources tab
and then you will get a confirmed location recorded.
You will do the same for the rest.

Then the user will need to put the "OCR" reader box over the parish price list.

You will only need to do this one time for each time you use the program.

Then you can just open a parish of your choice in trade, type the name of the parish in the Parish name box and select "Update" for each resource tab And prices will automatically imported

Current Known Bugs (Beyond my control)
Sometimes the OCR cannot decipher a 9, 5, 8 or 0 and sometimes will not recognize the selected box. This is due to the hard to see text on the potato sack linen background
User will just need to change that value after reloading the parish from the list.
The OCR code is complex, The image is captured and inverted in color and converted to gray-scale so OCR can work nicer. I nearly beat myself to death trying to get it perfect.

Other bugs are just features I will like to add or fix up better.


Image
kaesekuchen
Posts: 6
Joined: Fri Mar 29, 2013 11:24 am

Re: *Update 4/17 New Release SHK Stocks v1.6 Beta 2* Market

Post by kaesekuchen »

Hello,
first off: Good work! I was meaning to write a tool like this myself, but i just hadn't had the time to do that.
But i know how annoying OCR related programs are to write, i coded one myself for a poker bot some time ago, but instead of using a generic OCR library i wrote specific pattern matching algorithm that catered to the need of the OCR related tasks for that bot.
(That being, detection of suites, oncard values, and of course digits and letters for bet value/player names etc.)

I hope constructive criticism is welcome, because i have a few things to point out:

- World Selection
I've seen in your todo list that you are already working on a world selection list, which is a very good feature to implement down the road.
I'm guessing you are going to achieve that with the help of a filter or tag to the Parish names.

My thought on this: It would be helpful, if one could distinguish different counties/provinces/countries within one world as well.
This is aimed at those, that can't trade world wide yet, but have villages in multiple "trade zones" (Or for that matter want to limit the radius of parishes eligble for the "best price trade" algorithm, to optimize trade routes time efficiency wise)

- OCR
As you as well pointed out, the OCR sometime fails to recognize certain digits. For this, it would be helpful, if you could check the input boxes, after a scan, if they contain numerical values.
If they don't exclusivly contain numeric values, but for instead 's' or 'a' characters, you could highlight that field somehow, so that one sees right away, that you have to manually put in the correct value.
You are probably already/still working on that matter, but for now this would help in terms of usability.

- Trade time
This is probably something not too urgent at the moment, more of a "nice to have" feature :)
You could scan the travel time as well, and factor these into the "best price" algorithm as well. But i'm guessing that occured to you already as well :)

-Additional Thoughts/ question to the ocr
I don't know how exactly your ocr is implemented (obviously), but i was wondering if you get any additional information to the detection results as well.
For example: If the ocr results a certain string for an input image, does it have some sort of probability/level of correctness value attached to that?

Just for those 10 digits 0 to 9 it might be more feasible to try to match those directly with a pre recorded pattern of the digits 0 to 9.
But once again, don't want to step on your toes here, these are just some thoughts that were going through my mind testing your program and recollecting the thought process i've undertaken when developing my poker bot :)

Again, thanks for putting in the effort to bringing this program to us. I appreciate it, because i know, that this sort of software can drive you mad from time to time during development :)

And thanks for reading my thoughts :)

keep up the good work!

regards
kaesekuchen
kaesekuchen
Posts: 6
Joined: Fri Mar 29, 2013 11:24 am

Re: *Update 4/17 New Release SHK Stocks v1.6 Beta 2* Market

Post by kaesekuchen »

Hi,

i'm aware of that and sorry, if my mentioning of "poker bot" set off an alarm regarding botting in SHK.
I just mentioned the comparision, because the part, information processing via OCR, was comparable in this project and my former project., and via this i was just trying to give some feedback.
If i crossed a line, i'm sorry.I won't mention the evil b word anymore :)

regards
kaesekuchen
User avatar
Nublet
Posts: 95
Joined: Thu Sep 13, 2012 6:36 am

Re: *Update 4/17 New Release SHK Stocks v1.6 Beta 2* Market

Post by Nublet »

Hi, Thank you.
Yes, everything you have mentioned I have on a list or in the back of my mind.

I haven't wrote the "off" character recognition feature, If you all can write the kind of letters out for me you are receiving along with what it is suppose to be that will be helpful.
I am curious if it is different for different parishes, the blank box issue I had in my tutorial I have only had problem with on the food tab for some odd reason.

This is what I was getting:
IN) = 150
lor = 107
M = 94
mm = 100

I am dreading the time feature programming to see whats closest and different counties, that is what stressed me out when I was making the webpage program of this. lol.

Yeah the (b) word is bad, This is not to even be called a (b) because it is user interactive and the user has to be at the computer to use it.
If you were a handicap person with limited hand usage, this is handicap friendly.

Thanks again, I love getting feedback.
-Nub
kaesekuchen
Posts: 6
Joined: Fri Mar 29, 2013 11:24 am

Re: *Update 4/17 New Release SHK Stocks v1.6 Beta 2* Market

Post by kaesekuchen »

Hi,
well regarding the time feature:
It's not that dreadful, once you have the travel time and values, since you can put these in a neat little formula, consisting of two parts:

part1 : raw profit, this is what you already have, for example you can buy Product A for 50 gold (including taxes) and can sell it for 150 gold, which would yield a profit of 100 gold per complete transaction.
part2: travel time. time value, that a merchant is "tied up" with the task, that being time to buy target x2 and time to sell target times 1 or 2, depending, if you want to calculate up to the point you get the gold, or to the point the merchant is available again after the transaction (which is useful for a repeated transaction)

To put this into perspective, let's take that example i mentioned above.
(1)There is a parish 15 minutes away from you, that sells wood for 50 gold (including taxes)
(2)There is a parish 30 minutes away from you, that buys wood for 150 gold
(3)There is a parish 15 minutes away from you, that buys wood for 120 gold.

Now, for this example we assume, that parish (1) is the cheapest source of the product, that leaves us with only two options:
We sell to (2) or (3).

raw profit for (2) : 100 gold
raw profit for (3) : 70 gold

complete travel time for (2) : 2x15 for buying, 2x30 for selling, 1.5h for the whole transaction
complete travel time for (3) : 2x15 for buying, 2x15 for selling, 1.0h for the whole transaction

As a last step, you just have to divide the raw profit with the according travel time, yielding:

100gold/1.5h = ~66.67 gold/h
70 gold/1.0h = 70 gold/h

And there you go, you have a comparable value.

Luckily, this isn't anything close to the complexity of the travelling salesman problem, which at first seems like it's suitable to this problem (if we would rename it to travelling merchant problem :D )

regards
kaesekuchen
Post Reply

Return to “Game Help”