⚡ UE Plugin: Bind Redis PubSub-based events (WIP)
  • C++ 74.5%
  • Python 15.3%
  • C# 10.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Brandon Thomas c69a1a3ef5 warp command
2021-03-12 21:00:51 -05:00
Source/EventCenterPlugin warp command 2021-03-12 21:00:51 -05:00
.gitignore Use secrets for websocket server 2021-03-03 03:46:32 -05:00
EventCenterPlugin.uplugin First commit of EventCenterPlugin (not working, wip) 2021-02-15 23:31:25 -05:00
publisher.py load test (works!!) 2021-02-20 23:56:05 -05:00
README.md Use secrets for websocket server 2021-03-03 03:46:32 -05:00
requirements.txt Use secrets for websocket server 2021-03-03 03:46:32 -05:00
server.py this works! command parsing for spawn and tts 2021-03-08 08:06:52 -05:00

EventCenterPlugin

(WIP) Subscribe to events.

I tried Redis PubSub first, but the plugin I found was buggy. I'm trying WebSockets now.

Installation

  1. Install python and dependencies
# Windows works just as Linux,
python -m venv python

# Except for activating the venv
.\python\Scripts\Activate.ps1

# Then it's easy again,
pip install -r requirements.txt
  1. Install the BlueprintWebSocket plugin (paid/commercial) from the Epic/Unreal Marketplace. It's not expensive and has great documentation.

  2. You need to adjust the main project's build dependencies (ProjectName.Build.cs) to include the following,

		PublicDependencyModuleNames.AddRange(new string[] { 
			// Preset dependencies
			"Core", "CoreUObject", "Engine", "InputCore", 

			"...",
			
			// EventCenter
			"BlueprintWebSocket",
			"EventCenterPlugin",
		});

Unfocused Audio needs to be set in Config/DefaultEngine.ini, otherwise the game won't play audio when unfocused,

[Audio]
UnfocusedVolumeMultiplier=1.0

Usage

It's expected to wire events up in the Level Blueprint.

Python testing

I stand up a websocket+pubsub system like so:

PS C:\Users\echel\OneDrive\Documents\Unreal Projects\RedisTestProject\Plugins\EventCenterPlugin> .\python\Scripts\Activate.ps1

Notes

A few collected notes, since I'm still new to Unreal engine and I'm cleaning up my debug code.

To log to the game screen,

GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "Message goes here");

Time based handling in Tick(),

void AEventSourceActor::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	float time = GetGameTimeSinceCreation();

	if (time - timerLastTime > 15.0) {
		timerLastTime = time;
		// Do the thing
	}
}