FireGraft 1.16.1 (primarily exe edit discussion)

Help - Resources - AI Scripting - Grafting - Plugins - Modding Projects
pastelmind
Posts: 57
Joined: Fri Nov 19, 2010 7:50 am

Postby pastelmind » Wed Aug 08, 2012 11:52 am

Edit: Removed outdated file.

Super big update!
From now on, you can tweak various settings hardcoded into the AI so that...
  • [s]Queens will mercilessly Spawn Broodlings on your heroes[/s] Whoopsie!
  • High Templar will run around casting Psi Storm over all parts of the map
  • AI-controlled Dark Archons will steal your SCVs and Drones
  • Arbiters will recall in Zealots, Dragoons, and Archons to your base
  • And more!

The list of new EXE edits is too big to describe here. So check it out!

Terminology
Target Search Boundary
AI Spells have a property called "target search boundary," or TSB for short. This defines the size of the target search box that is placed around the AI's spellcaster unit. When the AI decides to use a spell, it looks for potential targets within the target search box.

Most spells have different TSB values for idle mode and "under attack" mode. This is so that spellcasters in a battle will not wander off toward distant targets. When the AI's unit is not being attacked, though, it searches further and wider, scouring the entire map in some cases (Yamato Gun, Nuclear Strike). For many spells, being in Campaign AIs causes the spellcaster to look further than in Melee AIs; this additional distance is represented as "target search boundary - idle (campaign bonus)."

High-Priority Units
Most AI spells have some kind of built-in checks to prevent the AI from wasting energy. For example, Queens will cast Spawn Broodlings on units that have at least 100 hit points and shields combined. Thus, by default, Queens would never target Medics, since they only have a maximum of 60HP. However, because the AI treats Medics as high-priority units, it overrides the HP/shield check and allows its Queens to target Medics. This does not mean that the Queens would choose Medics over other units, though; a Queen is as likely to kill a full-HP Goliath as it is to a Medic.
User avatar
Taranok
Posts: 256
Joined: Tue Sep 07, 2010 9:41 pm

Postby Taranok » Mon Aug 13, 2012 3:33 am

The AI ones are pretty cool.

Is it possible to add more high priority targets (for spells like Spawn Broodling)?
pastelmind
Posts: 57
Joined: Fri Nov 19, 2010 7:50 am

Postby pastelmind » Mon Aug 13, 2012 7:42 am

Adding a specific unit -- well, not really. It's possible, but I imagine the necessary changes would be way too specialized to add into FireGraft as a general-purpose EXE edit.

BTW, "high-priority" does not mean that the AI will always target a specific unit, nor that the AI will prefer one unit over the other. It just means that the AI will Spawn Broodlings on some units that don't pass the current HP check (Medics and Siege Tanks).

P. S. And the edit I mentioned about spawning broodlings on Heroes? Yeah, I forgot to add that one. Please wait for the next update!
User avatar
Taranok
Posts: 256
Joined: Tue Sep 07, 2010 9:41 pm

Postby Taranok » Mon Aug 13, 2012 4:38 pm

Under Maelstrom AI Blacklist there are no Terran Units?
pastelmind
Posts: 57
Joined: Fri Nov 19, 2010 7:50 am

Postby pastelmind » Wed Aug 15, 2012 9:42 am

Taranok wrote:Under Maelstrom AI Blacklist there are no Terran Units?


Nope. I'm afraid it's a hardcoded thing -- because the particular function (and many others) use switch tables, the range of controllable units is limited. It can be changed to include Terran units, but at the cost of removing many Protoss units (which are at the far end of the switch table). Besides, it would be too complex and too specific for FireGraft.

I'd also like to explain how the new "inclusion flag checks" and "exclusion flag checks" work.

Flag Checks

(For those who don't know what a bitfield is, see the Wikipedia article on bitfields and masks.)

In StarCraft, each unit has several distinct properties. A Marine is a Terran unit, on ground, and organic. A Shuttle is a Protoss unit, in air, and is both mechanical and robotic. These properties are used to determine which unit is affected by certain abilities and spells, such as Irradiate and Lockdown. How does StarCraft do this?

If you open DatEdit and go to the Advanced tab in units.dat, you will see many checkboxes that control a unit's properties. In StarCraft, this information is saved into a single bitfield that is known as the Unit Prototype Flag, aka the Special Ability Flag. Each property (checkbox) is represented as:

(Data copied from IDA Pro)

Code: Select all

; enum unitSpecialAbilityFlags (bitfield)
00000001 USAFlag_Building  = 1
00000002 USAFlag_Addon    = 2
00000004 USAFlag_Flyer    = 4
00000008 USAFlag_Worker   = 8
00000010 USAFlag_Subunit  = 10h
00000020 USAFlag_Flying_Building  = 20h
00000040 USAFlag_Hero     = 40h
00000080 USAFlag_Regen_HP  = 80h
00000100 USAFlag_Ani_Idle  = 100h
00000200 USAFlag_Cloak    = 200h
00000400 USAFlag_2_in_1   = 400h
00000800 USAFlag_Neut_Access__Neutral__Single_Entity  = 800h
00001000 USAFlag_Resource_Depot  = 1000h
00002000 USAFlag_Resource  = 2000h
00004000 USAFlag_Robotic  = 4000h
00008000 USAFlag_Detector  = 8000h
00010000 USAFlag_Organic  = 10000h
00020000 USAFlag_Creep    = 20000h
00040000 USAFlag_Unused   = 40000h
00080000 USAFlag_Req_Psi  = 80000h
00100000 USAFlag_Burrowable  = 100000h
00200000 USAFlag_Spell_Mana  = 200000h
00400000 USAFlag_PermaCloak  = 400000h
00800000 USAFlag_NPC_Access__Powerup  = 800000h
01000000 USAFlag_Morph_from_Unit__Check_Supply_Count  = 1000000h
02000000 USAFlag_Med_overlay  = 2000000h
04000000 USAFlag_Large_overlay  = 4000000h
08000000 USAFlag_Auto_attk__Battle_React  = 8000000h
10000000 USAFlag_Attack__Direct_attk  = 10000000h
20000000 USAFlag_Invincible  = 20000000h
40000000 USAFlag_Mech     = 40000000h
80000000 USAFlag_Wide_radius_creep  = 80000000h


For example, a Marine has the following checked in DatEdit: Organic, Battle Reactions, and Full-Auto Attack. In-game, this would combine into

Code: Select all

USAFlag_Organic | USAFlag_Auto_attk__Battle_React | USAFlag_Attack__Direct_attk
  = 0x10000 | 0x8000000 | 10000000
  = 0x18010000
  = 402718720


Now, let's look at the actual EXE edits. Example: AI Management > Tech > Irradiate AI > High-priority flag check (special ability)

This EXE edit controls which units are selectively Irradiated when a Science Vessel is not under attack. The default value is 8 = 0x8 = USAFlag_Worker, which means that Vessels will hunt (organic) worker units when they aren't being attacked.

Now, let's say we want SVs to hunt ALL Zerg units when they are idle. How do we do this? Because all zerg units (except the eggs and cocoons) regenerate HP, it would be best to use the USAFlag_Regen_HP flag. Thus, we would have to set the new value to...

Code: Select all

USAFlag_Worker | USAFlag_Regen_HP = 0x8 | 0x80 = 0x88 = 136
There! Now your SVs are much more active versus Zerg.

You can also do things like this with the Unit Status Flag, which tells you whether a unit is burrowed, is a hallucination, or is currently cloaked, etc.

(Data copied from IDA Pro)

Code: Select all

; enum unitStatusFlags (bitfield)
00000001 USFlag_Completed  = 1
00000002 USFlag_GroundedBuilding  = 2
00000004 USFlag_InAir     = 4
00000008 USFlag_DisabledUnit  = 8
00000010 USFlag_Burrowed  = 10h
00000020 USFlag_InBuilding  = 20h
00000040 USFlag_InTransport  = 40h
00000080 USFlag_Unknown0x80  = 80h
00000100 USFlag_RequiresDetector  = 100h
00000200 USFlag_Cloaked   = 200h
00000400 USFlag_DisabledDoodad  = 400h
00000800 USFlag_NoCloakingEnergyDecrease  = 800h
00001000 USFlag_NoOrdersAllowed  = 1000h
00002000 USFlag_NoBrkCodeSection  = 2000h
00004000 USFlag_Unknown0x4000  = 4000h
00008000 USFlag_CannotAttack  = 8000h
00010000 USFlag_IsAUnit   = 10000h
00020000 USFlag_IsABuilding  = 20000h
00040000 USFlag_IgnoreTileCollision  = 40000h
00080000 USFlag_Unmovable  = 80000h
00100000 USFlag_IsNormal  = 100000h
00200000 USFlag_NoCollide  = 200000h
00400000 USFlag_Unknown0x400000  = 400000h
00800000 USFlag_IsGathering  = 800000h
01000000 USFlag_Unknown0x1000000  = 1000000h
02000000 USFlag_Unknown0x2000000  = 2000000h
04000000 USFlag_Invincible  = 4000000h
08000000 USFlag_HoldingPosition  = 8000000h
10000000 USFlag_SpeedUpgrade  = 10000000h
20000000 USFlag_cooldownUpgrade  = 20000000h
40000000 USFlag_IsHallucination  = 40000000h
80000000 USFlag_IsSelfDestructing  = 80000000h


A fair warning: many of these flags may have unknown properties. Use with caution!

For those who want to deal with flags, I have made a small tool that decodes flag masks into individual bits. Just download, extract and double-click the sc_flags.hta file, and it will work like any normal Windows program.
pastelmind
Posts: 57
Joined: Fri Nov 19, 2010 7:50 am

Postby pastelmind » Fri Aug 17, 2012 4:09 am

Edit: This version of FireGraft is now outdated, and subsequently removed.

New EXE edits:
  • Modify Glave wurm bounce amount & damage reduce per bounce
  • Game defaults - minimum & maximum weapon cooldown
  • Psionic Storm - interval between hits
  • Modify splash damage division factor (the 100%/50%/25% thing)
  • Recall: Modify effect area size
  • Hallucination: Don't get dispelled by D-Matrix, Psi Storm, Maelstrom, Ensnare, etc.
  • Spawn Broodlings AI: Modify exclusion flag check (so they can target hero units /tongue.gif' class='bbc_emoticon' alt=':P' />)
  • Interval between order changes (intercepter launch, burrow/unburrow delay, etc.)*

*This one is not completely understood. Be careful!
User avatar
Hydrolisk
Posts: 39
Joined: Mon Sep 15, 2008 8:39 pm

Postby Hydrolisk » Wed Aug 29, 2012 1:30 am

Is anyone getting Windows error messages along the lines of this http://img1.uploadscreenshot.com/images ... 4-orig.jpg ?

I don't know if it has something to do with FireGraft or the plugins I am using (ThunderGraft, ShadowFlare's Playlist Plugin, and GPTP), but I get this error whenever I try to run my mod's EXE saved through FireGraft while the EXE is anywhere but the directory where I originally saved it to.
pastelmind
Posts: 57
Joined: Fri Nov 19, 2010 7:50 am

Postby pastelmind » Thu Aug 30, 2012 12:12 pm

@Hydrolisk: I've never seen such error messages. If the error happens when you move your EXE to some other folder, perhaps it might be something related to admininistrator privileges. If you're under Windows 8 or Vista, try running the mod with admin rights.
pastelmind
Posts: 57
Joined: Fri Nov 19, 2010 7:50 am

Postby pastelmind » Thu Sep 06, 2012 3:51 pm

New FireGraft changes incoming.

Changes
  • I didn't know that Special Ability Flags were called Unit Prototype Flags in BWAPI's source code. Since many people here are involved with BWAPI, I figured it should be worth it to change the EXE edit names to reflect this.
  • The Chitinous Plating - Affected unit 1/2 (unused?) EXE edit was removed. They were actually pointing to the same address as the Anabolic Synthesis - Affected unit 1/2 EXE edits. Sorry about the mistake!
  • The empty space has been refilled by the first two EXE edits mentioned below.

New EXE edits
  • Modify detection range of grounded buildings
  • Modify status flag check for determining detection range of grounded buildings (0x02)
  • Allow blinded (by Optical Flare) detectors to see cloaked/burrowed units
  • Modify/remove special bullet count limit for Halo Rockets
  • Display shield damage overlay graphics for weapons that deal independent damage
pastelmind
Posts: 57
Joined: Fri Nov 19, 2010 7:50 am

Postby pastelmind » Sat Sep 22, 2012 9:47 am

Minor FireGraft updates are available.

This one fixes some typos and one duplicate EXE edit (Parasite AI requirement). Also, I'm considering allowing people to manually edit the unit flag checks instead of just skipping/NOPing them, similar to what I did in the spellcasting AI update.

Changes:
  • When using Ensnare/Spawn Broodlings as a weapon, you can now specify whether to make them into normal weapons (affected by high ground and Dark Swarm) or "never-miss" weapons. Also, using Spawn Broodling to deal weapon damage shouldn't crash anymore...
  • You can now edit Ensnare's flag checks.
  • The "don't ensnare robotic units" EXE edit was used in one of my mods, but I thought it wasn't fair to have something so specific in 1161.FGD. So I removed it.

Return to “StarCraft Modding”

Who is online

Users browsing this forum: No registered users and 2 guests