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

Add option to disable creating a native window for game launchers #18093

Merged

Conversation

spham-amzn
Copy link
Contributor

@spham-amzn spham-amzn commented Jul 3, 2024

This PR adds a feature to optionally disable the creation of native client windows when launching the GameLauncher executable. This use case supports a semi-headless scenario where the game launcher launches a simulation that does not need the native window because the simulation will be part of a wider ROS2 simulation run.

The option to disable the native window will creation will be controlled by any of the following:

Settings Registry

/O3DE/Launcher/Bootstrap/ConsoleMode

or

/O3DE/Atom/RPI/Initialization/NullRenderer

Command line argument

-console-mode

Setting the null renderer through command line argument

-rhi=null
or
-NullRenderer

This implements o3de/sig-simulation#89

How was this PR tested?

Tested with the RobotManipulation and RobotVacuum projects with the following scenarios:

Linux

  1. Launched Robot game launchers with -console-mode argument
  2. Launched Robot game launchers with -rhi=null argument
  3. Added bootstrap.setreg with the key /O3DE/Launcher/Bootstrap/ConsoleMode set to true

Windows

  1. Launched new project with same scenarios as Linux, except that the native client window was still created since its disabled on Windows

…e launcher project

- Added settings registry key `/O3DE/Atom/Bootstrap/CreateNativeWindow` to control the creation of a native window on the game client. (Default is true)
- Make sure that the Application Multisample State is set and initialized even if the native window is not created
- Make sure that we don't capture the mouse if there is no native window created (Even if we don't disable mouse capture)

Signed-off-by: Steve Pham <[email protected]>
* Add enabling console mode through 3 different ways:
* Settings Registry '/O3DE/Launcher/Bootstrap/ConsoleMode'
* '-console-mode' command-line argument
* '-rhi-null' detection
- Add trait to allow console only mode on Linux only since Windows can only do console-mode based on compile time settings

Signed-off-by: Steve Pham <[email protected]>
- Code clean-up
- Remove in-advertant change

Signed-off-by: Steve Pham <[email protected]>
@spham-amzn spham-amzn marked this pull request as ready for review July 8, 2024 19:47
@spham-amzn spham-amzn requested review from a team as code owners July 8, 2024 19:47
Signed-off-by: Steve Pham <[email protected]>
spham-amzn and others added 2 commits July 10, 2024 12:47
…eApplication.h

Co-authored-by: moudgils <[email protected]>
Signed-off-by: Steve Pham <[email protected]>
- Add checks to include '-NullRenderer' from the command line and '/O3DE/Atom/RPI/Initialization/NullRenderer' from the settings registry
- Add comments to describe each 'ApplicationType'

Signed-off-by: Steve Pham <[email protected]>
@byrcolin byrcolin added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Jul 16, 2024
@spham-amzn spham-amzn added the sig/simulation Categorizes an issue or PR as relevant to SIG Simulation label Jul 16, 2024
@spham-amzn spham-amzn merged commit 66f0ea8 into o3de:stabilization/2409 Jul 16, 2024
3 checks passed
spham-amzn added a commit to spham-amzn/o3de that referenced this pull request Jul 17, 2024
…de#18093)

* Initial implementation of enabling a 'window-less' client for the game launcher project

- Added settings registry key `/O3DE/Atom/Bootstrap/ConsoleMode` to control the creation of a native window on the game client. (Default is false)
- Make sure that the Application Multisample State is set and initialized even if the native window is not created
- Make sure that we don't capture the mouse if there is no native window created (Even if we don't disable mouse capture)
- Add new application type query flag : isConsoleMode
- Add enabling console mode through 3 different ways:
  - '-console-mode' command-line argument
  - '-rhi-null' detection
- Add trait to allow console only mode on Linux only since Windows can only do console-mode based on compile time settings

Signed-off-by: Steve Pham <[email protected]>

* - Add more comments
- Code clean-up
- Remove in-advertant change

Signed-off-by: Steve Pham <[email protected]>

* Add missing newline at end of the traits files

Signed-off-by: Steve Pham <[email protected]>

* Minor fix to console mode

Signed-off-by: Steve Pham <[email protected]>

* Update Code/Framework/AzGameFramework/AzGameFramework/Application/GameApplication.h

Co-authored-by: moudgils <[email protected]>
Signed-off-by: Steve Pham <[email protected]>

* Updates based on PR comments

- Add checks to include '-NullRenderer' from the command line and '/O3DE/Atom/RPI/Initialization/NullRenderer' from the settings registry
- Add comments to describe each 'ApplicationType'

Signed-off-by: Steve Pham <[email protected]>

* Initialize the MSAA when in console-only mode

Signed-off-by: Steve Pham <[email protected]>

* Update comments

Signed-off-by: Steve Pham <[email protected]>

---------

Signed-off-by: Steve Pham <[email protected]>
Co-authored-by: moudgils <[email protected]>
Signed-off-by: Steve Pham <[email protected]>
@spham-amzn spham-amzn deleted the console_only_game_launcher_support branch July 19, 2024 15:59
spham-amzn added a commit that referenced this pull request Jul 22, 2024
…8093) (#18137)

* Initial implementation of enabling a 'window-less' client for the game launcher project

- Added settings registry key `/O3DE/Atom/Bootstrap/ConsoleMode` to control the creation of a native window on the game client. (Default is false)
- Make sure that the Application Multisample State is set and initialized even if the native window is not created
- Make sure that we don't capture the mouse if there is no native window created (Even if we don't disable mouse capture)
- Add new application type query flag : isConsoleMode
- Add enabling console mode through 3 different ways:
  - '-console-mode' command-line argument
  - '-rhi-null' detection  
  - '-NullRenderer' detection
  - '/O3DE/Atom/RPI/Initialization/NullRenderer'  registry detection
---------
Signed-off-by: Steve Pham <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. sig/simulation Categorizes an issue or PR as relevant to SIG Simulation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants