Skip to content

tweak(input): Remove input latency for group creation in multiplayer games#1471

Merged
xezon merged 4 commits intoTheSuperHackers:mainfrom
Stubbjax:remove-group-assignment-delay
Aug 24, 2025
Merged

tweak(input): Remove input latency for group creation in multiplayer games#1471
xezon merged 4 commits intoTheSuperHackers:mainfrom
Stubbjax:remove-group-assignment-delay

Conversation

@Stubbjax
Copy link

The local player no longer has to wait for their group assignment commands to be processed by GameLogicDispatch, which is typically 10 - 64 logic frames after sending the command in multiplayer games. They are instead now immediately processed by CommandXlat for the local player.

This change makes gameplay feel smoother and more responsive. It has no effect on the synchronicity of multiplayer games.

Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am skeptical of this change because it splits the same kind of call into 2 places.

case GameMessage::MSG_CREATE_TEAM8:
case GameMessage::MSG_CREATE_TEAM9:
{
ThePlayerList->getLocalPlayer()->processCreateTeamGameMessage(t - GameMessage::MSG_CREATE_TEAM0, msg);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do disp = DESTROY_MESSAGE; here to avoid the dependency test in GameLogicDispatch?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this not prevent the message from being dispatched to other players?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not check.

@Stubbjax
Copy link
Author

I am skeptical of this change because it splits the same kind of call into 2 places.

This is the same pattern used everywhere else across the message translators.

@xezon
Copy link

xezon commented Aug 21, 2025

This is the same pattern used everywhere else across the message translators.

Ok. Can you please list one comparable example?

@Stubbjax
Copy link
Author

This is the same pattern used everywhere else across the message translators.

Ok. Can you please list one comparable example?

Simply selecting units (MSG_CREATE_SELECTED_GROUP) happens immediately for the client but is also sent across the network to other players.

Below are the commands that are processed in both CommandXlat and GameLogicDispatch. A lot of them are processed locally in CommandXlat for immediate feedback purposes (e.g. unit voices, UI state) before being logically actioned in GameLogicDispatch.

MSG_ADD_TEAM0
MSG_ADD_TEAM1
MSG_ADD_TEAM2
MSG_ADD_TEAM3
MSG_ADD_TEAM4
MSG_ADD_TEAM5
MSG_ADD_TEAM6
MSG_ADD_TEAM7
MSG_ADD_TEAM8
MSG_ADD_TEAM9
MSG_COMBATDROP_AT_LOCATION
MSG_COMBATDROP_AT_OBJECT
MSG_CREATE_SELECTED_GROUP
MSG_CREATE_SELECTED_GROUP_NO_SOUND
MSG_DESTROY_SELECTED_GROUP
MSG_DOCK
MSG_DOZER_CONSTRUCT
MSG_DOZER_CONSTRUCT_LINE
MSG_DO_ATTACKMOVETO
MSG_DO_ATTACK_OBJECT
MSG_DO_FORCE_ATTACK_GROUND
MSG_DO_FORCE_ATTACK_OBJECT
MSG_DO_GUARD_OBJECT
MSG_DO_GUARD_POSITION
MSG_DO_MOVETO
MSG_DO_REPAIR
MSG_DO_SALVAGE
MSG_DO_SPECIAL_POWER
MSG_DO_SPECIAL_POWER_AT_LOCATION
MSG_DO_SPECIAL_POWER_AT_OBJECT
MSG_DO_WEAPON_AT_LOCATION
MSG_DO_WEAPON_AT_OBJECT
MSG_ENTER
MSG_EVACUATE
MSG_GET_HEALED
MSG_GET_REPAIRED
MSG_INTERNET_HACK
MSG_LOGIC_CRC
MSG_PICK_UP_PRISONER
MSG_RESUME_CONSTRUCTION
MSG_SELECT_TEAM0
MSG_SELECT_TEAM1
MSG_SELECT_TEAM2
MSG_SELECT_TEAM3
MSG_SELECT_TEAM4
MSG_SELECT_TEAM5
MSG_SELECT_TEAM6
MSG_SELECT_TEAM7
MSG_SELECT_TEAM8
MSG_SELECT_TEAM9
MSG_SET_REPLAY_CAMERA
MSG_SWITCH_WEAPONS

Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it works, then all good.

@xezon xezon changed the title tweak: Remove input latency for group creation in multiplayer games tweak(input): Remove input latency for group creation in multiplayer games Aug 24, 2025
@xezon xezon added Bug Something is not working right, typically is user facing Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour Input Enhancement Is new feature or request and removed Bug Something is not working right, typically is user facing labels Aug 24, 2025
@xezon xezon merged commit 67f50d1 into TheSuperHackers:main Aug 24, 2025
18 checks passed
@Stubbjax Stubbjax deleted the remove-group-assignment-delay branch August 24, 2025 07:44
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Is new feature or request Gen Relates to Generals Input Minor Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants