So I munged around a bit trying to isolate it, and I tentatively narrowed it down to the picking code I had hastily written. The picking worked by setting up a container full of buckets, each bucket representing a unit cell in the world. Objects that wanted to be picked needed a component that would register an entry in the picking container for the object, and as the object was updated, it would call an update to shuffle the picking entry to different buckets as the physical position changed. I could pick by feeding a set of un-projected coords and testing the unprojection against the various entries. It worked pretty good, but I did put it together rather hastily and I was doing a lot more looping and table copying than I really needed to, so I suspect that something in there was eventually going wonky. Picking was on my list of things to move into C++ engine code, though, so rather than try to debug the Lua picker, I just rewrote it as engine code and in the process I got back a few frames per second as well. Just finished a 2hr stability run just now, and it seemed rock solid. But of course, as is always the case when a bug that I can't definitively put my finger on crops up, I am suspicious of things, so I'll be watching the debug logs like a hawk for awhile until I'm satisfied I really did fix it.
That's a drawback for using Lua for me, btw. I haven't dug deeply into the guts of it at all, so a lot of its operation is mysterious to me. I understand the basics of how GC works, but I don't understand the specifics of exactly why the code I had written would cause the problem I was running into. In pure C++, I have no problem profiling and narrowing down bugs of that nature, but with Lua I'm kind of in black-box mode, trusting the system to just work and wondering what the hell went wrong when it doesn't. I guess maybe I should put it on my todo list to track down some profiling and debugging tools for Lua.
With that out of the way (hopefully) I'm kind of thinking about making today either a creature AI rough-in day, or a graphical asset touch-up day. I'm badly in need of finishing at least 1 full set of animations for a character, in order to verify that all the animation state switching is working as intended. I could also use a few more special-effects; it's getting old staring at the same old red-yellow dots and poofy grey smoke clouds all the time. It needs more pop. It needs more sizzle. More zing.
Along those lines, too, I need to start formalizing the idea of tilesets and themes: grouping together tilesets, sets of resource entities, world props and decoration doodads, etc...There is no real reason I need to group tilesets, but I think it would be easier to create island variants by being able to swap in different tileset definitions to change the appearance.
But I really do need to get started on enemy AI. So many things to do. (I also need to do another hefty documentation push. *sigh*) (Oh yeah, need to start work on save/load of levels and player data.) (And resource pre-caching.) (And see where in the level generation process I can recover a few seconds of generation time.) (Still need to do a drop-item intermediary object)(oh yeah, and....)
Just never ends.