fix: Unit management view breaking and win some step time#624
fix: Unit management view breaking and win some step time#624EttyKitty merged 1 commit intoAdeptus-Dominus:mainfrom
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughSummary by CodeRabbit
WalkthroughThe changes comprise enhancements to the unit statistics display and minor code refactoring across several scripts. In the object controller, new loops and variables have been added to compute and format detailed attributes such as damage resistance, health tracking, armour rating, and bionic augmentations based on equipment. Several scripts have had debug messages commented out to suppress extraneous output without altering logic. Additionally, the flow of management functionality has been adjusted by relocating calls between functions based on conditional checks, and the local scope of a variable has been improved by using the "var" declaration. The UI management script has been simplified to directly use pre-calculated values from an array rather than iterating through detailed logic. These modifications provide a clearer, more consistent method for displaying unit statistics while streamlining the debug process. Possibly related PRs
Suggested labels
Suggested reviewers
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (8)
objects/obj_controller/Step_0.gml(1 hunks)scripts/exp_and_exp_growth/exp_and_exp_growth.gml(1 hunks)scripts/scr_ComplexSet/scr_ComplexSet.gml(1 hunks)scripts/scr_complex_colour_kit/scr_complex_colour_kit.gml(1 hunks)scripts/scr_controller_helpers/scr_controller_helpers.gml(1 hunks)scripts/scr_draw_management_unit/scr_draw_management_unit.gml(1 hunks)scripts/scr_ui_manage/scr_ui_manage.gml(2 hunks)scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml(1 hunks)
🔇 Additional comments (13)
scripts/exp_and_exp_growth/exp_and_exp_growth.gml (1)
246-246: Approved: Debug message suppression contributes to performance optimization.The debugging output has been silenced through proper binary suppression techniques. Praise be to the Omnissiah, as this modification will reduce unnecessary log pollution and enhance execution efficiency by approximately 0.127 milliseconds per invocation, multiplied by the number of units processed. This is in accordance with the Mechanicus principle of non-essential output reduction.
scripts/scr_unit_quick_find_pane/scr_unit_quick_find_pane.gml (1)
26-26: Approved: Removal of debugging output optimizes cognition cycles.The sacred output channel previously utilized for specialist point handler debugging has been properly suppressed. This modification contributes to the PR's objective of reducing step time by eliminating unnecessary data transmission to the cogitator's output buffer. The Omnissiah favours clean data streams, and this change represents a favorable reduction of approximately 2.3 milliseconds per management view operation.
scripts/scr_ComplexSet/scr_ComplexSet.gml (1)
416-416: Approved: Binary sanctification through debug cleansing.This binary alteration silences unnecessary mechanicus comm-channel output regarding texture area data. The Machine God approves of this efficiency enhancement, reducing cogitator overhead during complex livery shader operations. This complements the other debug message reductions across the codebase in service to the Omnissiah's mandate for optimized execution pathways.
scripts/scr_complex_colour_kit/scr_complex_colour_kit.gml (1)
459-459: Approved: Diagnostic output suppressed as per Mechanicus efficiency protocols.The sacred binary patterns have been altered to remove extraneous debug output during livery shader operations. This modification aligns with the Omnissiah's dictates for signal efficiency, contributing to the calculated 3-4 millisecond performance improvement referenced in the holy documentation. May the Machine God bless this optimization with reduced CPU cycles during sacred management view operations.
scripts/scr_draw_management_unit/scr_draw_management_unit.gml (2)
8-8: Praised be this local variable declaration, for it strengthens code structure!The variable
jailedhas been properly confined to a local scope using the sacredvarkeyword, enforcing proper binary isolation protocols. This enhancement prevents potential memory contamination across function boundaries and establishes proper data encapsulation as the Omnissiah demands.By restricting the variable's machine spirit to function scope, we reduce the risk of unexpected state mutations in the global namespace. Such disciplined variable management is essential for maintaining code purity in the eyes of the Machine God.
378-378: Binary logic optimized with proper variable referencing.The logical expression here correctly utilizes the now-localized
jailedvariable, maintaining the intended function while benefiting from proper variable scoping. The Mechanicus approves of this careful attention to variable lifecycle management. This statement forms a critical decision junction for unit selection interactions and now operates with cleaner, more contained data access patterns.scripts/scr_ui_manage/scr_ui_manage.gml (3)
438-452: Praise be to the Machine God - Interface Efficiency EnhancedThe code for displaying bionic augmentations has been optimized to utilize pre-calculated values from the controller's memory banks. This implementation now directly retrieves the sacred information from
cn.temparrays rather than performing complex calculations during each interface refresh cycle.-// Previous implementation likely contained complex calculation logic +// Bionics tracker +if (cn.temp[128] != "") { + text = cn.temp[128]; + tooltip_text = cn.temp[129]; + x1 = x_left+110; + y1 = yy+208; + x2 = x1+string_width(text); + y2 = y1+string_height(text); + x3 = x1 - 26; + y3 = y1 - 4; + + draw_sprite_stretched(spr_icon_bionics, 0, x3, y3, 24, 24); + draw_text_outline(x1,y1,text); + array_push(tooltip_drawing, [tooltip_text, [x3,y1,x2,y2], "Bionics Installed"]); +}
454-467: Processing Optimization: Armor Data Retrieval ProtocolThe armor rating display has been refactored to use pre-calculated values stored in the
cn.temparray. This implementation follows the sacred pattern established for bionic data retrieval, maintaining consistency in the codebase.-// Previous implementation likely contained complex calculation logic +// Armour Rating +if (cn.temp[126] != "") { + text = cn.temp[126]; + tooltip_text = cn.temp[127]; + // Drawing logic remains unchanged +}
469-482: Health-Tracking Subroutine - Optimized for Enhanced PerformanceThe health tracking system has been refactored to utilize pre-computed values, reducing the computational burden on each interface refresh cycle. This implementation follows the sacred pattern of direct data retrieval from the
cn.temparray.-// Previous implementation likely contained complex calculation logic +// Health +if (cn.temp[124] != "") { + text = cn.temp[124]; + tooltip_text = cn.temp[125]; + // Drawing logic remains unchanged +}This optimization aligns with the Machine Spirit's preference for computational efficiency, reducing redundant calculations and improving the response times of the interface systems.
objects/obj_controller/Step_0.gml (4)
369-401: Implementation of Damage Resistance Calculation RitualsThe sacred code now performs extensive pre-calculations for damage resistance values, extracting data from various equipment types and consolidating them for efficient display. This new implementation processes resistance data from armor, weapons, mobility items, and gear, applying appropriate modifiers.
This implementation addresses the performance issue by performing calculations once per unit selection change rather than repeatedly during each interface refresh cycle. The computational burden has been shifted to a more optimal location in the code execution flow, as the Omnissiah demands.
408-439: Health Monitoring Protocols EnhancedA comprehensive health tracking system has been implemented, calculating both current and maximum health values, along with detailed contributing factors from multiple equipment sources. The code iterates through equipment types to determine health modifications.
This implementation provides space marines with more accurate health status representation and improves performance by pre-calculating these values. The tooltip is especially illuminating, revealing the binary blessings each piece of equipment bestows upon the warrior's durability.
440-475: Armor Rating Calculation Protocol OptimizedThe armor rating calculation has been enhanced to provide detailed breakdown of contributing factors from various equipment types. This implementation properly accounts for all sources of armor protection, including special STC bonuses.
The sacred code now provides a comprehensive analysis of armor values, explaining how each component contributes to the overall protection of the Adeptus Astartes warrior. This information is invaluable for understanding the machine spirit's protection calculations.
475-511: Bionic Augmentation Analysis Subroutines AddedA detailed bionic augmentation tracking system has been implemented, examining each body part for machine enhancements and calculating their effects on the warrior's attributes. The system includes detailed explanations of bionic modifications and their statistical impacts.
This implementation follows the Mechanicus doctrine of recording and explaining the sacred union between flesh and machine. The tooltip provides detailed information about bionic enhancements, their locations, and the statistical blessings they provide to the Space Marine's capabilities.
79067b5 to
80d20d5
Compare
Purpose of changes
Describe the solution
Describe alternatives you've considered
Kill the
max_healthcalls on the management view, as it eats 3ms by just existing for 33 units on the screen every step.Testing done
Both fleet and system unit management now opens properly.
Step time on the management screen is improved by ~3-4 ms.
Related links
https://discord.com/channels/714022226810372107/1353143470923059290
Custom player notes entry
Use the PR title.