Author Topic: Composite AI and XML Guidelines  (Read 5935 times)

Kashlavor

  • Posts: 79
  • Spike Dodger.
    • View Profile
Composite AI and XML Guidelines
« on: September 27, 2013, 05:21:38 PM »
Hello everyone, I'm having a ton of fun coming up with my own dungeons and monsters and messing with the xmls. How does the composite AI work? I saw the post Myran made about the worm with two attacks and such, but couldn't find any other references to it.  Is there a way to give them a melee skill?

Was wondering what other valid skills there were.
Starting work on the Lair of the Archnecromantrix, a Hammerwatch campaign!

NekoBaron

  • Posts: 124
  • Scripting Wizard
    • View Profile
Re: Composite AI and XML Guidelines
« Reply #1 on: September 27, 2013, 08:29:58 PM »
The only way I know at the moment is to decompile the dll's with the game to look at the composite functions and check what possible variables they can be given but at the moment It's fairly vague if your not used to looking at pure code and references.

I think the composite class is mostly designed for ranged units and allowing a diverse skill set or there might be a way to set it up to allow it to have melee attacks. I know for sure you could fake melee attack with invisible projectiles with a short lifespan.

Kashlavor

  • Posts: 79
  • Spike Dodger.
    • View Profile
Re: Composite AI and XML Guidelines
« Reply #2 on: September 27, 2013, 08:45:22 PM »
Faking it with a short range projectile is probably what I'll do, thanks for the reply.

What sort of tools would you use to decompile the dlls?  I'm not sure how enlightening it will be to wade through dlls but I'm sure it will be an adventure.
Starting work on the Lair of the Archnecromantrix, a Hammerwatch campaign!

NekoBaron

  • Posts: 124
  • Scripting Wizard
    • View Profile
Re: Composite AI and XML Guidelines
« Reply #3 on: September 27, 2013, 08:59:31 PM »
I ended up trying out http://www.telerik.com/products/decompiler.aspx?gclid=CN61s-b2ybkCFbMbtAodmW8AzA and it seems to do just fine.

I tried converting an eye enemy into composite and giving it a blink skill.

Code: [Select]
<actor collision="5" behavior="composite" minimap="menus/minimap.xml:enemy">
<behavior>
<dictionary>
<entry name="hp"><int>80</int></entry>
<entry name="multiplayer-scale-hp"><bool>true</bool></entry>
<entry name="aggro-range"><float>15</float></entry>
<entry name="max-range"><float>20</float></entry>

<dictionary name="movement">
<string name="type">melee</string>
<float name="speed">0.6</float>
</dictionary>

<entry name="death-snd"><string>sound/monsters.xml:death_eye</string></entry>
<entry name="hit-effect"><string>effects/particles.xml:hit_eye_1_small</string></entry>
<entry name="hit-particle"><string>effects/particles.xml:particle_eye_1_small</string></entry>

<array name="skills">
<dictionary>
<string name="type">blink</string>
<int name="cooldown">2500</int>
<float name="range">6</float>
<string name="sound">sound/misc.xml:spawn_tele</string>

<float name="dist">-4</float>
<string name="effect">effects/particles.xml:flash</string>
</dictionary>

</array>

</dictionary>
</behavior>


<!-- Idle -->
<sprite scale="16" random-start="true" name="east">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="250">40 20 20 20</frame>
<frame time="250">100 20 20 20</frame>
</sprite>

<sprite scale="16" random-start="true" name="northeast">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="250">40 0 20 20</frame>
<frame time="250">100 0 20 20</frame>
</sprite>

<sprite scale="16" random-start="true" name="north">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="250">20 0 20 20</frame>
<frame time="250">80 0 20 20</frame>
</sprite>

<sprite scale="16" random-start="true" name="northwest">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="250">0 0 20 20</frame>
<frame time="250">60 0 20 20</frame>
</sprite>

<sprite scale="16" random-start="true" name="west">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="250">0 20 20 20</frame>
<frame time="250">60 20 20 20</frame>
</sprite>

<sprite scale="16" random-start="true" name="southwest">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="250">0 40 20 20</frame>
<frame time="250">60 40 20 20</frame>
</sprite>

<sprite scale="16" random-start="true" name="south">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="250">20 40 20 20</frame>
<frame time="250">80 40 20 20</frame>
</sprite>

<sprite scale="16" random-start="true" name="southeast">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="250">40 40 20 20</frame>
<frame time="250">100 40 20 20</frame>
</sprite>


<!-- Walk -->
<sprite scale="16" name="east-walk">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="150">160 20 20 20</frame>
<frame time="150">220 20 20 20</frame>
</sprite>

<sprite scale="16" name="northeast-walk">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="150">160 0 20 20</frame>
<frame time="150">220 0 20 20</frame>
</sprite>

<sprite scale="16" name="north-walk">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="150">140 0 20 20</frame>
<frame time="150">200 0 20 20</frame>
</sprite>

<sprite scale="16" name="northwest-walk">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="150">120 0 20 20</frame>
<frame time="150">180 0 20 20</frame>
</sprite>

<sprite scale="16" name="west-walk">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="150">120 20 20 20</frame>
<frame time="150">180 20 20 20</frame>
</sprite>

<sprite scale="16" name="southwest-walk">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="150">120 40 20 20</frame>
<frame time="150">180 40 20 20</frame>
</sprite>

<sprite scale="16" name="south-walk">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="150">140 40 20 20</frame>
<frame time="150">200 40 20 20</frame>
</sprite>

<sprite scale="16" name="southeast-walk">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="150">160 40 20 20</frame>
<frame time="150">220 40 20 20</frame>
</sprite>


<!-- Attack -->
<sprite scale="16" name="east-attack">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="150">40 80 20 20</frame>
<frame time="150">100 80 20 20</frame>
</sprite>

<sprite scale="16" name="northeast-attack">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="150">160 0 20 20</frame>
<frame time="150">220 0 20 20</frame>
</sprite>

<sprite scale="16" name="north-attack">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="150">20 60 20 20</frame>
<frame time="150">80 60 20 20</frame>
</sprite>

<sprite scale="16" name="northwest-attack">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="150">120 0 20 20</frame>
<frame time="150">180 0 20 20</frame>
</sprite>

<sprite scale="16" name="west-attack">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="150">0 80 20 20</frame>
<frame time="150">60 80 20 20</frame>
</sprite>

<sprite scale="16" name="southwest-attack">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="150">120 40 20 20</frame>
<frame time="150">180 40 20 20</frame>
</sprite>

<sprite scale="16" name="south-attack">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="150">20 100 20 20</frame>
<frame time="150">80 100 20 20</frame>
</sprite>

<sprite scale="16" name="southeast-attack">
<texture>actors/eye_1.png</texture>
<origin>10 12</origin>
<frame time="150">160 40 20 20</frame>
<frame time="150">220 40 20 20</frame>
</sprite>
</actor>

It goes up to you and blinks behind you every few seconds but I can't find a way to give it a normal melee attack using the default methods.

Kashlavor

  • Posts: 79
  • Spike Dodger.
    • View Profile
Re: Composite AI and XML Guidelines
« Reply #4 on: September 27, 2013, 09:32:40 PM »
Pretty much what I was thinking of, as it stands though I think its more than dangerous enough to torment my friends with when we play co-op. 

I guess we'll have to stick to some sort of workaround by giving it a ranged attack with only 0.5 range or so.
Starting work on the Lair of the Archnecromantrix, a Hammerwatch campaign!