Tutorial : How to play against ai

Started by redspike474, February 27, 2010, 02:26:50 AM

Previous topic - Next topic

redspike474

Hello,
                 i have been doing some research into Ai in starcraft 2, im sure now everyone has played lazytowns sandbox mod, which is great, big thanks to them,
your probally borred of playing against yourself,
here i will explain how to edit a map file to add ai.

Currently the ai only attack you if you attack them, and do not come looking for you or build ect, so they are kind of brain dead. maybe you would say not even ai? however its a step further than playing with yourself.

first you will need a mpq editor.

use your mpq editor to open the map you wish to add ai to,
find and extrac the file called objects.file

open this file in notepad.

this file is a file generated by the sc2 map editor, it contains the location of all the maps objects such as minerals gas rocks watch towers ect. but also could contain units heros buildings effects ect. to add a unit to the objects list you must use the correct name for the unit .

here is a example. this line places a highyeild mineral filed at the specifyed location.

<Unit id="66" variation="7" position="49,86.5,0" scale="1,1,1" unitType="HighYieldMineralField">

if you modify it to this

  <Unit id="66" position="49,86.5,0"  scale="1,1,1" unitType="Zealot" player="2"/>
adding the player="2" stops the unit from being neutral.

other options you can experiment with are
Variation
scale
rotation
let me know if you find any others, you can use this to add buildings critters anything to your map. tricky part is working out the positions.
Does anyone know a debug way of showing position of the cursor?

once you have edited you objects file, readde it to the s2ma file .replaceing the original,
then run your m ap with lazytown !

hopefully using this method we can create some maps that are more intresting than playing on our own.

Also ive figured out alot more for custom mods. such as for each map u can have custom units , custom upgrades ,and its very easy to change the atmosphere of a map, all can edited per map with out effecting other maps wich is really cool and loads of possibiltys for mods.

Also i have been looking into gettin ai to work correctly.
firstly im not sure exactly what the lazytown crack does, does it just boot you into a melee  game?  does it say victory when u start because there is no ai player, there for you have won?
anyways i have asumed that the reason for the ai not apearing is because the maps are not setup for or are not triggering  ai to spawn when the map is loaded,
You can edit the .galaxy script files but as of yet i havent managed to get ai that think, they just stand there,
if anyone that knows more about the galaxy scripting would like to help, than please do,
maybe we need to just setup the maps correctly.
this is just speculation though.

anyways its really really late here 7 in the morning. so i probally have done a bad job at typeing all this, i just thought people might like to play against some computer before i go to sleep.
im more than happy for a mod to edit my post , as i really am half asleep whilst i type this.
here is a pic showing it working. in the picture i have replaced the watch towers with Zelots, as you can see they attack when i get close.

Rain[sun]

#1
Didnt test it out but, props if you got it, wont be very hard id imagine to get a fully functioning player now

Edit: You could probably do some major editing and create a zombie-base to siege, which could definitely keep me entertained till a fully functioning crack comes out, will see what I can come up with when I get on tomorrow!

As you mentioned with the possibilities, that is what the designers hinted at about the Editor having limitless possibilties, nice to know it wasnt all talk for once
better wear your shades, the spotlights here can burn holes through the stage

MiCrOMaN1

#2
Yo! You got it bro! It works fine~
So far I've created an entire Terran base as an AI lol...too bad it doesn't do anything.
Hmm...Did you know that if you open up the trigger file using MPQ extractor, you can edit the triggers...but you need to know its ID...so that won't help. LoL.
Our Greatest Resource is Our Mind ~ Kareem Abdul-Jabbar
Check this: http://img123.exs.cx/img123/4497/gif1.gif

openheimer

Oh sweet, could you post your objects.file or map file so we could mess around with it without creating one of our own?


If anyone else creates one that they enjoy, would you mind posting it? I know it's not much at all but it can give me something to mess around with for little bit.


Thanks

sYk0

@redspike474: Nice find, very nice indeed :D

I started messing around with the map files a few mins ago and have already found something very interesting, which i'm sure all of you will find interesting too.

All I did was add a (one) command to the MapScript.galaxy file and have managed to spawn a second base (without editing the "objects.file")

Some key things you may want to take note of:

       
  • The second base is mine and is NOT the AI.
  • The second base is spawned right next to my current (first) base.
Technically, all I did was create an additional loop in the "MapScript.galaxy" file, which made it initialize twice.

But hey, it's a starting point.

Rain[sun]

True enough, just copying the file here will save everyone else some time, if it isn't done tomorrow then I'll post what I can get!
better wear your shades, the spotlights here can burn holes through the stage

lovetoby

hi guys mabe we schould compare sc1 trigger and put them into trigger files ill play with it now... an i thin beginning here and writing a few startoptions would be nix progress so i thing the uni id could let the unit walk over to som coordinates ... just triggering no ai but the native ai will start if they see non friendly one?! http://nopaste.info/ef673f53a3.html

ups

Can you please put a link to were to download the map editor.

I tried to open the .s2ma with regular mpq editors ... but it did not open.

lovetoby

Quote from: ups on February 27, 2010, 04:35:29 AM
Can you please put a link to were to download the map editor.

I tried to open the .s2ma with regular mpq editors ... but it did not open.

EDITOR
http://www.zezula.net/en/mpq/download.html

Maybe someone can tell me the Terrain - Thor Unit Id and attributes?

Blackcode

I think we should dig into this even more.... i'll ask for a wiki place to start developing.....

the AI is initialized from the map so teoreticalli we've could build custon AI maps

    if (runActions) {
        MeleeInitResources();
        MeleeInitUnits();
        MeleeInitAI();
        MeleeInitOptions();
    }

Blackcode

Quote from: lovetoby on February 27, 2010, 04:35:14 AM
hi guys mabe we schould compare sc1 trigger and put them into trigger files ill play with it now... an i thin beginning here and writing a few startoptions would be nix progress so i thing the uni id could let the unit walk over to som coordinates ... just triggering no ai but the native ai will start if they see non friendly one?! http://nopaste.info/ef673f53a3.html

I think the most closed parent to sc2 is war3 not sc1

dodongbadong

#11
i agree with blackcode..

the setting and unit handling is quite war3 though its in sc background. . well its a combination of the two. but definitely the economy is sc. hahaha.

man i cant wait playing online or atleast a good ai to understand more about the game. hehe

but i think multiplayer on own server is much better playing against other darkblizz would much more be fun too bad no one has any idea on how to make 1 yet since almost all of us have not played on real server coz of beta key thingy.. hehe

or not really server may be a lan like hamachi style or changing the server to connect to.. eeerrrr cant understand my self anymore on what to do to have a possible multiplayer game with beta..
You make your best AI script "cheating or not"
and ill test it for you
- FREE-

araknee

if someone manages to make an AI map, please post it here^^
thx

ooni

#13
Quote from: Blackcode on February 27, 2010, 04:51:02 AM
I think we should dig into this even more.... i'll ask for a wiki place to start developing.....

the AI is initialized from the map so teoreticalli we've could build custon AI maps

    if (runActions) {
        MeleeInitResources();
        MeleeInitUnits();
        MeleeInitAI();
        MeleeInitOptions();
    }

Hate to burst people's bubble but MeleeIntAI() is the same as the JASS (wc3 language) for intialising a computer player.
What it does is looks if there is a computer slot and assign's to that slot with AI.
^The very thing we need to do, oh the irony~

What we need is simple, use galaxy to create starting units for player 2 and set AI to the player. I could do this in JASS but I do not know the functions names in galaxy. If anyone has list of functions I'll be happy to do this~ But if someone did have the list of functions, this would have been already done.

Well we can deduce that from the following galaxy code that
        MeleeInitResources(); This function gives each player in slot starting resources for melee (50 minerals)
        MeleeInitUnits(); This function gives each player in slot starting units (workers and base)

etc and etc

useruseryey

#14
This is WORKING!
I'm making a huge zerg fleet to hit 10 static marins and one thor standing in the corner lol...

anyone up for making a map with a full base with bunkers, turrets and whatever? is it doable? still not really AI but at least some sort of simulation on attacking a baseץץ