Console AppState Plugin

Last post update: August 15, 2013
Current Plugin Version: 0.99
Download: (available as plugin in SDK soon)

I’ve been working on an AppState that serves as a universal game wide console that shows when you push the grave key, a common feature of most PC games. The nifty gui project has a Console in it, but you need to incorporate nifty in to your game to use it. (Which means requiring the use of nifty, and all the code that goes with it).

My main goal with it is to keep it easy to include in to your project and to only use components that come with a fresh jmonkey install (besides needing to download the plugin/jar file of course). The console itself is just a few Quads and BitmapTexts on the guinode. Adding/removing console commands are similiar in nature to add/removing key mappings with the InputManager.

It’s an AppState, so all you need to do is attach it to the StateManager.

stateManager.attach(new ConsoleAppState());
stateManager.attach(new ConsoleDefaultCommandsAppState()); // optional app state that provides some default command mappings if you want them.

I’ve been working on it since I made this post a week ago to make it “plugin” worthy. I’ve added a few new features to make the console more configurable.

Also as @zarch mentioned having a “DebugModeAppState” was a little confusing with the name. Instead of renaming it to “ConsoleDebugMode” I actually just canned it and made “ConsoleDefaultCommands” instead. the DefaultCommands appstate just contains a couple mappings that manipulate the console’s settings (rather than having the debug commands). Its main purpose is just so you can quickly add and test out the console.

Hopefully in the next few days I will be able to upload it to the contributions repository so anyone can easily download it as a jMonkey SDK plugin…

For now you can get the library and the sources+javadoc here:


  • Easy to add to any game
  • Well documented with javadoc
  • Remembers input history that can be recalled by the user (up and down arrow keys)
  • Uses a RawInputListener to listen for the grave key to show the Console.
  • While console is shown it automatically eats all keyboard input. (to prevent performing game actions while using the console).
  • Doesn’t consume any keys besides grave when console isn’t showing.
  • Automatically sizes the console window based on the gui ViewPort Camera dimensions.
  • Number of console lines is configurable.
  • Console Font (and size) is configurable
  • the alpha transparency effect of the console is configurable
  • console can be set to be “fullscreen” of the gui viewport if you want it to be.
  • Has its own “CommandParser” so you you don’t have to parse the input strings yourself.
  • ConsoleDefaultCommandsAppState provides some default mappings: (eg console size, help, clear, hide, exit)
  • Contains an example (TestConsoleAppState) that attaches the Console and registers custom commands with it.

Issues that I’m currently working on:

  • Has not been extensively tested
  • Console “error” output does not show up red (currently looks the same as regular output)
  • Console input line currently does not wrap. (output window does though)

Here is a screenshot of it in action…


That’s a pretty neat thing, great work.

Whoops I meant to include the link to the jar file

(Filed removed, use the link from the top of this page for newest version.)

btw I have written javadoc style comments for all of the public methods, though I can’t seem to figure out how to include those comments in the jar file >.<… most of the methods are pretty self explanatory though

This looks really nice. A feature quite a few people are going to have a use for I think!

The only suggestion I’d make is to change the second app state name to ConsoleDebugAppState so it’s more obviously tied to the first one.

This would make a nice SDK plugin. :slight_smile:

Sweet! Great work.

Will you make this a plugin ?

I would like to make it one. I’m not completely sure on what the process is to get access to upload to the plugins repository.

cool stuff. This has details on making a plugin[]=plugin

You need access to the repository to upload it, @normen can help here :slight_smile: