151

(44 replies, posted in Scripting)

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.

152

(44 replies, posted in Scripting)

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.

153

(44 replies, posted in Scripting)

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.

154

(44 replies, posted in Scripting)

Well, thanks anyway Akira_san, very much. I will just continue without the sound. Thanks again.

155

(44 replies, posted in Scripting)

Here is the project file:

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

156

(44 replies, posted in Scripting)

function Speak()
    if isCollisionBetween(eyes,box) then
        if soundplay == 0 then
            playSound(seeBox)
        soundplay = 1
        end
    else 
        soundplay = 0
    end
    
    if isCollisionBetween(eyes,monkey) then
        if soundplay == 0 then
            playSound(seeMonkey)
        end
        soundplay = 1
    else
        soundplay = 0
    end

    if  isCollisionBetween(eyes,building) then
        if soundplay == 0 then
            playSound(seeBuilding)
        end
        soundplay = 1
    else
        soundplay = 0
    end
end

That is how I have it set up now, but it is still doing the skipping.
I think the issue might be how I set up the scene. I am going to package the project and post it here.

157

(44 replies, posted in Scripting)

Going to try com3D's suggestion from this post:
http://forum.maratis3d.com/viewtopic.php?id=742

Edit: Well, that didn't work, so I scratched all the complexity and made it simple again. I will start from here:

function Speak()
    if isCollisionBetween(eyes,monkey) then
        playSound(seeMonkey)
    end
    
    if isCollisionBetween(eyes,box) then
        playSound(seeBox)
    end
    
    if  isCollisionBetween(eyes,building) then
        playSound(seeBuilding)
    end
end
function onSceneUpdate()
       Speak()

end

158

(11 replies, posted in Scripting)

Well, I was hoping to find my answer here, guess I have to try elsewhere.

159

(44 replies, posted in Scripting)

Hehe. Right on Akira_san, I thought of the boolean thing, but my first attempt didn't work. I am going to try again. thanks.

Edit: I just can't get it. I even tried the example from this post:
http://forum.maratis3d.com/viewtopic.php?id=61

I will post the code.

Player = getObject("Player")--object
Head = getObject("Head")--object
eyes = getObject("Eyes")--object
box = getObject("Box")--object
monkey = getObject("Monkey")--object
building = getObject("Building")--object

seeBox = getObject("SeeBox")--sound
seeMonkey = getObject("SeeMonkey")--sound
seeBuilding = getObject("SeeBuilding")--sound

collision = 0

--SENSES
function See(object)
    if isCollisionBetween(eyes,object) then
        seenObject = getName(object)
        setText(text, "I see a ".. seenObject)
        seeing = true
    else --setText(text,"I see nothing")
        seeing = false
    end    
end

function Touch(object)
    if isCollisionBetween(Player,object) then
        touchedObject = getName(object)
        setText(text2, "I feel a ".. touchedObject)
        touching = true
    else setText(text2,"I feel nothing")
        touching = false
    end
end

function Speak()
    if isCollisionBetween(eyes,monkey) then
        if collision == 0 then
            playSound(seeMonkey)
        end
        collision = 1
    else 
        collision = 0
    end
    
    if isCollisionBetween(eyes,box) then
        if collision == 0 then
            playSound(seeBox)
        end
        collision = 1
    else 
        collision = 0
    end
    
    if  isCollisionBetween(eyes,building) then
        if collision == 0 then
            playSound(seeBuilding)
        end
        collision = 1
    else 
        collision = 0
    end
end

function onSceneUpdate()
    Touch(building)
    See(box)
    See(monkey)
    See(building)
    Speak()
end

I stumbled across something interesting when wondering if I can use a function as an argument:
http://stackoverflow.com/questions/1698 … ter-in-lua

function init() 
     print("init");
end

block = { 
     startup = init
}

They also say the two examples below are the same:

function foo()
end

foo = function()
end

161

(44 replies, posted in Scripting)

Thanks for the link Dahnielson. I think I can agree with simple AI being more intelligent. This senses system is feeling rather good. It gets the job done, and it can be implemented very easily. It sorta behaves like AI since I am detecting something with a sensor, and having a reaction follow it. From a lecture I saw, that is how she described basic AI.

I can't figure out how to solve this sound issue though. I would like to share the project if I can get a few basic things down.

162

(44 replies, posted in Scripting)

Okay, I am running into an issue. I am checking a collision between two objects, using the isCollisionBetween() function.

if there is a collision between the two objects, I trigger a sound. I call this under the onSceneUpdate() function and it is trying the sound tries to trigger 60 times per second as long as the collision is happening.

I just want the sound to finish playing first and then stop. I guess I would need a function similar to isAnimationOver() but called isSoundOver().

When I call the it outside of the update function, it doesn't work at all. Any tips? I am using this to let the character speak upon seeing an object.

163

(44 replies, posted in Scripting)

Thanks for the link, it my be of use if I decide to expand this out into a full AI system.

We had a big discussion on Gamedev.net about AI, and it seems a lot of people have definitions of AI. The definition I am sticking with is that intelligence is the ability to gather information, or it can be gathered information.

Most of what we know we use our senses to gather. Now, the extra part of intelligence is being able to use that information in meaningful ways. I just came upon a term called

164

(22 replies, posted in General)

Yes. The senses script is Lua.

Good idea about the starter packs for genres. I downloaded about 2,000 sounds yesterday. The file size is getting big. For the sounds and fonts I am at 350mb. So splitting it up by genres would be better.

165

(44 replies, posted in Scripting)

This is how my code looks so far:


Player = getObject("Player")
Head = getObject("Head")
eyes = getObject("Eyes")
text = getObject("Text")
text2 = getObject("Text2")
box = getObject("Box")
monkey = getObject("Monkey")
building = getObject("Building")

--SENSES
function See(object)
    if isCollisionBetween(eyes,object) then
        seenObject = getName(object)
        setText(text, "I see a ".. seenObject)
        seeing = true
   -- else setText(text,"I see nothing")
        --seeing = false
    end    
end

function Touch(object)
    if isCollisionBetween(Player,object) then
        touchedObject = getName(object)
        setText(text2, "I feel a ".. touchedObject)
        touching = true
    else setText(text2,"I feel nothing")
        touching = false
    end
end


--ACTIONS
function Jump(object)
    if seeing then
        setGravity({0,0,-4})
        addCentralForce(object,{0,0,9},"local")
    end
end
function onSceneUpdate
    See(box)
    Jump(Player)
    Touch(building)
    See(monkey)
end

166

(22 replies, posted in General)

I need to finish working on this "Senses System" I have. The system works like AI sort of. So far, I have it where if an object sees another object, it will veer left or right. It can also jump when it sees an object. It is sort of like a physics based AI system that can be applied to anything.

167

(22 replies, posted in General)

Vegas's text display scripts can be found here:
http://forum.maratis3d.com/viewtopic.php?id=909

He has some health bar examples here:
http://forum.maratis3d.com/viewtopic.php?id=154

Light Examples:
http://forum.maratis3d.com/viewtopic.php?id=138

Door Lift:
http://forum.maratis3d.com/viewtopic.php?id=72

Third Person:
http://forum.maratis3d.com/viewtopic.php?id=140

168

(22 replies, posted in General)

Good idea. Currently I use the script from the Jules demo for third person characters, and the script from Sponza for 1st person.

I have a character controller script myself, but it is not finished. The example scripts is a good idea. Vegas has made a few already, if he doesn't mind, I would like to add them to the starter pack. Right now I have about 1,000 free fonts in the project, and I re-did the primitives so that they rotate about their centers.

I should be able to make a male and female character with idle, walking, and jumping animations, for testing, but that will be last, as I want it to be good.

Perhaps a few small scripts for standard motions could be added. For example, a script that makes an object move left to right continuously.

169

(22 replies, posted in General)

I just had an idea of creating a starter pack of objects, sounds, fonts, etc for maratis.

When you first get Maratis, you really have nothing to manipulate. So I created a bunch of primitives and put them in the meshs folder. You also have no sounds, nor fonts loaded (I understand copyright stuff with fonts).

I have made some test rooms and some assets for maratis, but I was wondering if anyone would be able to contribute to a Maratis Starter pack.

Of course, we would have to get the scale correct. so that all objects are at the right scale. Anyone interested?
Anyone have any ideas of what essential types of objects (other than primitives) they would like to have in a starter pack?

170

(1 replies, posted in General)

It could be that I'm still new to how macs work, but it seems more difficult to use maratis on a Mac.

For one, I can't get .proj files to open with maratis without the error I posted about a while ago. Also TextEdit keeps saying the lua files don't have permission, even though I set Smultron to the default program to open lua files with.

Also, Maratis really needs a way to set a default folder for searching for maratis files instead of the root directory.

Perhaps it's just me though.

171

(1 replies, posted in General)

Yeah. I have. I have had to do the copy paste thing myself.

172

(2 replies, posted in Gossip)

Saw this on game dev, thought a ale might check it out.

http://www.gamedev.net/topic/653769-new … scripting/

It uses lua and c++ also.

Could this be useful? Hehe.

173

(4 replies, posted in Scripting)

You might have to use several functions then.

rayHit()
getUnprojectedPoint()
getAxis()
vec3()

Mainly getUnProjectedPoint() and rayHit() do the 2D to 3D thing.

174

(3 replies, posted in General)

If you are using Windows, you should be able to associate .lua files with notepad++ by right-clicking a .lua file and going to properties and then to "Change" next to "Opens with" and choosing the notepad++ exe file.

175

(6 replies, posted in General)

I've sorta gotten used to