HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[Script, AI] Michael Peppers's Melee AI template

04-09-2011, 12:33 PM#1
Michael Peppers
After all this community has given me, and due to my inactivity, I thought it would be a good idea to make my most valuable resource available to everyone here, on this site.
That's right, this is and will stay a WC3C-exclusive resource. No exceptions allowed.

This is an .ai template that eases the burden of AI scripting. It has been used as a base for the Melee AIs in my project (The Withering Kind) and in Kam's Beyond The Throne. (from version 3.9.4.2 to 3.9.4.4 at least, latest version's one is "streamlined" according to the release notes so I'm not sure it's the same)

.ai scripts are pure JASS. This script is aimed at JASS/vJass coders that want to script quick 'n' dirty Melee AIs or that want to learn how to script AIs.

Its features: (and also its non-features)
  • Most common racial tasks are either fully automatized or streamlined. Namely, the AI will:
    1. Build houses automatically.
    2. Tier up when a set amount of gold and wood is reached.
    3. (added in v0.4.1) Train workers automatically with a system that covers:
      • An user defined number of them, divided in main base workers and expansion workers.
      • Having different harvesters types for gold and wood. (max. 2)
    4. Build/research/train most buildings, upgrades and units without modifications to the BuildPriorities and UpgradePriorities as long as you've set the IDs correctly. (To make the AI work right, though, you'll still have to tweak those according to the race's needs)
  • Most of the AI scripting now consists in setting global variables at the beginning of the script. Most users will only have to set variables and tweak the two functions I named above to have a fully working, competitive AI.
  • The most common racial differences (like the UD harvesting mechanics, the fact Naga can swim etc.) are supported. As always, it's a matter of setting up a couple of variables.
  • The AI can stop creating Basic Melee (Footmen) units when they're obsolete, saving food for better units, if you want to.
  • There's a basic implementation of difficulty settings.
  • The HallCount function.
  • If a variable that should store an ID is unused, set it to 0. No, the script won't crash and burn.
  • The template script is (badly) commented.
  • Uhhh.... AI scripts support 4 heroes.

Differences with Blizzard's Melee AI: (and downsides)
  • The AI will build houses quicker than the standard AI.
  • It will also (normally) start raiding creep camps later, but...
  • Will Tier up and build armies faster.
  • It will not buy Zeppelins as it is now, as it got stuck once trying to buy one. (sigh)
  • Difficulty settings for now consist in Hero and Expansion number differences. Nothing more.
  • It's able to rebuild and recover if it can.
  • Sometimes it likes to spam towers in useless positions. There's nothing I can do about it, blame Blizzard. =P
  • (Obviously) more error-prone than the standard one, it may sometimes act *weird*.
  • (Rare) If on the verge of being defeated it may enter a loop, thus start sucking memory cycles and noticeably slow down the game. If you resist a couple of minutes it will stop. (Yes, it's like a crybaby that doesn't want to admit defeat)
Expand JASS:
06-18-2011, 03:26 PM#2
Michael Peppers
If there's no one able/willing to moderate this, may I suggest sticking this resource into the "Triggers & Scripts" section?
06-18-2011, 06:20 PM#3
deolrin
Quote:
(Rare) If on the verge of being defeated it may enter a loop, thus start sucking memory cycles and noticeably slow down the game. If you resist a couple of minutes it will stop. (Yes, it's like a crybaby that doesn't want to admit defeat)
I lol'd. xD
No contributory comment, sorry, I'm a dummy when it comes to JASS, vJass, and even GUI. (And other coding languages)
I just felt the need to comment, because you seem to have put quite a lot of effort into this. :3
06-18-2011, 07:26 PM#4
Michael Peppers
You bet! =D
I spent countless hours making it this as automatized as possible with my limited JASS skills, but it's been an investment more than a loss of time.

Aaand... off for saturday night!
07-15-2011, 04:39 PM#5
Michael Peppers
Update! I noticed I forgot to implement a functionality: now the AI will create harvesters automatically using the number variables for them, instead of hardcoded numbers... dumb me, the infrastructure for this was all set, but it seems like I never got around to make use of it.

This means that the version number has been bumped up. (Now it's v0.4.1)

(And you believe me when I say that the AI I'm coding with this has took me less than 1 hour to set up and now I'm testing it?)