Skip to content

Commit

Permalink
Merge pull request #18 from sammyfreg/dev
Browse files Browse the repository at this point in the history
Dev->Main
Version 1.9 release
-Tested on UE5
-Updated FontAwesome to v6
  • Loading branch information
sammyfreg committed May 6, 2022
2 parents d989b8a + f424a91 commit 84313ca
Show file tree
Hide file tree
Showing 18 changed files with 10,894 additions and 4,498 deletions.
4 changes: 2 additions & 2 deletions NetImgui.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 8,
"VersionName": "1.8",
"Version": 9,
"VersionName": "1.9",
"FriendlyName": "Unreal NetImgui",
"Description": "Plugin exposing Dear ImGui library for drawing 2D menus. These menus are displayed and controlled from an external application but processed from this engine code.",
"Category": "2D",
Expand Down
6 changes: 3 additions & 3 deletions NetImguiServer/netImgui.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
"Auto": true,
"HostPort": 8889,
"Hostname": "localhost",
"Name": "UE4 Game"
"Name": "UE Game"
},
{
"Auto": true,
"HostPort": 8890,
"Hostname": "localhost",
"Name": "UE4 Editor"
"Name": "UE Editor"
},
{
"Auto": true,
"HostPort": 8891,
"Hostname": "localhost",
"Name": "UE4 Server"
"Name": "UE Server"
}
],
"Note": "netImgui Server's list of Clients (Using JSON format).",
Expand Down
59 changes: 38 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
</p>

# Summary
### Support of [NetImgui](https://github.com/sammyfreg/netImgui "NetImgui") in [Unreal Engine 4](https://github.com/EpicGames)
### Support of [NetImgui](https://github.com/sammyfreg/netImgui "NetImgui") in [Unreal Engine 4 & 5](https://github.com/EpicGames)

**UnrealNetImgui** is a plugin adding remote debug GUI interface to **Unreal Engine** using the [**Dear ImGui**](https://github.com/ocornut/imgui "Dear ImGui") paired with [**NetImgui**](https://github.com/sammyfreg/netImgui). Allows **UE4** users to remotely display and control some custom GUI on the dedicated **NetImgui Server** application. This proves convenient with games running on limited inputs/display hardware, such as gaming consoles and smartphones. Also reduces the game screen clutter of debug informations contents.
**UnrealNetImgui** is a plugin adding remote debug GUI interface to **Unreal Engine** using the [**Dear ImGui**](https://github.com/ocornut/imgui "Dear ImGui") paired with [**NetImgui**](https://github.com/sammyfreg/netImgui). Allows **UE** users to remotely display and control some custom GUI on the dedicated **NetImgui Server** application. This proves convenient with games running on limited inputs/display hardware, such as gaming consoles and smartphones. Also reduces the game screen clutter of debug informations contents.

![NetImgui](https://raw.githubusercontent.com/wiki/sammyfreg/netImgui/Web/img/UnrealNetImgui.gif)

> **Note 1:** Allows a simple use of **Dear ImGui** in **Unreal Engine 4**. To support more complex scenario with GUI content displayed locally on the game screen, please take a look at the excellent [**UnrealImGui**](https://github.com/segross/UnrealImGui/tree/net_imgui) plugin. It also has NetImgui support integrated in the **net_imgui branch**.
> **Note 1:** Allows use of **Dear ImGui** in **Unreal Engine 4 & 5** in a separate window/PC. To have Dear ImGui GUI content displayed locally (game screen), please take a look at the excellent [**UnrealImGui**](https://github.com/segross/UnrealImGui/tree/net_imgui) plugin (also has NetImgui support in the **net_imgui branch**).
> **Note 2:** Useful library when **Dear ImGui** is not already supported in your UE4 engine codebase. Otherwise, ignore this plugin and add [**NetImgui's**](https://github.com/sammyfreg/netImgui "NetImgui") client code alongside your **Dear ImGui's** code. It requires minimal integration time and you can refer to this plugin for implementation details.
> **Note 2:** Useful library when **Dear ImGui** is not already supported in your UE engine codebase. Otherwise, ignore this plugin and add [**NetImgui's**](https://github.com/sammyfreg/netImgui "NetImgui") client code alongside your **Dear ImGui's** code. It requires minimal integration time and you can refer to this plugin for implementation details.
# Fonts and Icons
The plugin comes packaged with various Latin fonts, a Japanese Mincho font, [Kenney's Gaming Icons](https://kenney.nl/assets/game-icons "gaming icons"), [Font Awesome](https://fontawesome.com "Font Awesome") (the free subset) and [Google Material Designs icons](https://github.com/google/material-design-icons "Google Material Designs icons"), for a nice selection of useful icons. The screenshot above shows a small subset of available icons. Mixing latin text, kanjis and icons is kept straightforward using utf8 strings.
Expand All @@ -30,7 +30,7 @@ There are mutliple ways of connecting your game to the **NetImguiServer**.
![NetImgui](https://raw.githubusercontent.com/wiki/sammyfreg/netImgui/Web/img/NetImguiServer_AddClient.gif)

### Optional
When launching your game or using the Unreal Console, you can also manually control the connection to the NetImguiServer using these commands:
When launching your game or using the Unreal Console, you can also manually control the connection to the NetImgui Server using these commands:

Command Name | Parameter | Description
--- | --- | ---
Expand All @@ -40,11 +40,11 @@ Command Name | Parameter | Description

*Note :* The Port parameter is optional, it will use default values unless specified.

*Example :* `UE4Editor.exe -NetImguiListen` Launch Unreal Editor and wait for a connection on default port.
*Example :* `UEEditor.exe -NetImguiListen` Launch Unreal Editor and wait for a connection on default port.

*Example :* `UE4Editor.exe -NetImguiListen 8000` Launch Unreal Editor and wait for a connection on port 8000.
*Example :* `UEEditor.exe -NetImguiListen 8000` Launch Unreal Editor and wait for a connection on port 8000.

*Example :* `UE4Editor.exe -NetImguiConnect MyPCName` Launch Unreal Editor and try connecting to NetImguiServer running on Windows PC with network name 'MyPCName' on default port.
*Example :* `UEEditor.exe -NetImguiConnect MyPCName` Launch Unreal Editor and try connecting to NetImguiServer running on Windows PC with network name 'MyPCName' on default port.

*Example :* (In Unreal Console) `NetImguiConnect 192.168.1.10:7000` Launch Unreal Editor and try connecting to NetImguiServer running on PC with IP 192.168.1.10 and Port 7000.

Expand All @@ -63,19 +63,32 @@ This plugins comes with ***Imgui Unreal Commands***, adding Unreal Commands brow
-Follow usage found in `Source\Private\NetImguiModule.cpp` (inside IMGUI_UNREAL_COMMAND_ENABLED defines)

# Integration
1. Download and copy the **UnrealNetImgui** folder to **Unreal Engine**'s Plugin directory (`.\Engine\Plugins`)
1. Regenerate your project solution to have the new plugin included *(right-click [ProjectName].uproject-> Generate Visual Studio Project Files)*
1. In your game project `(ProjectName).Build.cs` file, add the `NetImgui` dependency to `PublicDependencyModuleNames` entries.
1. In editor, enable the plugin `2D\NetImgui`.
1. Start the `UnrealNetImgui\NetImguiServer\NetImguiServer.exe` application.
- **Dear ImGui's** menu content created in your code, will be displayed and controlled in it (after a connection is established).
- The client list comes pre-configured with 3 clients configuration (game, editor, server) that will be automatically connected to when detected. For remote PCs, game consoles or others, create a new client configuration with proper address settings.
1. You can now invoke **Dear ImGui** drawing functions to generate your GUI every frame.
- Any code running on the Game Thread can now invoke make drawing calls (as long as `NetImguiHelper::IsDrawing()` is true)
- You can also add a callback to `FNetImguiModule::OnDrawImgui` to be invoked by **UnrealNetImgui** when some drawing is expected.
- The define `NETIMGUI_ENABLED` allows to selectively disable code if planning to remove **NetImgui** on certain game configurations (shipping, ...)
1. The Unreal build file `NetImgui.Build.cs` contains many option to toggle features/fonts.
1. When using this plugin in the Editor, unselect the option `Edit->Editor Preferences->General->Performances->Use Less CPU when in Background`, otherwise framerate will be low when focus is on the NetImguiServer window instead of the Unreal Editor.
1. Download and copy the **UnrealNetImgui** folder to **Unreal Engine**'s Plugin directory (`.\Engine\Plugins`)

2. Regenerate your project solution to have the new plugin included *(right-click [ProjectName].uproject-> Generate Visual Studio Project Files)*

3. In your game project `(ProjectName).Build.cs` file, add the `NetImgui` dependency to `PublicDependencyModuleNames` entries.

4. In editor, enable the plugin `2D\NetImgui`.

5. Start the `UnrealNetImgui\NetImguiServer\NetImguiServer.exe` application.
- **Dear ImGui's** menu content created in your code, will be displayed and controlled in it (after a connection is established).
- The client list comes pre-configured with 3 clients configuration (game, editor, server) that will be automatically connected to when detected. For remote PCs, game consoles or others, create a new client configuration with proper address settings.

6. You can now invoke **Dear ImGui** drawing functions to generate your GUI every frame.
- Any code running on the Game Thread can now invoke make drawing calls (as long as `NetImguiHelper::IsDrawing()` is true)
- You can also add a callback to `FNetImguiModule::OnDrawImgui` to be invoked by **UnrealNetImgui** when some drawing is expected.
- The define `NETIMGUI_ENABLED` allows to selectively disable code if planning to remove **NetImgui** on certain game configurations (shipping, ...)

7. The Unreal build file `NetImgui.Build.cs` contains many option to toggle features/fonts.

8. When using this plugin in the Editor, unselect the option `Edit->Editor Preferences->General->Performances->Use Less CPU when in Background`, otherwise framerate will be low when focus is on the NetImguiServer window instead of the Unreal Editor.

9. It is possible to have some compilation linking errors concerning `Freetype`. The **Freetype** library comes with UnrealEngine and might have some issues on your current engine version, or target platform. Fortunatly, **UnrealNetImgui** use of it is optional (relies on it to improve the font quality) and can be safely disabled. **In UnrealNetImgui\Source\NetImgui.Build.cs : 85**
```
// bool bFreeType_Enabled = true;
bool bFreeType_Enabled = false;
```
# Example

Code example of **Dear ImGui** to display a very basic menu from the `Tick()` method of an actor.
Expand Down Expand Up @@ -136,6 +149,9 @@ void AMyImGuiActor::Tick(float DeltaTime)
#endif
}
```
# Release notes 1.9
- Tested with **Unreal Engine 5**
- Updated **Font Awesome** icons (v5 -> v6)
# Release notes 1.8
- Added Japanese Font
- Added Kenney's gaming icons
Expand All @@ -144,6 +160,7 @@ void AMyImGuiActor::Tick(float DeltaTime)
- Added FreeType font rendering support (for sharper text)
- Added the delegate `FNetImguiModule::OnDrawImgui` to listen to for drawing
- Cache module lookup(every frame) when calling `FNetImguiModule::Get()` instead of more expensive search
- Upgraded to **Dear Imgui 1.86.5** *(docking branch)*
- Upgraded to [**NetImgui 1.7.5**](https://github.com/sammyfreg/netImgui/releases/tag/v1.7.5) *(more details in link)*
# Release notes (older)
Expand Down
36 changes: 23 additions & 13 deletions Source/NetImgui.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public NetImgui(TargetInfo Target)
#endif

//---------------------------------------------------------------------
// Settings configuration
// User Configuration: Basic settings
//---------------------------------------------------------------------
// Toggle NetImgui support here
bool bNetImgui_Enabled = true;
Expand All @@ -92,28 +92,35 @@ public NetImgui(TargetInfo Target)
// Can be found in 'NetImguiDemoActor.cpp', demonstrating how to use NetImgui in your own project
bool bDemoActor_Enabled = true;

//---------------------------------------------------------------------
// User Configuration: Fonts
//---------------------------------------------------------------------
// See 'NetImguiModule.h' for more details
// Note: Can either have IconAwesome or IconMaterialDesign enabled, not both

// Will load Japanese font
// Note: If not using Japanese, set this to false, to save on memory (avoids 6MB font data table source include)
// Note: If not using Japanese, set this to false, saves on memory (avoids 6MB font data table source include)
bool bFontJapanese_Enabled = true;

// Will load the 'Kenney Game Icons' font
// For list available icons, see: https://kenney.nl/assets/game-icons and https://kenney.nl/assets/game-icons-expansion
// Gaming oriented icons
bool bFontIconGameKenney_Enabled = true;

// Will load the 'FontAwesome 5' font ('free' subset)
// Contains various icons for every use, using only the
// For list of available icons, see: https://fontawesome.com/v5/search?m=free (Regular/Solid)
// Will load the 'FontAwesome 6' font ('free' subset)
// Contains various icons for every use
bool bFontIconAwesome_Enabled = true;

// Will load 'Google Material Designs icons' font
// Note: Can either have IconAwesome or IconMaterialDesign, not both
// For list of available icons, see: https://fonts.google.com/icons
// Contains various icons for every use
bool bFontIconMaterialDesign_Enabled = false;

//---------------------------------------------------------------------
// User Configuration: Network
//---------------------------------------------------------------------
// Com Port used by this client, to try connecting to the remote NetImgui Server (8888 by default)
// Used when engine is launched with command line parameter 'netimguiserver' to request a connection
// attempt, instead of waiting for server to reach the game
string kRemoteConnectPort = "(NetImgui::kDefaultServerPort)";
string kRemoteConnectPort = "(NetImgui::kDefaultServerPort)";

// Com Port used by Game exe to wait for a connection from netImgui Server (8889 by default)
// NetImgui Server will try to find running game client on this port and connect to them
Expand All @@ -122,20 +129,23 @@ public NetImgui(TargetInfo Target)
// you will need to add their IP in the Server Client list.
// Alternatively, you can modify the connection code in 'FNetImguiModule::StartupModule()'
// to let the client connect directly to NetImGui server using 'NetImgui::ConnectToApp(ServerIP)'
string kGameListenPort = "(NetImgui::kDefaultClientPort)";
string kGameListenPort = "(NetImgui::kDefaultClientPort)";

// Com Port used by Editor exe to wait for a connection from netImgui Server (8890 by default)
// NetImgui Server will try to find running editor client on this port and connect to them
string kEditorListenPort = "(NetImgui::kDefaultClientPort+1)";
string kEditorListenPort = "(NetImgui::kDefaultClientPort+1)";

// Com Port used by Dedicated Server exe to wait for a connection from netImgui Server (8891 by default)
// NetImgui Server will try to find running dedicaed server client on this port and connect to them
string kDedicatedServerListenPort = "(NetImgui::kDefaultClientPort+2)";


//---------------------------------------------------------------------
// Plugin setup (no edit should be needed)
//---------------------------------------------------------------------

// Developer modules are automatically loaded only in editor builds but can be stripped out from other builds.
// Enable runtime loader, if you want this module to be automatically loaded in runtime builds (monolithic).
bool bEnableRuntimeLoader = true;
//---------------------------------------------------------------------

PublicDependencyModuleNames.AddRange( new string[] { "Core", "Projects"} );
PrivateDependencyModuleNames.AddRange( new string[] { "CoreUObject", "Engine", "Sockets" } );
Expand Down
Loading

0 comments on commit 84313ca

Please sign in to comment.