Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - ptanhkhoa

#46
Tested your AI, it very good, it keeps a distance from the enemy base but it keep dancing too much, can you fix that problem ? :). Also I included your AI to Green Tea for testing, hope you don't mind.
#47
Vernam, this is the Trigger Libs for my Terran AI, also included Protoss AI of Suxue, current AI cannot Run because of error Main State, I think that you launcher have something with the AI Difficulty Setting, 

The Ai current don't have other difficulty than the very easy ( but it will still hard enough than the Blizzard AI ), if you set higher, it won't run. :|, I hope we can cooperate to make the AIs run in your launcher.
#48
Not yet, but I'm update a test version that compatible with patch 10, check the first post, I think it more fun than the Blizzard AI though  :D .  Just Terran AI only, the Protoss is belong to Suxue.
#49
@SuXue, thx for the tips, it working for me, now I can try all the new blizzard function code  :jig: , just tried the AIMapPathCost ( it help to find the shortest path between point ).
P/S: The AIExpandDefalut is dead now, try the AIExpand function.

@AlsoKnowAs : His method is good, actually. The problem is not because of the launcher but because every native function of blizzard has some slighty change. My advice: rewriting your script from the beginning, which I am doing now from the Blizzard default AI code. Also you can test new function and improved your AI much more.
#50
haha , I found it out Kernel, the Melee AI in liberitymod galaxy don't have the AISetMainState Function .
Quotevoid AIMeleeStart (int player) {
    point targDPoint;
    point targOPoint;
    wavetarget targD;
    wavetarget targO;

    if (DEBUG) {
        DebugMeleeInit();
    }

    AIStart(player, false, DifficultyAPM(PlayerDifficulty(player)));

    if (PlayerDifficulty(player) >= c_skirCheater) {
        AIHarvestBonus(player, 2.0);
    }

    AISetDifficulty(player, c_diffNormalVision, (PlayerDifficulty(player) != c_skirCheater));
    AISetDifficulty(player, c_diffLimitAPM,     (PlayerDifficulty(player) != c_skirCheater));

    AISetDifficulty(player, c_diffSpotChangelings,   (PlayerDifficulty(player) >= c_skirVeryHard));
    AISetDifficulty(player, c_diffWaveAvoidDanger,   (PlayerDifficulty(player) >= c_skirHard));
    AISetDifficulty(player, c_diffFleeDamage,        (PlayerDifficulty(player) >= c_skirHard));
    AISetDifficulty(player, c_diffEarlyDefenseScout, (PlayerDifficulty(player) >= c_skirHard));
    AISetDifficulty(player, c_diffUseExtraScouts,    (PlayerDifficulty(player) >= c_skirHard));
    AISetDifficulty(player, c_diffHoldAtIdleChokes,  (PlayerDifficulty(player) >= c_skirHard));
    AISetDifficulty(player, c_diffPressForward,      (PlayerDifficulty(player) >= c_skirMedium));
    AISetDifficulty(player, c_diffFleeWorkers,       (PlayerDifficulty(player) >= c_skirMedium));
    AISetDifficulty(player, c_diffFleeDanger,        (PlayerDifficulty(player) >= c_skirMedium));

    AISetDifficulty(player, c_diffRepairDamage, true);
    AISetDifficulty(player, c_diffOptimizeGas, true);
    AISetDifficulty(player, c_diffDefendWithPeons, true);
    AISetDifficulty(player, c_diffEnableDangerMap, true);
    AISetDifficulty(player, c_diffNormalTargetPrio, true);
    AISetDifficulty(player, c_diffAllowResourceReq, true);

    AISetDifficulty(player, c_diffAutoLoadBunkers, false);
    AISetDifficulty(player, c_diffEarlyGameRepair, false);

    //AISetFlag(player, e_flagsRunScared, AIDiffThreshold(player, false, c_skirVeryHard, true));
    AISetFlag(player, e_flagsRunScared, false); // TODO fix scared and re-add this

    AISetFlag(player, e_flagsLateScout, false);
    AISetFlag(player, e_flagsClearObs, false);

    AIDeclareTown(player, c_townOne, PlayerStartLocation(player));
    AISetMainTown(player, c_townOne);
    AIHarvest(player, c_townOne);
    AISetNumScouts(player, 1);
    AIScout(player);
    AISetAllStates(player, 1);
   
    targDPoint = AIWaveTargetGatherDPoint(player, c_townMain);
    targOPoint = AIWaveTargetGatherOPoint(player, c_townMain);
    targD = AIWaveTargetGatherD(player, c_townMain);
    targO = AIWaveTargetGatherO(player, c_townMain);

    AIWaveSet(player, c_waveMain,       AIWaveCreate(AIWaveInfoCreate(), player, targOPoint));
    AIWaveSet(player, c_waveAttack,     AIWaveCreate(AIWaveInfoCreate(), player, targOPoint));
    AIWaveSet(player, c_waveDivert1,    AIWaveCreate(AIWaveInfoCreate(), player, targOPoint));
    AIWaveSet(player, c_waveDivert2,    AIWaveCreate(AIWaveInfoCreate(), player, targOPoint));
    AIWaveSet(player, c_waveClearObs,   AIWaveCreate(AIWaveInfoCreate(), player, targOPoint));
    AIWaveSet(player, c_waveHome,       AIWaveCreate(AIWaveInfoCreate(), player, targDPoint));
    AIWaveSet(player, c_waveDefend,     AIWaveCreate(AIWaveInfoCreate(), player, targDPoint));

    AIWaveSetType(AIWaveGet(player, c_waveMain),     c_waveStateIdle, targO);
    AIWaveSetType(AIWaveGet(player, c_waveAttack),   c_waveStateIdle, targO);
    AIWaveSetType(AIWaveGet(player, c_waveDivert1),  c_waveStateIdle, targO);
    AIWaveSetType(AIWaveGet(player, c_waveDivert2),  c_waveStateIdle, targO);
    AIWaveSetType(AIWaveGet(player, c_waveClearObs), c_waveStateIdle, targO);
    AIWaveSetType(AIWaveGet(player, c_waveHome),     c_waveStateIdle, targD);
    AIWaveSetType(AIWaveGet(player, c_waveDefend),   c_waveStateIdle, targD);

    AISetMaxBestAttackersLimit(player, AIMeleeDiffSelect(player, 1, 1, 2, 4, 6, 8) );

    AITransportIgnore(player, "VikingAssault");
    AITransportSetPanic(player, 0.6);
    AITransportSetReturn(player, targDPoint);
   
    AISpecifiedMakers();
    AISpecifiedHealers(player);
    AISetDefaultCombatFlags(player, true);
    AIAddDetectionDangerUnits(player);

    //AISetNukeConstants(player);
}

Instead of this he uses the AISetAllStates Function, maybe the Lazy Launcher do not know to call it from the core, just change it to the old AISetMainStates function.

I found this AISetALLState in current AI.galaxy script in the Core
Quotenative void AISetAllStates (int player, int state);

Like you said, AI.galaxy doesn not parsed, . May be I should try to copy that to the Mod folder.
I'm backing up the Patch.Archive , 800 Mb =.=' , modified something then report to you guys.
#51
I think the problem within the launcher, there are some extensive function that the launcher do not supported. Also I think they change the way to implement code too, I even didn't see the Exit Button Screen.
Let wait for Vernam update launcher tonight, i'm eager to use the new function in this patch which very interesting  :D .
#52
AI Development / A whole new functions in Patch 9
April 23, 2010, 07:32:16 AM
At first i'm very disappoint in Patch 9 because the AI don't run but affter take a look carefully at the core.base, i see that they change a lot with a new very interesting function, not only helpful for map maker but also our AI developer as well.

In the natives.galaxy

First, the problem how to receive player message now resolved with this :

Quoteconst int c_invalidConversationId           = 0;
const int c_invalidReplyId                  = 0;

const int c_conversationReplyStateUnread    = 0;
const int c_conversationReplyStateRead      = 1;
const int c_conversationReplyStateOld       = 2;

native int          ConversationCreate (bool visible);
native int          ConversationLastCreated ();
native void         ConversationDestroy (int intId);
native void         ConversationDestroyAll ();

native void         ConversationShow (int intId, playergroup to, bool visible);
native bool         ConversationVisible (int intId, int player);

native int          ConversationReplyCreate (int intId, text inText);
native int          ConversationReplyLastCreated ();
native void         ConversationReplyDestroy (int intId, int replyId);
native void         ConversationReplyDestroyAll (int intId);

native void         ConversationReplySetText (int intId, int replyId, text inText);
native text         ConversationReplyGetText (int intId, int replyId);

Interesting right, so we can use this to make a command function to make the AI to to do what we want, for example, starting a specific opening.



now, another previous problem about the coordinate, take a look at this guy, now we can make them build at any place, so walling should be no problem ( damn, I should waiting for this patch, all the time I thinking to build wall now useless >.< ).

Quotenative point Point (fixed x, fixed y);
native point PointWithOffset (point p, fixed x, fixed y);
native point PointWithOffsetPolar (point p, fixed distance, fixed angle);
native point PointFromId (int id);

native fixed PointGetX (point p);
native fixed PointGetY (point p);
native void  PointSet (point p1, point p2);

native fixed PointGetFacing (point p);
native void  PointSetFacing (point p, fixed inFacing);

native fixed PointGetHeight (point p);
native void  PointSetHeight (point p, fixed inHeight);

native bool  PointsInRange (point p1, point p2, fixed range);

native fixed AngleBetweenPoints (point p1, point p2);
native fixed DistanceBetweenPoints (point p1, point p2);

native int   PointPathingCost (point p1, point p2);
native fixed PointPathingCliffLevel (point p);
native bool  PointPathingPassable (point p);
native bool  PointPathingIsConnected (point p1, point p2);
native point PointReflect (point source, point dest, fixed angle);

Not only building, but also strategy too, the pathing problem now solved easily. not to mention some math function like

Quotenative fixed SquareRoot (fixed x);
native fixed Pow (fixed x, fixed power);
native fixed ModF (fixed x, fixed m);
native fixed MinF (fixed x1, fixed x2);
native fixed MaxF (fixed x1, fixed x2);
native fixed AbsF (fixed x);

native int   ModI (int x, int m);
native int   MinI (int x1, int x2);
native int   MaxI (int x1, int x2);
native int   AbsI (int x);

// Trigonometry
// Note: All angles are in degrees
native fixed Sin (fixed degrees);
native fixed Cos (fixed degrees);
native fixed Tan (fixed degrees);
native fixed ASin (fixed x);
native fixed ACos (fixed x);
native fixed ATan (fixed x);
native fixed ATan2 (fixed y, fixed x);


Imagine that, with this we could make the Transport Medievac to enemy base, if it discover an anti-air, it can change direction to get out the range of that anti-air.


Not only the point, put the region has some nice function too
Quotenative region RegionEmpty ();
native region RegionEntireMap ();
native region RegionPlayableMap ();
native void RegionPlayableMapSet (region r);

native region RegionRect (fixed minx, fixed miny, fixed maxx, fixed maxy);
native region RegionCircle (point center, fixed radius);
native region RegionFromId (int id);

native void RegionAddRect (region r, bool positive, fixed minx, fixed miny, fixed maxx, fixed maxy);
native void RegionAddCircle (region r, bool positive, point center, fixed radius);
native void RegionAddRegion (region r, region regToAdd);

native void  RegionSetOffset (region r, point offset);
native point RegionGetOffset (region r);

native bool RegionContainsPoint (region r, point p);

// RegionRandomPoint attempts to find a random point somewhere within the region.  For regions
// containing only a single positive shape, this is guaranteed to work, but for more complex
// sets of shapes it may give up after a maximum number of tries and return (0, 0).
//
native point RegionRandomPoint (region r);

native point RegionGetBoundsMin (region r);
native point RegionGetBoundsMax (region r);
native point RegionGetCenter (region r);

// Setting the center will adjust the offset such that
// the region becomes centered on the given point.
//
native void RegionSetCenter (region r, point p);

// RegionAttachToUnit will attach the region to the given unit such that the region center
// is always at the unit's position plus the given offset.  Use a null unit to detach the region
// from whatever unit it may already be attached to.
//
native void RegionAttachToUnit (region r, unit u, point offset);
native unit RegionGetAttachUnit (region r);

So we can actually make a unit don't run out of the region and return to center when necessary, that good when making AI for terran, where we get Siege Tank at the center and the soldier should not go far for it, notice that we can plus 2 region together so that mean, 2 siegetanks means 2 circle.
I think with this, we can add our drop location, not depend on the LastDropLocation fuction anymore  :thumbsup: .

And much much more interesting function that make develop AI more convenient.

#53
Same here  :-[ .
#54
I'm going to release it this weekend, but there is patch 9, so it have to be delayed to get it compatible.
#55
QuotePretty cool. Hopefully one day AIs can block chokepoints.
@Suxue:

I'm getting close to this now,







Maybe I should add some "bigger" building like EngineerBay :P

@Alsoknowas:

Looking forward to your AI ^^. Maybe you should check out GT AI Arena, there are a lot of stronger AI than strategy 3.1, for example : DoZerg AI of Chriamon & Protoss Aiur AI of Suxue
#56
I will update when it come to next release, here are some nice stuff I had developed , somewhat close to "Walling" for terran.





#57
AI Discussion / Re: HexBox AI Needs Your Strategy
April 21, 2010, 02:19:13 AM
QuoteChainaw,Yeah, it is possible. The most apparent work-around is typing   something. As simple as 1,2,3, or Enter, 12, Enter, will then set the AI   to the 12th opening, which then leads to the 12th tier 1.5, and so   forth.

It is a very neat idea, how can you recognize the input text of the player :) ? I think if you can do this you can order the ally AI to do something for us to. For ex : Tell them to Attack what player, focus on producing something or help from them. So it good when playing vs team.
#58
@esshy : Like chriamon said, this is the main conflict when putting AI in the same folder, It take time to look through their code. I will fix and update it when I have time, thx for report.
@Chriamon : Thanks Chriamon, your AI is current the strongest Zerg now, and thanks again for the update, I will included it in the next version.
#59
That because the GameData folder is outdated, you should put this new one in the samefolder with Trigger Libs,
#60
Well, silly me because I forget to put the AI.Galaxy into Trigger Libs, I'm sure that the next version will run SC2Base.Data smoothly :)