4 ms·
Ask HN: C/C++ adjusting variables at runtime
I recall hearing of a library that can be linked into a C/C++ program that allows you to register variables. When your application is launched, the library would start a webserver, which you can then connect to. The displayed webpage would then show you all the variables you have registered and allow you to adjust them.
In terms of games development, this would be very useful, but after spending 90 minutes searching Google, I can't find the library. Either it no longer exists, my search terms are bad, or perhaps I made up this whole idea in my head.
Can anyone help?
- iab 11y agoI think you are looking for something like CVars, or equivalent. The doom source has an implementation, there is also one as part of the library below which I highly recommend. http://www.robots.ox.ac.uk/~gsibley/GLConsole/index.php?n=Main.Documentation http://www.robots.ox.ac.uk/~gsibley/GLConsole/index.php?n=Ma...
- scraft 11y agoI have come across GLConsole http://www.robots.ox.ac.uk/~gsibley/GLConsole/ http://www.robots.ox.ac.uk/~gsibley/GLConsole/ and CVars https://github.com/arpg/CVars https://github.com/arpg/CVars and http://anttweakbar.sourceforge.net/doc/ http://anttweakbar.sourceforge.net/doc/ which are definitely along the lines of what I was after. I just seem to specifically remember something that displayed the information via a webserver, at the time I remember thinking I'll come back to integrate it at a later date, but now can't find the original source!
- to3m 11y agoI wrote an HTTP server (https://github.com/tom-seddon/yhs https://github.com/tom-seddon/yhs) with pretty much exactly this use case in mind. (This influenced the main unusual thing about it: it doesn't use threads, the idea being that when your function is called in response to an HTTP request, you're less likely to have to do anything special before modifying values as requested.) The code is mostly complete, and should be usable as-is, but I never ended up using it in anger. My quick and dirty stopgap solution at the time was some on-screen (on the iPhone) widgets, and people seemed to prefer that in the end, because it meant they didn't need a computer/second iPhone/etc. So I never rolled out an HTTP-based equivalent. If I were doing it again, I probably wouldn't bother with a full(ish) HTTP implementation - I'd support only WebSockets. Then write the Javascript client code separately from the game, and store it separately in SVN or whatever. Faster iteration on the client code, and you can update the UI stuff separately from the game. Though of course, if people preferred on-screen widgets once, they might then still prefer it a second time ;) (As an example, a project that's on my must-take-a-closer-look list, that I believe but works in the way I suggest: https://github.com/Celtoys/Remotery https://github.com/Celtoys/Remotery)
- scraft 11y agoWell, I have integrated Remotery, not what I was looking for but pretty cool. I have made a bunch of feature requests for it which would bring it more in line with other profilers: https://github.com/Celtoys/Remotery/issues/47 https://github.com/Celtoys/Remotery/issues/47
- scraft 11y agoI also stumbled upon microprofile https://bitbucket.org/jonasmeyer/microprofile https://bitbucket.org/jonasmeyer/microprofile which has similarities to Remotery.
- to3m 11y agoThat's another entry for my must-take-a-closer-look list :)
- shortoncash 11y agoKuck and Associates had a performance tuning library with OpenMP support years ago that did this or something similar to this around 17 years ago. They got acquired by Intel. I don't know if Intel's compilers and libraries still have this feature.
- scraft 11y agoThe first post on here lists a lot of cool things it would be nice to be able to do... https://www.reddit.com/r/programming/comments/36d190/h2o_is_a_very_fast_http_server_written_in_c_it/ https://www.reddit.com/r/programming/comments/36d190/h2o_is_...