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

Implement dedicated server export mode that strips unneeded visual resources and forces --headless #5970

Closed
dsnopek opened this issue Dec 20, 2022 · 0 comments · Fixed by godotengine/godot#70377
Milestone

Comments

@dsnopek
Copy link

dsnopek commented Dec 20, 2022

This is an alternate proposal for what Juan proposed in #2756 based on feedback that I got from @Faless on PR godotengine/godot#69546, which attempted to implement that proposal.

Describe the project you are working on

Godot

Describe the problem or limitation you are having in your project

(Copied and modified from Juan's original proposal: #2756)

With the rise of popularity of monetizable multiplayer games, more users want to work on this. These types of games, however, require dedicated authoritative servers (hosted on the cloud via Kubernetes, Agones, etc), to avoid users from cheating (and hence ruining the monetization).

Godot seems to work well for this due to its Linux friendly and Open Source nature, and the fact it can run in headless mode. There are some hurdles to overcome, however to make this process smoother for users:

  • Exports still include all graphics and audio assets, which get included even if exported to server.
  • Exports still include all scripts and scenes, and its not possible to discern what is not needed on the server (or in exchange, what is, since you may want to include information to connect to a back-end that is not present in the player side).

(A few points from the original proposal are removed. In discussion with @Faless, we agreed that it'd be good to keep the changes almost entirely contained to the export system, and that nodes disappearing from scenes due to the export mode could be problematic for a couple reasons, including that it'd be tricky to test the server, because you'd have to export.)

Describe the feature / enhancement and how it helps to overcome the problem or limitation

This feature will add a "dedicated server" export mode, that will force the exported project to run in headless mode, and allow the developer to pick specific resources to "Strip" (replace with placeholders), "Keep" or "Remove".

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

  • When setting up an export preset, on the "Resources" tab, the developer can set the "Export Mode" to "Export as dedicated server":
    Selection_469
  • When this mode is selected, the developer can choose to customize any folder or file, and set them to:
    • Strip: Replace the resource with a placeholder version (if the resource has one).
    • Keep: Include the resource in the export.
    • Remove: Remove the resource from the export completely.
  • When one of these options is set on a directory, it will cascade down to all the other files and sub-directories in it, unless those files or sub-directories are customized with a different option.
  • When a resource (including scenes) are set to "Strip", it will also strip all embedded resources in that file. If the developer wants to keep an embedded resource, they need to first save it externally in a .tres file, and then they can set that to "Keep".
  • When exported with this mode, the --headless CLI option will be forced.
  • When exported with this mode, the "dedicated_server" feature tag will be set (so, code can use OS.has_feature("dedicated_server") to determine if this is a dedicated server build).
  • The feature tag also allows the developer to override project settings just for dedicated servers (ie. "setting.dedicated_server").

On the old PR, there were a number of good suggestions for a better term than "dedicated server", including: "gameserver" and "headless server". I'm fine to switch to whichever term the consensus forms around!

(BTW, with a couple extra bits of UI, the way resources are customized for this "Export Mode" could replace all the other export modes! However, for the time being, we're only proposing this for the dedicated server mode.)

If this enhancement will not be used often, can it be worked around with a few lines of script?

There's no good, not-hacky workaround.

Is there a reason why this should be core and not an add-on in the asset library?

Developers can hack around this problem, but I don't think it'd be possible to make a truly good experience from an addon.

@dsnopek dsnopek added this to the 4.x milestone Dec 20, 2022
@Calinou Calinou changed the title Implement dedicated server export mode that strip unneeded visual resources and force --headless Implement dedicated server export mode that strips unneeded visual resources and forces --headless Dec 20, 2022
@akien-mga akien-mga modified the milestones: 4.x, 4.0 Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants