Possible Architecture Change Solution

Discussion in 'General Discussion' started by burgesjl, Jun 10, 2021.

  1. burgesjl

    burgesjl Registered

    Joined:
    Feb 2, 2013
    Messages:
    344
    Likes Received:
    540
    So I got bored and decided to document an idea I had many years ago, for a possible change to the way rF2 is architected, in order to get better performance out of it. This is based on my knowledge such as it is for how the app works, which might not be right. But I still think the idea is worthy of review.

    As we all know when the app runs, there is a main thread which runs at a certain "tick" rate. There are other threads that collect input from devices etc. and on the output side, could be some more for sounds etc. But in that main thread it has to do a lot of things: calculate the physics of your own car; calculate the physics and positions of any AI cars; update the display; output FFB to devices. As we know, the physics on the AI cars use a 'simplified' model especially for the tires. As such, when we see the AI cars, they behave notably differently to your own car, especially over things like sharp kerbs. I've always thought, how much better it would be if these things could all be separated to run in parallel and on different threads. I've read lots from the iRacing developers on why this approach doesn't work (because there needs to be lots of thread synch or locking of shared bits of data to do updates).

    However, we do also know its possible to run the dedicated server. It can be run on the same machine as the client, and you connect to it as you would to any other remote server. It's my understanding that, these servers don't just track the cars in 3D space, driver positions/stats etc. but it will also run the AI physics/logic when you add AI cars to it. By definition this server is its own process and therefore running its own threads.

    So my simple solution is: why not have every session you run take place on a local dedicated server? The primary advantage here I see, is offloading the workload of AI cars onto different processes/threads, thus freeing up more time for the local client for better physics/graphics. Further, the server part also has less work to do than the client, so possibly the AI cars could be run with the same physics and tire model as the client? And finally, since you always have a server running, its easy as pie to have someone remote (friend) connect into it and run with you. No need to go through rigmarole of separate dedi launch; it's already there.

    Thoughts, @Marcel Offermans ?
     
    EricW and atomed like this.
  2. davehenrie

    davehenrie Registered

    Joined:
    Jul 6, 2016
    Messages:
    7,454
    Likes Received:
    4,370
    Start a conversation with @durge driven. He has been running his solo rF2 sessions via a server for ages. You two might come up with something that automates much of the process.
     

Share This Page