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.

DarkBASIC Discussion / AI scripting

Author
Message
t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 10th Sep 2009 05:27 Edited at: 10th Sep 2009 05:28
It's a function.

Read this if you need to:

http://forum.thegamecreators.com/?m=forum_view&t=96040&b=7

A good game is one percent inspiration, ninety-nine percent perspiration.
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 10th Sep 2009 05:27 Edited at: 10th Sep 2009 05:29
ok, a function declaration is the first part of a function (u know what a function is right?) where the word FUNCTION is

is the program hits this then it errors out, as it did to u

what BB posted isnt a stand alone code, it is a fragment that he wants u to use for enemy movement

[edit] lol razer, nice link

t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 10th Sep 2009 05:30 Edited at: 10th Sep 2009 05:32
Ya, I did'nt feel like explaining it.

EDIT:

Look what I dug up:

http://forum.thegamecreators.com/?m=forum_view&t=147570&b=10

A good game is one percent inspiration, ninety-nine percent perspiration.
Brick Break
User Banned
Posted: 10th Sep 2009 05:33
Thanks, I'm glad I didn't have to explain it to him. You don't just pop it into the editor and whack the F5 key.

Quote: "[quote]She should post screens, to benefit the other members"

Hmmm I'm a lil scared how others may benefit from this lol [/quote]
pictionaryjr
15
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 15th Sep 2009 00:41
hey sorry for bringing this up again, but with the recent challenge for ai coding and this topic i thought it might help if i posted something i made a while back. my internet has been down so i wasnt able to post it earlier.

Here's an example of simple ai. probably not the best one but it works.

Use the mouse to control the blue circle and try to run from the red one. both circles use ai:

Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 15th Sep 2009 05:36
well to me the blue circle doesnt use AI,it just follows the mouse,the red one ,im not sure because all it does is just follow the blue circle,i know im still learning AI but that is just my opinion,please correct me if im wrong.

yeah im southern WATCHA GONNA DO BOUT IT?
pictionaryjr
15
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 15th Sep 2009 05:48
the only ai it uses is to tell if an object is in front of it and try to find a way around it. besides that all it does do is follow the mouse. but the fact that it can tell the object is there proves it has some sort of ai. I was just trying to show the simplest form of ai.
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 16th Sep 2009 02:22
That's a great start Well in my opinion lol, It is one of the simpler forms of AI, just following something. heck that's all the monster hunt tutorial is!

as has been stated, AI is creating the illusion of inteligence. well you have to have some intelligence to follow something(and find a way around something) so it is AI

New Site! Check it out \/
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 16th Sep 2009 04:18 Edited at: 16th Sep 2009 17:20
Well here's the definition of AI:
Quote: "a_i [ah-ee] -noun, plural a_is [ah-eez]
A three-toed sloth, Bradypus tridactylus, inhabiting forests of southern Venezuela, the Guianas, and northern Brazil, having a diet apparently restricted to the leaves of the trumpet-tree, and sounding a high-pitched cry when disturbed."

No wait that's just a hilarious coincidence

Quote: "artificial intelligence
The ability of a computer or other machine to perform actions thought to require intelligence. Among these actions are logical deduction and inference, creativity, the ability to make decisions based on past experience or insufficient or conflicting information, and the ability to understand spoken language."

Based on that definition, simply moving one object towards another isn't AI as there is no decision being made. Add conditions to the object's movement and you have AI.
A simple example would be to only move the object if its target is within a certain proximity.

TGC Forum - converting error messages into sarcasm since 2002.
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 16th Sep 2009 15:39
wow obese that was the most helpful post on here!

yeah im southern WATCHA GONNA DO BOUT IT?
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 16th Sep 2009 17:42 Edited at: 16th Sep 2009 17:51
@Travis
I can't tell if you're being sarcastic but you're welcome

Technically my proximity example isn't true AI either, because it represented the sight capabilities of the entity. Even though variables determine whether the entity will follow, it is not a decision the entity has made, it is a limitation of the entity's sensory perception. It's a bit confusing because we are talking about a theoretical entity that's governed by the same computer that governs the whole "world", so it's difficult to make a distinction between what are just constraints of the world and what is actually AI.
That's not to say you can't use proximity to drive AI, perhaps you want your entity to bash people when they get too close.

This has given me an idea for a game where you have a bunch of AI entities that act differently and you have to work out what they respond to.
For example: one might run away from you while another will only follow when you lead, and another will only follow if you bring one of its friends along.

TGC Forum - converting error messages into sarcasm since 2002.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 16th Sep 2009 17:54 Edited at: 16th Sep 2009 17:54
I have to double post because I ran out of space
Most of that last post is me thinking out loud so sorry if I made it more complicated than it needs to be lol

TGC Forum - converting error messages into sarcasm since 2002.
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 16th Sep 2009 19:43
What i said wasnt sarcasm,it really was the most helpful post on here, it gave the real definition of AI which in my book, helps alot.

yeah im southern WATCHA GONNA DO BOUT IT?
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Sep 2009 01:21
Quote: "What i said wasnt sarcasm,it really was the most helpful post on here, it gave the real definition of AI which in my book, helps alot."



You right! Now I'm off to model a Sloth!

Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 18th Sep 2009 01:52
Well Thats not what i meant! i meant the real Definition!
ya know
Quote: "artificial intelligence
The ability of a computer or other machine to perform actions thought to require intelligence. Among these actions are logical deduction and inference, creativity, the ability to make decisions based on past experience or insufficient or conflicting information, and the ability to understand spoken language"

That AI!

yeah im southern WATCHA GONNA DO BOUT IT?
NightX
15
Years of Service
User Offline
Joined: 3rd Apr 2009
Location: Australia, QueensLand
Posted: 9th Oct 2009 12:26 Edited at: 24th Oct 2009 10:58
What i think of AI is where the computer solely thinks by its self, learning.. I would use a Neural net.. here is a link, -

http://forum.thegamecreators.com/?m=forum_view&t=110156&b=8

Physics & AI to the MAXXXX
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 12th Oct 2009 02:11
cool!
(by The Way make it a link by highlighting the link and pressing the link button-> like this

Google.com. Nuff Said
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 12th Oct 2009 04:07
Brick Break's post was just that - a function.

You need to call the function somewhere in your loop for it to work properly.

I think Latch's description of tic tac toe was probably a good starting point. Your programs all have the user controlling what's going on. AI has the computer making decisions on it's own. Try making a basic 1-player Tic Tac Toe game and try to implement the system Latch has suggested for the computer's moves. And remember, if in doubt... Latch probably knows the answer

Seriously though, don't get over your head with AI at first, try and learn the basic principles. I've had problems with basic AI in the past (for example in Tic Tac Toe, I kind of suck at it anyway, and making the computer virtually unbeatable kind of ruins the fun)

The suggestion of having a computer controlled object avoiding another object is a good starting point. You would just have to arrange how the object was going to move, then tell it to check if it was near the object you wanted it to avoid. If it was, tell it to face away from it and start moving randomly again.

"A West Texas girl, just like me"
-Bush
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 12th Oct 2009 04:31 Edited at: 12th Oct 2009 04:33
The flight of a flock of birds I remember as a good simple AI. It made the news that a very small computer program can simulate their flight by just telling them to keep away from each other, and follow the leader. But really, anything programmed will never truly be AI. You need a neural network.

demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 12th Oct 2009 18:08 Edited at: 12th Oct 2009 18:10
Also, have you done the Monster Hunt tutorial? It's at
http://developer.thegamecreators.com/?f=t01/3d_tutorial_index
It's quite good, covers a lot of the basics, and this page specifically http://developer.thegamecreators.com/?f=t01/3d_tutorial_21 deals with a basic system for simulating AI - if the player gets within a certain distance of the enemy, the enemy aims at him and starts shooting.

Again, nothing too complex, just a computer reacting to some basic information, but it simulates intelligence.

Obviously, you have to have followed the instructions from the rest of the tutorial for this to work (if you don't have the necessary variables etc then it just won't work).

"A West Texas girl, just like me"
-Bush
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 13th Oct 2009 02:53
Ok That Sounds good to me!

Google.com. Nuff Said
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 13th Oct 2009 04:12
Quote: "But really, anything programmed will never truly be AI. You need a neural network."

I thought that's why it's called "artificial", or is that just because it's man-made and not organic.

All AI I've seen does is run through set routines and respond differently to changing inputs. A genuinely intelligent "brain" needs to be able to construct its own routines or "ways of thinking", it needs to be able to decide which data to analyse and how to analyse it.
That's what I think true intelligence is anyway.

TGC Forum - converting error messages into sarcasm since 2002.
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 13th Oct 2009 04:36
Quote: "t needs to be able to decide which data to analyse and how to analyse it."


True, But i have seen things where the enemy "Learns" things like where to go, or how to react depending on your position or style. Although, I do agree with you about the fact that it can be true AI. now real intelligence is truly impossible

New Site! Check it out \/
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 14th Oct 2009 01:09
Quote: "True, But i have seen things where the enemy "Learns" things like where to go, or how to react depending on your position or style. Although, I do agree with you about the fact that it can be true AI. now real intelligence is truly impossible "
now i know i dont really know that much about ai but i think that would be HARD to script even with DB!

Google.com. Nuff Said
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 14th Oct 2009 01:56
At one time I was really into trying to understand how to make a chess program. I always thought it would be a match of wits with the computer - how could the computer ultimately "out think" a human - impossible if the human knows what they're doing - so I thought. In my imagination, I thought that the computer would choose moves to try and set up traps like a human and also could be lured into traps itself. And then to have the computer learn from it's mistakes! That's what I was imagining.

I was wrenched from my fantasy world with the sad awakening that the most winning chess programs just use brute force. That means, they look at the pieces on the board for both sides. Each piece has a value, and arrangements and positions and captures all have a value. Before the computer makes it's move, it runs through as many possible moves for both sides as it can for as many combinations as it can based on time, processor speed and the search depth allowed, then it adds up the points for each possible move for both players, and decides what the best move is by the number of points for that move and the eventual path that it has calculated forward to. So, it doesn't think and plan - it just does something that a human can't - it goes through thousands or all or as many possibilities as it's processor will allow in a set time, and chooses the best possibility based on the most points it can gain and the least points it's opponent can gain.

It simulates intelligence, but all it's really doing is out mathing the human. A middle level chess program on any modern PC is very hard to if not impossible to beat - simply because it can choose it's moves based on many, many moves ahead.

What's the point? I guess to me, it was that the computer doesn't think. And even the best AI is not thought. It just uses math and loops to get a result based on a set of values. The computer doesn't infer, nor does it imply. It simply carries out calculations in a certain order really fast.

Enjoy your day.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 14th Oct 2009 02:09 Edited at: 14th Oct 2009 02:14
Quote: "I thought that's why it's called "artificial", or is that just because it's man-made and not organic.

All AI I've seen does is run through set routines and respond differently to changing inputs. A genuinely intelligent "brain" needs to be able to construct its own routines or "ways of thinking", it needs to be able to decide which data to analyse and how to analyse it.
That's what I think true intelligence is anyway."


Well.. what I meant was that Neural Networks always surprise their creators by doing things that were unexpected. The programmer is as surprised as we are. And that sounds very cool. Seems a bit higher level.

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 14th Oct 2009 02:30 Edited at: 14th Oct 2009 02:52
Reading about neural networks, it's quite interesting. I didn't know you could code like that.
Why does programming have to be so varied and interesting? I'll never get anything finished!

[edit]
okay I don't think I'm going to be jumping straight into this, it is slightly complicated
I've realised how to do an XOR gate in DB though

Haven't tested it but OR - AND should be XOR.

TGC Forum - converting error messages into sarcasm since 2002.
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 16th Oct 2009 20:09
what is XOR? i heard about it before cuz i was reading up on ICO files and apperantly you need a XOR bitmap

New Site! Check it out \/
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 20th Oct 2009 03:09 Edited at: 21st Oct 2009 00:52
@Caleb
XOR stands for eXclusive OR. While OR will return bits that are in either or both values, XOR only returns bits that are exclusive to either value and not common to both.
Comparing 5 and 3:
5&3 = 1 because both 1st bits (1) are on.
5|3 = 7 because 5 has 1st (1) and 3rd (4) bits and 3 has 1st and 2nd (2).
5XOR3 = 6 because 3rd bit (4) is exclusive to 5 and 2nd bit (2) is exclusive to 3.

TGC Forum - converting error messages into sarcasm since 2002.
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 20th Oct 2009 21:48
Oh ok! thanks! that's helpful.

New Site! Check it out \/
NightX
15
Years of Service
User Offline
Joined: 3rd Apr 2009
Location: Australia, QueensLand
Posted: 21st Oct 2009 12:53
Quote: "
by The Way make it a link by highlighting the link and pressing the link button-> like this
"


@Travis gatlin
Oops, i thought i made it a link


Quote: "
A genuinely intelligent "brain" needs to be able to construct its own routines or "ways of thinking", it needs to be able to decide which data to analyse and how to analyse it.
"


@Obese87
Ive been reading about nerual networks for ages an i just cant get enough! there is so much info about them. ive been thinking if you had a scripting language made in DBPro or c++ and then into a dll or some thing, so the neural can write/edit/delete basic code to change its self, only basic stuff.

Physics to the MAXXXX
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Oct 2009 17:30
@NightX
I couldn't understand a lot of it but neurons seems to be like logic gates. Changing the connections is the weird and complicated part.
Have you attempted anything like this?

TGC Forum - converting error messages into sarcasm since 2002.
NightX
15
Years of Service
User Offline
Joined: 3rd Apr 2009
Location: Australia, QueensLand
Posted: 23rd Oct 2009 12:49 Edited at: 23rd Oct 2009 15:28
@Obese87
nah, ive been thinking about it, i want to make a program called "Animal AI", and im thinking about adding a neural network for the animals, but in not sure about it yet.

Ive come accross some simple neural net tutorials(how they work), ill see if i can dig one up. i had a whole folder of book marks about neural nets..

EDIT :

HEY!!! , i found some videos on neural nets, he explains it well, the videos are for c#, but you only need to listen to the bits (which is like all of it) that is about how the neural net works. look at his other videos he has made. the first and second are pretty boring but the rest are pretty good, but still listen to them, here is the link : http://www.youtube.com/watch?v=966b0IgA3DA&feature=related

also there are 16 classes and afew parts in every class. so once you have watched like EG part 4/4 got to the next class.

Here is his space thing with all of his videos and every thing : http://www.youtube.com/profile?user=HeatonResearch#grid/uploads

Physics & AI to the MAXXXX
Neuro Fuzzy
16
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 24th Oct 2009 08:14
If you're interested in neural nets, search the forum for the ANNE WIP, it was programmed in DBPro, and demonstrates neural networks. It's a pretty cool piece of software

Still, for animals, i think a neural network is a bit overkill just for making something cool (it would take a lot of work to implement and may not work the way you want it to). For animals, i would just do this:

1. Get a list of attributes for a creature, might include stats like health/resilience, speed, agressiveness, laziness, hunger, sleepiness, food type, etc.

2. create an instance of this creature in the world, just assign values to each stat n stuff

3. Each loop change the variables appropriately. increase hunger, increase sleepiness, decrease health based on hunger, etc.

4. based on the variables, change the state of the creature (just an integer variable called "state". Weigh the values and choose the most important stat, and change the creature to an appropriate state. If the creature is hungry, change it's state to forage or hunt. If the creature is lazy and sleepy, change it's state to alseep. If the creature is getting attacked, change it's state to run, etc.

5. For each possible state, have a piece of code. if the state is "forage", maybe select the closest bush, move, then change the state to "eat".

And thar you have it, finite state AI.
NightX
15
Years of Service
User Offline
Joined: 3rd Apr 2009
Location: Australia, QueensLand
Posted: 24th Oct 2009 10:56 Edited at: 24th Oct 2009 11:01
Yer, I was going to do some thing like that but I just want to see how animals interact with eachother and the environment using neural nets.

Also, like 10 or so posts up , i put a link to the ANNE fourm.

I have a whole list of things the animal can do allready, but i want to make the neural net simple but more relistic than just eg."forage", if you have played the game "Dear hunter", you will see dears and things, and i want some thing like that, but the dear/animals learns the environment.

Physics & AI to the MAXXXX
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 26th Oct 2009 04:25
Quote: "I couldn't understand a lot of it but neurons seems to be like logic gates. Changing the connections is the weird and complicated part.
Have you attempted anything like this?"


Neurons? if i've not mistaken they are what stores knowledge in the brain.

Google.com. Nuff Said
NightX
15
Years of Service
User Offline
Joined: 3rd Apr 2009
Location: Australia, QueensLand
Posted: 26th Oct 2009 08:17
Yer, the neurons do the work, like find some thing out, and they store stuff.

Physics & AI to the MAXXXX

Login to post a reply

Server time is: 2024-05-04 03:57:27
Your offset time is: 2024-05-04 03:57:27