-
Notifications
You must be signed in to change notification settings - Fork 8
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
Proposed RFC Feature: Client and server build target separation #32
Comments
There's also a semi-orthogonal issue of separating assets into server-only, common, client-only |
Posted this in #sig-build discord channel. Reposted this in #sig-network discord channel. Aim to bring to TSC on Jan 4th 2022 meeting to discuss next steps for cross-cutting RFC. |
Need to get SIG-build to provide approval as this is cross-cutting. Next meeting on O3DE calendar is Jan 12th, but no current meeting agenda exists: https://github.com/o3de/sig-build/issues. Reached out to SIG-chair directly to discuss issue. |
SIG-Build will review the RFC during the SIG-Build meeting on 12th Jan. |
Notes from review with SIG-Build 01/12 SIG-Build requested to be on PRs related to this feature Suggestions:
Concerns:
|
This RFC has been approved by Build-SIG after a review in Build-SIG's meeting on 12th Jan. |
Could we also mention how this separation allows for code validation and why that's really cool :D? Update: |
RFC was accepted by SIG on 01/18. Will get requestor to add note about code validation and then archive. |
Just made some minor adjustments to this line based on @kberg-amzn 's suggestions. |
Archived in #41 |
Summary:
For some O3DE applications, like multiplayer and live service games, server code cannot be shipped to the clients. Doing so creates incremental security and cheating risks. Servers that include client code and resources can also bring unnecessary dependencies which causes long build and relocation times. This RFC proposes a hard client and server split by separating the client and server into different build targets when required.
What is the relevance of this feature?
With the solution proposed by this RFC, O3DE will support the following two hosting modes for multiplayer applications:
Feature design description:
This solution proposes to add a new Boolean CMake flag
LY_CLIENT_BEHAVES_AS_SERVER
which indicates whether the client target can behave as a client server. If this flag is set to true, the generated binaries will satisfy the requirements of use case 2, and if false the binaries will satisfy the requirements of use case 1.Two compiler definitions are also introduced to allow the separation of client and server behaviors:
AZ_TRAIT_SERVER_ENABLED
: Compile the server code for the current target.AZ_TRAIT_CLIENT_ENABLED
: Compile the client code for the current target.O3DE developers can use combination of these CMake flags and compiler definitions to separate the client and server targets, so that they can create either a dedicated server for live service games or client hosted server for console titles.
Technical design description:
CMake definitions
For any multiplayer O3DE project, as well as any dependent gems that contain multiplayer components, define separate static libraries for the client and server targets like below:
All the downstream targets should always refer to the client or server static library.
Multiplayer gameplay components will live in both of the client and server targets to keep a simple cook and replication pipeline. Their behavior and accessors will be different because of the compile definitions and macros.
If O3DE developers only need the client hosted solution and don’t want to generate a server launcher, they can just remove the following lines in the CMake configuration:
Macros
Macros would be enforced at the auto-generated component level. We should be adding additional
#if AZ_TRAIT_SERVER_ENABLED
and#if AZ_TRAIT_CLIENT_ENABLED
markup around authority, server, autonomous, client properties and remote procedure calls (RPC), which will force derived components to respect those same defines.What are the advantages of the feature?
What are the disadvantages of the feature?
LY_CLIENT_BEHAVES_AS_SERVER
will require a rebuild of all the targets that are using it, which may result in long recompilation and compilation times.How will this be implemented or integrated into the O3DE environment?
Are there any alternatives to this feature?
Add the same CMake flag/compile definitions as the proposed solution and also create the following three static libraries for the client hosted and dedicated server mode:
Project/Gem CMake configuration will look like below:
This solution has the same advantages as the proposed solution. Disadvantages include:
How will users learn this feature?
LY_CLIENT_BEHAVES_AS_SERVER
flag and compile definitions.Are there any open questions?
The text was updated successfully, but these errors were encountered: