Clone wiki

ignifuga / RemoteConsole

Ignifuga has built in functionality to support remote access to the running engine using:

  • RFoo
  • Telnet
  • Websockets (Useful to interact from a browser or to explore the game using a Javascript terminal such as Dark Websocket Terminal

To use RFoo, start the demo with:

./ -r

Install RFoo (Using easy_install, pip, etc) and run:


You'll enter an interpreter much like the standard Python interpreter, but this one runs inside the engine. It comes pre seeded with a few useful variables (unless you specified --staticglobals on the command line), to view them type:


Some of these variables are persistent across scenes (pQuery, Gilbert, DataManager, Renderer, DONE, ERROR, etc), and others reflect entities present in the scene, which are created with a variable name that matches their id (if the id is defined).

Entity with ID: title (2028089)

Let's now try changing the scene

for x in range(0,689, 3):
      title.x = x

When you hit Enter, you'll see the main title jump to the x coordinate 0 and slowly move to the center jumping 3 pixels at a time. The SKIP() function is important here as Ignifuga's entities and the remote console run in a single cooperative thread, so basically what you are doing is releasing control so the rest of the engine can keep updating. Once the engine finishes updating, thanks to the magic of Greenlets, execution resumes on that same spot.

You can combine this technique with pQuery, to modify more than one entity at the same time.

for red in range(0,255):
   _('*').red = red / 255.0

What you'll see now is that the red component of all sprites goes to zero (blacks out) and slowly comes back. Pretty neat for 3 lines of code, right? Besides this sort of rudimentary animation method pQuery supports a full fledged "animate" method and it behaves mostly like jQuery, so that's a good place to figure out what each selector does.

pQuery also works on LibRocket elements, the selection is done depending on the context provided (the second parameter provided to pQuery, which by default is the current Scene, except for Python code ran from inside a libRocket document, in which case the default context is the current document)

# Select all entities in the Scene
# Select all components in an entity
_('*', title)
# Select all elements in a Rocket document 
# The "gui" variable is also pre seeded, but in case you want to select the component manually:
gui = _('#gui')[0]
_('*', gui.document)
# While not technically correct, this also works, yay for syntactic sugar!
_('*', gui)
# Rocket document objects have a pre seeded pQuery object with the default context set to the document
# So, this also selects all the elements in the document

Now let's try changing the menu colors:

gui = _('#gui')[0]
_('#loadBtn', gui.document).css('color', '#FF00FF')

You'll notice that the load button is now colored with an ugly violet.

gui = _('#gui')[0]
gui.pQuery('#loadBtn').css('color', '#00FF00')

Now the load button is green and the text has changed. You can also experiment with Actions, like this:

from ignifuga.components.Action import Action
Action(entity=gui, targets=['#loadBtn',], color='#00ff00', duration=5.0, relative=False, easing='outelastic').init()

For more tips and tricks on Actions, animations, pQuery, etc, see Using pQuery