X Tutup
Skip to content

Move server files into their subfolders#89409

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
aaronfranke:server-folders
Oct 3, 2025
Merged

Move server files into their subfolders#89409
Repiteo merged 1 commit intogodotengine:masterfrom
aaronfranke:server-folders

Conversation

@aaronfranke
Copy link
Member

@aaronfranke aaronfranke commented Mar 12, 2024

This PR moves most of the servers/*.{cpp,h} files into the subfolders, when they exist. The old approach always seemed off to me. If there is a folder for a thing, we should put all files for that thing in the folder.

This PR also improves consistency, as some servers (debugger, extensions, and movie writer) did not have any top-level files.

@aaronfranke aaronfranke added this to the 4.x milestone Mar 12, 2024
@aaronfranke aaronfranke requested review from a team as code owners March 12, 2024 04:45
@aaronfranke aaronfranke requested review from a team March 12, 2024 04:45
@aaronfranke aaronfranke requested review from a team as code owners March 12, 2024 04:45
@aaronfranke aaronfranke force-pushed the server-folders branch 2 times, most recently from 21fd5f6 to d13f9aa Compare March 13, 2024 18:47
@Mickeon
Copy link
Member

Mickeon commented Mar 16, 2024

This feels like a good call. But I don't about every server being in its own folder. Physic servers greatly benefit from it due of the other Godot Physics files, though.

@Calinou Calinou removed request for a team March 10, 2025 17:43
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I support this, I've been meaning to propoose the same for a while. Our setup with the main server file in servers/ with its dependencies in servers/<type>/ always seemed a bit weird.

And now with the work done by @YeldhamDev to allow compiling without 2D/3D physics, 2D/3D navigation, XR, or RenderingDevice, this becomes more relevant.

One major argument against doing such change is that it breaks paths that C++ modules might rely on. But we're already breaking a lot of those paths with @YeldhamDev's PRs for 4.5 so we might as well do it all at once.

I'd like more @godotengine/maintainers opinions before we merge this though. @BastiaanOlij did raise a good point too.

@YeldhamDev
Copy link
Member

YeldhamDev commented Mar 31, 2025

Is there a reason for rasterizer_dummy.h having its own subfolder? It's the only dummy file organized like that, and the subfolder only contains that single file.

Misread the git diff, ignore that. 😛

Copy link
Member

@YeldhamDev YeldhamDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file organization looks fine, and it's better to do this sooner rather than later.

Copy link
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The restructure for navigation looks good to me, didn't dig into the rest

@@ -1,5 +1,5 @@
/**************************************************************************/
/* nav_heap.h */
/* navigation_common.h */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sole navigation file under servers/ seems a bit weird.

We should consider if this alternative isn't better:

  • Duplicate the shared enums in both the 2D and 3D folders, it's just a few constants and not uncommon in the Godot codebase to do this.
  • Move the Heap class to core.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CC @smix8

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is I could just move it into, say, the NavigationServer3D folder, and have this header be the only dependency 2D navigation has on 3D. Since it's not a cpp file, the build system wouldn't have to know. 🙈

Copy link
Member

@akien-mga akien-mga Apr 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I'd say keep it as servers/nav_heap.h and move the enums back, duplicating them in 2D and 3D (maybe re-creating navigation_utilities_{2,3}d.h out of navigation_defaults_{2,3}d.h + these enums).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got sidetracked with scope creep so I opened PR #105718 which we can merge first.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is we could have servers/navigation/2d/ and servers/navigation/3d/ instead of servers/navigation_2d/ and servers/navigation_3d/, putting the common files in servers/navigation/. But then there is the question of if we would do this with physics as well.

Copy link
Member

@KoBeWi KoBeWi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was a easy to recognise difference between the outward facing servers, and their internal implementation.

I don't see much difference personally. But I also never had to include or touch server files 🤔
Server files follow a common structure: servers/topic/topic_server.h. The main file is still easy to identify. Alternatively we could rename them to the same name, but that's questionable.

Copy link
Contributor

@Repiteo Repiteo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invariably a very noisy change, but one that I think makes total sense with the added context of several other stylistic shuffling PRs similar to this one

@Repiteo
Copy link
Contributor

Repiteo commented Oct 3, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

X Tutup