Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[2.2]Programmable AI via scripting
#1
Quick Steps! (Thanks to Azriel)
Quote:quick steps:
1. put the dll in the lf2 folder (i.e. /lf2/ddraw.dll).
2. make a folder "ai" in the lf2 folder (i.e. /lf2/ai)
3. in this ai folder, any [id].as files ([id] being the id of ur char) will be used as an ai script for ur char, so you'll have 13.as for an id 13: char.
4. start coding.

2.2:
Someone else Wrote:Updated!
Version 2.2

The rand() function now works correctly with replays.
Added weapon_num.


Download: http://www.mediafire.com/?pxd026nqoqgw0

2.1:
2.0:
1.2:

1.1:
1.0:
0.6
0.5:
0.4:
0.3:
0.2:
Original Post:
[Image: doty7Xn.gif]

10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.


Reply
#2
cool. is it possible to have access to self's frame_number or an ally/enemy's frame_number?

the possibilities with that will be cool for tag team moves with computer players, and/or story modes where you can get AI to walk to specific places and do actions
i thought ".chai" was short for char-ai till i read the post again



Azriel~
<table><tr><td><a href="http://heroquest-silver.blogspot.com/"><img style="border: #000000 solid 1px" src="http://i1.ytimg.com/vi/6UjfBvNBUIA/mqdefault.jpg" height="100" /></a></td><td><table style="font-size:11px;font-family:Arial;font-weight: bold;"><tr><td valign="top" colspan=3>
(12-31-2009, 08:43 AM)Blue Phoenix Wrote:  over 99% will not be able to do this before their 20th birthday.
</td></tr>
<tr><td colspan=3>
<div style="border-top:2px solid #FFFFFF;border-bottom: 2px solid #FFFFFF;background-color:#000000;text-align: center;">
Hero Quest [Check In] 14th June 2014
</div>
Legend tells of a deadly group of fighters who would come in 3 terrifying waves
The first wave is here.</td></tr></table></td></tr></table>
Reply
Thanks given by:
#3
not yet azzy but after id specific chais are done its on the todo list like many other parameters

heres a very simple general AI i just wrote to test everything a little:

Code:
//D>A long ranged
if ((target_y - self_y)*(target_y - self_y) < 100) {
if ((self_x - target_x) > 100) {
if ((self_x - target_x) < 600) {
    DlA()
}}
if ((target_x - self_x) > 100) {
if ((target_x - self_x) < 600) {
    DrA()
}}}

//D>J and DJA mid ranged
if ((target_y - self_y)*(target_y - self_y) < 81) {
if ((self_x - target_x) > 50) {
if ((self_x - target_x) < 300) {
    DlJ()
}}
if ((target_x - self_x) > 50) {
if ((target_x - self_x) < 300) {
    DrJ()
}}
if ((self_x - target_x) > 100) {
if ((self_x - target_x) < 400) {
    DlJ()
}}
if ((target_x - self_x) > 100) {
if ((target_x - self_x) < 400) {
    DrJ()
}}}

//DvJ low health
if (self_hp < 250) {
DdJ()
}
//D^J high health
if (self_hp > 250) {
DuJ()
}

//DvA and D^A short ranged
if ((target_y - self_y)*(target_y - self_y) < 64) {
if ((target_x - self_x) < 50) {
if ((target_x - self_x) > 0) {
if (self_facing == 0) {
DdA()
}}}
if ((self_x - target_x) < 50) {
if ((self_x - target_x) > 0) {
if (self_facing == 1) {
DdA()
}}}
if ((target_x - self_x) < 50) {
if ((target_x - self_x) > 0) {
if (self_facing == 0) {
DuA()
}}}
if ((self_x - target_x) < 50) {
if ((self_x - target_x) > 0) {
if (self_facing == 1) {
DuA()
}}}}

owns me pretty badly with many chars

edit: facing might not work in the first download yet but its already fixed
and there is also D() A() J() but i cannot confirm them to be working yet
and left() right() up() down() still need to be fixed
Reply
Thanks given by:
#4
The syntax is a combination of python and c++. Experimenting now XD
questions:
Does this work only for AI?. I mean can we make states and other things with it in the future?. I don't know but it sounds possible.

And YINYIN! can you please post what these letters/shortcuts means.
Edit:@Azriel: troll? why would I troll. Thanx anyway for clarification.

Azriel edited this post 06-09-2012 12:07 AM because:
can't tell if trolling or not. DrA() == defend right attack. DuA() == defend up attack. etc.
[Image: signature.png]
A-Engine: A new beat em up game engine inspired by LF2. Coming soon

A-Engine Dev Blog - Update #8: Timeout

Reply
Thanks given by:
#5
Hell yeah, finally something to turn random additional chars into killer additional chars :3
My Creations: (Click to View)

Return (String) System.getNewsOfTheDay();
Barely active, expect slow responses. If at all.


Greetz,
Alblaka
Reply
Thanks given by: mfc
#6
i can already imagine "_player1_ style ai" vs "_player2_ style ai" competitions. or maybe, "upload your best ai" competitions that get run through an unknown stage :p.
that's something i would put effort into.



Azriel~
<table><tr><td><a href="http://heroquest-silver.blogspot.com/"><img style="border: #000000 solid 1px" src="http://i1.ytimg.com/vi/6UjfBvNBUIA/mqdefault.jpg" height="100" /></a></td><td><table style="font-size:11px;font-family:Arial;font-weight: bold;"><tr><td valign="top" colspan=3>
(12-31-2009, 08:43 AM)Blue Phoenix Wrote:  over 99% will not be able to do this before their 20th birthday.
</td></tr>
<tr><td colspan=3>
<div style="border-top:2px solid #FFFFFF;border-bottom: 2px solid #FFFFFF;background-color:#000000;text-align: center;">
Hero Quest [Check In] 14th June 2014
</div>
Legend tells of a deadly group of fighters who would come in 3 terrifying waves
The first wave is here.</td></tr></table></td></tr></table>
Reply
Thanks given by: A-Man
#7
Updated. See first post for info and download.
[Image: doty7Xn.gif]

10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.


Reply
Thanks given by:
#8
Here is a suggestion:
I think u should add an armor in your todo list. Atleast if this is even possible using the above method.
[Image: signature.png]
A-Engine: A new beat em up game engine inspired by LF2. Coming soon

A-Engine Dev Blog - Update #8: Timeout

Reply
Thanks given by:
#9
(06-09-2012, 02:37 PM)A-MAN Wrote:  Here is a suggestion:
I think u should add an armor in your todo list. Atleast if this is even possible using the above method.

What? How does that have anything to do with AI...

Quote:PS: If you post useless things I will kill you.

Seriously, please think before posting things.
[Image: doty7Xn.gif]

10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.


Reply
Thanks given by:
#10
(06-09-2012, 02:56 PM)Lord Silva Wrote:  
(06-09-2012, 02:37 PM)A-MAN Wrote:  Here is a suggestion:
I think u should add an armor in your todo list. Atleast if this is even possible using the above method.

What? How does that have anything to do with AI...

Could be useful for characters who have single and multi-hit attacks... former one won't damage Armor'd characters, latter one do.
I assume you mistook his request for the capability to add armor to specific char ID's, I think he just wants something to determine the target's armor level (similar to fall, frame, etc).

Btw, how about the ability to react differently to specific (target) IDs?
My Creations: (Click to View)

Return (String) System.getNewsOfTheDay();
Barely active, expect slow responses. If at all.


Greetz,
Alblaka
Reply
Thanks given by: A-Man




Users browsing this thread: 1 Guest(s)