Main 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

Topics - Kernel64

General Discussion / Breaking the M3 file (MDX3)
February 28, 2011, 01:01:05 PM
Hey guys, been a long time.

Blizzard uses for their models the m3 file format. Some guys are creating scripts for import/exporting models from 3d apps.

Their problem is mainly trying to document mdx3, and I'm guessing you guys have the power and skills to unravel this thing quite easily. They say once the documentation is complete, any export/import tools will be quite easy to make.

I'm sincerely hoping you guys could help them out.

A lot of people are having problems with playing in offline mode, and these are people who have a valid sc2 license. Always connected doesn't really work for everyone, which we all could agree on.

Without the skills to code this kind of stuff, I am looking forward to finding a tool that makes offline play available.

As far as I know, these are the stuff that gets the "you must authenticate your copy" error:

1. Offline mode using a valid account -- a valid account stores campaign data in one's own pc, and offline mode supposedly allows players to continue their SP experience even without connection.

2. Offline editor -- running the editor requires some kind of authentication just as the above.

3. Offline Test Document -- in the editor, you can test your work, which loads SC2 with your map from the editor. The problem circles back to #1, but with a different error.

The real issue is simple at face value: some sort of module is downloaded from the servers which supposedly authenticates your copy and allow you to play offline (without connection) either using your account name or the 3 guest options in guest mode for 30 days. However, something goes wrong. Somehow this module is no longer existent even by just getting disconnected while playing a game.

Anyway, I'm pretty confident you guys can figure this out. This request would eventually, if possible, help people who need them.

Thanks in advance, and I hope you guys would consider this request.

Again, thank you.
Are you guys having problems with the AI? I can't seem to get them to work.
AI Discussion / HexBox AI Needs Your Strategy
April 06, 2010, 10:59:48 PM
Hey guys, I'm currently developing and coding HexBox AI. It can contain potentially hundreds of strats, including timed pushes.

It seems that if the AI had stuff that people do it will make for a good semi-practice partner. It's a non-cheating AI, and does well if given a good strat/BO.

I would gladly include the strats you want to be in it. So, please don't hesitate to post them in detail them below.

After 7 mins, the AI tends to slow down. I say this because

UIDisplayMessage(PlayerGroupAll(), 3, StringToText("status: " + CBlockStatus));

doesn't show up on the screen as fast as it did before this time. It slows down then takes some speed again.

Then, at 12 mins everything else stops besides this:

time = AIGetTime();
Itime = FixedToInt(time);
minutes = 0;
while (Itime >= 60) {
    Itime = Itime - 60;
    minutes = minutes + 1;
msgTime = IntToString(Itime);
minutesTime = IntToString(minutes);

UIDisplayMessage(PlayerGroupAll(), 2, StringToText("Time Elapsed:                " + minutesTime + ":" + msgTime));

Which shows the time.

What's happening here?

Obviously, some codes are executed. I still get this displaying "List Empty"  on the screen:

UIDisplayMessage(PlayerGroupAll(), 3, StringToText("status: " + CBlockStatus));

But then, all the other codes, like this one:

        if ( (TotalUnit(c_ZB_Spire, player) == 1) && //military manager muta prototype
             (TotalUnit(c_ZU_Drone, player) >= 14) &&
             (FreeFood(player) >= 4) &&
             (AIHasRes(player, 100,100)) &&
             (HowManyCanWeProduce(c_ZU_Mutalisk, 1, player) >= 1)){ //&&
             //(CBlockStatus != "InProgress") ) {
                QInUnitPB(c_ZU_Mutalisk, 1, MaxUnitFreeFood(c_ZU_Mutalisk, 2,player) , c_townOne);
            if(AIGetBuildingCountInTown (player, c_townTwo, c_ZB_Hatchery_Alias, c_techCountCompleteOnly) >=1 ) {
                QInUnitPB(c_ZU_Mutalisk, 1, MaxUnitFreeFood(c_ZU_Mutalisk, 2,player) , c_townTwo);

isn't getting passed by the AI.

Does the AI go somewhere after 12 mins? How do I keep the AI running  ZergOpenGnd0 stuff until 30 mins?
The idea is utilizing how the AI engine loops within a state like OpenGnd0, for example.

By making a variable loop from 20 to 0, and resetting at will, the Queen can be ordered to move between the two bases.

Having a third base may not work with this code. But as a prototype, this is somewhat a good start.

Here's the code used to order the Queen around:

void CommandQueen(int player, int CTown, string StructHatch){
order ord;
point OTarg;
unit Queen;
unit nearbyHatch;
region r;   
        nearbyHatch = AIGrabUnit(player, StructHatch, c_prioScriptControlled, AIGetTownLocation (player, CTown));
        Queen = AIGrabUnit(player, c_ZU_Queen, c_prioScriptControlled, AIGetTownLocation (player, CTown));
        r = RegionCircle(UnitGetPosition(nearbyHatch), 4);
        //OTarg = UnitGetPosition(nearbyHatch);
        OTarg = AIRandomSpawnPoint (player, r, 50, 100, 3);
            ord = AICreateOrder(player, c_AB_Move, 0);
            OrderSetTargetPoint(ord, OTarg);
        if (UnitOrderIsValid(Queen, ord)) {
            AICast(Queen, ord, c_noMarker, c_castHold);       
        else {}

Here's how it is used within OpenGnd0:

        if (loopTimer < 20 && loopTimer > 10 ) {  //queen management prototype
            CommandOvie(player, c_townOne);
            CommandQueen(player, c_townOne, c_ZB_Lair);
            CommandQueen(player, c_townOne, c_ZB_Hatchery);

        if (loopTimer < 10) {                    //queen management
            CommandOvie(player, c_townTwo);
            CommandQueen(player, c_townOne,c_ZB_Lair);
        if (loopTimer < 1) {
            loopTimer = 20;

Obviously, this can be developed further. And as you can see, even if c_townOne is used at both cases, the queen will still be ordered to move to c_townTwo.

I have no idea what's going on with that.
Just add, say your custom library of functions are within ZergFuncs.galaxy:

include "TriggerLibs/ZergFuncs"

from where you would call the functions. Say if you're looking to call them from Zerg0.galaxy, just add the above at the top of Zerg0.galaxy.

having other extensions other than .galaxy is something to be tested yet.

This function below allows you to command overlords at will. The command given here is a move command, where the point is chosen by the function:

AIPlacementNearbyFindTest (...);

and is used by:

This isn't perfect. But to use this, disabling the code at Zerg.galaxy in the function AINewUnitZerg (int player, unit u) where overlords are given to scout seems to be necessary.

The goal of this function is to make the overlords stay at creep spots and drop creep there whenever lair is up.

void CommandOvie(int player, int CTown){
order ord;
point OTarg;
unit Ovie;
        Ovie = AIGrabUnit(player, c_ZU_Overlord, c_prioScriptControlled, AIGetTownLocation (player, CTown));
        OTarg = AIPlacementNearbyFindTest (player, UnitGetPosition(Ovie), 20, c_ZB_CreepTumor);
        ord = AICreateOrder(player, c_AB_Move, 0);
        OrderSetTargetPoint(ord, OTarg);
        if (UnitOrderIsValid(Ovie, ord)) {
            AICast(Ovie, ord, c_noMarker, c_castHold);       
        else {}
We can count alive or dead units, but is there a way so that the AI would count units that are in production , even in queue, or under construction owned by a human enemy player?

AITechCount works only for itself.
AIKnownUnitCount works for alive.

int DronesCount = TechTreeUnitCount(3-player, c_ZU_Drone, c_techCountQueuedOrBetter);

I know this works too. But I'm thinking region, point circle specific. Too complicated but I'm looking to grab certain structures and see if they're done. Like add-ons, etc. then go back a few seconds to see if they've been canceled, or does not exist anymore, or has been completed.


Some traces of filters show filtering of buffs, ability effects (maybe same as buff), and checking of abilities. Maybe, just maybe, each structure's production queue is an ability. And if that ability is in use, we might be able to use this to check if a structure is working on something.

It may also be possible to create a group, and an order much like "follow" but this time, an "attack-move" order. This way, we can create a custom function that holds multiple groups of units, and order them to attack-move to certain location.
How do I change a variable that's been passed as a parameter? Say, I have:

void func (string OrderList, int OrderCount[j], int OrderPrio[k]);

how do I actually change the values of those arrays? I don't know how to make them change in that function and have the changes happen after the function is called.

Also, is that a valid function? Assigning arrays as arguments like that? Is that how to do it?

Thanks in advance.
The problem with the default Queen is that if you have multiple queens, they are bunched together at the main. And if you have >10 drones anywhere, even if say your expo has only 3 drones, it will not cast spawn larva.

This one fixes that, so you can train Queens at expos or other bases, and have that queen spawn larva and only keep count of the larva in front of her. Also, this allows your Queens to stay where they're trained from unless grabbed and given an order somewhere else.

at TactZergAI.galaxy replace the respective code with this:

order SpawnLarva (int player, unit aiUnit) {
    order ord;
    unitgroup hatcheries;
    unitgroup larvas;
    int larvaCount;

    //  Only cast if idle.
    if (UnitOrder(aiUnit, 0) != null) {
        return null;

    ord = AICreateOrder(player, c_AB_SpawnMutantLarva, 0);
    if (!UnitOrderIsValid(aiUnit, ord)) {
        return null;

    larvas = AIFindUnits(player,
    //  Don't cast if we already own at least 10 larva
    larvaCount = UnitGroupCount(larvas, c_unitCountAll);
        //TechTreeBehaviorCount(player, c_BF_MutantLarvaTimer, c_techCountQueuedOrBetter) * 4
      //+ TechTreeUnitCount(player, c_ZU_Larva, c_techCountQueuedOrBetter)
    if (larvaCount >= 10) {
        return null;

    hatcheries = AIFindUnits(player,
    return AIUnitGroupGetValidOrder(hatcheries, ord, aiUnit, c_backwards);

This will make the engine scan larva count local to where the Queen was trained. Remember to train Queen at specific town since our next code prevents the grouping and taking home of all queens:

At Zerg.galaxy, find the function "void AINewUnitZerg (int player, unit u)"
and comment out the line which adds queens into a wave.

it should say something like:
    if (type == c_ZU_Queen) {
        //AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);c_prioWaveIdle doesn't work

Perhaps through here we can code so that ovies are not automatically added as scouts, but positioned somewhere at edges of creep. Then we can add a Think for the overlord and give it an order to drop creep.

edit: It would be nice to have the limit of counting of larva multiplied by the number of hateries/lair/hive within range of the queen. This way, one queen can cast spawn larva on two hatcheries. Coding where to cast the order depending on the number of larva of that specific grabbed hatchery would be the awesome.
Moving the code to Mapster.
AI Development / How to Grab and Count Enemy Units?
March 08, 2010, 01:00:10 PM
I've seen a code somewhere within the Zerg one that grabbed units and counted them. It was for the overseer I guess. There was also one that counted ground and air.

How do I grab all enemy units, then filter them out one by one:
zealots for zealots, stalkers, colossuses, etc.

Or is it better to just count each one by making grabs for each? I don't want to use the Count enemy units one, as that is good for the AI that has default vision off.

You guys have a function for this already? I'm focusing on studying actual build orders now, and I'll share them all as soon as I get something solid. All with counters and race specifics.

AI Development / How does AICast() and Markers work?
March 07, 2010, 03:39:04 PM
native int AICast (unit u, order o, marker m, bool retreat);

is u supposed to be the caster unit?
what is m?

Say, I want to order a caster to cast on another unit, is the caster u and the target marked by m?

I'm confused.
Hey guys, how can I install the client and have it updated to the latest patch without a connection? My other PC has no internet connection. How do I patch it to the latest version?
So, A few besides the Starcraft Team could make use of build orders and unit compos, response to such build orders, where to proceed when what and when.

The idea is to post your opening BOs, what units you get, when you expand, and what conditions prompt you to do such things. Timings on when you attack using what, etc, and what you would do when facing a certain BO. Say, for example, a 7-rax reaper harass build to fast-expo, banshee.

Post your own, and they might get included in the upcoming releases of AI scripts.

The more we have stored here, the more the devs have to work with and fast. :)
Could someone make these? If not, can someone point me to where I can learn to hack maps and set the following:

observer maps for: (1v1)
ZvZ all comps
ZvP all comps
ZvT all comps
TvP all comps
TvT all comps
PvP all comps

1v1 Player vs AI:

ZvZ Player vs. comp
ZvP Player vs. comp
ZvT Player vs. comp
TvP Player vs. comp
TvT Player vs. comp
PvP Player vs. comp

Onemap, like Lost Temple with all the above items preset would be alright.Would make testing build orders for AI development lot smoother.

Is this even possible?
AI Development / Where to Find AI Queen Management
March 04, 2010, 07:58:19 AM
I'd like to see the codes related to the AI's control of the queen. It seems that the AI cannot handle two queens and use them on two different towns each.

Does anyone know where to find these or how to override them? Like, manually ordering a queen to cast an ability at a certain point, for example.
AI Development / AI Editing and Information
March 02, 2010, 11:58:43 AM
So far, I've come across a few tidbits that could help in developing the AI scripts.

1. The Phase/State the AI is in is time controlled. Can be edited at NotHard file. Not sure if two states can run side by side. For example, Open and MidGndA.

2. AIClearStock() resets the AI in some way.

3. defaultExpansion function can be controlled by modifying the gas and mineral entries. As it counts every mineral and gas close to a TH, you can set the mineral and gas entries to trigger the AI to expand.

4. There are three modes of expansion: default, VitalHard, and Normal
     a. vital hard seems to include gas structures automatically

5. You can add if and while within the [race]0 files.

6. You can define functions there and call them in a "goto" sort of way. So you can actually make a loop between two functions.

7. The AI will rebuild stocked units through AIstock unless the AIClearStock is called.

8. AIStockandWait can be used in an if(!). This function automatically stocks in a unit or structure if the AI doesn't have it. Other actions following will wait for this to be true before being run.

9. TechCount using ordercompleteonly can also be used to make if statements. Works like AIstockandWait.

10. AIstock function does not run one after the other. The AI engine may decide to build/train the next cheapest item.

Things in mind/to test:

1. Is it possible to edit the retreat and attack items in order to make the AI not dance? Say increase the time before attacking in the section where the AI is not in combat but is not too weak? Can the difficulty be 2000 and set the ai's APM to 75 and not bog it down to achieve this result instead?

2. Is it possible to add randomization and enter build orders within each of the multiple openings and following MID and Lates through if statements?

3. Is it possible to use Counterunit and allow the AI to decide what unit to train while utilizing AIClearStock() to completely change the AI's unit composition and Base composition? Or is it better to use if's and randomization instead? Can we make the AI take information and as such use that information to call specific custom functions suitable to handle these information?

That's it for now. I'll update whenever I find more or make progress. Note that the exact terms are not there. I can't remember them all at this time, but will update them for those who are not familiar with the code.