hifiMoveList.h
Engine/source/T3D/gameBase/hifi/hifiMoveList.h
Classes:
class
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _MOVELIST_HIFI_H_ 25#define _MOVELIST_HIFI_H_ 26 27#ifndef _MOVELIST_H_ 28#include "T3D/gameBase/moveList.h" 29#endif 30 31class HifiMoveList : public MoveList 32{ 33 typedef MoveList Parent; 34 35public: 36 37 HifiMoveList(); 38 39 void init() { mTotalServerTicks = ServerTicksUninitialized; } 40 41 void ghostReadExtra(NetObject *,BitStream *, bool newGhost); 42 void ghostPreRead(NetObject *, bool newGhost); 43 44 void clientWriteMovePacket(BitStream *bstream); 45 void clientReadMovePacket(BitStream *); 46 void serverWriteMovePacket(BitStream *); 47 void serverReadMovePacket(BitStream *bstream); 48 49 void markControlDirty(); 50 U32 getMoves(Move**,U32* numMoves); 51 void onAdvanceObjects() { if (mMoveVec.size() > mLastSentMove-mFirstMoveIndex) mLastSentMove++; } 52 53 void advanceMove(); 54 55protected: 56 void resetMoveList(); 57 S32 getServerTicks(U32 serverTickNum); 58 void updateClientServerTickDiff(S32 & tickDiff); 59 bool serverTicksInitialized() { return mTotalServerTicks!=<a href="/coding/class/classhifimovelist/#classhifimovelist_1ae68982a37a614e2143f8b6b1c6a399a7a342c083421409f8544a5180730ccaad4">ServerTicksUninitialized</a>; } 60 61protected: 62 U32 mLastSentMove; 63 F32 mAvgMoveQueueSize; 64 65 // server side move list management 66 U32 mTargetMoveListSize; // Target size of move buffer on server 67 U32 mMaxMoveListSize; // Max size move buffer allowed to grow to 68 F32 mSmoothMoveAvg; // Smoothing parameter for move list size running average 69 F32 mMoveListSizeSlack; // Amount above/below target size move list running average allowed to diverge 70 bool mSuppressMove; // If true, don't return move on server 71 72 // client side tracking of server ticks 73 enum { TotalTicksBits=10, TotalTicksMask = (1<<TotalTicksBits)-1, ServerTicksUninitialized=0xFFFFFFFF }; 74 U32 mTotalServerTicks; 75}; 76 77#endif // _MOVELIST_HIFI_H_ 78