Skip to content

Instantly share code, notes, and snippets.

@gazliddon
Created September 5, 2015 18:29
Show Gist options
  • Save gazliddon/b057d83453acd5d87b96 to your computer and use it in GitHub Desktop.
Save gazliddon/b057d83453acd5d87b96 to your computer and use it in GitHub Desktop.
Livecoding Info

Livecoding Notes

  • TBD
  • Conversion of TxK for the Vita by Llamasoft to:
    • Linux
    • Android
    • OSX
    • IoS
    • XBOX ONE
  • Written in C++
  • Game originally written directly for Vita libs
  • Abstracted all IO to a bespoke library layer which isn't tied to any HW / OS
  • Current version sitting on top of SDL2
  • Base renderer OGL
    • Works under GLES2 and OGL 2.0 and greater
  • Source code proprietary and not available
  • Will likely make abstraction layer public
  • Allows you to register a variable in a database
  • You can change that variable via the tweak system
  • That all works - currently binding that to my Lua layer

In C++ do something like this

using namespace shitlib::experimental;

// Derive from cTweakable

struct tweaks_t : public cTweakable<tweaks_t> {

    // Declare structure members

    bool mCheatModeActive;
    std::string mString;
    cVec3 mV3;

    // Supply an add function, this registers
    // the elements of the struct you want
    // to be accsible externally

    void adder(maker_t & tw) {
        // Use the function operator overload
        // to add the vars you want externally
        // alterable along with their names
        tw
            ("mCheatModeActive", mCheatModeActive)
            ("mString",          mString)
            ("mV3",              mV3)
            ;
    };
};

// You if you have a cTweakManager object you can then add
// the struct to that manager

tweaks_t tweaks;
tweaks.addTweaks("mytweaks", tweakManager);

tweakManager.setTweak("mytweaks", "mCheatModeActive", true);

It's a lot of work to just set a bool BUT an interface like that allows me to hook it into Lua easily. So..

local tweaks = tweakManger:find("mytweaks")
tweaks.mCheatModeActive = true

It means I'll be able to live edit a lot of game parameters. I have a lua repl built into the game.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment