Headless application that generates images

I need to generate a video or a series of images based on the animations that I’m doing. I was able to as a test have an application that doesn’t derive from Sprite that creates a sprite (that’s not added to the display list) and saves a png based on its contents. However, it still pops up a window and I’m not sure how (or if it’s even possible) to make the sprite do its animation. It’s not frame-based but me doing tweens (using Actuate). Is there a way to do this? If I could do a loop to save x number of frames and not have to pop up a window, that would be great. I don’ see how to configure project.xml to do that…

1 Like

I was able to simulate advancing frames. The only issue I still have is a window pops up that’s not needed (not even used for drawing).

In the latest development builds of Lime, we added hidden window support:

<window hidden="true" />

There are also other ways to do it, the tools for Lime do image processing and are obviously headless :smile:

Does this actually prevent it from trying to talk to X11? Because I do need this to run on a server that doesn’t have x running. Do I need to build the latest lime from source to get this feature?

Okay I switched to the latest version of lime on the repo. It appears to have the change to add the hidden window feature in the history but it’s still popping up a window. Is there something else I need to do to make sure it doesn’t display a window?

Did you edit your project.xml?

I did and it didn’t work. But also looking in the code it just looked like (in C++/SDL anyway) it was just setting a hidden flag on the window anyway, so that wouldn’t allow it to function without x11 afaict. I just ended up making an hxml file for the settings I needed (looking at the one auto-generated by openfl), made my main class more suitable for something standalone (adding a lime, not openfl application, etc.) Had to do other things like setting actuate to be manually updated instead of real-time.

Need this to (wanna let run peoteNet lib on dedicated linux-server via console only [stdio] :slight_smile:). Cool would be some “daemonizing” feature (for windows it could be “service” or something to run into background, i dont know there).

Well it’s a matter of what you’re doing. If you don’t need any openfl stuff or graphics, you can just use the haxe compiler directly. The challenge is using openfl stuff on the server. It’s also handy if you’re sharing a lot of code between, say, a game and a server to be able to use the same tools to compile both. And since openfl offers a lot of cool stuff to make the boilerplate code, like showing windows and stuff, it would be pretty handy if console application was a use-case it supported, as long as that didn’t confuse people into thinking all the drawing routines will work without a connection to x (in my case it did, since nothing I was using was using opengl under the hood).