Photon voice proximity voice chat?

HooDooHooDoo
edited August 2016 in Photon Voice
Is it possible to have chat by distance? For example if im far enough away from another player, I wont be able to hear them. Also, is there an example or tutorial for press and hold down a button for chat?

Comments

  • JohnTubeJohnTube mod
    edited August 2016
    Hi @HooDoo,

    Thank you for your suggestions.

    We already prepared a Push-To-Talk demo that will be released with the next Voice package update.
    Regarding 3D effect however, we think this should be done directly by tweaking Unity audio components directly. We may have something to show in the future but I can't promise anything. I'm sure there are plenty of resources available on the internet regarding this that can help you implement it.

    Stay tuned and thank you for choosing Photon!
  • Thanks, when will this demo be out? We plan to release our game using photon and photon voice within the next 2 weeks, so if it is not before then could you possibly post the scripts required to do push to talk?


    Thanks!
  • HI @JohnTube
    Did you see my last post? Were really pushing for this release date.
    I would really appreciate it!

    Thanks :)
  • HooDooHooDoo
    edited August 2016
    *EDIT*
    I added the UI from the demo scene, I am not able to transmit audio, where it normally says calibrate, it just stays on "unavailable", and I am unable to check transmit or use VOIP at all. Where as in the demo scene, it works fine, I cant pin point what I am doing different. Could it because we are loading the main scene from a menu scene? I also have a warning, "PUNVoice cannot transmit" Could it be the way we spawn the player? Because, when I drag our player prefab onto the prefab slot in the demo scene, it works fine. But still in our scene, the main problem is where it normally says calibrate, it just says unavailable.



    Hey @JohnTube, downloaded the latest version, looks good! However, im attempting to do this without programming knowledge, in the push to talk script, it seems to call something from the spawn script and then turns on the record component.
    Anyways, long story short, I cant make it work. I add on the speaker and recorder scripts to my player prefab, I added the push to talk script onto a empty game object in the scene, made a build, and it does not work, im also not getting any errors. Any tips? I am also unclear, because in the documentation it says you need the settings script on a empty game object in your scene, but when I have the push to talk script and the settings script in the scene, it returns an error.

    Any tips on how to make this work, Im just trying to get push to talk working in my scene, nothing else.

    Thanks!
  • Hi @HooDoo,

    Did you try the Push-To-Talk demo scene without changing it? It should work out-of-box if not then we have a problem and please do let us know.

    The Push-To-Talk script won't work in another project by simply adding it to a scene.
    Same thing for UI logic in DemoScene, the scripts are not generic and you can't use them as is in other projects.
    Maybe I should take that into consideration and try to make more generic drag'n'drop scripts in the future but it's not simple.

    Voice demos are meant to be a starting point and an open source example of how to use voice features by taking inspiration from the logic exposed. Code is an important part and should be understood.

    In order to make Push-To-Talk work you need to get a reference to the "PhotonVoiceRecorder" script of the local player/character then toggle "Transmit" property on and off.

    So what you can do to make it work is changing the way we are getting that reference to your own, you need to assign "rec" field after instantiating voice prefab of local player. This can be done in multiple ways, using Unity messages, C# events (like in the demo), assign "rec" field directly by making it static or making PTT script singleton or keeping a reference of PTT component in instantiation script and making "rec" field public to be able to assign it from there. Rest of code should stay the same if you want same behavior. Don't forget to assign the PTT button of course.

    Copying UI logic from DemoScene to PTT scene requires more explanation and more work. Maybe you don't need all of it.

    I can't promise anything but we may have a complete basics tutorial in the future for Photon voice.

    "Unavailable" text means you can't use calibration feature as Voice client is not joined to a room.
    I'm interested in the "PUNVoice cannot transmit" warning, can you give us more logs and what you are actually doing.

    in the documentation it says you need the settings script on a empty game object in your scene


    If that's the case then we need to update our documentation. I'll look for this info and rectify it.
  • JohnTubeJohnTube mod
    edited August 2016
    Hey @HooDoo,

    First I need to have a final answer on this:
    Does the demo ("DemoVoice-Scene" and "DemoVoice-PushToTalk-Scene") work as expected?

    Can you please send full Unity console logs that contain this warning: "PUNVoice cannot transmit".
    Do you use one device for all dev. and tests?

    Thanks.
  • Hey @JohnTube Yes, demo scene works great. I can use the UI from the demo scene, in my scene, and I can see that the microphone is being detected just fine. The only problem, is it won't transmit audio, did you see the scripts I posted earlier? Same player prefab works fine, if I spawn it into the demo scene using the demo scene scripts. But when I use my own scripts, it just stays on unavailable. I am guessing I am spawning the player wrong some how. Is it the player log or editor log you are looking for? If not where do I find the log you are mentioning?

    Thanks!
  • All Editor logs please that include the "PUNVoice cannot transmit" warning.

    Did you try using your own scripts w/o multiple scenes? I mean if it works in a single scene then maybe it's due to the scene switching as you load a scene as soon as player is connected.
  • Hey JohnTube, I am going to get the editor log now.
  • OK, here is the editor log, starting from when I play from the main menu, let me know how it looks :)
    http://textuploader.com/58xoy
  • Hey @JohnTube I will try the fix you mentioned but I can't seem to even get a single scene working. So I made a test scene, I used the utility scripts "Connect and Join Random" and "On joined instantiate" the photon voice instantiate script, like you said, is not generic. I used this to spawn a voice object which has the right components attached. The only way I can get it to transmit in the scene I created, is if I use the character instantiate script that comes with the demo, along with one of the characters which comes with the demo. Any other way of instantiating, not using the script that comes with photon voice. Even instantiating a demo character, it just stays on unavailable.
  • I believe I am just missing something simple.....Is there no getting started tutorials? or any on implementing Photon voice into an existing Photon project? Or generic scripts for use? Surely not everyone that will use Photon voice has programming experience.
  • Hey @JohnTube Any idea?
  • Hi @HooDoo,

    The only way I can get it to transmit in the scene I created, is if I use the character instantiate script that comes with the demo, along with one of the characters which comes with the demo. Any other way of instantiating, not using the script that comes with photon voice. Even instantiating a demo character, it just stays on unavailable.


    I believe I am just missing something simple


    I will repeat what I said previously:

    So what you can do to make it work is changing the way we are getting that reference to your own, you need to assign "rec" field after instantiating voice prefab of local player. This can be done in multiple ways, using Unity messages, C# events (like in the demo), assign "rec" field directly by making it static or making script singleton or keeping a reference of PTT component in instantiation script and making "rec" field public to be able to assign it from there. Rest of code should stay the same if you want same behavior.


    Please try any of the above because I believe that's what makes the instantiation in Voice demos "work" is the CharacterInstantiation.CharacterInstantiated event that is used to enable "PhotonVoiceRecorder" of local character and get its reference. You need to substitute this event logic with your own way as described above.

    About your other questions:

    Is there no getting started tutorials? or any on implementing Photon voice into an existing Photon project? Or generic scripts for use?


    Currently the answer is no. You need to wait or try to find a solution to your problem by understanding the code.

    Surely not everyone that will use Photon voice has programming experience.


    Yes but some programming knowledge and efforts do not hurt and can help you out.
Sign In or Register to comment.