1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.


Discussion in 'Racer' started by tienzyee, Mar 14, 2010.

  1. I wanted to write a script for some tweaks.
    Having checked the documentation (i hope i didn't miss any), here's my question:

    It seems there are 2 files, one after loading the car and one after the start of the race,

    question is, how do i write my own script? do i add them to the existing scripts or do I create a new script?

    And what programming language the scripts use?

    And is there anyone who knows in and outs of the scripting here?

    Would love to have some guide :)
  2. for now, Racer does not support real "scripting".
    .rex script-files are batched console commands.

    But real scripting might be a good idea for future releases.

    What kind of tweaks do you have in mind?
    And what kind of information and functions should be available in a scripting language for Racer?
  3. *edited*
  4. What kind of tweaks do you have in mind?
    I'm trying to use Racer for training instead of gaming purposes, ie turning racer into a learning tool.
    I'll start with a script that detects car collision with the other car and moveables, we can then use the information to warn the user or more than that.

    And what kind of information and functions should be available in a scripting language for Racer?
    this question is too general, but i'm hoping that it would be something really simple and widely available such as C or C++
    I have problem with the model, .dof format since most models were in .3ds format, i wouldn't want to spend time developing my own model, but instead reusing other people's model, with credit of course.

    I hope I answer your question.

    And may I ask?
    What do you mean by "for now, Racer does not support real "scripting".
    .rex script-files are batched console commands."

    From what I understand, it seems the scripts inside Racer .rex file are prewritten somewhere, as in the codes were written in Racer game engine and then the command in .rex file were just to turn those functions on or off.

    Is that you mean? or you're confused :D
  5. Stereo

    Premium Member

    I was thinking maybe a good model for how scripting could work is the Starcraft/Warcraft trigger system.

    Basically it has 4 components in a "trigger".
    1) Who it affects - player car, AI car, track, tournament? (for organization)
    2) What conditions it requires - low fuel, at specific location (pits, starting grid, finish line), wheel slip ratio etc.
    3) What actions to take - display text, adjust speed limiter, apply brake/throttle, reset lap clock
    4) When to check conditions - every 100ms, every gear change, collision event, etc.

    For example, you could set up traffic lights & police with a couple triggers
    a) track, every 40 seconds, switch textures X and Y and change variable Z to "red" or "green".
    b) AI, car entering intersection on red light (ie. Z is "red") -> start pursuit mode
    c) AI, pursuit mode enabled, play sirens & flash lights & follow player car
    d) AI, pursuit mode enabled & player car is stopped, issue ticket to player

    The complexity available is only really limited by what variables can be modified, you could script a tunnel to change ambient/diffuse/shadows for example, if you had access to track special.ini & the position of the car.
  6. What a great idea! I far prefer car /chases/ than car /races/ :)
  7. yeah, but at current situation/ racer edition, we're not able to implement any of this right?
    it seems the scripting is limited to just on and off.

    I still don't really understand what mitch meant :S
  8. Current scripting does not allow stuff like a*b+c, real scripting languages should be able to do that..
    I will draw a picture if needed ;)
  9. i saw the page but mitch, can you explain a little? heh appreciate that.

    does it mean that in the script i wanted to write, the command are limited to what is in the scripting page?
    beyond that, i wouldn't be able to code them?

    thank you
  10. For one area:

    Any debug info should be able to be processed via the car.ini...

    So rather than define a variable, ie, max_rpm for engine, we define the max_rpm as a code string. Ie, like the LUT for curves for dampers or whatever.

    We can then store code in the car folder (ie, sub-dir or root depending on authors wishes), or a global one.

    We can then say in our code file, say:

    max_rpm =

    while sim_time < 100

    max_rpm = 8000 - (sim_time * 40)


    max_rpm = 8000

    assuming sim_time is in seconds, then for now, we can make it so our car has an engine rpm limiter of 4000rpm, and as the car warms up (that is what we are faking), then we get more and more rpm to use.

    Going further, we could even define some variables within this small bit of code to create an engine coolant and oil temperature, iteratively looking at the rpm's, throttle position and car speed, and every step adding some 'heat' to the system... this could then power a gauge in views.ini (perhaps, if views.ini could see these variables eventually)

    That addition alone would add SO much power to Racer... good bits of code that have been developed well could then be refined and added into the proper Racer.exe