Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-10-2010, 09:47 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Detecting Sound

I have a couple of situations where being able to detect a sound being played, and it's position, would be very useful (ex: A baddy being able to "hear" a players foot steps).

I don't know if an event (onSoundPlayed or something) or another method would be best, but some way to do this would be nice.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #2  
Old 03-10-2010, 09:50 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
All I see is "sound" in the future improvements section, and I agree.
Reply With Quote
  #3  
Old 03-10-2010, 12:07 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Can't you just check each player's gani instead?
Or if the sound is scripted and not in a gani, trigger your own event?
Reply With Quote
  #4  
Old 03-10-2010, 05:14 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura about
Send a message via AIM to adam
Creating your own sound and loudness variables would be best prabably. That way you could totally script running and walking and creeping. Which would be useful if you have a baddy that detects sound.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #5  
Old 03-10-2010, 08:04 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by DrakilorP2P View Post
Can't you just check each player's gani instead?
Or if the sound is scripted and not in a gani, trigger your own event?
Well, the only useful sounds to detect, in all honesty, are in ganis. And there are situations where detecting the sound (and it's distance and/or loudness) would be far better than checking the gani.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #6  
Old 03-10-2010, 09:00 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Couldn't something like this be a workaround? Maybe have distances for each baddy?
PHP Code:
//baddy.x+1.5 and baddy.y+2 for center if using regular character height/width
if (player.ani == "my_run") {
  if (
player.x in |baddy.x+1.5-15baddy.x+1.5+15| && player.y in |baddy.y+2-15baddy.y+2+15|) {
    
//stuffz
  
}
}
else if (
player.ani == "my_walk") {
  if (
player.x in |baddy.x+1.5-10baddy.x+1.5+10| && player.y in |baddy.y+2-10baddy.y+2+10|) {
    
//stuffz
  
}
}
else if (
player.ani == "my_creep") {
  if (
player.x in |baddy.x+1.5-5baddy.x+1.5+5| && player.y in |baddy.y+2-5baddy.y+2+5|) {
    
//stuffz
  
}

__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #7  
Old 03-10-2010, 09:27 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Well, in terms of using it for detecting a player, that would force me to use a less efficient method of perception for the AIs sensory model.

Either way, event-based is always better than checking things in a loop.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #8  
Old 03-10-2010, 09:28 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Switch View Post
Couldn't something like this be a workaround? Maybe have distances for each baddy?
Yeah that would work fine and having a variable for "loudness" affecting the distance checked would add to it but using sound as the detection method for a baddy seems silly to me.
__________________
Quote:
Reply With Quote
  #9  
Old 03-10-2010, 09:40 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by fowlplay4 View Post
Yeah that would work fine and having a variable for "loudness" affecting the distance checked would add to it but using sound as the detection method for a baddy seems silly to me.
Not even having a variable for how loud you are, just different baddies have different distances. Or a "threat" feature that once you get in an area and are doing something "threatening" to the baddy, it would attack you, or "aggro".
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #10  
Old 03-10-2010, 10:07 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Switch View Post
Not even having a variable for how loud you are, just different baddies have different distances. Or a "threat" feature that once you get in an area and are doing something "threatening" to the baddy, it would attack you, or "aggro".
Yeah that's how it's done on Zodiac and other MMORPGs, and just makes the most sense.
__________________
Quote:
Reply With Quote
  #11  
Old 03-10-2010, 11:36 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Switch View Post
Couldn't something like this be a workaround? Maybe have distances for each baddy?
PHP Code:
//baddy.x+1.5 and baddy.y+2 for center if using regular character height/width
if (player.ani == "my_run") {
  if (
player.x in |baddy.x+1.5-15baddy.x+1.5+15| && player.y in |baddy.y+2-15baddy.y+2+15|) {
    
//stuffz
  
}
}
else if (
player.ani == "my_walk") {
  if (
player.x in |baddy.x+1.5-10baddy.x+1.5+10| && player.y in |baddy.y+2-10baddy.y+2+10|) {
    
//stuffz
  
}
}
else if (
player.ani == "my_creep") {
  if (
player.x in |baddy.x+1.5-5baddy.x+1.5+5| && player.y in |baddy.y+2-5baddy.y+2+5|) {
    
//stuffz
  
}

It's usually best to just use the distance rather than trying to check a certain box.

PHP Code:
// adding 3 to both; assuming player and NPC are 3x3 tiles so + 1.5 + 1.5
temp.distance = (((player.this.3) ^ 2) + ((player.this.3) ^ 2)) ^ 0.5;

if (
distance 5) {
  
// whatever

__________________
Reply With Quote
  #12  
Old 03-10-2010, 11:51 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
I would suggest using a more 'approximate' method for checking distance that doesn't involve square root, but yeah.

I mean, all of this is very much a logical, acceptable way to do it. I just wouldn't consider it the best option.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:49 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.