Core/Movement: Improve client control logic#26348
Conversation
…dd check on these handlers too
6a32b60 to
bf7dc7c
Compare
bf7dc7c to
023a00c
Compare
|
does this just need to be tested, merged and then every new bug will be fixed shortly after that as they get reported ? |
|
Yes. Let's first see if problems can be found through code review. Then in 2 weeks or so, let's merge it and I will take care of the bug reports that emerge. |
|
love to see you back @chaodhib great work! ❤️ |
|
@ccrs Thank you. It's good see familiar |
|
I wasn't sure if you were still active in wow emulation. In any case, thanks for your time! |
|
please wait for #26501 to be merged before this PR |
|
PR #26501 has been merged, thanks for waiting |
|
looking on it right now, though I have to say that there are several things to look into, the new ack opcode handling + gameclient + controlling revisit |
|
I'm merging. Thank you for the review! |
This reverts commit 2d114ea.
This PR serves as a necessary prelude for Core/Movement: Improve player movement .
Core/Movement: Improve player movement needed proper client transfer control. Up until now, two fields served that purpose:
Unit::m_playerMovingMeandPlayer::m_unitMovedByMe. There are 2 issues with them:Player::SetMovedUnit()if you don't believe me).player_B->m_unitMovedByMewill still points toward player_B. What is missing here is what I call an API that gives the "real-time client control status" of player_B.In order to fix these problems, this PR introduces 3 notions:
Base client control: assuming I'm correct (please correct me if I'm wrong here), there are only 2 ways a client can have 'client control' over a unit in the game: a) the unit is a player and the client logs into the world with that player (I call this Player unit, the "base player" of that client). b) a (base) player charms another player or unit (this includes a Priest MCing another unit or a Player mounting a vehicle). Therefore, by looking at a unit's
UNIT_FIELD_CHARMandUNIT_FIELD_CHARMEDBYvalues, we can tell who/what is really moving that unit. [1]Real-time client control: On top of the base client control, the server will send to the client
SMSG_CONTROL_UPDATEmessages when the client should loose/regain control over a unit because a CC is applied/removed from that unit. A client could therefore have base client control but temporarily loose actual control while the CC is active. I call this real-time client control. Knowing the "real-time client control status" of a unit is needed when we need to change the speed of a unit for example: if the server controls the unit, we need to send aSMSG_MOVE_SPLINE_SET_RUN_SPEEDmessage to the client to inform of the speed of change. if the client has real-time client control, the server needs to send aSMSG_FORCE_RUN_SPEED_CHANGEmessage (and expect an ACK response).A GameClient entity. Instead of
player_B->m_playerMovingMepointing toplayer_B, we now havegameClient_A->_activeMoverpointing toplayer_B. And if control is lost,gameClient_A->_activeMoverisNULL. Same forplayer_B->m_unitMovedByMewhich also points toplayer_B. Instead, we haveplayer_B->_gameClientMovingMewhich points togameClient_A. This is much more understandable than the cyclic referencesm_playerMovingMeandm_unitMovedByMe.Base client control API:
Real time client control API:
Real time client control is implemented using the exchange of the following packets:
SMSG_CONTROL_UPDATECMSG_SET_ACTIVE_MOVERand/orCMSG_MOVE_NOT_ACTIVE_MOVER[1] If the unit is a creature
UNIT_FIELD_CHARMEDBY == 0, then nobody has "client control" over that unit (in other words, the server has control over that unit).UNIT_FIELD_CHARMEDBYis set, then that player has "client control" over that unit (vehicle or mind control).If the unit is a player
UNIT_FIELD_CHARMEDBY == 0, then we are in a "base player" situation.UNIT_FIELD_CHARMEDBYis set, then that player has "client control" over that unit (e.g. mind control).Target branch(es): 3.3.5/master
Tests performed:
Tested in game. Vehicles work. Weird scenarios like
player_A (a priest) MCs player_B and then player_C fears player_Balso work.