MightyPirates / OpenComputers

Home of the OpenComputers mod for Minecraft.
https://oc.cil.li
Other
1.57k stars 427 forks source link

microphone #295

Closed Wuerfel21 closed 10 years ago

Wuerfel21 commented 10 years ago

Got the idea while thinking about #293 A block fireing an event whenever it hears a sound in its range(range depends on tier). Possibly ignoreing computer fans. Event looks like this: "sound", address, the name of the sound, the total distance, xyz distances(higher tiers only)

evg-zhabotinsky commented 10 years ago

Stereo microphone to detect a walking player? Like camera or entity locator, but realistic and simple enough to use at the same time :D (not so easy to implement though because there are no server side sounds) Really interesting. About fan noise - maybe each sound source would have its own volume (consistent at least for vanilla and OC sounds) which is divided by distance square to identify volume of microphone input. Then microphone only detects sounds that are louder than some minimum based on recent average noise level. Also, names of sounds do not make sense (as do raw item IDs). I think it should be some consistent hash that only allows to compare sounds.

Wuerfel21 commented 10 years ago

Ok, but names without numbers(cow instead of cow3) are more realistic(you might need an internet card to craft), but we sure want to say if we heard a zombie or a sheep(to make our super farming robots of DOOM!!!). And there are server side sounds(/playsound command)(theres also a bukkit plugin called craft book where you place down a sigin, write some special text on it and it plays back noteblock sounds)

Wuerfel21 commented 10 years ago

For implementation:(note that im not that experienced in minecraft modding) there must be a function called everytime when a sound should play. This function then checks for players in range, right? So redefining it to search for "microphone" tileenteties(spelled correctly?)

Wuerfel21 commented 10 years ago

Oh(damn, why there is no edit button in either the webbpage or the app) if we are using hashes(which im not a fan of), we should use the hashes minecraft already uses for sounds

fnuecke commented 10 years ago

Interesting. There's a PlaySoundEffectEvent that could probably be used for that. It's a client side event.

fnuecke commented 10 years ago

Since I don't see a way to reliably detect sounds directly on the server, this would involve too much hackery / client-server intercommunication for my taste, so I'll stop further investigation. If someone wants to take a shot at it, go make an awesome addon!