Giter Club home page Giter Club logo

unrealnetimgui's Introduction

Unreal NetImgui

Summary

UnrealNetImgui is a plugin adding remote debug GUI interface to Unreal Engine using the Dear ImGui paired with NetImgui. Allows Unreal Engine 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

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 plugin (also has NetImgui support in the net_imgui branch).

Note 2: Useful library when Dear ImGui is not already supported in your UE engine codebase. Otherwise, ignore this plugin and add NetImgui's 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, Font Awesome (the free subset) and 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.

Dear ImGui extensions

Additional to the inclusion of extra fonts and icons, some Dear ImGui extension are already integrated and ready to use.

ImPlot

From the author :

ImPlot is an immediate mode, GPU accelerated plotting library for Dear ImGui. It aims to provide a first-class API that ImGui fans will love. ImPlot is well suited for visualizing program data in real-time or creating interactive plots, and requires minimal code to integrate. Just like ImGui, it does not burden the end user with GUI state management, avoids STL containers and C++ headers, and has no external dependencies except for ImGui itself.

https://github.com/epezent/implot

Node-Editor

From the author :

An implementation of node editor with ImGui-like API. Project purpose is to serve as a basis for more complex solutions like blueprint editors.

https://github.com/thedmd/imgui-node-editor

Connecting to the NetImgui Server

There are mutliple ways of connecting your game to the NetImguiServer.

Default

  • Launch your Editor/Game on your local PC, a connection should be automatically be established when NetImguiServer and game are on the same PC.
  • When launching on remote hardware, add connection information in the NetImgui Server's clients list. Then, the connection will also automatically be established.
  • Note : The default behaviour is to start waiting on a connection from the NetImguiServer on the default port of the executable type 8889(Game) / 8890(Editor) / 8891(Dedicated Server). If you do not wish this plugin to automatically open a port, you can disable it in NetImgui.Build.cs and rely on the NetImgui commands below.

NetImgui

Optional

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
NetImguiConnect Hostname/IP:[Port] Try reaching the NetImgui Server Application directly.
NetImguiListen [Port] Start waiting for a connection from the NetImgui Server application (if not already connected).
NetImguiDisconnect None Disconnect from the NetImgui Server and stop waiting for a connection.

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

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

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

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.

Unreal Commands

This plugins comes with Imgui Unreal Commands, adding Unreal Commands browsing and execution functionalities.

NetImgui NetImgui [Demonstration Video]

  • Note :
  • The Imgui Unreal Commands support is early release.
  • I am interested in hearing back from people, to know what 'Preset' should comes by default
  • The Imgui Unreal Commands functionality can easily be added in other projects (without UnrealNetImgui dependency). -Copy Source\Private\ImguiUnrealCommand.cpp + .h to your own project -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)

  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 use Dear ImGui's drawing functions to generate your GUI every frame.

    • Any code running on the Game Thread can 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 #if 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.

  • A more detailed sample can be found in UnrealNetImgui\Source\Sample\NetImguiDemoActor.*.
  • The sample actor NetImguiDemoActor can be dropped in any of your scenes.
  • Information on Dear ImGui menu generation, can be found reading the code of ImGui::ShowDemoWindow() in UnrealNetImgui\Source\Private\ThirdParty\DearImgui\imgui_demo.cpp and their webpage.
// ...
#include <NetImguiModule.h>

// ...
void AMyImGuiActor::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);

#if NETIMGUI_ENABLED
    //---------------------------------------------------------------------------------------------
    // Avoid drawing ImGui menus when not expecting a new frame, reducing CPU cost.
    // Mandatary when 'bSupportFrameSkip' is enabled in 'NetImgui.Build.cs', otherwise
    // 'Dear ImGui' will assert on a missing 'ImGui::NewFrame()'
    //---------------------------------------------------------------------------------------------
    if( NetImguiHelper::IsDrawing() )
    {
        //-----------------------------------------------------------------------------------------
        // First 'ANetImguiDemoActor' actor will display the following content
        // (could use 'FNetImguiModule::OnDrawImgui' callback delegate instead)
        //-----------------------------------------------------------------------------------------
        static uint64 sLastFrame = 0;
        if( sLastFrame != GFrameCounter )
        {
            sLastFrame = GFrameCounter;
            ImGui::Begin("NetImgui Demo");
            ImGui::TextWrapped("Simple display of a text label");
            ImGui::TextUnformatted("I " ICON_KI_HEART " icons in my text."); // Display 'I (HeartIcon) icons in my text
            ImGui::End();
            ImGui::ShowDemoWindow(); // Show Dear ImGui demo window
        }

        //-----------------------------------------------------------------------------------------
        // Every 'ANetImguiDemoActor' display the following content
        //-----------------------------------------------------------------------------------------
        FString windowName = FString::Format(TEXT("DemoActor: {0}"), {GetName()});
        ImGui::SetNextWindowSize(ImVec2(400.f, 200.f), ImGuiCond_Once);
        if (ImGui::Begin(TCHAR_TO_UTF8(*windowName)))
        {
            ImGui::Text("Name: ");
            ImGui::SameLine(64.f);
            ImGui::TextUnformatted(TCHAR_TO_UTF8(*GetName()));

            FVector pos = GetTransform().GetLocation();
            ImGui::Text( "Pos: ");
            ImGui::SameLine(64.f);
            ImGui::Text("(%.02f, %.02f, %.02f)", pos.X, pos.Y, pos.Z);
        }
        ImGui::End();
    }
#endif
}

Release notes 1.12

  • Updated to Dear ImGui 1.90.0 (docking branch)
  • Updated to NetImgui 1.10
    • Now support text Copy/Paste between Client and Server
    • Now support monitor DPI (increase font size on high resolution monitor)
    • Fixed fast typing dropping some characters

Release notes 1.11

Release notes 1.10

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
  • Added Font Awesome's icons
  • Added Font Material Design icons
  • 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 (more details in link)

Release notes (older)

  • Upgraded to NetImgui 1.6 (more details in link)
  • NetImgui Server keyboard Input fixes
  • Added Imgui Unreal Commands support (browse and execute Unreal Commands)
  • Upgraded to Dear Imgui 1.83 (docking branch)
  • Upgraded to NetImgui 1.5 (more details in link)
  • Tested on **Unreal Engine 4.26, ** (other versions should be supported without issues)
  • NetImgui Server now requires less CPU/GPU

Credits

Sincere thanks to Omar Cornut for the incredible work on Dear ImGui.

Code inspired by existing UnrealImGui plugin for Unreal 4.

Icons Various icons have been integrated to UnrealNetImgui existing fonts and accessible as normal unicode entries. The following credits made it possible:

Dear ImGui Extensions

unrealnetimgui's People

Contributors

phil-vela avatar rtjonnyr avatar sammyfreg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

unrealnetimgui's Issues

UE4.27でFreeType2とのシンボリックエラーが発生する

はじめまして。素敵なプラグインありがとうございます。

こちらUnrealEngineのバージョン指定等ございますか?
freetype.libがLNK2019エラーとなりビルドが通らない状態でして、Engine内のFreeType2との互換性が合っていないものと考えています。
ご指摘、ご見解いただければ幸いです。
よろしくお願いします。

環境 : Windows10 UE4.27

2022-03-20_19h56_44

High CPU consumption if not connected to a Server

Hey, I have a small server where I run some Game Servers. Since its nice for dev to be able to connect to them with ImGui I kept the dependency to ImGui etc. Since thise time the CPU consumption is above 100% and I think this comes from the fact, that each frame we try to connect smth. even if it is not present, and since I just have 2 Cores this blocks the full server. Do you think this can be improved? Like waiting non blocking on the connection, if this is possible, or would I need to disable ImNetImGui if I don't use it?

Multiple errors depending on the plugin directory.

I followed the instructions from the readme, added the dependencies in .build.cs and everything, but if I put the plugin folder in (Engine/Plugins) it gives this exact error:

1.
Expecting to find a type to be declared in a module rules named 'NetImgui' in UE5Rules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null. This type must derive from the 'ModuleRules' type defined by Unreal Build Tool.

If I put the plugin folder in (Project/Plugins):

2.
image
27 unresolved externals

If I put the plugin folder in (Engine/Plugins/Marketplace):

3.
image

Even after I recompiled the plugin using RunUAT.

Making it impossible to use,
I tested 2 versions 1.10 and 1.09, the result was the same.
My unreal version is 5.0.3

[Question] Dynamic ports

Hey, do you see a way that the clients can request a port from the server? I mean I could also add a cmd line arg that specifies the port but you can't set per client startup args if you start a game from within UE4 with multiple clients^^
(I also could add my own handling by asking my server which ports to use) But maybe you have smth in mind that you could do on your side :D

Intermittent shutdown crashes

During application shutdown there is a race between DestroyModule and the thread that runs CommunicationsHost.

There is a clumsy, temporary fix at #5 but it would be good to find something better. Perhaps there should be a mutex at the ClientInfo level?

ImGui is not compatible with Unreal's hot reloading

UE4 supports the hot-reloading of code by building and loading additional instances of DLLs. If the user builds to trigger a hot-reload, the first call to ImGui:: methods will crash as GImGui is null in that DLL.

#10 contains a change that allows users to fully support hot-reloading alongside UnrealNetImgui.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.