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

Refactor filesystem #306

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Refactor filesystem #306

wants to merge 21 commits into from

Conversation

cruglet
Copy link
Member

@cruglet cruglet commented Dec 27, 2024

Description of changes

Most of the ingame content has been moved into the game folder with split directories for textures/scripts/sfx/etc. This provides an easier framework for the refactoring of underlying systems, as well as future implementations for other systems to come (and organization, of course). The level designer and pipescript have not really been touched, as those can be addressed later when refactored. The only change made to those would be the moving of pipescript's assets from godot into the respective pipescript folder, under scene (the rust source code is under source).

The only part of this refactor that I sort of have a issue with is the UI and "classes". I'd be lying if I didn't want to just tear most of that down and start anew, but I'm still unsure how important those elements are going to be in the long run, so they'll stay mostly untouched in this refactor.

Here is a summary of the new filesystem:

android - Untouched (still am unsure if this should be moved somewhere)

console - The in-game console (/)

core - Basically whatever does not fit in game like the audio bus layout or specific shaders.

game - All assets [textures/scenes/scripts/sfx/music] for the game

  • classes: Any former class are organized here, as opposed to being scattered throughout the filesystem
  • locale: The folder for fonts & translations
  • music: All of the game's music
  • objects: Any entity/sprite with their textures/sfx/scripts/etc.
  • ui: The UI for the game (HUD, Menus, Screens, etc.)
  • world: Mostly for unsorted stuff like backgrounds, terrain, water, death & camera zones, etc.

level_designer - Untouched, just moved out of its original place

meta - Any assets for publications of the game or for the README

pipescript - Contains everything for pipescript, including its respective Godot scene and resources.

Issue(s)

A lot of things are broken right now. Good news is we were gonna rewrite those systems anyway, so its not that big of a deal in the long run 🤷

Alright, all of the scattered files have been organized under the "game" folder. Only a few files were renamed to match convention but other than that nothing about the files themselves have changed. This folder can serve as a template for other campaigns based off the original. All objects have been split into: textures, sfx*, and scripts*. Other folders like level designer, pipescript, global, etc. have not been touched here, since it won't really be necessary to organize them. Reconnections must be made but that's fine since the codebase needed a rewrite anyway, that will be done later.

* Some objects may not have these folders, because their respective assets do not exist.
I have no idea why it undeleted my other commit but it should be fine now.
Was missing cloud, sign, and pipe organization
The NOTIFICATION_TRANSLATION_CHANGED signal would be fired before key_list could be loaded.
Reassigns all sounds to new directory for the player
Added the tracks intended for looping alongside their loop points
Gave it the temp name of `grassy_hills`, this can be changed.
Themes probably should be kept separate from shaders anyway
Just reassigning some paths, the game should be bootable now.

The tutorial level has been removed in this refactor since we're probably gonna load it as a JSON file as opposed to a Godot scene.
/game/shaders -> core/shaders
/residual_sfx.tres -> core/audio/residual_sfx.tres
/default_bus_layout.tres -> core/audio/default_bus_layout.tres

/fonts -> game/locale/fonts
/gui -> game/ui
Seriously, this was really cluttering the repo
whoops 🤦‍♂️
This can be changed back once the website is up and running
It's not completelypolished; mostly because we're likely gonna refactor most of the UI anyway, but this provides a nice foundation to start with that.
@cruglet cruglet added enhancement New feature or request refactor Edits to the underlying code optimization labels Dec 27, 2024
@cruglet cruglet self-assigned this Dec 27, 2024
@jaschutte
Copy link
Collaborator

Although I like the new organization, how much of the game is still, functional after all of this? A lot of code uses absolute pathing for resources, I imagine this could create quite the fuss with a lot of systems, such as the level editor.

Also, does moving the files under a sub-folder erase tracking? If so, it may cause issues with other branches active right now too.

I'll do a more thorough check tomorrow, my main point of contention is erasure of tracking, that would make it all old issues harder to track. But I'm overall supportive of the changes

@cruglet
Copy link
Member Author

cruglet commented Jan 4, 2025

Although I like the new organization, how much of the game is still, functional after all of this? A lot of code uses absolute pathing for resources, I imagine this could create quite the fuss with a lot of systems, such as the level editor.

This is true, and I wouldn't be surprised if the vast majority of systems did not work correctly. The thing is, those exact same systems were due for a rewrite anyway, either because we have to remove specific elements of source code or the code itself is old/composed of a mixture of band-aid solutions and spaghetti code (like the former player script). Regardless of whether some systems break or not, the direct process to fix those issues would be as easy as reassigning paths, simply following the engine's errors would be more than enough to fix those issues. Which also gives us the opportunity to revisit this code and see if any improvements/optimizations can be made.

Also, does moving the files under a sub-folder erase tracking? If so, it may cause issues with other branches active right now too.

This was my major concern with the refactor. To my knowledge, tracking is not erased with git mv, however I'm unsure if moving files in Godot's filesystem compensates for that. Regardless, since we're kinda obligated to rewrite a lot of systems, it wouldn't be so bad if it did, anyway. Older issues can be addressed during the refactoring of other systems, and the only active branches I'm aware of is the player refactor and the ld-polygon + ld-widget branches.. Those wouldn't be too hard to port over, especially since the ld was barely touched (for this reason) and I was gonna rewrite the player statemachine anyway 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request optimization refactor Edits to the underlying code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants