The code would be in the attachment. Its written in VC++ 2008, it is the modified code of the BWAPI exempla ai module. (ignore the huge amount of static memory required, later i modify it to dynamic if that works)
EDIT: the = operator was not redefined for vect2d struct, so some other operations like firstpoint=lastpoint messed up things a little. still some problems. it seems that conditions should be rewritten a little, plus restructured, so that when finding new links, first we find al lthe candidates, and if there are more then one, pick the closest candidate which is present in the zone. That would give some overhead too... tell me if you notice other problems.
EDIT: new version. picks candidates up in a list, then if more, filters out those not present in current zone, then it should pick the one, which makes the next link deviate from previuos lines (links') direction. There is alos one more problem for sure. usually, it lefts out the last point from the poligon from some zones. there is some other problems.
EDIT: now it works it seems, problem was that as i changed it to pick up candidates first rather then just pick one, i forgot to remove code which would immediatly flag candidates as already picked (even if just only one was eventually picked, all the would be nodes had been flagged picked). Try to find bugs, if you will. Next part should be poligon simplification, then slising up zones, and in the meantime creation of pathes for zones. Poligon simplification is easy; you could throw in some ideas about how to slice up zones into "corridors","crossroads" or open areas, so, that it would limit the number of cycles. Now one idea at this point, is to just make a vary degraded version of those poligons, and check every link for every link. Pick the one which is closets, presents the same inner side to the currently checked, plus is the closest in angle (so as close to paralell as possible). I don1t know how much weight to give to those attributes. distance is measured from one endpoint of link. thats it so far. the pathing stuff in BWTA (which i want to replace at this point) Builds up Voronoy diagram for that. I want to make something faster then BWTA.
you should BWAPI from google code, if you want to check.
Attachments:
Post has been edited 6 time(s), last time on Nov 8 2011, 10:12 am by matefkr.
None.