All Projects → Andrey1994 → game_overlay_sdk

Andrey1994 / game_overlay_sdk

Licence: Unknown, Unknown licenses found Licenses found Unknown LICENSE.md Unknown COPYING
Library to write messages on top of game window

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language
C#
18002 projects
python
139335 projects - #7 most used programming language
CMake
9771 projects
GLSL
2045 projects

Projects that are alternatives of or similar to game overlay sdk

goverlay
DirectX hook and game overlay solution for Electron, Qt and CEF, just like discord/steam game overlay,inject any app to overlay in your game
Stars: ✭ 426 (+647.37%)
Mutual labels:  directx, overlay, game-overlay
Renderdoc
RenderDoc is a stand-alone graphics debugging tool.
Stars: ✭ 5,969 (+10371.93%)
Mutual labels:  vulkan, directx
ShaderGlass
Overlay for running GPU shaders on top of Windows desktop
Stars: ✭ 417 (+631.58%)
Mutual labels:  directx, overlay
Bgfx
Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.
Stars: ✭ 10,252 (+17885.96%)
Mutual labels:  vulkan, directx
MoravaEngine
2D/3D graphics engine written in C++ language. It currently supports the following graphics APIs: OpenGL 3.3+, Vulkan 1.2, DirectX 11. Its current purpose is to experiment with various CG concepts and techniques.
Stars: ✭ 129 (+126.32%)
Mutual labels:  vulkan, directx
Bansheeengine
Modern C++14 game engine with Vulkan support, fully featured editor and C# scripting
Stars: ✭ 2,906 (+4998.25%)
Mutual labels:  vulkan, directx
Llgl
Low Level Graphics Library (LLGL) is a thin abstraction layer for the modern graphics APIs OpenGL, Direct3D, Vulkan, and Metal
Stars: ✭ 1,011 (+1673.68%)
Mutual labels:  vulkan, directx
bgfx-python
Python 3.7+ wrapper for the BGFX library. 🐍
Stars: ✭ 99 (+73.68%)
Mutual labels:  vulkan, directx
Crossshader
⚔️ A tool for cross compiling shaders. Convert between GLSL, HLSL, Metal Shader Language, or older versions of GLSL.
Stars: ✭ 113 (+98.25%)
Mutual labels:  vulkan, directx
Bsf
Modern C++14 library for the development of real-time graphical applications
Stars: ✭ 1,640 (+2777.19%)
Mutual labels:  vulkan, directx
Diligentengine
A modern cross-platform low-level graphics library and rendering framework
Stars: ✭ 2,142 (+3657.89%)
Mutual labels:  vulkan, directx
renderdoc-rs
RenderDoc application bindings for Rust
Stars: ✭ 28 (-50.88%)
Mutual labels:  vulkan, directx
CrossWindow-Graphics
A header only library to simplify creating 🌋 Vulkan / ⚪ OpenGL / 🌐 WebGL / ❎DirectX / 🤖 Metal data structures with CrossWindow.
Stars: ✭ 48 (-15.79%)
Mutual labels:  vulkan, directx
Fiber2d
Cross-platform 2D Game Engine in pure Swift
Stars: ✭ 415 (+628.07%)
Mutual labels:  vulkan, directx
framework
The exomia/framework is used for building 2D and 3D games and more inspired by the XNA/Mono framework.
Stars: ✭ 21 (-63.16%)
Mutual labels:  vulkan, game-dev
D9vk
A Direct3D9 to Vulkan layer using the DXVK backend. [Upstreamed to DXVK]
Stars: ✭ 805 (+1312.28%)
Mutual labels:  vulkan, directx
Imguizmo.quat
ImGui GIZMO widget - 3D object manipulator / orientator
Stars: ✭ 187 (+228.07%)
Mutual labels:  vulkan, directx
harfang3d
HARFANG 3D source code public repository
Stars: ✭ 173 (+203.51%)
Mutual labels:  vulkan, directx
render-doctor
渲染医生,基于 RenderDoc 的渲染分析工具,以 html 形式展现方便阅读和分享。
Stars: ✭ 46 (-19.3%)
Mutual labels:  vulkan, directx
Premulalpha
Pre-Multiplied blend mode is a 3 in 1 blend mode that has a lot of uses. It has been around for a long time but it seems to be re-discovered every few years. This project includes descriptions/examples and tools for using pre-multiplied alpha.
Stars: ✭ 97 (+70.18%)
Mutual labels:  vulkan, directx

Game Overlay SDK

Library to write text messages on top of game window.

Supported Graphical APIs:

  • DirectX 11
  • DirectX 12
  • Vulkan

Supported Architectures:

  • x86
  • x64

Usage

Run it with admin priviligies!

Install Vulkan SDK (I've used v1.1.106.0) or Vulkan Runtime at least

To draw overlay for fullscreen game you have to hook inside game process before initializing of graphical API, so there are two options to achive it:

  • Create suspended process, install hooks and resume threads
  • Register a callback for CreateProcess Event, if target process was created - suspend all threads, install hooks and resume all threads( I use WMI to achive it)

Both of these options are implemented, so there are:

run_process (exe_path, exe_args = "", steam_app_id = None)
start_monitor (process_name)

Important note: for start_monitor you need to provide executable name exactly like in TaskManager and run target process by yourself while for run_process you need to provide full path to the executable and SDK will run it for you

As soon as DLL was loaded inside game process you are able to call

send_message (message)

To send message and render it on top of game process window

For Inter Process Communication I use Memory Mapped Files, so send_message method just sends data to this Memory Mapped File and DLL which was injected to game process reads it.

Important note: message will be showed as soon as game presents new frame and I don't ensure that all your messages will be displayed, for example if you send messages faster than game draws frames only the latest message will be displayed, also game process reads data one time per 200ms(but I use queue in python code to buffer messages, so real rate could be bigger)

Also, there are several methods to control log level of Cpp code:

set_log_level (level) # level here is not related to python's log levels!
enable_monitor_logger ()
disble_monitor_logger ():
enable_dev_logger ()

I recommend to use enable_monitor_logger by default

And method which should be called in the end:

release_resources ()

And I've added python logging handler to write log messages on top of game window

overlay_log_handler = game_overlay_sdk.injector.OvelrayLogHandler ()

Usage with Steam Games

Steam forks game process by default so there are two process and it's impossible to distinguish them and it breaks DLL injection, for run_process DLL will be loaded to the wrong process so no overlay will be drawed while for start_monitor it's almost random, it may hangs if wrong process was selected or may works well

Fortunately there is a way to force Steam to create only one process, we just need to create file steam_appid.txt in game folder, and it should be done only once per game, that's why there is steam_app_id argument in run_process method. You can get app_id here also make sure that Steam Client App is running

Examples

How does it look?

Demo

How to achive it?

Code:

import argparse
import time
import game_overlay_sdk
import game_overlay_sdk.injector
import threading
import logging


logging.basicConfig (filename = 'test.log', level = logging.WARNING)

logger = logging.getLogger (__name__)
logger.setLevel (logging.INFO)
overlay_log_handler = game_overlay_sdk.injector.OvelrayLogHandler ()
formatter = logging.Formatter ('%(levelname)s:%(message)s')
overlay_log_handler.setFormatter (formatter)
logger.addHandler (overlay_log_handler)


class MessageThread (threading.Thread):

    def __init__ (self):
        super (MessageThread, self).__init__ ()
        self.need_quit = False

    def run (self):
        i = 0
        while not self.need_quit:
            logger.info ('Hi from python OverlayLogHandler %d' % i)
            i = i + 1
            time.sleep (1)


def main ():
    parser = argparse.ArgumentParser ()
    parser.add_argument ('--exe_path', type = str, help = 'exe path', required = True)
    parser.add_argument ('--exe_args', type = str, help = 'exe args', default = '')
    parser.add_argument ('--steam_app_id', type = int, help = 'for steam games please provide app_id', required = False)
    args = parser.parse_args ()

    game_overlay_sdk.injector.enable_monitor_logger ()
    game_overlay_sdk.injector.run_process (args.exe_path, args.exe_args, args.steam_app_id)

    # start sending messages to overlay
    thread = MessageThread ()
    thread.start ()
    input ("Press Enter to stop...")
    thread.need_quit = True
    thread.join ()

    game_overlay_sdk.injector.release_resources ()


if __name__ == "__main__":
    main ()

Command line(I use trial demo of Tomb Raider, for another Steam game you need to change steam_app_id):

python examples\overlay_log_handler.py --exe_path "D:\Steam\steamapps\common\Shadow of the Tomb Raider Trial\SOTTR.exe" --steam_app_id 974630

Example with start_monitor instead run_process:

Code:

import argparse
import time
import game_overlay_sdk
import game_overlay_sdk.injector
import threading
import logging


class MessageThread (threading.Thread):

    def __init__ (self):
        super (MessageThread, self).__init__ ()
        self.need_quit = False

    def run (self):
        i = 0
        while not self.need_quit:
            try:
                game_overlay_sdk.injector.send_message ('Hi from python %d' % i)
                i = i + 1
                time.sleep (1)
            except game_overlay_sdk.injector.InjectionError as err:
                if err.exit_code == game_overlay_sdk.injector.CustomExitCodes.TARGET_PROCESS_IS_NOT_CREATED_ERROR.value:
                    logging.warning ('target process is not created')
                    time.sleep (5)
                elif err.exit_code == game_overlay_sdk.injector.CustomExitCodes.TARGET_PROCESS_WAS_TERMINATED_ERROR.value:
                    logging.warning ('target process was stopped')
                    # in monitor mode we can run process several times so dont need to stop this thread here
                    i = 0
                    time.sleep (5)
                else:
                    raise err


def main ():
    logging.basicConfig (level = logging.DEBUG)
    parser = argparse.ArgumentParser ()
    parser.add_argument ('--name', type = str, help  = 'process name', required = True)
    args = parser.parse_args ()

    game_overlay_sdk.injector.enable_monitor_logger ()
    game_overlay_sdk.injector.start_monitor (args.name)

    # start sending messages to overlay
    thread = MessageThread ()
    thread.start ()
    input ("Press Enter to stop...")
    thread.need_quit = True
    thread.join ()

    game_overlay_sdk.injector.release_resources ()


if __name__ == "__main__":
    main ()

Command Line:

python examples\monitor.py --name SOTTR.exe

Important note: with start_monitor you can run target process several times sequentially the only requirement here: dont run several processes at the same time

More examples here

Build Instructions

  • Install Vulkan SDK (I've used v1.1.106.0)
  • Install cmake
  • Install Visual Studio/MSBUILD
  • run cmake_build.cmd or cmake_build32.cmd (if you have VS!=2017 you will need to change cmake generator)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].