You don't have to write the particle spawing code twice for client and
server. The particle_parse.h/cpp is a shared file, so calling
DispatchParticleEffect() once would be sufficient, as the same function
runs on both the client and server. This function ultimately calls the
DispatchEffect() from c_te_effect_dispatch.cpp from client and
te_effect_dispatch.cpp from server. You can just create your custom
functions on their basis.

The shared code is necessary for client side prediction for MP. When the
server executes the same code, it dispatches the effect to all clients
except the one who spawned it in the first place. For a single player game,
you don't require any server side dispatch as client should do everything.

I am looking forward to your work on this, this can a really amazing
experience for people suffering from partial to complete deafness.

Thanks
-incubus

On Mon, Jan 30, 2012 at 1:05 AM, Nick <xnicho...@gmail.com> wrote:

> I like the effect of the sound particles very much. I watched it in
> mute and it was interesting. The code looks very professional actually
>
> 2012/1/26 Flávio Roberto <feg...@gmail.com>:
> > Okay, here I am again!
> >
> > I was able to inject some code in SoundEmitterSystem.cpp that spawns a
> > particle system whenever/wherever a sound effect is played. This is part
> of
> > the ugly, temporary (and a bit simplified) code:
> >
> > #if defined( CLIENT_DLL )
> > #include "particles_new.h"
> >
> void AttachParticleEffectForSynaesthesia(int entindex, const Vector* origin, 
> bool isVoice = false, float duration = 1, bool ignorez = false)
> > {
> >       if (!sv_synaesthesia_mode.GetBool() || origin == NULL)
> >               return;
> >
> >       PrecacheParticleSystem("synaesthesia_particles");
> >
> CNewParticleEffect* pEffect = new 
> CNewParticleEffect(ClientEntityList().GetBaseEntity(entindex), 
> "synaesthesia_particles");
> >
> >
> // If sound is a voice, shift it up a bit (because the sounds from voices are 
> emitted not from the mouths, but from chararacters' bellies)
> >       Vector newOrigin = *origin;
> >       if (isVoice) {
> >               newOrigin += Vector(0,0, 45);
> >       }
> >       pEffect->SetControlPoint( 0, newOrigin );
> >
> >       // This sets the color of the particle effect to red. Later, it'll
> use a
> > sound processing library to extract features and set the color
> accordingly
> >
> >       pEffect->SetControlPoint( 1, Vector(255, 0, 0));
> >
> >
> > }
> > #else
> > #include "particle_parse.h"
> >
> void AttachParticleEffectForSynaesthesia(int entindex, const Vector* origin, 
> bool isVoice = false, float duration = 1, bool ignorez = false)
> > {
> >       if (!sv_synaesthesia_mode.GetBool() || origin == NULL)
> >               return;
> >
> DispatchParticleEffect( sv_synaesthesia_particle_name.GetString(), *origin, 
> QAngle(0,0,1), NULL);
> > }
> > #endif
> >
> >
> > Results of a previous (almost equal) version of that code and particle
> > system:
> >
> >
> http://www.youtube.com/watch?v=OHJ8iTb4T54&feature=context&context=C3e61f17UDOEgsToPDskJNfp_0vvinY3J-zCIyOzex
> >
> http://www.youtube.com/watch?v=OqKrDiiqoCA&feature=plcp&context=C3e61f17UDOEgsToPDskJNfp_0vvinY3J-zCIyOzex
> >
> >
> >
> >
> >
> > Now I got one problem. When the sound is emitted from the client, I am
> able
> > to configure the particle effect. But from the server side,
> > DispatchParticleEffect does not give me the opportunity (right?).
> >
> > So now, I am moving to a more organized implementation. AFAIK, to be
> able to
> > configure the particle effect, I have to create them on the client. But I
> > have not yet understood the client/server entities thing yet.
> >
> > I would like to know if this can be a good way to do it:
> >
> > Create a "CSynaesthesiaEntity" on the server.
> > Create a "C_SynaesthesiaEntity" on the client.
> >
> > For sounds triggered from the client, I spawn a "C_SynaesthesiaEntity"
> with
> > the intended parameters to configure and spawn the particle effect.
> > For sounds triggered from the server, I spawn a "CSynaesthesiaEntity"
> that
> > will only trigger a "C_SynaesthesiaEntity" that will finish the job.
> >
> >
> > Can that work??
> >
> >
> >
> > Thanks very much!
> >
> > Flávio Roberto
> > http://www.dcc.ufmg.br/~flavioro/
> >
> > PS: About the previous issue with setting up HL2 maps, I ended up finding
> > the configuration files with GCFScape and using them. =)
> >
> >
> >
> >
> > Em 27 de dezembro de 2011 13:15, Flávio Roberto <feg...@gmail.com>
> escreveu:
> >
> >> Hey Saul,
> >>
> >> That was what I chose, but the configuration files were all from EP2.
> >> But I have managed to make some progress these days and I got something
> >> working (using GCFScape and tuning the configuration files).
> >>
> >> Now, to the modding =)
> >> Thanks everyone and a late merry xmas!
> >>
> >>
> >>
> >> Flávio Roberto
> >> http://www.dcc.ufmg.br/~flavioro/
> >>
> >>
> >>
> >> On Fri, Dec 23, 2011 at 7:51 PM, Saul Rennison <saul.renni...@gmail.com
> >
> >> wrote:
> >>>
> >>> Use "Modify HL2 Singleplayer" as your Create a Mod option. It should
> work
> >>> exactly like HL2 as far I recall.
> >>>
> >>>
> >>> Kind regards,
> >>> Saul Rennison
> >>>
> >>>
> >>>
> >>> On 23 December 2011 16:38, Flávio Roberto <feg...@gmail.com> wrote:
> >>>>
> >>>> Just to clarify: the problem is that my first step is to "recreate"
> the
> >>>> HL2 environment (map sequence, configurations etc) so I can work on
> top of
> >>>> it. And I'm still struggling with that.
> >>>>
> >>>>
> >>>> Flávio Roberto
> >>>> http://www.dcc.ufmg.br/~flavioro/
> >>>>
> >>>>
> >>>>
> >>>> 2011/12/23 Flávio Roberto <feg...@gmail.com>
> >>>>>
> >>>>> Oh, that's great! Thank you aVoX and Saul!
> >>>>>
> >>>>> aVoX, I had already found that folder
> (\sourcesdk_content\hl2\mapsrc),
> >>>>> but there are only some of the maps there. In this case, I believe
> the
> >>>>> option left is to use GCFScape on ...\steamapps\half-life 2
> content.gcf and
> >>>>> decompile, right?
> >>>>>
> >>>>> One more thing: the configuration files created by the "Create a Mod"
> >>>>> Wizard contain information as if it were based on EP2 (chapters,
> >>>>> gameinfo...).
> >>>>> Is that because I used the 2007 sdk version? Is there a quick way to
> >>>>> reuse all (and only) the HL2 configuration files?
> >>>>>
> >>>>> Thanks!
> >>>>>
> >>>>> Flávio Roberto
> >>>>> http://www.dcc.ufmg.br/~flavioro/
> >>>>>
> >>>>>
> >>>>>
> >>>>> On Fri, Dec 23, 2011 at 5:02 AM, <a...@arcticmail.com> wrote:
> >>>>>>
> >>>>>> Concerning 1. you should take a look in your
> >>>>>> "...\SteamApps\<USER>\sourcesdk_content\hl2\mapsrc" directory. All
> maps are
> >>>>>> available in a Hammer-readable VMF.
> >>>>>>
> >>>>>> aVoX.
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> _______________________________________________
> >>>>>> To unsubscribe, edit your list preferences, or view the list
> archives,
> >>>>>> please visit:
> >>>>>> https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
> >>>>>>
> >>>>>>
> >>>>>
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> To unsubscribe, edit your list preferences, or view the list archives,
> >>>> please visit:
> >>>> https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
> >>>>
> >>>>
> >>>
> >>>
> >>> _______________________________________________
> >>> To unsubscribe, edit your list preferences, or view the list archives,
> >>> please visit:
> >>> https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
> >>>
> >>>
> >>
> >
> >
> > _______________________________________________
> > To unsubscribe, edit your list preferences, or view the list archives,
> > please visit:
> > https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
> >
> >
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
>
>
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders

Reply via email to