Sunday, July 27, 2014

Sublime Text 3 Game Engine RPC Integration

I've been using Sublime Text for a while now, and as you know I have integration for Kagura.  Today I want to share a basic skeleton sample on how to add integration for your project.  Kagura provides both a telnetd and httpd for accepting RPC commands and content, which are the basis of the web based tools such as the editor and profiler charts.   Hooking sublime up via HTTP is easy as it's all python.

I would like to make a full tutorial and go step by step for this, however blogger has no source code formatting / syntax highlighting options via the editor.  Basically, all you need to do is make a small GET / POST request function to push embedded script commands to the game.  Then you can get responses back to process if needed.  Given this is integration into a text editor you're not going to request JSON + js to make pretty graphs or edit content, so responses are ignored.  :)

As far as the game engine side of things go, you'll need to implement or integrate an httpd -- such as mongoose httpd -- to your project and have that feed your main logic loop the script in a thread-safe manner.  Notice all these samples assume local to game engine file modifications to avoid pushing entire files and mirroring during development.  Kagura development is "uncooked" as you can't ship with this enabled for security reasons anyway.  Would make the game a little too easy to hack.  ;)

Sample menu, keys, and plugin files at github:

No comments: