GithubHelp home page GithubHelp logo

mkaito / se-analogthrottleplugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wolfe-labs/se-analogthrottleplugin

0.0 1.0 0.0 458 KB

๐Ÿ•น๏ธ Plugin for Space Engineers that enables you to pipe your controller's analog (and digital) inputs into in-game script actions

C# 100.00%

se-analogthrottleplugin's Introduction

AnalogThrottle Plugin for Space Engineers

๐Ÿ•น๏ธ Plugin for Space Engineers that enables you to pipe your controller's analog (and digital) inputs into in-game script actions

Note: this is still a work in progress and possibly may change later, specially regarding the format data is passed down to scripts. Make sure to keep updated to prevent script bugs/crashes!

Usage

This plugin does not provide any hooks into the game's movement system and is quite useless on its own, as it is intended to work instead with Programmable Blocks.

The idea behind that decision is both simplicity and the goal of providing ship builders extra flexibility on controlling their builds, like using the analog axis to control cranes, pistons, rotors, etc.

Please check the Scripting API for more details.

Make sure your Programmable Block has the tag [AnalogThrottle] on it, otherwise the plugin will not trigger it

Does it work on multiplayer? Does it require anything installed on the server?

The plugin is compatible with multiplayer and doesn't require anything installed on the server, with the only requirement being that the server allows you to create and use Programmable Blocks and scripts.

Any processing regarding the raw input of your controllers is done client-side and converted to a common format that is then read by the script on the Programmable Block, which is running on the server. Read more below for a detailed view on how it works.

Note: In non-local sessions (aka multiplayer) the plugin will automatically throttle the amount of updates sent to the server to around a third of the normal amount, so it doesn't overuse bandwidth or cause lag due to Programmable Block processing.

How it works

Being a plugin instead of a mod or script, it has way more access to things outside of what the game engine exposes and also allows for usage anywhere, since it's only client-side.

In the inner workings, the plugin uses SharpDX, a wrapper for DirectX, to access DirectInput's devices, which includes your controller, be it a gamepad, joystick or HOTAS. All available devices are connected at beginning of a game session and updated in sync with the game engine's ticks, so we don't overload the game with requests or anything.

After new controller data is fetched, it is compared with the previous state and only the changes are then combined and sent to the Programmable Block. This ensures fewer calls to the script and potentially less performance issues.

Script Development

To keep things as compatible and in sync as possible between the Plugin and Scripts, both use the same Scripting API. That API contains any shared classes along with methods to serialize and deserialize data.

The shared API is present on the AnalogThrottleScriptingAPI directory of this project, along with instructions on how to use it on your scripts.

se-analogthrottleplugin's People

Contributors

matpratta avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.