WIP Beta released BeamNG Remote control: All controllers, all day.

Discussion in 'Utilities and programming' started by duk3luk3, Aug 15, 2014.

  1. duk3luk3

    duk3luk3
    Expand Collapse

    Joined:
    Aug 7, 2014
    Messages:
    7
    BeamNG Remote Control

    [Irrelevant backstory, skip if not interested]
    A few weeks ago, Kerbal Space Program 0.24.2 was released, after almost a year of no releases. I was so pumped! Surely by now they would have fixed the problems with joystick support that led to a lot of joysticks not working.
    Well... they hadn't.
    After a bit of frustration, I said to myself "Surely one of the many multiplayer mods supports remote control. Maybe that'll help me." - but alas, none of the KSP multiplayer mods has real remote control. So I said to myself "this should be easy to mod in!" and I started by trying to coax KSP into loading SlimDX. But all it did was barf at me. Well then, I said to myself, we'll just have to set up a remote control. And off I went and started coding up the client part: An application that takes game control input and sends it somewhere over the network. I made some decent headway and had an application that could enumerate DirectInput devices and read them.

    Meanwhile, I remembered about beamng.drive. Downloaded it and played around a bit and plugged in my Thrustmaster dual trigger 3-in-1 and what is this? It doesn't work! Many hours were spent trying to come up with a working input map, but it was impossible. But then I said to myself "Hey, beamng.drive is supposed to have decent mod support. Let's take a look at this."
    And off I went and found remotecontroller.lua. And it didn't work. And I fiddled with it a bit more and then a bit more aaaand... I got it to work!

    [Real content starts here]

    I present to you: The beamng remote control.

    If your joystick, gamepad, or wheel is not supported by BeamNG.drive yet... this might just be the ticket!

    x605vD5.png

    This application enumerates all DirectInput devices and lets you select one of them plus three axes to... remote control beamng.drive!

    Caveats
    • This may not work at all if you have a 32-bit OS. Try installing The 32-bit SlimDX runtime from slimdx.org/download.php!
    • BeamNG.drive will open a network socket if you run it with the -luasock commandline parameter, so your Firewall might pipe up. Allow it to listen to connections.
    • All of this is highly experimental.
    • This utility requires you to fudge around in the system lua files for the game.
    • The updater will probably revert the fudging if you run it so beware of that.
    • I have no idea what will happen if BeamNG and my utility fight over control of an input device. So you should probably remove any inputmaps for a device you'd like to use with my utility before trying this.

    Download
    The application is attached.

    Setup
    1. You need to install .Net Framework 4.0
    2. Extract BeamNGRemote.zip
    3. Backup your BeamNG.drive\alpha_prerace\lua\system directory
    4. Copy the lua directory into your BeamNG.drive\alpha_prerace folder so that main.lua and remotecontroller.lua overwrite the files in BeamNG.drive\alpha_prerace\lua\system
    5. Done, you can now run JoystickTool.exe

    Usage
    1. Start BeamNG.drive with the "-luasocket" commandline parameter. (Add this parameter to the shortcut you use to start the game with.)
    2. Load a level.
    3. Start JoystickTool.exe and select a joystick and Axes.
    4. Click "Start".
    5. Actuate the axes on your game input device and see if cool things happen.

    Source Code
    Source code is here: https://github.com/duk3luk3/KSPRemoteTCP - Yes. It says KSP.
    You need the SlimDX development kit from http://slimdx.org/download.php.

    Roadmap
    • Add support for remote hosts
    • Add support for buttons
    • Add input-output curves
     

    Attached Files:

  2. tdev

    tdev
    Expand Collapse
    Developer
    BeamNG Team

    Joined:
    Aug 3, 2012
    Messages:
    3,031
    very nice, i like - good idea and work :)

    Could i suggest to make the lua side working via hooks and it using another filename than the default one?
     
  3. duk3luk3

    duk3luk3
    Expand Collapse

    Joined:
    Aug 7, 2014
    Messages:
    7
    Hey, thanks for dropping by. I have a few questions:
    1) How would I hook lua files?
    2) How can I control the camera? I haven't found a lua file that controls the camera.
    3) Are you going to fix the problem that remotecontroller.lua gets loaded before socket.core is initialised? Because then I won't have to override main.lua...
     
  4. BulletNinja42

    BulletNinja42
    Expand Collapse

    Joined:
    Mar 23, 2014
    Messages:
    18
    I can NOT get this to work.. I'm not the best with software, so maybe I'm doing something wrong, but every time I run the joystick.exe, it just stops running. I'd love to use it though, looks like a really handy tool.
     
  5. duk3luk3

    duk3luk3
    Expand Collapse

    Joined:
    Aug 7, 2014
    Messages:
    7
    Hi, are you on x64 or x86?
     
  6. BulletNinja42

    BulletNinja42
    Expand Collapse

    Joined:
    Mar 23, 2014
    Messages:
    18
    Windows 8.1 x64
     
  7. duk3luk3

    duk3luk3
    Expand Collapse

    Joined:
    Aug 7, 2014
    Messages:
    7
    Hi,

    sadly I can't test on Windows 8(.1).

    Please check that

    1. You have DirectX 9 installed
    2. You have .Net 4.0 installed
    3. You have the SlimDX runtime for .Net 4.0 installed

    That should be everything you need.

    I've attached a debug build. Please run that and see if it produces any error messages!
     

    Attached Files:

  8. BadLuckPro

    BadLuckPro
    Expand Collapse

    Joined:
    Dec 14, 2013
    Messages:
    1
    Hi



    Every time when i hit that start button it gives me this error :D why ?

    http://prntscr.com/4scfax

    And also can you make tutorial like how to set it up :D
    It would be really cool :D
     
    #8 BadLuckPro, Oct 2, 2014
    Last edited: Oct 2, 2014
  9. Flexiny

    Flexiny
    Expand Collapse

    Joined:
    Jan 20, 2013
    Messages:
    22
    It doesn't show any devices connected. I wanted try BeamNG with Acme Monza wheel. :/
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice