Skip to content

Battle/feature - PlayerRefactor#1338

Draft
Topi3 wants to merge 179 commits intomainfrom
Battle/feature/ShieldRefactor
Draft

Battle/feature - PlayerRefactor#1338
Topi3 wants to merge 179 commits intomainfrom
Battle/feature/ShieldRefactor

Conversation

@Topi3
Copy link
Copy Markdown
Contributor

@Topi3 Topi3 commented Mar 4, 2026

Added a way to use the new spritesheets.
Separated shields into separate Quantum entities.
This was done to allow for detaching a shield and for it's shape and looks to be easily changeable.
A general way to store entities outside the arena was added to make this possible.
This was done in the new BattleEntityManager class.
The player's simulation and view code was refactored in various ways.
BattleViewRegistry was added to be able to reference separate entities on the view side of the code.
A lot of documentation was rewritten.

  • Class naming format was changed from names to codes in their data files, simulation scripts and view scripts.

BattleCompoundEntity.qtn

  • Added BattleEntityLink struct.
    • Link structure used to reference Quantum entity and its relative position.
  • Added BattleCompoundEntityComponent component.
    • Component that stores one or more Quantum entity links for Compound Entities.

BattleEntityID.qtn

  • Added BattleEntityID struct.
    • Used by BattleEntityManager to reference Quantum entities.

BattleEntityManagerData.qtn

  • Added BattleEntityManagerDataQSingleton component.
  • Holds a list of registered entities, their off screen positions and their grid spacing.

BattleEvents.qtn

  • Renamed all EntityRefs to ERef instead of Entity.
  • Renamed BattlePlayerViewInit event to BattlePlayerCharacterViewInit.
  • Added BattlePlayerShieldViewInit event.
  • Added BattleInPlayStateUpdate event.

BattlePlayerCharacterClass.qtn

  • Enum names were changed from class names to class codes, I.E Class100 = 100.

BattlePlayerCharacterID.qtn

  • BattlePlayerCharacterID enum was added
    • Has all characters listed in the same way as the classes in BattlePlayerCharacterClass, I.E Character101=101.
  • Also changed all int CharacterID fields from the rest of the code to use this instead of int.

BattlePlayerData.qtn

  • Modified BattlePlayerDataQComponent.
    • Renamed FP RotationBase and FP RotationOffset to FP RotationBaseRad and FP RotationOffsetRad.
    • Removed HitboxShield and CharacterEntity EntityRefs.
    • Added int ShieldCount, int AttachedShieldNumber and BattlePlayerShieldEntityRef AttachedShield.
    • Renamed FP MovementCooldownSec to BotMovementCooldownSec.
  • Moved structs BattlePlayerHitboxColliderTemplate and BattlePlayerHitboxTemplate to BattlePlayerHitbox.qtn.
  • Removed BattlePlayerHitboxTemplate HitboxShield from BattlePlayerDataTemplateQComponent component.

BattlePlayerHitbox.qtn

  • Removed bool IsActive, FPVector2 Normal and NormalBase from BattlePlayerHitboxQComponent.
  • Renamed PlayerEntity to ParentEntityRef.
  • Added FP NormalAngleRad.

BattlePlayerManagerData.qtn

  • Renamed multiple arrays.

BattlePlayerShieldData.qtn

  • Added BattlePlayerShieldDataQComponent.
    • Includes a reference to it's player, its ShieldNumber and a bool for if its attached.
  • Added BattlePlayerShieldDataTemplateQComponent.
    • Includes a list of hitbox templates.

BattlePlayerShieldManagerData.qtn

  • Added BattlePlayerShieldManagerDataQSingleton.
    • Includes an array of player shield counts and shield entity IDs.

BattleCustomEntityReferences.qtn

  • Added BattlePlayerEntityRef struct.
  • Added BattlePlayerShieldEntityRef struct.

CharacterSpecEditor.cs

  • Added ShieldEntityPrototypes to the editor.

BattleDiamondQSystem.cs

  • In the BattleOnDiamondHitPlayer method, changed getting playerData to be based on the hitbox type.

AltzoneBattleLink.cs

  • Modified required methods to get shield prototypes in addition to character prototypes.

CharacterSpec.cs

  • Added ShieldEntityPrototype array.

PlayerCharacterPrototype.cs

  • Added ShieldEntityPrototypes.

BattleCollisionQSystem.cs

  • Added CreateCollisionTriggerComponent method.

BattleEntityManager.cs

  • Added CompoundEntityTemplate struct to handle creating and linking compounds entities.
  • Added a way to all Quantum entities in the game
  • Added a way to register entities and compound entities
  • Added a way to get an entityref of an entity using its ID
  • Added a way to return entities offscreen
  • Added a way to make, move and teleport compound entities.

BattleGameControlQSystem.cs

  • Added BattleEntityManager and BattlePlayerShieldManager Init method calls to OnInit.

BattlePlayerClass400.cs

  • Removed unnecessary OnCreate method.

BattlePlayerClassManager.cs

  • Added CreationParameters struct to handle shield AttachedShieldNumbers on creation.

BattlePlayerHitboxQComponent.cs

  • Added a method to calculate hitbox normals.
  • Changed all normal calculation to use this method elsewhere in the code.

BattlePlayerMovementController.cs

  • Modified Move and Teleport methods to use BattleEntityManager methods.

BattlePlayerQSystem.cs

  • Refactored OnProjectileHitPlayerShield method.
    • Added handling for when a shield is destroyed.

BattlePlayerManager.cs

  • Moved BattlePlayerPlayStateExtension class to a separate script.
  • Refactored code.
  • Moved PlayerHandle and PlayerHandleInternal to a separate script.
  • Modified code to use BattleEntityManager.

BattlePlayerManagerPlayerHandle.cs

  • Refactored code.

BattlePlayerShieldManager.cs

  • Added a way to create, attach and remove shields.
  • Added a way to retrieve the EntityRef for a detached shield.

BattleCustomEntityReferences.cs

  • BattlePlayerEntityRef
    • Added methods for creating a BattlePlayerEntityRef.
    • Added methods for retrieving Transform2D and BattlePlayerDataQComponent pointers.
  • BattlePlayerShieldEntityRef
    • Added methods for creating a BattlePlayerShieldEntityRef.
    • Added methods for retrieving Transform2D and BattlePlayerShieldDataQComponent pointers.

BattleSpriteSheet.cs

  • Added BattleSpriteSheet struct.
    • Added a way to get a specific sprite out of the spritesheet.
  • Added an easy way to add a full spritesheet from the editor.

BattleViewRegistry.cs

  • Added a way to link together entities on the view side of the code.

Player folder

  • Restructured all view controllers to have a character and shield version separately.

BattlePlayerCharacterViewController.cs

  • Added a SpriteSheetMap struct to hold an enum that has names and indices for all used spritesheet sprites.
  • Added BattleSpriteSheet and BattleViewRegistry functionality.
    • Added methods to change the sprite of a specific body part's gameobject.
  • Added subscription and handler methods to BattleShieldTakeDamage and BattleInPlayStateUpdate events.

BattlePlayerCharacterViewControllerEditor.cs

  • Added a way to automatically set base sprites to a character in the editor.

BattlePlayerShieldViewController.cs

  • Added BattleSpriteSheet and BattleViewRegistry functionality
    • Added a method to change the sprite of the shield's gameobject.
  • Added subscription and handler method to BattleInPlayStateUpdate event.

BattlePlayerShieldViewControllerEditor.cs

  • Added a way to automatically set a base sprite to a shield in the editor.

Doxygen

  • Updated player concept page.
  • Added Entity Manager and View Registry concept pages.
  • Added documentation for new qtn files.
  • Updated documentation of changed qtn files.

Player prefabs

  • Restructured hierarchy.
    • Added a base character for each class, which is a variant of the 000 prefab.
    • All characters of a class are variants of their class base character.
  • Added shield prefabs.
    • Same hierarchy as character prefabs, except for characters with multiple shields.
    • If a character has multiple shields, the first shield they have acts as the base prefab to create variants from.
  • Added new spritesheets to all character prefabs that have them.
    • Repositioned LocalPlayerIndicator for all characters with the new spritesheet.



Contains method for creating player shield entities, and method for retrieving a shield entity.

Also contains various private helper methods.
BATTLE_PLAYER_SHIELD_COUNT = 4
BATTLE_PLAYER_SHIELD_TOTAL_COUNT = 48
Used for registering, and later accessing any created entities.

Uses BattleEntityManagerDataQSingleton defined in new BattleEntityManagerData.qtn.

Uses BattleEntityID struct defined in BattleEntityID.qtn.
NOTE: some parts still unfinished, does not compile!

BattlePlayerPlayStateExtension and PlayerHandle structs are now in their own separate files
Contains a list of hitbox EntityRefs. Is defined in editor using BattlePlayerShieldDataTemplateQComponent.
Removed HitboxShield from template.
Added int ShieldCount and EntityRef AttachedShield.
Removed HitboxShieldEntity
Renamed HitboxCharacterEntity to CharacterHitboxEntity
…1110

Used to set correct viewmodel active based on team. OnShieldTakeDamage is now handled here to play hit particle.
@Niklas603619 Niklas603619 added Battle battleen liittyvät tehtävät Quantum labels Mar 18, 2026
Topi3 added 26 commits March 19, 2026 13:59
…ts into one file #1110

also updated their documentation
also removed OnCreate in BattlePlayerClass400.cs
also fixed some documentation
also added missing documentation
also updated GetCharacterEntityRef methods in BattlePlayerManagerPlayerHandle
also renamed a variable
also renamed an event in BattleEvents and updated it's documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Battle battleen liittyvät tehtävät Quantum

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Task: Pelaaja Hahmo ja Kilpi refactor

4 participants