How do you program AI with Lua?

Member
Posts: 116
Joined: 2005.02
Post: #1
Ok, I've gotten the basics of Lua down. Now, how do I program AI with it?

Last login: Sat Aug 6 09:15:05 on console
Welcome to Darwin!
Matt-Chelens-Computer:~ matthew$
Quote this message in a reply
Member
Posts: 567
Joined: 2004.07
Post: #2
one can program AI in any language. Think about what you would do in the enemies position, then implement it.

It's not magic, it's Ruby.
Quote this message in a reply
Member
Posts: 116
Joined: 2005.02
Post: #3
ok, that advice helps but I mean how as in how do you automate it without having to use more keys?
(I'm not looking for sample code just what type of command I should use)

Last login: Sat Aug 6 09:15:05 on console
Welcome to Darwin!
Matt-Chelens-Computer:~ matthew$
Quote this message in a reply
Member
Posts: 567
Joined: 2004.07
Post: #4
you just draw it's position on the screen... Have you thought through how the game works? the player is drawn on the screen at pos x and pos y, and the coords change when you press a key, but it can also change without keypresses.

It's not magic, it's Ruby.
Quote this message in a reply
Member
Posts: 116
Joined: 2005.02
Post: #5
Ok, thanks Nayr

Last login: Sat Aug 6 09:15:05 on console
Welcome to Darwin!
Matt-Chelens-Computer:~ matthew$
Quote this message in a reply
jspoon
Unregistered
 
Post: #6
First paint your head red. Then take your shirt off to expose your manly chest. Next, get some boxing gloves, or if you don't have boxing gloves, oven mitts will do. Next, duct tape some aluminum foil to some twine. And finally, get your mom to program you an AI.

Seriously, whole books have been written about the subject of writing AIs. Try your local library or look for reviews online. If you're feeling really lucky, look for a tutorial online that is doing more or less what you want.

A lot of artificial intelligence research revolves around making chat bots that can pass for humans-all of this will probably be useless for you. Instead, you want something that can learn the rules of your game and make good moves accordingly. As such, it might be easiest to write your game with human input first and get it working so you know what your AI will have to do before you start writing it.
Quote this message in a reply
Moderator
Posts: 522
Joined: 2002.04
Post: #7
http://www.oreilly.com/catalog/ai/ is decent if you're new to the subject

-Jon
Quote this message in a reply
Member
Posts: 116
Joined: 2005.02
Post: #8
@jspoon:
jspoon Wrote:First paint your head red. Then take your shirt off to expose your manly chest. Next, get some boxing gloves, or if you don't have boxing gloves, oven mitts will do. Next, duct tape some aluminum foil to some twine. And finally, get your mom to program you an AI.
Sounds like that weird mexican wrestler dude off of Homecop Drekelstein or whatever...I think his name was Crud Bag...A friend told me about whatever it was 2 years ago and haven't been there since

@Graveck: I'll try it

Last login: Sat Aug 6 09:15:05 on console
Welcome to Darwin!
Matt-Chelens-Computer:~ matthew$
Quote this message in a reply
Apprentice
Posts: 12
Joined: 2005.05
Post: #9
Quick and dirty AI "tutorial"

1) Register some c/c++ function to LUA. These functions should return different stuff like position, direction, health, list of other objects (the player, other enemies, etc) close to the current object (sorted if needed), etc. Other functions to set different stuff to, like Move( int xoff, int yoff), Shoot(), Turn(), etc.

2) Start writing lua code. Run away if health is low, shoot the player if he/she is nearby, duck for cover if someone is shooting this way, etc.

3) profit.


And the red headed guy with no shirt and boxing gloves could also be Strong Bad. http://www.homestarrunner.com/sbemail.html

EDIT: Oh, and hello. This is my first post. Smile
Quote this message in a reply
Member
Posts: 168
Joined: 2004.10
Post: #10
Hi deps!
Firstly: Welcome to the forums, and enjoy your stay!

Secondly, this is a rather old thread so it didn't really need to be resurrected. Thirdly, Blorx2 doesn't really mean lua. He means how to implement AI in a programming IDE like xcode that uses a type of lua as it's scripting language. He then looked up lua, which didn't cover half the stuff on the actual IDE, as the IDE uses specific methods of displaying graphics and whatnot.
I doubt if he has made a window that stays up - many people haven't Wink
Quote this message in a reply
Apprentice
Posts: 12
Joined: 2005.05
Post: #11
Quote:Firstly: Welcome to the forums, and enjoy your stay!
Thank you. Smile

Quote:this is a rather old thread so it didn't really need to be resurrected.
D'oh. When I posted I looked more at the day in the month than the actual month the message was posted. Annoyed
I will be more careful in the future. Wink
Quote this message in a reply
Member
Posts: 168
Joined: 2004.10
Post: #12
I've seen much older gravedigs than this, so I really don't think you will get penalised for doing so here, especially considering you're new Smile

It seems you've had some experience with Lua by the looks of your post. Have a look here to see the IDE Blorx was referring to.
Quote this message in a reply
Member
Posts: 116
Joined: 2005.02
Post: #13
OH! Hi, deps, welcome Grin . Yeah, I remember Homestar...that was funny...Also, I now know more about AI, I've talked to a few people about it

Last login: Sat Aug 6 09:15:05 on console
Welcome to Darwin!
Matt-Chelens-Computer:~ matthew$
Quote this message in a reply
Post Reply