newaged Posted January 30, 2016 Share Posted January 30, 2016 SFXPlaylist's pack function outputs too much data for the bitstream to handle, so I am reducing the amount of data it sends. Some of its default values are -1, so I was wondering if writesignedfloat has any downsides when compared to writefloat. Secondary topic, is assigning 10 bits for general data too much or too little? Quote Link to comment Share on other sites More sharing options...
Azaezel Posted January 30, 2016 Share Posted January 30, 2016 https://github.com/GarageGames/Torque3D/blob/2044b2691e1a29fa65d1bdd163f0d834995433ce/Engine/source/sfx/sfxPlayList.cpp#L375 wow, that is nasty... Would say you could reduce more than a little overhead on all but the corneriest of cornercases by killing that fixed 16 off and tracking the max amount of filled-in slots.For the signed/unsigned thing, general rule of thumb is go ahead and leave it signed throughout the majority of the codebase. Might as well stay consistent there.On the bitlength end, to use an example with more than a few variants: https://github.com/GarageGames/Torque3D/blob/2044b2691e1a29fa65d1bdd163f0d834995433ce/Engine/source/T3D/fx/particle.cpp#L351 general range is 7(also used for things like packing player aiming angles to give you another point of reference for fidelity) up to typically around 12-14 for a cap-out when folks have specified. Not really seeing anything listed requiring ultra-sensitive didgits there though, so could see trending on the lower end. Quote Link to comment Share on other sites More sharing options...
newaged Posted January 30, 2016 Author Share Posted January 30, 2016 Went along with the lower precision idea for a bit, but my basic coding skills weren't enough to make something stable. I decided to use a bunch of flags until I get better at C++.The code changes for anyone who wants them. SFXPlayList::packData( sfx/sfxPlaylist.cpp line 366) ... FOR_EACH_SLOT stream->write( mSlots.mFadeTimeIn.mValue[ i ] ); FOR_EACH_SLOT stream->write( mSlots.mFadeTimeIn.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT stream->write( mSlots.mFadeTimeIn.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT stream->write( mSlots.mFadeTimeOut.mValue[ i ] ); FOR_EACH_SLOT stream->write( mSlots.mFadeTimeOut.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT stream->write( mSlots.mFadeTimeOut.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT stream->write( mSlots.mDelayTimeIn.mValue[ i ] ); FOR_EACH_SLOT stream->write( mSlots.mDelayTimeIn.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT stream->write( mSlots.mDelayTimeIn.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT stream->write( mSlots.mDelayTimeOut.mValue[ i ] ); FOR_EACH_SLOT stream->write( mSlots.mDelayTimeOut.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT stream->write( mSlots.mDelayTimeOut.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT stream->write( mSlots.mVolumeScale.mValue[ i ] ); FOR_EACH_SLOT stream->write( mSlots.mVolumeScale.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT stream->write( mSlots.mVolumeScale.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT stream->write( mSlots.mPitchScale.mValue[ i ] ); FOR_EACH_SLOT stream->write( mSlots.mPitchScale.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT stream->write( mSlots.mPitchScale.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT stream->write( mSlots.mRepeatCount[ i ] ); ... SFXPlayList::unpackData(line 408) ... FOR_EACH_SLOT stream->read( &mSlots.mFadeTimeIn.mValue[ i ] ); FOR_EACH_SLOT stream->read( &mSlots.mFadeTimeIn.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT stream->read( &mSlots.mFadeTimeIn.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT stream->read( &mSlots.mFadeTimeOut.mValue[ i ] ); FOR_EACH_SLOT stream->read( &mSlots.mFadeTimeOut.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT stream->read( &mSlots.mFadeTimeOut.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT stream->read( &mSlots.mDelayTimeIn.mValue[ i ] ); FOR_EACH_SLOT stream->read( &mSlots.mDelayTimeIn.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT stream->read( &mSlots.mDelayTimeIn.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT stream->read( &mSlots.mDelayTimeOut.mValue[ i ] ); FOR_EACH_SLOT stream->read( &mSlots.mDelayTimeOut.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT stream->read( &mSlots.mDelayTimeOut.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT stream->read( &mSlots.mVolumeScale.mValue[ i ] ); FOR_EACH_SLOT stream->read( &mSlots.mVolumeScale.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT stream->read( &mSlots.mVolumeScale.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT stream->read( &mSlots.mPitchScale.mValue[ i ] ); FOR_EACH_SLOT stream->read( &mSlots.mPitchScale.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT stream->read( &mSlots.mPitchScale.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT stream->read( &mSlots.mRepeatCount[ i ] ); change that to this SFXPlayList::packData ... FOR_EACH_SLOT if (stream->writeFlag(mSlots.mFadeTimeIn.mValue[ i ] != -1 )) stream->write( mSlots.mFadeTimeIn.mValue[ i ] ); FOR_EACH_SLOT if (stream->writeFlag( mSlots.mFadeTimeIn.mVariance[ i ][ 0 ] > 0)) stream->write(mSlots.mFadeTimeIn.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT if (stream->writeFlag( mSlots.mFadeTimeIn.mVariance[ i ][ 1 ] > 0)) stream->write(mSlots.mFadeTimeIn.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT if (stream->writeFlag(mSlots.mFadeTimeOut.mValue[ i ] != -1 )) stream->write( mSlots.mFadeTimeOut.mValue[ i ] ); FOR_EACH_SLOT if (stream->writeFlag(mSlots.mFadeTimeOut.mVariance[i][0] > 0)) stream->write(mSlots.mFadeTimeOut.mVariance[i][0]); FOR_EACH_SLOT if (stream->writeFlag(mSlots.mFadeTimeOut.mVariance[i][1] > 0)) stream->write(mSlots.mFadeTimeOut.mVariance[i][1]); FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeIn.mValue[ i ] > 0)) stream->write(mSlots.mDelayTimeIn.mValue[ i ] ); FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeIn.mVariance[ i ][ 0 ] > 0)) stream->write(mSlots.mDelayTimeIn.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeIn.mVariance[ i ][ 1 ] > 0)) stream->write(mSlots.mDelayTimeIn.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeOut.mValue[ i ] > 0)) stream->write(mSlots.mDelayTimeOut.mValue[ i ] ); FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeOut.mVariance[ i ][ 0 ] > 0)) stream->write(mSlots.mDelayTimeOut.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT if (stream->writeFlag(mSlots.mDelayTimeOut.mVariance[ i ][ 1 ] > 0)) stream->write(mSlots.mDelayTimeOut.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT if (stream->writeFlag(mSlots.mVolumeScale.mValue[ i ] != 1)) stream->write(mSlots.mVolumeScale.mValue[ i ] ); FOR_EACH_SLOT if (stream->writeFlag(mSlots.mVolumeScale.mVariance[ i ][ 0 ] > 0)) stream->write(mSlots.mVolumeScale.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT if (stream->writeFlag(mSlots.mVolumeScale.mVariance[ i ][ 1 ] > 0)) stream->write(mSlots.mVolumeScale.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT if (stream->writeFlag(mSlots.mPitchScale.mValue[ i ] != 1)) stream->write(mSlots.mPitchScale.mValue[ i ] ); FOR_EACH_SLOT if (stream->writeFlag(mSlots.mPitchScale.mVariance[ i ][ 0 ] > 0)) stream->write(mSlots.mPitchScale.mVariance[ i ][ 0 ] ); FOR_EACH_SLOT if (stream->writeFlag(mSlots.mPitchScale.mVariance[ i ][ 1 ] > 0)) stream->write(mSlots.mPitchScale.mVariance[ i ][ 1 ] ); FOR_EACH_SLOT if (stream->writeFlag( mSlots.mRepeatCount[ i ] > 0)) stream->write( mSlots.mRepeatCount[ i ] ); ..... SFXPlayList::unpackData ... FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeIn.mValue[ i ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeIn.mVariance[ i ][ 0 ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeIn.mVariance[ i ][ 1 ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeOut.mValue[ i ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeOut.mVariance[ i ][ 0 ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mFadeTimeOut.mVariance[ i ][ 1 ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeIn.mValue[ i ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeIn.mVariance[ i ][ 0 ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeIn.mVariance[ i ][ 1 ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeOut.mValue[ i ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeOut.mVariance[ i ][ 0 ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mDelayTimeOut.mVariance[ i ][ 1 ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mVolumeScale.mValue[ i ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mVolumeScale.mVariance[ i ][ 0 ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mVolumeScale.mVariance[ i ][ 1 ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mPitchScale.mValue[ i ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mPitchScale.mVariance[ i ][ 0 ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mPitchScale.mVariance[ i ][ 1 ] );} FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mRepeatCount[ i ] );} I do realize I could have just changed the slot count, but it still would have sent out a large amount of mostly blank data. Quote Link to comment Share on other sites More sharing options...
newaged Posted January 31, 2016 Author Share Posted January 31, 2016 @Azaezel I should probably mention that the last comment was about lowering the hardcoded value, not about your idea of detecting filled slots. That would work fine if I knew how to do it.Anyways, I am posting here again because I will probably do github stuff soon. Does anyone have an opinion on this being one of the prs? Its not a pretty solution to the problem, but it doesn't break networking like whats in the engine right now. Quote Link to comment Share on other sites More sharing options...
Duion Posted February 1, 2016 Share Posted February 1, 2016 I have no idea about that stuff, but it looks like the thing that causes problems in my game as well.If it fixes the issue and does not break anything why not? Did you test if it solves the issue? Quote Link to comment Share on other sites More sharing options...
newaged Posted February 1, 2016 Author Share Posted February 1, 2016 @Duion It fixes the problem in the full template. The problem will still occur if a playlist has enough of its slots changed from their default values. Quote Link to comment Share on other sites More sharing options...
Duion Posted February 1, 2016 Share Posted February 1, 2016 Like changing volume, pitch etc? Quote Link to comment Share on other sites More sharing options...
Nils Posted February 1, 2016 Share Posted February 1, 2016 Thanks @newaged, every improvement on networking is welcome!Tested it (with DM though) and didn't notice any issues! Quote Link to comment Share on other sites More sharing options...
newaged Posted February 1, 2016 Author Share Posted February 1, 2016 @Duion Yep. Delay, fade time, repeat count and the variances of the first 4 mentioned groups as well. Quote Link to comment Share on other sites More sharing options...
JeffR Posted February 1, 2016 Share Posted February 1, 2016 I'd say go ahead and PR it if you think it's a worthy change/improvement. As Timmy said, any improvement is welcome :) Quote Link to comment Share on other sites More sharing options...
Nils Posted February 2, 2016 Share Posted February 2, 2016 As Timmy said, any improvement is welcome :)Hahaha How do you know those are @Timmy 's words ? :lol: :lol: :lol: :lol: Quote Link to comment Share on other sites More sharing options...
Azaezel Posted February 2, 2016 Share Posted February 2, 2016 As Timmy said, any improvement is welcome :)Hahaha How do you know those are @Timmy 's words ? :lol: :lol: :lol: :lol: Because if he was channeling me, it'd be "a step forward is a step forward" :P Quote Link to comment Share on other sites More sharing options...
Hyper Posted April 25, 2016 Share Posted April 25, 2016 I am still having issues with engine 3.8 and dedicated server. Mod the core game with a few new assets and when I try to connect to a dedicated server I get this:Connection error: sfxResolve - Could not resolve local SFXDescription datablock with name '���'.Any help? Quote Link to comment Share on other sites More sharing options...
Duion Posted April 26, 2016 Share Posted April 26, 2016 Did you roll in the bugfix? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.