Scala code generator for physics based games