Got some updates on this. I was able to solve my problem of not being able to configure the particle system when dispatched from the server like this:
1. Created a temporary entity on Server and Client (CSynaesthesiaEntity and C_SynaesthesiaEntity). - On the server, it just transmits some info of the sound to the client version (some EmitSount_t members). - On the client, it spawns a client-side only entity (C_SynaesthesiaProcessor) to configure, dispatch and control a particle effect. 2. Created a client-side only entity (C_SynaesthesiaProcessor) that creates and maintains the particle effect based on information from the sound metadata and audio features extraction. I'm almost sure that that's not the most efficient way to do it, but I believe the performance loss won't be a problem for a prototype. Now, the next task is to use an audio feature extraction library to read some information from the game sounds. I have already integrated the library (http://marsyas.info) to the source code using the FMOD tutorial on the wiki as guide. However, as I am using the sounds from HL2 (my sounds folder does not exist) * I still haven't figured out how to access the game sound files - that are inside the GCF*. A really simple but ugly approach is to extract the game sounds from the GCF to the mod's sound folder, but I would like to avoid that. Can someone shed some light on this matter? Thanks!! Flávio Roberto http://www.dcc.ufmg.br/~flavioro/ Em 26 de janeiro de 2012 15:08, Flávio Roberto <feg...@gmail.com> escreveu: > 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: > > 1. > > http://www.youtube.com/watch?v=OHJ8iTb4T54&feature=context&context=C3e61f17UDOEgsToPDskJNfp_0vvinY3J-zCIyOzex > 2. > > 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: > > 1. Create a "CSynaesthesiaEntity" on the server. > 2. 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