23 October 2012

Mac OS X and Simultaneous Multi Platform Runtime Compiling

With the help of the lightweight cross platform GL windowing library GLFW and the Simple File Watcher, we've added Mac OS X support to Runtime Compiled C++. As an added benefit, you can now run multiple platforms from a shared directory, using one of them to code on the fly. Turn around times on Mac OS X with XCode 4 and Clang++ are excellent, better than windows on a similar system.


RCC++ on OS X and Windows 7 simultaneously
Mac OS X 10.8 with XCode 4 running the SimpleTest example natively top right along with a Windows 7 Parallels Desktop Coherence mode version of the example running bottom right. The apps in each OS have just compiled changes made from XCode. Turn-around times are significantly faster when not running the VM.

For the moment you'll need OS X 10.8 and XCode 4 to run the code on the Mac (we've not tested with OS X 10.7 but it might work). If you change the debugger to GDB the exception handling mechanism doesn't work as smoothly as with the default LLDB debugger, since GDB doesn't pass the exception signal on to the app.

We'll have more information on the port, the changes and our plans for the future soon.

Please do give us your feedback on the OS X version, as we've had limited ability to test this on other systems as yet.

09 August 2012

Building a Console

Building a Console from RuntimeCompiledC++ on Vimeo.

Many game engines include a command console that allows a user to issue text commands to adjust settings, get debugging information, change the state of the world and so on. The feature opens up a great deal of potential for rapid development.

However, the implementation will usually be based on a scripting language of some kind: either giving access to one already integrated or using simple custom syntax. Both of these represent significant barriers and maintenance costs. To allow you to access all the features of your engine a scripting language must be pervasively integrated, which is a lot of work - and if you've been reading this blog, you know we see a lot of disadvantages in this approach. A simple custom scripting language will also take work and will always be much less powerful.

RCC++ offers a new option: allow the user to give commands directly in C++.

We can do this by taking the text the user has entered and dropping it into a simple .cpp file, forming the content of a standard execute() method. We can then compile this file at runtime and immediately execute it, just once, as a "snippet" of disposable code. By passing in virtual interfaces to our major subsystems we can have access to our existing functionality with very little work. In essence, anything you could do in the C++ code, you can now do on the command console.

The same crash protection discussed before allows us to catch basic crash errors, so we can use it with confidence. We can also go further: if we restrict the symbols and methods we expose, we can make it safer to use; if we write some nicer wrapper methods we can make it easier to use. This opens the way for a console friendly enough for non-programmers.

We've got some other ideas for applications of code "snippets" and making them easier for designers to use - you can expect this topic to return in future posts.

19 July 2012

RCC++ at the Develop Conference

Last week we gave a talk on RCC++ at Develop in Brighton. 45 minutes long, it included live demos of everything you've seen on this blog and some features we so far haven't covered. We featured videos of recent integrations with the Dynamic Resolution Rendering demo Doug developed with Intel, and with the popular Recast navigation toolkit that features in my own work. We also received permission to give an overview of Crytek's Softcode implementation, which was based on our work.
We've really appreciated the great feedback we had after the talk and on Twitter. We'll be blogging about those other features and integrations in the coming weeks. In the meantime, you can download the slides.

02 July 2012

Library Support

We've just added improved support for libraries. Whilst it was previously possible to have runtime code linked against a library using the Visual Studio #pragma comment(lib, "nameOfLibrary"), the directories for library search were only specified if added as an environment variable. You can now add library directories as well as include directories, as shown in the example below for supporting DirectX:

m_pRuntimeObjectSystem = new RuntimeObjectSystem;
m_pRuntimeObjectSystem->AddIncludeDir( "%DXSDK_DIR%/Include");

#ifdef _WIN64
m_pRuntimeObjectSystem->AddLibraryDir( "%DXSDK_DIR%/lib/x64/" );
#else
m_pRuntimeObjectSystem->AddLibraryDir( "%DXSDK_DIR%/lib" );
#endif


We hope to improve upon this in future so that developers don't need to specify libraries and paths in both their project file and their code, and to support compilers which don't use the lib comment for libraries.

These features allow some significantly increased flexibility to what can be runtime coded. For example I was able to move scene rendering code to RCC++ for a project, allowing me to not only modify shaders but also C++ code on the fly.

30 June 2012

Visual Studio 2011 and x64 Support

We've just added support for x64 builds and Visual Studio 2011. Additionally, if you have multiple versions of Visual Studio installed, the runtime compiler will now default to the version used to compile the code originally.

24 June 2012

New: installation and integration instructions, tutorials

We've updated the Wiki on Github. New:
  • Instructions for installing the demo code;
  • 3 detailed tutorials enabling you to reproduce the content of the videos;
  • Basic integration instructions.
If you have any feedback, post on the RCC++ discussion group.

Edit: 26 June, thanks to Mike Bell for spotting that we'd not pulled the tutorial changes from our development fork. Now fixed! 

21 June 2012

We'll be presenting at Develop Conference in Brighton

Matthew and I will be presenting Runtime Compiled C++ at this years Develop Conference in Brighton, on Thursday 12th July from 12:15 to 13:00. The presentation will include a live demonstration of the technique, and we'll be around afterwards to answer any questions. We've been beavering away busily improving the code to make it easier to integrate, as well as make the demo a little flashier!

We'd love to see you at the event, if you're coming do let us know if you have any specific questions you'd like to see us answer and we may be able to modify the talk to answer them.

18 June 2012

New Feature: Include File Tracking


Include File Tracking in Runtime Compiled C++ from RuntimeCompiledC++ on Vimeo.

We've added a major new feature - automatic runtime include file handling. Before, when they changed a header file, developers needed to manually trigger recompilation of every runtime source file. Now all developers need to do is add an include and the macro RUNTIME_MODIFIABLE_INCLUDE to their header and when the header file on disk is modified, all runtime source files which include it are recompiled and the resultant library is loaded as usual.

The implementation for header tracking took some slight of hand with macros and the C++ feature set. We also need to track which source file included that header, so we need a dependency map. The result is simple to use and doesn't significantly increase compile times or code complexity.

Check out the code at Github to take a look at the new changes!

15 June 2012

Unreal Engine 4 Hot Reload


Some of our readers have spotted the similarities of our runtime compilation and the Hot Reload function in UE4 (see the end of this video at around 9:50 , and the UE4 site). We don't know if their technique is inspired by or related to our work, but it certainly looks very familiar. Convergent designs frequently occur when conditions for their utilization are right, but we have a few friends who work at Epic so we're trying to find out. We're very happy to see this approach being used, and to mark the occasion we've added a 'compiling...' notification GUI element to the game, so you can see when something is being compiled even if you don't have the log window open.

When a compilation is running, the following element is shown (the dot animates as a scrolling '...' ):


And when complete you get the following:


We've yet to add any fancy transitions, and we don't show whether the completed compile was successful or not (though the log and log notification does), but perhaps we will at some stage!