Re: Artificial Intelligence(In Progress)

Hello, no it's not, it's because you are using the same variable for all sounds imo,
i've been struggling trying to make a simple OO way to play the sounds but unsucessful right now,
so i just made 3 variables (ugly but it works) : SponzaMouse

Re: Artificial Intelligence(In Progress)

Amazing!

Re: Artificial Intelligence(In Progress)

Muchas Gracias Vegas! Once again, Vegas to the rescue! haha.

Now the level feels so much better (rubs hands together for next feature).

I am going to study how you adjusted the script so I can learn a new principal for programming.

BTW, I used an app for the ipad called Speak It to do the voice. It is a text to speech app. And you can see how realistic the voices are.

I can do all sorts of dialog with this as audio cues for actions.

Re: Artificial Intelligence(In Progress)

I just did a bit of stress testing on the project, and your adjustment works very well (no lagging when two things are seen simultaneously.

Thanks again! I am going to work on hearing now. I might run into some issues with getSoundGain(). we will see.

Last edited by Tutorial Doctor (2014-03-03 05:10:45)

Re: Artificial Intelligence(In Progress)

It looks like I am going to have to use the distance formula for the hearing aspect, and check the distance between a sound object and a hearing object. I am also going to have to get the sound gain of the sound object.

If the distance between the two objects is less than a certain number and the sound gain is above a certain number, a "heard" flag goes up. That is the basics of it, now to do it! haha.

Re: Artificial Intelligence(In Progress)

Watch out! I move fast! haha. This is the beginning of my Hear() function. It is short, but almost complete.

import math
function Hear(object)
    earPosition = getPosition(ears)
    heardObjectPosition = getPosition(object)

    x2= earPosition[1]
    x1= heardObjectPosition[1]
    y2= earPosition[2]
    y1= heardObjectPosition[2]

    xDiff = x2-x1
    yDiff = y2-y1

    radicand =  math.pow(xDiff,2) + math.pow(yDiff,2)
    
    distance = math.sqrt(radicand)
    
    if distance == 0 then
        setText(txt_hearing,"I hear something...")
    else
        setText(txt_hearing,"I hearn nothing")
    end
end

I think that calculus course is coming in handy for checking if things are working. I have to check minimums and maximums to see if it works on either side of 0. I am not printing the distance yet.

I put the "squeeze" on the distance and here is how it checked out:

--At start distance is not equal to 0
--At start distance is greater than 0, which is how it should be. 
-- At start distance is not less than 10
-- At start distance is greater than 10
--I think this might be a scale issue.  I am going to move a box around in the environment to see the scale of the scene. 
-- Turns out, at start, the distance between the ears and the monkey is roughly 130 units. 
-- at start, distance is greater than 20 and less than 30

This doesn't seem right, as it was about 130 units in distance along the X-axis.

I am going to try to use getUnprojectedPoint() this should work better. I will save that for tomorrow. I am going to add some more sound effects to the project for the next upload.

Update: OOPS, that is not the distance forumula for 3d space. I need a "Z" axis in there.

Last edited by Tutorial Doctor (2014-03-03 19:37:05)

Re: Artificial Intelligence(In Progress)

This looks like interesting thing to look at - Enemy AI – random movement
http://www.freeactionscript.com/tag/ene … -movement/

Re: Artificial Intelligence(In Progress)

I am trying to avoid randomness, and try to program a system that does things with intent. For instance, a person doesn't randomly walk somewhere. They usually have intent. So an enemy should move with intent.

I am also going to have states that determine what the enemy does.

Is the enemy tired? He will go to sleep (play some animation)

Is he angry? He will pout (some pout animation).

I could set a timer to determine when the enemy will go to sleep. Perhaps that will be a chance for you to sneak past him?

Re: Artificial Intelligence(In Progress)

I see.

Re: Artificial Intelligence(In Progress)

Here is the updated file with a bit more environment. I added a simple pickup function and I hid the text on the screen. I also made some music and added it to the scene.

https://sites.google.com/site/maratisfi … System.zip

Re: Artificial Intelligence(In Progress)

The monkey sound is too loud.

Re: Artificial Intelligence(In Progress)

Okay, thanks, I will change it before the final upload. If you want to change it, just click it in the Editor and change the gain.

Re: Artificial Intelligence(In Progress)

Haha. I should just use the vec3() function. Didn't even think of it

Re: Artificial Intelligence(In Progress)

This is just a note to do some research on sensory cues, mainly auditory cues and visual cues. Wikipedia has a very nice article it.

Edit: Okay, I put all the text in another scene and used enableCameraLayer() to project it over the main camera. Now I can easily add readouts. I added a readout that displays the name of the object collected (small box).

Last edited by Tutorial Doctor (2014-03-21 02:38:14)

Re: Artificial Intelligence(In Progress)

Can't get this distance thing to work right. The ears are parented to the player, which is moving. At the start of the program, the distance reads 33. It only changes when I move the monkey, not when I get closer to the monkey. It seems the distance is being calculated between the monkey and some point in the middle of the level. I checked to see if the origin of the ears is off, but it isn't.

Here is the code for calculating the distance:

function Hear(object)
    earPosition = getPosition(ears)
    heardObjectPosition = getPosition(object)
    
    x2= heardObjectPosition[1]
    x1= earPosition[1]
    y2= heardObjectPosition[2]
    y1= earPosition[2]
    z2= heardObjectPosition[3]
    z1= earPosition[3]
    
    xDiff = x2-x1
    yDiff = y2-y1
    zDiff = z2-z1
    
    radicand =  math.pow(xDiff,2) + math.pow(yDiff,2) + math.pow(zDiff,2)
    distance = math.sqrt(radicand)
    
    if distance > 20 and distance < 30 then
        setText(hear,"I hear something...")
    else
        setText(hear,"I hear nothing")
    end
    
    setText(hear_distance,"Distance:"..distance)
end

Re: Artificial Intelligence(In Progress)

Okay, here are a list of things that I can use the current Senses system for:

Automatic Navigation -- If an object is seen, the walking character can turn left or turn right. They can jump or duck. I can make invisible primitive planes that, if seen, can make the character turn a certain direction, or perform any other type of action. The same goes for touch. I can't get hearing working yet, and smell requires a particle system (there is one, but it still crashes on me.)

Enemy AI -- if an an enemy sees you, they can attack you.

Trigger Emotions-- The senses can trigger a change in state. Perhaps the character is happy and a happy animation plays, but when it sees a dog, it gets afraid, and the character does a 180' and runs?

I will try to put together a little demo that demonstrates several of these scenarios.

Re: Artificial Intelligence(In Progress)

Okay, after a very good conversation on gamedev.net
http://www.gamedev.net/topic/655272-i-h … ew-habits/

I think I will be applying fuzzy logic instead of boolean logic to make the Senses system more realistic. For the main 5 senses I will use boolean logic. But to make this more of an AI system, I will use fuzzy logic.

Re: Artificial Intelligence(In Progress)

Just uploaded a very quick and dirty version of the senses system in 3rd person.

Re: Artificial Intelligence(In Progress)

I need to make a simple Say() function that sets a text to a string.

Say("Hello Maratis")

I could also make this an audio thing so that I could possibly type:

if happy then
    Say(hello)
end

However, in the event that the Say() function is choosing an audio file to play based on an emotion I could type:

Say(hello)

And the character can choose from three different ways to say hello given an feeling:

if happy then 
   hello = getObject("HelloHappy")
elseif sad then
   hello = getObject("HelloSad")
elseif normal then
   hello = getObject("HelloNorm")
end

Last edited by Tutorial Doctor (2014-05-19 19:53:32)

Re: Artificial Intelligence(In Progress)

I am going to start testing in some test area style spaces because the textures are a distraction for now:

https://sites.google.com/site/maratisfiles/files/Screenshot%20%28978%29.png