Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port "SStechtree startup optimisation" #343

Merged

Commits on Jul 24, 2024

  1. SStechtree startup optimisation (#5218)

    # About the pull request
    
    Optimises the initialisation time of the 'Tech Tree' subsystem.
    
    Currently, `/datum/controller/subsystem/techtree/Initialize()` is
    changing the turf of every tile on the tech tree's z-level to
    `/turf/closed/void`, presumably so that it all appears black rather than
    space-y. However since it's calling `ChangeTurf()` on the *entire*
    z-level (300x226, or 67,800 turfs), this is pretty performance
    intensive.
    
    This PR fixes that by just... not changing the turfs, instead only
    adding a few `/turf/closed/void`s around the edge of the tech tree area
    so that it still looks the same in-game. This changes the subsystem's
    init time from 6.4 seconds(ish), to 0.15 seconds(ish).
    
    **Before:**
    ![before
    1](https://github.com/cmss13-devs/cmss13/assets/57483089/b7423bfd-7cbf-434b-ac2b-49765d5a78cc)
    
    **After:**
    ![after
    1](https://github.com/cmss13-devs/cmss13/assets/57483089/543f1ef6-bf61-46c5-90f5-f85b171631bd)
    
    Players viewing the tech tree through the console won't notice anything
    different, as the remaining layer of `/turf/closed/void`s block their
    view of the rest of the z-level.
    
    # Explain why it's good for the game
    
    About 6 seconds knocked off of the server's init time. (10%!) *(At least
    on my end)*
    
    
    # Testing Photographs and Procedure
    <details>
    <summary>Screenshots & Videos</summary>
    <hr>
    
    ### Before/after init times from a few different tests:
    **Before:**
    ![before
    1](https://github.com/cmss13-devs/cmss13/assets/57483089/2c81c7d2-6376-4bea-a7c4-8e071cf09e3f)
    ![before
    2](https://github.com/cmss13-devs/cmss13/assets/57483089/06d21d9a-1c86-4246-bf2b-f0108875713a)
    ![before
    3](https://github.com/cmss13-devs/cmss13/assets/57483089/5590723d-291e-48c9-b0ae-10fef6b05410)
    
    **After:**
    ![after
    1](https://github.com/cmss13-devs/cmss13/assets/57483089/481324cd-fc0d-4876-9359-d9544fcc37c6)
    ![after
    2](https://github.com/cmss13-devs/cmss13/assets/57483089/ffb8c2c7-a09f-4b15-806e-481927a5099d)
    ![after
    3](https://github.com/cmss13-devs/cmss13/assets/57483089/1e9cb315-56b6-47a6-a0be-2a7973b25f88)
    
    <hr>
    
    ### Teleporting to it as an observer, there *is* a visible difference:
    
    **Before:**
    
    ![(null)scrnshot2](https://github.com/cmss13-devs/cmss13/assets/57483089/a133f889-7020-4477-84e5-e49c8cde03aa)
    
    **After:**
    
    ![(null)scrnshot1](https://github.com/cmss13-devs/cmss13/assets/57483089/b7fd8ca6-220c-4366-b367-115c339fe207)
    
    <hr>
    
    ### But viewing it IC, it all works exactly the same as before:
    
    
    https://github.com/cmss13-devs/cmss13/assets/57483089/14fc7b05-5279-489f-99df-e9acc83b1420
    
    <hr>
    
    ### The new `/turf/closed/void` tiles highlighted for reference:
    
    
    ![techtreebounds](https://github.com/cmss13-devs/cmss13/assets/57483089/02159fee-bbe4-4c8a-b0b7-4ba7963f233d)
    
    </details>
    
    
    # Changelog
    :cl:
    code: Made the Tech Tree subsystem initialise faster.
    /:cl:
    SabreML authored and Doubleumc committed Jul 24, 2024
    Configuration menu
    Copy the full SHA
    e2d5a91 View commit details
    Browse the repository at this point in the history