Page 1 of 1

new metal spot finder class

Posted: 13 Oct 2005, 17:02
by alik83
new metal spot finder class: http://www.fileuniverse.com/?p=download ... ip&ID=1619

Works better then anything yet released:)
for now just use Initialize() function and it will draw all the mexes on the map, and put sorted array of spots into metalpatch list. (might want to tweak with the minMetalOnSpot and minProduction variables if anything goes wrong)
Try on maps like small divide, redhaven.
Not optimized/not using caching yet/ better not use on metalmaps (I'll add this later) /function to include already builded mexes will be later
What's important here is the algorythm:
Goes through metal map, when finds a free spot(other mexes checking) checks all spots within radius on which a mex can be built with maximum production (checks other mexes intersecting for production).
This way it's very area-effective.
Might want to remove checking for mexes structures themselves intersecting as this shouldn't be needed.

Posted: 13 Oct 2005, 18:35
by jcnossen
If you claim it works better then mine, have you tested that?
If so I'll put this one in jcai...

Yeah

Posted: 13 Oct 2005, 18:57
by alik83
Yeah, I tested, It works nicely on non-OTA maps like small divide, but let me just update a few things in there, like make it work good on metal maps, I'll do it today...

Posted: 13 Oct 2005, 20:17
by AF
I'll see if this gains better results than cains.

Posted: 13 Oct 2005, 21:31
by AF
Ahk, this can easily be used to get rid of the bulk of questionable code in cians class that I've bene pondering, but the class you've got here is terriblely done alik, I will ahev to spend ages getting rid of compiler errors, though I am sure the end result will be pleasing

forgot

Posted: 13 Oct 2005, 23:10
by alik83
Sorry, was 1 error in previous version here: http://fileuniverse.com/?p=showitem&ID=1621
somewhat updated metalspot finder class:
checks if the map is metalmap(most of metalsquares are metal), and only runs the second part if it's not: you could easyly add separate algorythm for metalmap.
Works better on "dirty" maps like greenhaven which have small traces of metal exept main deposits.
Also it takes some time to load on maps like small divide.
You can remove the drawing part after testing...

Posted: 14 Oct 2005, 20:17
by AF
I fiddled with your class. It is heavily base don JCAI, i ahd to spend a while editing and changing code to get it to just compile without the JCAI project present, then I found that the class didnt have the best functions for getting spots like cains does, and cains uses the same method fo storing and getting positions, so I deleted cains mex fidner core code and replaced it with a link to your class so I could use his interface.

I'll update that for the newer version you released and upload later.

Posted: 14 Oct 2005, 21:28
by AF
http://taiskirmish.sourceforge.net/mexspot.rar

The modified version thats totally independant of JCAI, and has the nicer itnerface cain provided. Just create an instance of cains class and it'll do all the work for you.