logoalt Hacker News

benstopicslast Tuesday at 9:18 AM2 repliesview on HN

I built an FFI via event dispatching and shared memory pointers/matching structs. Imported the C++ UI layer as a DLL via Win32 LoadLibrary. The PB shares a big array for storing global pointers allowing them to read/write each other's memory. The C++ has an event queue and has DLL functions the PB can call to peek/pop the next event. It actually isn't that complicated, just took me forever to come up with the idea.

As for languages, PB, C++, and JavaScript (Electron/Preact). I chose a no-build UI framework so that it could be modded by players without installing any build tools, just edit the text files in the game folder, and it has been a very good decision.


Replies

nwellinghofftoday at 6:30 AM

Indeed very clever. I wonder if you framed this problem up with claude how it would “guide” you to solve this problem. Would be an interesting match up of ai vs human. Love the story!

show 1 reply
replwoacauselast Tuesday at 2:28 PM

That’s awesome. What a clever approach!