feat(network-weapon): allow firing multiple projectiles in a single batch - #638
Draft
Nyx255 wants to merge 2 commits into
Draft
feat(network-weapon): allow firing multiple projectiles in a single batch#638Nyx255 wants to merge 2 commits into
Nyx255 wants to merge 2 commits into
Conversation
…PC roundtrip - Add batch methods to trigger multiple shots in a single RPC roundtrip - Retain existing single-shot API for backward compatibility
- Some callbacks were missing for each network weapon type that were now added - changed the first parameter of the _after_fire_multiple function to just be an untyped Array. The type check now happens internally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR introduces the ability to fire multiple projectiles in a single RPC roundtrip for
NetworkWeapon. It aims to optimize network traffic for weapons that shoot multiple projectiles simultaneously (e.g., shotguns or burst patterns).Key Changes
fire_multiple,_after_fire_multiple,_configure_multi_projectile) to support multi-projectile execution in a single RPC._NetworkWeaponProxywith callables (c_after_fire_multiple,c_configure_multi_projectile) to ensure full functionality for proxy-based setups.fire(),_after_fire(), etc.) fully intact to guarantee 100% backward compatibility.Architectural Considerations & Discussion Points
1. Backward Compatibility vs. Code Duplication
Currently, single-shot and multi-shot methods exist side-by-side, which introduces some code duplication.
fire(projectile_count: int = 1) -> Array.Arrayfor single shots would introduce breaking changes to existing setups.Array[Node]vsArray[Node2D]) limit clean sub-typing without extra overhead or type cast issues.2.
_NetworkWeaponProxyImplementation_NetworkWeaponProxy. I would appreciate a quick review to ensure this aligns with the intended proxy pattern design.3. Hitscan Weapons Integration
TODO / Next Steps