Introducing ofxDarkKnight: flow based programming for OF

Hello OF developers!

I’ve been working on a flow based programming environment designed for audiovisual performances. I started this project before the OF 0.10 was released, so this is based in OF 0.9.8.

The motivation for this project is to have the ability to perform with my OF sketches. My focus is to create VJ’ing and projection mapping graphics with this. I already perform two times with it in public competitions.

The addon includes 5 basic modules:

  • Sketch Pool: integrates drawing sketches and the ability to change between each other in real time.
  • 2 graphics modules: classic constellation & classic terrain examples.
  • Preview: shows the output of the sketch pool.
  • Screen output: renders the output into an external screen.

I’ve already created a lot of modules with this addon including:

  • MIDI controller
  • OSC controller
  • Syphon input/output
  • Audio analysis
  • Ableton link
  • Projection mapping adjustment
  • NDI
  • A lot of graphics modules.

None of those modules are included in the addon, I will release those in separated addons.

Of course it has some problems but I hope you find it useful. Let me know if you have any questions, I’ll try to make a good documentation that shows you how to create your own modules. But if you look into the graphics modules you will see how to do it.

Here’s an example of an implementation of the addon in my own app:

Greetings from Mexico

5 Likes

Wow! looks neat.

Can you tell us a bit more about how the nodes I/Os and wires are implemented and how could we use it to control arbitrary parameters in our own sketches?
I read that you are writing the docs, but just a vague description to get the idea.

great job!

Thanks @daylankifky,

There’re two types of modules, “stand alone modules”, something you need to create like a MIDI controller, a Shader FX or a Syphon server. And there are “graphics modules” this are your sketches that you want to include in the media pool and switch between each other during your performance. Both of them should extend the Module class but the first ones are added directly to the manager and the second ones are added to a collection that will be displayed in your sketch pool.

For now it can handle only two types of connections: floating point values and fbo’s. When you create your own module you need to implement some methods: setup, update, draw, addModuleParameters, and few others.

To add your parameters you need to have a property in your class, let’s say int numParticles. Then you need to add a slider in the addModuleParameters function just like you normally do it in ofxDatGui and bind it to your property. My fork of ofxDatGui is implementing the WireConnection class, so every parameter creates an instance of it and creates this connection.

Everytime you create a “cable” between parameters it creates an instance of Wire class, this has an output connection and an input, you always interact with the input and this modifies the output with the reference that is stored in memory.

It’s all about memory addresses (pointers). For the fbo’s it’s the same, but I call this, mainOutputs or mainInputs, for instance the preview module, in order to draw something you need to pass a mainOutput to it’s input. You can do that in a special method called drawMasterInput or drawMasterOutput. In this method you just specify the color of the connection, the addon handles everything else.

The preview module shows how you can create a stand alone module it’s located in libs/modules/preview. To create a graphics modules take a look at libs/graphics/constellation.hpp. You can create something similar, but to added to the project you need to modify the /libs/collections/basic.hpp and add it to the collection. With this it will appear in your sketch pool and you will be ready to rock. I’ll try to do a video tutorial this same week to show you how to do this. I hope I gave you a big picture of how it works.

Thank you for your interest.

It did give me a big picture, thanks!
I’ll give it a try as soon as I can

Hello everyone,

I would like to share that I just released the BETA version of Batmapp which was the main reason why I created this addon. I hope now it makes sense why I called like that :slight_smile:

I created Batmapp because I love openframeworks but I don’t like that everytime that I start with a new sketch I found my self using the same addons and doing a lot of boilerplate code. With this flow-based environment I just easily reuse a lot of useful things, like MIDI, OSC, Syphon, Spout, Ableton Link, LFO, Noise, Screen output, etc, while I keep the power of coding.

At this point I’ve figured out how to do a lot of interesting things. Like deploying an OF app with a lot of addons and dependencies, it’s really a pain to get the package done. And actually I will release soon an addon for managing serial numbers and licenses with a remote server (ofxLicensing) that I will use to try to sell my content. Another thing that I’m working on, is in the notarization of an MacOS app to be able to share the software outside of the Mac App Store and to have Catalina not complaining about it. Also to sign the code with a paid certificate on Windows to do the same. But right now, non of the versions (mac and Win) are correctly signed, so you will have to trust me if you want to install it, which I know is hard, since I’m a stranger. But I promise that I have no malware there. It’s open source you can always look at the code.

There’s a lot of room for improvement in my code, specially at the core level, but this is a one man project developed with my free time. But I really will love to hear your feedback. Batmapp works really fast and it’s really fun to play with in professional environments and at the classroom. I will start using it to teach people how to “creative code” and of course spread the world of openframeworks, by far my favorite creative coding platform.

I have a video explaining what it is, it’s in spanish, my native language. But I will try to make videos with my poor english if you don’t mind :upside_down_face:

Batmapp video at youtube

I need to close this cycle and see if I need to kill my project or keep the hard work, but this milestone is done and I’m really proud that I finally finish something that I can share at least at a BETA level.

Thank you so much for reading this. I hope everybody is safe.

Cheers

Luis Fer

6 Likes

Hello Luis,

This is impressive. I really like the idea of stringing blocks together to produce an output.
Useful for both programmers and non programmers.

Thanks @oxillo. I’m agree, I believe that flow-based programming is the only real alternative to the Von Neumann style, independently of the language or programming paradigm. Batmapp is a combination of both worlds :slight_smile:

Wow, nice project!
Apparently, were all finding different solutions to similar problems.

Is there any chance of a Linux release of Batmapp ? (or source code ?)

1 Like

Hi @Daan,

That’s an interesting list of projects, I knew only a couple of them. Are you working on something like this too?

I have not tried ofxDarkKnight on Linux, but you can try to build it yourself, I just updated the example project with the last changes with all the modules. Let me know if you want to try it and if you have any problems doing it, I will be happy to help.

Hey,
Yes, I started making karmaMapper a few years ago, now, after a break, I’ve started contributing to Mosaic together with @n3m3da.

The scope of my project was growing and it needed some heavy refactoring, so it made sense to team-up with Mosaic, which was (or still is) in a refactoring phase. (I still have got lots of code to port from karmaMapper).
As it uses ofxVisualProgramming underneath, even if I can’t fit my project in Mosaic, I can always go for a fork, still sharing the same ofxVisualProgramming codebase.

The Mosaic/Batmapp and ofxVisualPrograming/ofxDarkKnight concepts are almost identical, from a first insight. The interfaces look slightly more different though, so that’s interesting !
That’s awesome that you updated the example ! I’ll definitely try and compare it to Mosaic, and report back :slight_smile:

That’s very cool, I’ve been following Emanuele’s work since GAmuza and I think I met some of his colleagues from Labo Luz in person at a video mapping contest at Rome in 2018, where I was using Batmapp for my performance. So I’m aware of Mosaic, actually, I think I steal some of his (and your) code for my project at some point :slight_smile: Mosaic looks very advanced compared with my project.

I have some ideas and code for making this kind of projects sustainable. I will love to know what are your long term goals, maybe we can talk about it later and perhaps we can join forces if our goals overlap, because I think you’re right with your first comment, It looks like we’re finding similar solutions to the same problems.

We have lots of ideas for later too, and we’re still focusing on the “engine” so, yes, sure we should talk ! :slight_smile:

It will be nice to join you on this talk :slight_smile:

1 Like