Giving Sight and Sound to your actors.

Talk about making games.

Giving Sight and Sound to your actors.

Postby Fuzzy » Sat May 06, 2006 5:02 am

Create an actor. You might name it 'ant' and use this animation.
Image

Next, create another actor, and use an image somewhat like this:
Image

Move it off the view area, and set it to not be created at start. You might put its parent as the view, so that you dont walk over it, depending on the nature of your game. It will be used to create a field that will detect noise.

In your 'ant' actor, select create actor event, and then action script editor. You could just use the action, but we want to do some stuff with it first.

In the script editor, select function create actor, and fill out the actor field that appears with AudioRange128 or whatever you called the animation. Make the offset 0 and 0 for this one. Make 'ant' the parent. hit add.

In the next line of the script editor, select ChangeTransparency and in its actor field, select the AudioRange128 actor. Please use a better name than I did! Select the highest level of transparency. Hit add.

Now go back and change that line that appeared. make the 1.00000 into 0.995. This makes the actor too faint to see, but not totally gone. if you can still see it, make it closer to 1.0, but dont go too far, or the actor will not affect other actors.

Close the script editor. Close the create actor event.

Now design your player collide events to collide with that circle. As longs as it has enough non-transparency, it will collide with other actors, but the player cannot see it. In its collision event, have it make the ant do whatever actions you want, based on the fact that the ant "heard" the player.

use something like this image for sight.
Image

Follow the same steps as the soundrange actor, but put the offsets as 64 and -64. That should align the triangle with the ants head. The collision events of this actor can cause the ant to act out whatever is needed, based on the assumption that anything touching or in this field is in sight of the ant. you might need to put off assigning the transparency until you get it aligned right.

Feel free to use these graphics, but simple ones might be better, as you dont need the alpha gradient in them(a simple two color png would be smaller).

Please respond with any comments or questions. If there is any confusion in what I have said, I'd like to hear about it, so I can clear it up.

Here is a example of the sight field in use, with the field being Visible.

Image
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby Game A Gogo » Sat May 06, 2006 12:46 pm

cool...hmm
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Just4Fun » Sun May 07, 2006 4:07 am

ThreeFingersPete:
Thanks for sharing this with all of us. It is good stuff and like nothing that I've seen posted in the forum before. Complex, yet simple. I like it.

Has anyone else tried these techniques yet? If you have, how are you thinking of applying them in your games?

I think I will fire up GE and try this one out! :D
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby DilloDude » Sun May 07, 2006 5:03 am

I think it's a good idea, but with the hearing, normally you wouldn't necesarily make a noise just when you go into hearing range, so you could try on an event that would make noise, check the distance, or just not use hearing at all. The thing with sight is pretty good, but it's not the only way to do it: if you look at my WWW demo, you notice things like balloons and AAGuns and things, they use a function to find if their face direction is approximately equal to the direction between them and you. But good ideas, anyway.[/url]
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby Fuzzy » Sun May 07, 2006 5:57 am

Yeah, you can use the direction facing routines too; depending on circumstance and design, that would be the way to go. How about outlining that technique for the GE users?

This method jives with my current kick of dodging decision making. I suspect that GE does the collision detection regardless; unless you specifically turn it off, so its more like hitching a ride, as GEs collision detection would involve IF, but of a hard wired type.

This doesnt pre-suppose sensing anything, it just outlines a timeslice/distance opportunity to make a decision. Its a field limit to sensory data. It is a type of bounding box, which i am making a post on next.

Lately, i've been interested in showing how to abstract real life concepts into programming. Having your counterpoint presented is a good thing. It allows GE uses to see a variety of solutions to problems.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby Just4Fun » Sun May 07, 2006 8:28 pm

Yes DilloDude:

Would you share your process with us for doing this. I really enjoy seeing different approaches to doing similar things. Sometimes it helps me suddenly understand a completely different concept! :D TIA
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest