rFactor2Python: Python scripting for rFactor

I’ve created a plugin for rFactor that forwards plugin calls to Python scripts, making the task of programming for rFactor much easier. Python is loaded with tons of useful modules (urllib2 and serial, for example) ready to use, and their documentation is very, very good.

Using the plugin is simple as placing its .dll in rfactor/Plugins and rfactor.py in rfactor/.
Python (2.7 at the moment) is the only requirement.
rfactor.py is a simple demonstration but also serves as the plugin’s documentation.

Let me illustrate some cases. You can:

  • update a database with players timings every 30 seconds
  • create a webpage with live server status (like this one)
  • transmit telemetry data over a serial connection (ex. to an Arduino)
  • send an email, with results, after a race ends

Of course, all of these examples are possible with C++ plugins, but doing them in Python is incredibly more friendly.
It’s just a matter of editing rfactor.py! No compiling!

Possibilities are many and if you’re using this plugin in a project, I’d be happy to know about it.

Download 20110508_python27

11 thoughts on “rFactor2Python: Python scripting for rFactor

  1. Nice module you just created man!, im testing it and have the intention of bulding a display with it as a school project, i was wondering if you could help me out a bit with some things?


    • Hi nicko.

      Great project of yours. You have access to every physics parameter of the vehicle, you should be able to turn those into force feedback values, am I right?


  2. Hello !

    I began to try your rfactor2python, but got an issue when exiting the game, it crashes with an error on python2.7.dll. I’ve installed python 2.7.5 32bits, i tried your plugin example, the trace file is well filled, but when exiting the game, it crashes, no log in rf2python log.
    Tested on 2 rfactor installs, on 2 different Windows intalls.

  3. i installed “python-2.7.2″ , “mysql-installer-″, “MySQL-python-1.2.3.win32-py2.7″

    I created a schema for rfactor and opened “rfactor-mysqldb.sql” and execute the query. The session and timing tables are created.
    then put the sql and plugin file to py plugin folder
    But rfactor not starts it gives the below error.

    Error is :

    • Hi.

      When you say python 2.7.2, is it the 32bit version?

      Can you please:
      – confirm if rFactor still crashes after emptying rf2py_plugins/?
      – send me your rfactor2python.log.
      – also, can you try rFactor2Python on a clean rFactor install?

      You can also try to run another python application to see if python is correctly installed (python comes with IDLE IDE. To access it you can right click any .py file and chose Edit).


      • hi,
        i use 32bit version on 32bit windows 7.

        rfactor is working without phyton plugins.
        also there is no problem with serial plugin and log plugin.
        the plugin can write the telemetry datas to txt file.

        but if i try to use the sql plugin rfactor is not starting :(
        can you tell the installing process of sql plugin so i can start over on a clean rfactor install.

        (About log plugin: i want to know how to tracuate the txt file (because nearly it is over 100MB per a lap in a race) i want to have it once, then delete and new data comes. )
        Thank you for your help

  4. hi, very good plugin.
    i able to use it for txt logging. but couldn’t work with database
    it gives phtyon27.dll error if i start with the sql plugin inserted.

    i downloaded and installed the mysql but dont know how to insert correct tables to where in your plugin.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Heads up! You are attempting to upload an invalid image. If saved, this image will not display with your comment.