3 registered members (7th_zorro, Aku_Aku, 1 invisible),
579
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
ent_playsound on moving entities
#463690
12/21/16 16:06
12/21/16 16:06
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
OP
Serious User
|
OP
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
well, I want to play sounds for the characters using ent_playsound instead of snd_play, for example for footsteps, weapons and so on. Right after starting the game, where the player it's on its original position the sound plays fine. However, if I move the character, for example to x=800, sounds can barely be heard. as you get farther from the original position the volume will get lower unitl you can't heard it.
According to the manual ent_playsound "Plays a 3D sound at the current position of the given entity". However, it looks like when you call ent_playsound it uses the entity original position instead of the current one.
Has anyone else noticed this behaviour?
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: ent_playsound on moving entities
[Re: 3run]
#463693
12/21/16 17:55
12/21/16 17:55
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
OP
Serious User
|
OP
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
I never noticed anything like that.. works pretty good for me. How many view do you have? Cause (as far as I know) there should be only one with flag AUDIBLE set on. Maybe there is a view, which doesn't move with the entity?
Greets! I'm using only the default camera view, so that shouldn't be a problem. Maybe Shade-c EVO or PhysX causes it? I think I used ent_playsound in the past and didn't have those issues
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: ent_playsound on moving entities
[Re: 3run]
#463695
12/21/16 18:32
12/21/16 18:32
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
OP
Serious User
|
OP
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
I think it's related somehow to shade-c evo. If I disable it then ent_playsound works fine
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: ent_playsound on moving entities
[Re: rayp]
#463708
12/22/16 10:49
12/22/16 10:49
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
OP
Serious User
|
OP
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
I don't have any special settings set on windows audio settings. The problem only seems to appear when using shade-c evo.
I've searched through all shade-c files and every created view has its AUDIBLE flag reset except for screen.views.gBuffer on sc_gBuffer.c line 46. However, changing it to reset doesn't seem to fix it neither.
Last edited by painkiller; 12/22/16 10:49.
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: ent_playsound on moving entities
[Re: painkiller]
#463711
12/22/16 12:03
12/22/16 12:03
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
Serious User
|
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
Perhaps its related to the variable doppler_factor? It sounds like that anyway. If that isn't it, it could perhaps be that Shade-c has a similar kind of variable that is experimental or such (would have to dig in the scripts though).
-edit, or it might be related to physx or such in the sense that the xyz coordinates that ent_playsound uses it perhaps not updated automatically. Try updating the xyz values manually too.
Last edited by Reconnoiter; 12/22/16 12:06.
|
|
|
Re: ent_playsound on moving entities
[Re: Reconnoiter]
#463713
12/22/16 12:18
12/22/16 12:18
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
OP
Serious User
|
OP
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
Perhaps its related to the variable doppler_factor? It sounds like that anyway. If that isn't it, it could perhaps be that Shade-c has a similar kind of variable that is experimental or such (would have to dig in the scripts though).
-edit, or it might be related to physx or such in the sense that the xyz coordinates that ent_playsound uses it perhaps not updated automatically. Try updating the xyz values manually too. I've tried to change doppler_factor and look for it on shade-c files but no luck. xyz coordinates shouldn't be a problem I think, as I'm attaching the camera to the entity using them and that works fine.
Last edited by painkiller; 12/22/16 12:19.
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: ent_playsound on moving entities
[Re: painkiller]
#463716
12/22/16 12:33
12/22/16 12:33
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
Serious User
|
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
I just tried it and for me ent_playsound works as it should ent_playloop(my, beep_snd, 100); or ent_playsound(my, beep_snd, 100); in a loop.
Are you sure you haven't accidently attach the sound to an other object that you forget / or dont move?
ps: I use both Shade-C evo and physx
Last edited by Reconnoiter; 12/22/16 12:36.
|
|
|
Re: ent_playsound on moving entities
[Re: Reconnoiter]
#463718
12/22/16 13:04
12/22/16 13:04
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
OP
Serious User
|
OP
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
I just tried it and for me ent_playsound works as it should ent_playloop(my, beep_snd, 100); or ent_playsound(my, beep_snd, 100); in a loop.
Are you sure you haven't accidently attach the sound to an other object that you forget / or dont move?
ps: I use both Shade-C evo and physx if you move the entity the sound plays at its new position? I just play them from the entity's action
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: ent_playsound on moving entities
[Re: painkiller]
#463720
12/22/16 13:42
12/22/16 13:42
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
Serious User
|
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
Yes I move the entity with pXent_move. Also tried several sounds simultaneously. (from entity's action) Perhaps your camera/view settings are different or such.
Last edited by Reconnoiter; 12/22/16 13:43.
|
|
|
Re: ent_playsound on moving entities
[Re: Reconnoiter]
#463725
12/22/16 20:26
12/22/16 20:26
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
OP
Serious User
|
OP
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
Yes I move the entity with pXent_move. Also tried several sounds simultaneously. (from entity's action) Perhaps your camera/view settings are different or such. In my case I move it using forces, not sure if that would make a difference
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: ent_playsound on moving entities
[Re: painkiller]
#463734
12/23/16 10:47
12/23/16 10:47
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
OP
Serious User
|
OP
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
I've uploaded a small demo based on the shade-c examples showing the problem: http://www.mediafire.com/file/v3bktj65kwn8pld/sound_test.zipYou can move the player with wasd and mouse and play sound with e key. On my computer on the origin position the sound plays fine, however if I move the player the volume gets lower like if the sound is still played at the origin position.
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: ent_playsound on moving entities
[Re: painkiller]
#463737
12/23/16 11:49
12/23/16 11:49
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
Serious User
|
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
Hey painkiller, I did some tests. I also didn't get any sounds with your script at far distance. The only thing I can think of now is indeed that the force function is the problem, but only the function(s) it seems. Cause e.g. if I move rigid objects (with an attached sound loop) with my character controller they continue to make sounds. So my quess is that its a bug with the physx force function.
-edit: a possible solution might be either just a dummy entity that you move normally with the player and play the sounds on it, or use snd_play and based on distance to camera calculate the right volume.
Merry Christmas
Last edited by Reconnoiter; 12/23/16 11:56.
|
|
|
Re: ent_playsound on moving entities
[Re: Reconnoiter]
#463738
12/23/16 12:23
12/23/16 12:23
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
OP
Serious User
|
OP
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
hmm this is strange. If I attach a dummy entity to the player or camera it moves with it as it should but the sound problem is still there.
Also tried to change the type to PH_CHAR and use pXent_move but the bug happens also.
ent_playloop seems to move with the entities, but ent_playsound stays at the entity's original position.
using snd_play and changing the volume depending on the position would work, but would loose 3d sounds advantages, for example knowing if an enemy comes from the left or right side.
Merry christmas to you too!
Last edited by painkiller; 12/23/16 12:26.
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: ent_playsound on moving entities
[Re: painkiller]
#463740
12/23/16 13:14
12/23/16 13:14
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
using snd_play and changing the volume depending on the position would work, but would loose 3d sounds advantages, for example knowing if an enemy comes from the left or right side. You can do that yourself too though, for example as follows (untested, just the idea): vec_diff(temp,ent.x,camera.x); temp.z = 0; vec_normalize(temp,1); vec_set(temp2,vector(0,-1,0)); vec_rotate(temp2,vector(camera.pan,0,0)); // pan alone should be enough, right? var balance = vec_dot(temp,temp2)*100; snd_tune(...,balance); If the result is super wrong, I'd start with DEBUG_VARing the vec_dot result.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: ent_playsound on moving entities
[Re: Reconnoiter]
#463741
12/23/16 13:42
12/23/16 13:42
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
OP
Serious User
|
OP
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
I tried your sound + setting the player in my script as rigid + adding this to its action pXent_addforcecentral(me, vector(0,-200,200)); , and the sounds kept working until I commented the original move function out. So perhaps try adding a dummy pXent_move call so something gets updated correctly(?). I think that doesn't seem to work, at least on my computer. I tried to add a pXent_move call but still got the problem. Did you try it on the demo I uploaded?
pXent_move(me,vector(0,0,0.1),nullvector);
vec_set(player_move_vec,nullvector);
vec_set(player_move_vec,vector(key_w-key_s,key_a-key_d,0));
vec_normalize(player_move_vec,0.975*time_step);
vec_rotate(player_move_vec,vector(my.pan,0,0));
pXent_addforcecentral(me, player_move_vec);
pXent_move(me,vector(0,0,-0.1),nullvector);
using snd_play and changing the volume depending on the position would work, but would loose 3d sounds advantages, for example knowing if an enemy comes from the left or right side. You can do that yourself too though, for example as follows (untested, just the idea): vec_diff(temp,ent.x,camera.x); temp.z = 0; vec_normalize(temp,1); vec_set(temp2,vector(0,-1,0)); vec_rotate(temp2,vector(camera.pan,0,0)); // pan alone should be enough, right? var balance = vec_dot(temp,temp2)*100; snd_tune(...,balance); If the result is super wrong, I'd start with DEBUG_VARing the vec_dot result. That's a good idea, I will take a look at it. Thanks superku
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: ent_playsound on moving entities
[Re: painkiller]
#463742
12/23/16 14:21
12/23/16 14:21
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
Serious User
|
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
I think that doesn't seem to work, at least on my computer. I tried to add a pXent_move call but still got the problem. Did you try it on the demo I uploaded? , I tried it many times but I cannot get it working in your script. I do know there is a lot of differences between our scripts, but mine is getting quite big so it could be alot of things. If Superku's solution doesn't work out you could take a look at 3run's physx code on this forum, I used that as a base for the physx parts of my script. Probably some variable is different
|
|
|
Re: ent_playsound on moving entities
[Re: Reconnoiter]
#463743
12/23/16 16:08
12/23/16 16:08
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
OP
Serious User
|
OP
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
I think that doesn't seem to work, at least on my computer. I tried to add a pXent_move call but still got the problem. Did you try it on the demo I uploaded? , I tried it many times but I cannot get it working in your script. I do know there is a lot of differences between our scripts, but mine is getting quite big so it could be alot of things. If Superku's solution doesn't work out you could take a look at 3run's physx code on this forum, I used that as a base for the physx parts of my script. Probably some variable is different hmm in your code based on the 3run's demo you are using shade-c evo, aren't you? because I think that is related. Anyway this is very strange indeed. I think I will use Superku solution for now as this is getting me a bit crazy, I've tested it also changing the volume depending of the distance and works fine. Thanks for the help
Last edited by painkiller; 12/23/16 16:09.
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: ent_playsound on moving entities
[Re: Reconnoiter]
#463746
12/23/16 21:17
12/23/16 21:17
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
After playing for a while with your demo (painkilled), I found out that evil comes from sc_setup (just comment it in main and you'll see that sound works correctly), at the end I could only strip down your demo to this functions: sc_materials_init(); sc_gBuffer_init(screen, SC_GBUFFER_DEFERRED, screen.settings.bitdepthGBuffer); sc_deferredLighting_init(screen, 1, screen.settings.bitdepthLBuffer); sc_forward_init(screen, SC_FORWARD_PASSTHROUGH); // option 2 They are called in sc_setup(SC_SCREEN* screen) (wrapper.c), seems that problem is in one of them.. I played a little bit with views in those files, but with no luck. Greets
|
|
|
Re: ent_playsound on moving entities
[Re: 3run]
#463747
12/23/16 21:36
12/23/16 21:36
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
Serious User
|
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
Bingo, with 3run's post I found the problem, do this:
sc_screen_default.settings.forward.enabled = 1;
Seems that the deferred pipeline was the culprit. So that is why the sounds worked in my script cause I turned it off already so particles would work in my script.
Last edited by Reconnoiter; 12/23/16 21:39.
|
|
|
Re: ent_playsound on moving entities
[Re: Reconnoiter]
#463787
12/27/16 17:10
12/27/16 17:10
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
OP
Serious User
|
OP
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
wow thanks Reconnoiter and 3run!! setting forward renderer to 1 solved the problem indeed
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: ent_playsound on moving entities
[Re: txesmi]
#463802
12/29/16 11:04
12/29/16 11:04
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
OP
Serious User
|
OP
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
Hi, looking to the solution it could have something to do with the AUDIBLE view flag set or missing on the main camera or one of the renderer view chains...
Salud! I tried to find issues with the AUDIBLE flag but I didn't find anything wrong in the shade-c code.
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: ent_playsound on moving entities
[Re: painkiller]
#463822
12/29/16 19:43
12/29/16 19:43
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Hi, looking to the solution it could have something to do with the AUDIBLE view flag set or missing on the main camera or one of the renderer view chains...
Salud! I tried to find issues with the AUDIBLE flag but I didn't find anything wrong in the shade-c code. Yep, same here.
|
|
|
|