new metal spot finder class

new metal spot finder class

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
alik83
Posts: 82
Joined: 08 Sep 2004, 15:32

new metal spot finder class

Post 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.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

If you claim it works better then mine, have you tested that?
If so I'll put this one in jcai...
alik83
Posts: 82
Joined: 08 Sep 2004, 15:32

Yeah

Post 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...
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I'll see if this gains better results than cains.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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
alik83
Posts: 82
Joined: 08 Sep 2004, 15:32

forgot

Post 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...
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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.
Post Reply

Return to “AI”