[Plugin] OSC for UE4

Hi m.gustav.

Just started using this on a project - it works very well!

Thanks for your effort kind efforts in the community.

Is there a way to define the addresses/ports at runtime?

Hi !
Sorry for the late answer : at the time it was not possible, but now it is !
The latest commit add the AddSendOscTarget blueprint function.

Guillaume

That’s great! I’ll look forward to fiddling with that soon.

Great work!

Hi Monsiergustav,

I’ve been using the plugin to great effect with touchosc - you probably know it. I’m sending commands out of the engine into my iPad to update text fields - because TouchOSC has only non-wrapping text labels I’m using 4 or 5 labels per block of text - and there are about 25 of these blocks.

In short I’ve got a stack on a timer in the engine which I often send 100+ osc commands to. Is there a way to bundle lots of commands into one osc transmission for a more optimised

A label might be a string sent to /data/label(n)/text 100 times - I have to throttle the osc txrate or I lose data

Thanks! And great work.

Hi !
Indeed, an ā€œOSC bundleā€ is a container, that may contains other bundles and messages.
It is sent in one piece and the order of inner bundles/messages is kept.

If you really need to update every line every frame (do you ?) I agree it would probably solve your issue.

It is not (yet) supported by the plugin though, but file an issue on the GitHub (GitHub - monsieurgustav/UE4-OSC: OSC plugin for Unreal Engine 4 Blueprints) as a reminder.

It’s not every frame. What i’ve got is like a quiz game. The ā€˜host’ has an ipad with all the questions and answers on and triggers the engine to display/reveal answers. On the engine side i’m loading the question data from an SQLite database and sending this data over to the iPad. So when we select a new question the whole ipad interface is altered, as well as the 100 or so text labels, I sometimes have to refresh positions,opacity, and colour of each label - which can be 500 or more OSC tx’s at a time. This is why I use a stack.

I’ll add a request to your github page. I imagine you’ll have a struct with the address and data in an array which is bundled maybe?

Thanks so much - it’s really helping me develop my game prototypes - before I was using python as an OSC intermediary and sending commands through it over a socket connection.

It is quite overkill to run UE4 to prototype OSC messaging… :slight_smile:

But I do exactly the same: I find it much easier to use than python, Pd, etc.

I use unreal to prototype gameshow ideas for a TV company. If i’m not there when they’re pitching ideas (like yesterday) I have to talk someone through finding ip addresses, editing the python scripts to do this etc. It’s a nightmare - Ive also found it’s actually a lot more responsive to have the iPad to talk directly to the engine too.

I had a problem yesterday (my stupid fault) where I was setting a default ip for the OSC target at begin-play in my OSC blueprint, but at the same time another blueprint was reading a database and pulling an IP from that and setting a target IP too. On the machine they were using the OSC blueprint with the default IP lost the race and was set second, if you know what I mean, so they couldn’t control the system - it’s always a nightmare when i’m not there!

You use AddSendOscTarget to do that ?

It returns an index to actually send a message to the new ā€œtargetā€.
You should set a variable with this index and use it in SendOsc function.
Hardcoding ā€œ1ā€ is hardly a good idea… :slight_smile:

No, I had a custom event which adds a target, then sets the new target index as the ā€˜one to use’ variable. It messed up because of the order I called it.

I feel stupid for asking, but can someone please direct me on how to do this from scratch. I’ve set the port and am sending Osc messages to it but it does not get into ue4. I have an OSC event reader so I know it sending. I’d app feciste any help at all.

Best regards,

I’ll help where I can.

You need to make a blueprint and add an OscReceiver component to that blueprint. (Edit your new blueprint, top left click add component)

Now - at begin play you can add a target to that component - drag the component from the top left onto the blueprint - then you have a reference to it. Drag off the component to add the new target or alternatively bind an event to it. This is important - I found it difficult to understand what binding meant when I first started with UE.

Drag off of the little red square and start typing ā€˜custom event’ When you make this you’re making an execution chain which will fire whenever an OSC command is received.

To check it’s all working, add a print command to this custom event - now when you run it you’ll get a ā€˜Hello’ or whatever whenever you receive a command.

If you’ve made the blueprint as an actor, make sure you add it to your level.

If it’s not working, check your IP addresses and ports. Then possibly check your firewall.

Hi, I’ve got a weird problem and hope to fix it cuz I’m stucked !

I’m Using Wekinator to send OSC messeges to UE4 . But inside ue4 when I want to listen to the float output it’s fixed to the first osc message at the Begining of Play .

Here’s the simple blueprint to view the osc messege :

I get the correct OSC messeges when listening with OSC Monitor , but in ue4 as I said It stucks to a fixed Value and gets the same value all the time !

Is it definitely a float you’re expecting? I’ve got a debug switch on my exec path which uses the Text Format node to display all of the potential data - something like:

ā€˜Message sent to {add} - Str:{st} - Int:{In} - Float:{Fl} - Bool:{Bl}’

Copy this into a text format node then connect all of the OSC Pop types and address, and connect it to a print node.

Also - Shouldn’t you have something connected to the ā€˜bind to’ little red box on the received node?

Hello,

Thank you very much monsieurgustav for this plugin. It has been working great for my project. I do have two questions that I wonder if you or someone else here could help me answer:

  1. How can I receive OSC messages in the BluePrints of more than one Actor? It seems that it’s only possible to have one instance of the OscReceiverComponent (I guess it binds to the incoming port and won’t let another instance bind?). What would be the best way to get OSC data forwarded to different Actors?

  2. I understand that it is a Preview version, but I’m not able to get incoming OSC messages when using UE4 4.11 (preview 5). It seems that something crashes since the second time I play my project I get this on the output log:

LogStats:Warning: MetaData mismatch. Did you assign a stat to two groups? New //STATGROUP_Threads//OSCListener///Thread_23b8_0///####STATCAT_Advanced#### old //STATGROUP_Threads//OSCListener///Thread_2914_0///####STATCAT_Advanced####

I’m using this version due to the improvements in VR performance.

Thank you again!

Hi !

1- There should not be any limitation in the number of receivers (either actor or component)… The incoming port is listened and all the messages are routed to all receivers.
Did you experience differently?

2- Please, log an issue on the GitHub for the 4.11 support.
The warning you see has been there for a long time, I doubt it is suddenly a cause for a crash.

Cheers
Guillaume

Is it possible to receive from two different ports rather than just one?

No, it’s not possible.

What use case would it be?

Thank you Guillaume,

In the past (with UE4 4.9) I’ve tried several times to use more than one OscReceiverComponent and incoming messages stopped working but for some reason now that I tried again it worked (with UE4 4.10).

I logged the 4.11 issue on GitHub.

Cheers!

Hector

Edit: Let me know if I can help in any way to figure out the 4.11 problem.

If you have some coding skill, the code is not hard to understand:

  • a thread listen the port and stack incoming messages in a buffer.
  • the main thread reads the buffer, forward the messages individually to every receiver, empties the buffer.

Any info about where is goes wrong is helpful ! :slight_smile: