Rmg

Merged jfhs's patch with current engine, without much investigation. Hopefully it's compatible with smart pointer usage and recent random number generator changes.

However, random map at this point won't even launch, showing bug in a very unexpected point of engine.
It's not aimed for merge, just a branch to develop RMG further. Please commit RMG-related code to this branch if you want to.