Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

The 20 Line Challenge / My first AI code working 100% only in 20 lines!

Author
Message
The Nerd
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 5th Jan 2005 04:26 Edited at: 5th Jan 2005 04:28
Hi.


i have just made my first AI EVER!!

But it is still really good(i think).

*Controls* :

Control the green box using:

Upkey = move forward
downkey = move backwards
leftkey = move left
rightkey = move right

And then a red box will follow you!


If you wanna try it then here is the code:
(compressed version) :



Here is the version with comments:




Hope you all like it



The Nerd


looking for Royalty free 3D objects?
then Check PanzerGames at this link : http://www.freewebs.com/panzergames
Nosnevel Xela
19
Years of Service
User Offline
Joined: 14th Dec 2004
Location: MA, USA
Posted: 7th Jan 2005 02:17
I hate to tell you that this can be done in about 10 lines...



I wouldn't really count this as AI either. Anyway, it is definately a useful technique for getting one object to follow another.

I am who I am
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 8th Jan 2005 03:09
It is AI. Just very simple.

The Nerd
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 8th Jan 2005 03:31
Yeah i know its simple but as i say its my first AI code ever



The Nerd


looking for Royalty free 3D objects?
then Check PanzerGames at this link : http://www.freewebs.com/panzergames
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 8th Jan 2005 05:00
Good point for discussion, though - what is AI and what isn't? I would have said this isn't AI, because I think AI means it has to have the appearance of some form of intelligence. And something that follows something else (like for example a caravan on the back of a car) doesn't to me display 'intelligence' - it is merely a physical process.

If you could get it to follow you whilst avoiding obstacles - then that would be AI in my book, because it would have the appearance of making decisions - ie which is the best way around the obstacle.




The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 8th Jan 2005 17:28
AI is basically anything where the computer reacts intelligently to an event. Now the question is "Define intellegence". In the context, The Nerd's code is very much AI. As it turns out, the computer doesn't have to react that intellegentally (see I can't spell, but I'm intelligent!) to be considered AI. Btw The Nerd, coming from a background of QBASIC, that code would have been a LOT harder to have accomplished. So be happy that the world is more simple now and AI is easier to obtain .


Home of DOOP, Strata Works, and Height
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 8th Jan 2005 21:03
The following object is not attached to the player object so it is not just a physical motion. Therefore, the computer is working out where the player is and making the other object follow it; AI.

Essence
22
Years of Service
User Offline
Joined: 12th Oct 2002
Location: The Netherlands
Posted: 8th Jan 2005 22:17
Ric, your right. AI is more like that object(characters) can think and make decissions.

If you give a character the command to follow (in-game) then the character needs to make a decission to follow you or not. Or in a deathmatch game, the bots needs to decide wich other player/bot they want to attack.

Thats real AI.

Even better is, that your program can learn from itself. I'm trying that too, its a bit hard though.


First DifNiX -> now EvaX.
Neofish
20
Years of Service
User Offline
Joined: 7th Apr 2004
Location: A swimming pool of coke
Posted: 11th Jan 2005 05:39
I agree with Ric, if the Nerd can make it dodge obsticles (can't spell) or work out the quickest route to the object then I'll be more impressed (seeming as I don't know how to do that )

Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 12th Jan 2005 08:50 Edited at: 12th Jan 2005 08:55
Quote: "Therefore, the computer is working out where the player is and making the other object follow it; AI."


Point taken, although I don't think AI is anything to do with how the computer is working something out - it's only to do with how it's behaviour appears on the surface. We all know that under the surface, there is no intelligence there. But if it appears to a human observer that it is behaving in an intelligent way, then it has AI (The same sort of principle as the Turing test for intelligence).

In this case, it appears to be a physical process, as it follows the other object no matter what. If this is AI, then so would a train be said to possess AI, as it follows the direction of the track. The way they work is different, but on the surface, the two things are the same to an observer

p.s. I watched IRobot, so I'm an expert.


dj blackdragon3710
20
Years of Service
User Offline
Joined: 5th Nov 2004
Location: In LaLa land
Posted: 12th Jan 2005 11:02
@Ric: lol.Nice. Ghosts in the code.

@nerd: Hey I see that your learning well. Keep it up.

It has been said that the body is a slave to the mind. Only the mind knows no freedom.
The Nerd
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 13th Jan 2005 00:21
Thanks for the comments guys!


I have made a little AI Engine.

There is also a new update you can see it here:

http://forum.thegamecreators.com/?m=forum_view&t=45721&b=6



The Nerd


looking for Royalty free 3D objects?
then Check PanzerGames at this link : http://www.freewebs.com/panzergames
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 20th Jan 2005 06:57
For obstacle avoidance and stuff check out IanM's A* routines and my version that I ported to make it DBC compatable

Hi
Turoid
21
Years of Service
User Offline
Joined: 1st Nov 2003
Location: The Netherlands
Posted: 22nd Jan 2005 04:31
where can i find your dbc version mattman?

Login to post a reply

Server time is: 2024-11-24 03:01:52
Your offset time is: 2024-11-24 03:01:52