Wc3C.net

Wc3C.net (http://www.wc3c.net/forums.php)
-   - Submit a resource - (http://www.wc3c.net/forumdisplay.php?f=637)
-   -   [Script, AI] Michael Peppers's Melee AI template (http://www.wc3c.net/showthread.php?t=110217)

Michael Peppers 04-09-2011 12:33 PM

[Script, AI] Michael Peppers's Melee AI template
 
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. 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)
    5. (added in v0.5) Can focus on either researching upgrades or tiering up, depending on FocusTiering's value.
  • Most of the AI scripting now consists in setting constants 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.
  • IDs aside, all constants are already set to values that should work fine with most races.
  • 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.
  • (added in v0.5) Easy and Normal difficulties are handled just like standard AI does.
  • (added in v0.5) New Attack function, it's more streamlined, almost identical to standard AI and... it buys Zeppelins! Woot! (disabled by default because it makes the AI do pretty reckless stuff at times, but other than that it's fine)
  • The HallCount function. :emote_wink:
  • 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 & bugs or other misc notes:
  • The AI will build houses quicker than the standard AI.
  • Will Tier up (if not focusing on upgrades) and build armies faster.
  • Will actually research upgrades (standard AI gets stuck on that at times :roll: )
  • It will not buy Zeppelins as it is now, it does with SimpleAttack enabled, but it doesn't use them anyway, so...
  • Hard and Insane difficulties for now consist in Expansion number differences. Nothing more. (might be on par with what Blizzard did actually. Maybe even better)
  • It's able to rebuild and recover if it can.
  • Building placement can be weird. There's nothing I can do about it, blame Blizzard. =P
Expand JASS:

Michael Peppers 06-18-2011 03:26 PM

If there's no one able/willing to moderate this, may I suggest sticking this resource into the "Triggers & Scripts" section?

deolrin 06-18-2011 06:20 PM

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

Michael Peppers 06-18-2011 07:26 PM

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!

Michael Peppers 07-15-2011 04:39 PM

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?)

Michael Peppers 12-02-2018 01:21 AM

Shameless necro-bump-update!

This new version (v0.5) includes:
- Focus on either tiering up or upgrades
- An alternative attacking function that probably works better than the old one, it's disabled but can be enabled by changing a variable
- Easy and Normal difficulty are just like Blizz's good ol' (bad) AI
- Bugfixes, better and leaner code, some useless stuff removed, other stuff added


All times are GMT. The time now is 07:18 PM.

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services