Wayward Programming

Hey folks! Hope everyone's doing okay. Feeling a bit defeated here, mainly due to programming woes.

I spent a bit more time trying to get flixel-ui's FlxUIInputText to work as a multi-line text field, but no dice. There seems to be some hard-coded behaviors in that class which assume a single line. Some hackery allowed me to input newline characters, but that still didn't solve the caret position and field height issues. Not wanting to waste too much time patching an unfinished system, I moved on to my next trick.

I had already started writing code the other day which dynamically replaced all FlxUIInputText fields with vanilla OpenFL TextFields. The nice thing about this is that those vanilla TextFields are a bit more robust. Multi-line input and line-wrapping work better, as does mouse selection and highlighting.

The trouble with that, however, is that they use a different display hierarchy than Flixel. So if I want to do any sort of scrolling/zooming of UI elements (and I do), it means manipulating both the Flixel camera and OpenFL rendering stack in tandem. And since each treat their stuff differently, this is tricky.

Worse, Flixel's camera.zoom seems to do weird stuff which makes it almost impossible to zoom out. The camera moves on-screen with each zoom, the bounds no longer fit, and even if I compensate for those, I get crashes below 1/8th zoom (which appear to be due to an invalid bitmap, probably either too big or too small to allocate memory for).

So, I put the Flixel/OpenFL mixed UI on the shelf, and started to take a look at a pure OpenFL UI. This is what I was using on NEO Scavenger's encounter editor, which mostly worked well for my needs. It was fast, zoomed/scaled predictably, and offered a lot of leeway in drawing.

However, I quickly remembered one of my frustrations with that setup: few out-of-the-box UI widgets to work with. Basically, a simple button and text field. If I wanted checkboxes, scrollbars, radio buttons, or anything else, I'd have to roll my own. (And probably hit many of the same problems I was trying to avoid by skipping the Flixel UI mentioned above.)

Finally, I took a stab at searching for OpenFL UI systems. And I found one! HaxeUI seems to be a very robust UI system including pretty much any UI one could want. It uses a variety of layout methods (XML or hard-coded), and could be skinned however I wanted. And since it used OpenFL, I still got the predictable scaling and scrolling I needed.

However, I forgot one other issue that I had with OpenFL in the NEO Scavenger encounter editor: text fields in native targets. Native C++ targets like Windows EXEs and the neko target had only partial text field support, ignoring crucial keyboard events like ctrl-A, ctrl-C, ctrl-V, etc. Basically, I could type, but not edit. Highlighting a bunch of text and hitting the shortcut to "copy" would just erase everything and replace it with the "c" character.

No good.

I don't think OpenFL has a fix for this yet. I saw a few whispers of a fix, but even when using the latest 3.3.6 lib, it seems broken.

I dunno. Like I said, I'm feeling a bit defeated. It's like I'm just hitting dead-end after dead-end here. Admittedly, this is just for making a tool to edit data. It's not actual game features I'm stumped with. And maybe I need to lay off the editor idea.

But on the other hand, my data is getting downright hoary. I need some better way to visualize what's going on if this game is going to get any more complex (spoiler: it is).

Unity's still out there, of course. But I have misgivings on that front, too. It's a lot of re-leaning I need to do, if I switched to that tech. It's a lot of dollars I need to lay down for each platform I want to target. A lot of the stuff is hidden behind their WYSIWYG editor, which irks me. And I don't like that they could vanish tomorrow and leave me with an expensive tool (and time investment) that's no longer supported.

Like I said. I dunno. Feels like a lot of dead-ends in here. I'd like to just be coding away making cools stuff, but it feels like I'm wrestling technology wherever I turn.

I should probably talk to some other devs. I'm in my own bubble here, and maybe self-defeating. There are lots of helpful people out there, and I know many of them.

For now, though, beer o'clock.