Sign in or Register (Free)
Please Upload Video

rFactor2Python 2011

By: Joao C.

Unavailable: 1-Click Install
Related Videos

Screenshots unavailable

Description (Click to toggle Visibility)

Changes:
- 20110927 (experimental)
- new: Python threading is now possible (finally...but needs further testing)

- 20110606 (experimental)
- new: Multiple plugins support! Place Python plugins inside rf2py_plugins/.
- new: Plugins are classes now! See rfactor.py.
- update: small updates here and there...

- 20110523
- new: CheckHWControl implemented.
- update: examples updated with CheckHWControl.

- 20110521
- update: fixed a crash when calling xdecref on loaded module
- update: print python version to log file
- new: mysqldb example. rfactor-mysqldb.sql contains the database structure
- new: test-score.py script. Very useful to simulate score updates and test
rFactor2Python scripts.
- new: rfactor-frames.py example. The output of this script can be used by
test-score.py. Example output: rfactor2python.frames.txt.tar.gz

- 20110516
- update: mLapDist field was missing. Added.

- 20110510
- Examples directory added
- Two examples added: log and serial
- rfactor.py functions are empty now. A brief description, from original headers, was
added at the top of every function.

- 20110509
- Telemetry updates! New function available: UpdateTelemetry. (check rfactor.py)
- Python exceptions tracebacks are now printed to log file. This helps debugging rfactor.py.

- 20110508
- Initial release


Description:
Use the power of Python programming language as a rFactor internals plugin!

* Advantages:
- You don't have to know C++
- You don't have to compile anything
- Most of the rFactor Internals Plugin methods are exposed to Python!
- Python provides huge functionality with little work and has high quality documentation
- Multiple python plugins supported.


* For example, you can easily:
- Save players timings to a database
- Create a webpage with live server status
- Send an email with results, timings, etc, when a race ends
- Interact with an Arduino


Requirements:
- Python (correct version) is the only requirement


Documentation:
- rfactor.py is self explanatory.
- rfactor2python_examples/ directory contains multiple plugin examples
- All attributes and functions have the same name as in Internals Plugin SDK (download from official rFactor site)


Installation:
1. Extract plugin zip file into rfactor root directory.
2. Read rfactor.py.
3. Place plugins inside rf2py_plugins/.


Problems:
- If you have any problems with the plugin, check rfactor2python.log file.
Python exceptions are logged to this file.


Message to users:
- If you're using this plugin on a public project, I'd be happy to know.

Community Rating

Overall rating since initial release  
400/500 (11 votes) 1 2 3 4 5
Community Ratings since October 01, 2009   My Ratings
Usefulness
You must be logged in to rate, comment and download mods

Download Links

You must be logged in to download files. Login if you have already have a account or register as a new user. Access to downloads is immediate.

Latest rFactor2Python Comments

Post a rFactor2Python Comment

In addition to national events, it hosts rounds of the British Hill Climb Championship.
192.168.1.1
192.168.1.1
192.168.1.1
192.168.1.254
192.168.1.254
newstart027 on Dec-01-2016

My Hall of Fame lets you nominate up to 15 tracks, 10 cars.
192.168.1.1
192.168.1.1
192.168.1.1
192.168.1.254
192.168.1.254
newstart027 on Dec-01-2016

Originally posted by: tourettes

Hi ialiende.



Some plugin functions, like UpdateTelemetry() are called at a fast rate and also contain lots of information. Depending on what you're doing, you can be writing tons of data (either to database or file) too fast. Try controlling the frequency at which you save rFactor's data.



You might want to read the comments at http://b.joaoubaldo.com/?p=688...1#comment-2671.



Cheers


Hi Tourettes,

I think the problem is not that, because I disabled the plugin and those debug files were written anyway. On the other hand, my plugin script outputs its info on another file, not those.

Thx for the answer anyway.
ialiende on Aug-05-2011

Hi vincebc.

rFactor2Python plugins are not threaded, at least for now.
tourettes on Aug-01-2011

Hi ialiende.

Some plugin functions, like UpdateTelemetry() are called at a fast rate and also contain lots of information. Depending on what you're doing, you can be writing tons of data (either to database or file) too fast. Try controlling the frequency at which you save rFactor's data.

You might want to read the comments at http://b.joaoubaldo.com/?p=688&cpage=1#comment-2671.

Cheers
tourettes on Aug-01-2011

Originally posted by: vincebc
Hi,
I've some trouble to send mouse control in rf. It's more a question about Python.
I tried different method found in internet, but without success.
It's for clicking on a driver in the monitor view. I move the cursor but the click don't work.
Do you have some tips?
Thanks

Ok I resolved my problem, I use a separate thread for the click.

I don't know if it's normal, but rfactor freeze and wait the end of an instruction in the py file. If I have a sleep of 1s, it freeze 1s.
In fact, I had micro freeze (cause I put a time sleep beetween click down and click up) and the click didn't work or very badly. So with a thread, I don't have freeze.
vincebc on Jul-20-2011

Hi again,

I did a fresh rfactor install and now I don't have those debug files. Then I installed your plugin with mysql script enabled but I still have fps issues.

I wish to know how debug is triggered and how to disable it in case I'll have that problem again (now it's clear for me that it is not caused by your plugin but maybe you know how to do it).

On the other hand, my intention was to do a web page with live and hotlaps info together and, based on your web example, I think it's possible but the live part seems difficult to me. You say that it's simple, am I missing something? Obviously, I have to solve fps issues first, do you have any idea? (I took your script and I changed mysql server ip to 127.0.0.1 only. Btw, I fixed a typo in the UpdateScoring call that was starting with downcase

Anyway, I like python and rfactor so this plugin is very useful.
ialiende on Jul-15-2011

Hi,

I've found a problem but I'm not sure if it's related with your plugin.
I tried a couple of your examples and I like your plugin very much, but now rfactor freeze several times in a lap and I realized that a lot of debug info is being written in files like MAP_DEBUG.txt and ExampleInternals*Output.txt.
I saw that this version of the plugin indicates 'experimental', is possible that it enables debug? Or, do you know how to disable it?

Thx.
ialiende on Jul-15-2011

Hi,
I've some trouble to send mouse control in rf. It's more a question about Python.
I tried different method found in internet, but without success.
It's for clicking on a driver in the monitor view. I move the cursor but the click don't work.

Do you have some tips?
Thanks
vincebc on Jul-09-2011

rFactor2Python was updated (20110606).

What's new:

- Support for multiple Python plugins:
For example, if one needs to save session data to a DB and send telemetry data through a serial port at the same time, just place rfactor-serial.py and rfactor-mysqldb.py files inside rf2py_plugins/.

- Plugin class:
By using RF2PyPlugin class, the code gets cleaner (no need for globals, etc.).
All the examples were updated to use this class.

- CheckHWControl() support:
It is possible to manipulate game controls from Python plugins.
Read rfactor.py.

Read more at http://emcheio.com/1k
tourettes on Jun-06-2011

Post a rFactor2Python Comment