April 10, 2021, 05:30:55 PM

Author Topic: How does AICast() and Markers work?  (Read 703 times)

Kernel64

  • Sr. Member
  • ****
  • Posts: 207
    • View Profile
How does AICast() and Markers work?
« on: 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.

1337

  • Resident
  • **
  • Posts: 34
    • View Profile
Re: How does AICast() and Markers work?
« Reply #1 on: March 07, 2010, 03:40:44 PM »
I do believe the marker indicates either a) that the casting unit is marked as "casting" so it isn't issued another cast order or b) that the target unit is marked so that other casting units won't double-cast on the same one.


You can also use c_noMarker in that slot and handle the target marking yourself.

Aeg1s

  • Resident
  • **
  • Posts: 39
    • View Profile
Re: How does AICast() and Markers work?
« Reply #2 on: March 07, 2010, 03:51:35 PM »
From what I've seen I'm almost positive the marker is used to mark targets so another caster won't try to cast something on it too.


u is the caster; if you want to set a target use:
OrderSetTargetUnit(order o, unit target);

Kernel64

  • Sr. Member
  • ****
  • Posts: 207
    • View Profile
Re: How does AICast() and Markers work?
« Reply #3 on: March 08, 2010, 04:45:41 AM »
I'm confused about OrderSetTargetUnit(). But maybe I'm doing something wrong, somewhere else though.

Also, I was trying this one:

Quote
if ((AIGetTime() > 0) && (AIGetTime() < 340) &&
    ( AIKnownUnitCount(player, AIEvalLargestEnemy(player), c_PU_Probe) >= 1)
    ) {
    TriggerDebugOutput(2, StringToText("Enemy is Toss!"), true);
}

Doesn't seem to work. I hate myself.

DarkZeros

  • Member
  • ***
  • Posts: 50
    • View Profile
Re: How does AICast() and Markers work?
« Reply #4 on: March 08, 2010, 09:59:25 AM »
unit: The unit that will "cast" smt
order: The order to cast, it includes (inside, so maybe is a struct or smt):
- the casting ability
- the target (unit or position in the map)
marker: probably nothing, because the only define in the code is "c_nomaker"

hd

  • Member
  • ***
  • Posts: 56
    • View Profile
Re: How does AICast() and Markers work?
« Reply #5 on: March 08, 2010, 10:04:15 AM »
I'm confused about OrderSetTargetUnit(). But maybe I'm doing something wrong, somewhere else though.

Also, I was trying this one:

Quote
if ((AIGetTime() > 0) && (AIGetTime() < 340) &&
    ( AIKnownUnitCount(player, AIEvalLargestEnemy(player), c_PU_Probe) >= 1)
    ) {
    TriggerDebugOutput(2, StringToText("Enemy is Toss!"), true);
}

Doesn't seem to work. I hate myself.

If the AI is using normal vision, AIKnownUnitCount will have no idea how many units it's opponents have until they come within line of sight of the ai's units. Thus AIEvalLargestEnemy is useless.

The best way I've found (for 1vs1) to get the opponents race is PlayerRace(3-player) == "Prot" for protoss, "Terr" for Terran and "Zerg" for Zerg.

int player is simple a 1, 2, 3, 4, 5 etc for each player. 0 being neutral things like minerals, gas, rocks blocking a path/expansion.

Thus, if you have 2 people, one of them is 1 and one is 2. 3 - 1 = 2, 3 - 2 = 1. So you'll always get the opponents player # (in 1vs1);

DarkZeros

  • Member
  • ***
  • Posts: 50
    • View Profile
Re: How does AICast() and Markers work?
« Reply #6 on: March 08, 2010, 10:15:54 AM »
You could always get the player number, and then use the normal AI natives to get info about the enemy (example AITechCount(enemy_player)), but that would be a cheating AI don't you think ;P

Kernel64

  • Sr. Member
  • ****
  • Posts: 207
    • View Profile
Re: How does AICast() and Markers work?
« Reply #7 on: March 08, 2010, 11:08:11 AM »
Nah, I think the AI needs to cheat since it has no memory like humans have. We actually become cheaters when we get the gameplay down like in SCBW.

We always know what to expect, where things are, what things are likely to be, because of experience. The AI doesn't have this, so having it cheat balances things out.

Besides, the AI has very limited micro control.

HD, thanks again. I'll try it all over again. Actually, I had difficulty set for the vision to false. This means the AI should see.

It triggered sometime when I had a significantly larger base than it has: 1 hatch + 6 drones vs my 3 pylons + 14 probes.  ???

hd

  • Member
  • ***
  • Posts: 56
    • View Profile
Re: How does AICast() and Markers work?
« Reply #8 on: March 08, 2010, 01:42:07 PM »
Nah, I think the AI needs to cheat since it has no memory like humans have. We actually become cheaters when we get the gameplay down like in SCBW.

We always know what to expect, where things are, what things are likely to be, because of experience. The AI doesn't have this, so having it cheat balances things out.

Besides, the AI has very limited micro control.

HD, thanks again. I'll try it all over again. Actually, I had difficulty set for the vision to false. This means the AI should see.

It triggered sometime when I had a significantly larger base than it has: 1 hatch + 6 drones vs my 3 pylons + 14 probes.  ???

You can give an AI memory :X Using your own knowledge, you can give that to the AI. In other words, while we have to experience something or learn from anothers experience, we can literally GIVE that experience to the AI. We can tell it, based on information from early scouting if it should anticipate a rush. We can tell it, based on information from what units it comes across, what is likely going to happen. You can even tell it that if it scouts specific buildings early on, the opponent is rushing something (like nukes).

AI is only limited by the programmers limitations.

As an example, my protoss ai will try to build counter units to whatever units you get. It checks to see if it has the capability of building that particular counter unit. If it can't, it starts building what's needed to build the counter unit and in the mean time, uses a secondary counter unit from tier1.
« Last Edit: March 08, 2010, 01:45:32 PM by hd »

Kernel64

  • Sr. Member
  • ****
  • Posts: 207
    • View Profile
Re: How does AICast() and Markers work?
« Reply #9 on: March 08, 2010, 03:48:39 PM »
Exactly. That's what I'm trying to accomplish as well. I'm going to give away what I have, it's not much though. Just so we can all then have the best AI for practice before the beta is over. :D