Jump to content

[0.20] HydroTech Mouse Drive v0.2 (2013.06.03)


Michael Kim

Recommended Posts

  • 3 weeks later...

Hi guys!

I've finally figured out how to get to mediafire and I've uploaded the new version there. (Please go to #1 to download)

I've been making some major changes to my codes since I'm now developing two mods (this is the second one), so sorry for the delay.

Enjoy :)

Link to comment
Share on other sites

Wait, if it's toggled by a click that'll cause conflicts with mods like Mechjeb and Lazor System that have menus. Is there a way to change the button in a .cfg?

Could you please be more specific with that? Don't get you

Link to comment
Share on other sites

As in, you need to click when using a menu. Would that clicking toggle modes? If so, say I toggle Mouse Drive off so that when moving my mouse over a menu I don't start turning, and then when I click a button on the menu, would it turn mouse drive back on and have me turn wildly when I don't want to?

Link to comment
Share on other sites

Why this scenario thing? No other mod needs it, and I think neither does this one really - especially with the new KSPAddon stuff. In fact just yesterday I got the previous version loading via KSPAddon.

Edit: And after a simple merge, this is the necessary change for the latest version: http://filebin.ca/jJWoJJhniXT/noscenario.zip

Edited by a.g.
Link to comment
Share on other sites

As in, you need to click when using a menu. Would that clicking toggle modes? If so, say I toggle Mouse Drive off so that when moving my mouse over a menu I don't start turning, and then when I click a button on the menu, would it turn mouse drive back on and have me turn wildly when I don't want to?

You can keep the Mouse Drive window away from other windows

Link to comment
Share on other sites

Why this scenario thing? No other mod needs it, and I think neither does this one really - especially with the new KSPAddon stuff. In fact just yesterday I got the previous version loading via KSPAddon.

Edit: And after a simple merge, this is the necessary change for the latest version: http://filebin.ca/jJWoJJhniXT/noscenario.zip

Well, KSPAddon is new to me. Got to try it out.

Your claim that no other mods use it is kinda not true, as they (as far as I know) use either a ghost part (KerbalAlarmClock) or a testing unit (DeadlyReentry), and I decided on a ScenarioModule because I like neither way.

However, what I do like about ScenarioModule is that the player can choose whether to add it, so it doesn't go into places like tutorials if not wanted. I guess I'll just keep it a scenario module, and I plan to make an external exe to help the player add it to save files.

Link to comment
Share on other sites

Well, KSPAddon is new to me. Got to try it out.

However, what I do like about ScenarioModule is that the player can choose whether to add it, so it doesn't go into places like tutorials if not wanted.

I think it is something of a solution in search of a problem. What you get as a result is a mod that despite being a purely ui thing that should be freely addable and removable by copying a directory (like subassembly loader or dynamic warp) requires modifications to the persistent save-game state. It's not like it is an autopilot or something anyway, it's just a joystick replacement using the mouse for fine control. :wink:

I think the dummy part based load mode doesn't work any more in 0.20, since parts are loaded only when needed - I had to switch dynamic warp to the unit test trick for it to work (didn't understand KSPAddon well enough at that time). So now it's only legacy unit test trick, or KSPAddon, which I think should be actually quite close to how scenario modules work, except that it is declared in code instead of the savefile.

Link to comment
Share on other sites

I think it is something of a solution in search of a problem. What you get as a result is a mod that despite being a purely ui thing that should be freely addable and removable by copying a directory (like subassembly loader or dynamic warp) requires modifications to the persistent save-game state. It's not like it is an autopilot or something anyway, it's just a joystick replacement using the mouse for fine control. :wink:

I actually think it's good to let the user choose which save file they want the mod functioning. And making modifications to a save file (on the level that this mod requires) isn't hard at all, not to mention that I will make it even easier in the future.

Anyway, this is how I like it, and since you know how to code stuff, you can always modify it for your own use

Link to comment
Share on other sites

Note that your code also assumes that there is only one vessel controlled, and it never changes. I bet it breaks when you switch with [ and ], and my patch fixes it. It is independent from how it loads, except that with KSPAddon it seems that there isn't any 'controlled' vessel at all when it is instantiated, so a change was necessary anyway.

Link to comment
Share on other sites

Its a good idea.....

Seems kinda odd to me to have to edit save file in order to use it....that's gonna turn some people off right there (some people may be uncomfortable or unsure of how to do this....sure its a simple change to you, but it may not seem so to someone not accustomed to such things)

That aside its a good mod if ya don't have a controller/joystick. If ya have one of those honestly don't bother....a cheap off-brand $30 joystick from wall-mart outperforms the mouse control by leaps and bounds....a 360 controller is even better!

Link to comment
Share on other sites

I tried, and indeed, it doesn't work without the fixes: after a vessel switch the indicators in the left bottom corner move, but there is no effect on the current ship at all. Presumably the ship will respond if and only if the update happens within its own OnFlyByWire.

Also, I just noticed that mouse control completely dies with trim set, which makes it largely useless for manual control of planes.

Another minor bug: on linux (and presumably osx), the settings end up in a file literally called "\GameData\HydroTech\PluginData\mousecontrol\settings.cfg" - no directory separators implied.

Link to comment
Share on other sites

Hmm, any chance you could maybe do another mod along a similar lines?

Have you heard of head tracking? ie TrackIR or FacetrackNoIR?

Yes, with these products you can do mouse emulation to look around, but for example my TrackIR is 6DoF - so being able to look, lean, zoom etc all by moving my head would be cool.

Link to comment
Share on other sites

a.g.,

Alright, thanks for the bug report. This mod largely what it is when it came out (I spent 8 hours on that) so yeah, I didn't think of that.

And another thing - at first I didn't intend to use OnFlyByWire, as you can see I wrote

xControl.SetFlightCtrl(FlightGlobals.ActiveVessel.ctrlState, xValue);

In fact, that was writen in Update(). But weirdly, sometimes the vessel didn't respond and I couldn't figure out why. Same for FixedUpdate(). And sometimes neither of them responded. So I had to go for OnFlyByWire, where without much thinking I put it into Awake().

About the Linux thing - I can't really do anything because I'm not using Linux. In Windows, the directory (i.e. ...\mousecontrol\) needs to exist. When loading, if the file doesn't exist, it gives out an ingame warning which won't affect the gameplay. And then after it is saved, the problem is gone. So it happens only for the first time.

I'm not sure if it is the same on Linux, but since it tells you "no directory seperators implied" (I don't know what it means; Windows must have used different terms), it could be that the directory doesn't exist

Link to comment
Share on other sites

Hmm, any chance you could maybe do another mod along a similar lines?

Have you heard of head tracking? ie TrackIR or FacetrackNoIR?

Yes, with these products you can do mouse emulation to look around, but for example my TrackIR is 6DoF - so being able to look, lean, zoom etc all by moving my head would be cool.

Sorry evilC, I'm not sure if the game or Unity support that kind of device. At least I can't find it. I believe there are alternative ways to do it, like getting input directly from USB port, but that's certaily too much for me.

You can go to Addon Request (exactly where I picked up the idea for this mod) to post your idea and see if anyone's interested. Also, if most plugin coders tell you that this is not do-able, you may consider making a suggestion and perhaps sqaud will make it in the future :)

Link to comment
Share on other sites

I'm not sure if it is the same on Linux, but since it tells you "no directory seperators implied" (I don't know what it means; Windows must have used different terms), it could be that the directory doesn't exist

That's not an error, that's me telling that it ends up as a big file name with backslashes and stuff, put into the root of ksp dir. To fix this, don't use backslashes, since forward slashes actually work everywhere, even on windows. Or there should be some get separator function somewhere.

Edit: I've been tinkering with the source further, so here are a number of changes I think are useful: http://filebin.ca/jTUvpJogaBJ/tweaks1.zip

* Fix the [ and ] switch support.

* Use KSPAddon :P (this and the above are unchanged from my previous file)

* Instead of replacing the control value when active, add to the current value and clamp to -1...1 so that trim works (auto-stabilizers in e.g. FAR work basically like this).

* Install the fly-by-wire callback first in the list, so that it runs before other handlers like the above mentioned auto-pilots; this makes them see the control values as user input and properly switch off. This bit is tricky, because I found a bug in mono that breaks the most simple way to do this.

* Add support for the rover steering and throttle controls.

* When the caps lock mode is activated, multiply produced control input by 0.4 to allow more fine-tuned control.

Edited by a.g.
Link to comment
Share on other sites

Sorry evilC, I'm not sure if the game or Unity support that kind of device. At least I can't find it. I believe there are alternative ways to do it, like getting input directly from USB port, but that's certaily too much for me.

You can go to Addon Request (exactly where I picked up the idea for this mod) to post your idea and see if anyone's interested. Also, if most plugin coders tell you that this is not do-able, you may consider making a suggestion and perhaps sqaud will make it in the future :)

Head tracking is just a DLL. You drop in the DLL and call it just like you would the unity or ksp libs.

Link to comment
Share on other sites

a.g.,

Well thanks. But I don't think I need you to teach me how to code, and I don't think this is the proper place to discuss my code.

I'm not sure if you are enthusiastic about what you are doing, and I don't want to be unfriendly, but it is really ruining my own joy of coding.

So bug reports and feature requests ONLY please - in the development thread, not here.

Also I request you to remove those links. Again, you can make modifications for your own use, but don't make it public.

Link to comment
Share on other sites

I'm just very impatient when the choice is to either make a bug report and wait potentially days or weeks for a fix, or fixing it myself in an hour. :wink: After that attaching a patch to a bug report just saves time and misunderstanding of what is meant - and you can consider all the points above as bug reports, because without the fixes the tool can't actually be used effectively (or at all without some fixes) for planes or rovers. The only reason I included the .cs files is that windows users often don't even know what a patch file is, or what to do with it. You are free to ignore the patches of course, so long as the end result addresses the actual issues. Since now it seems to work satisfactorily, I don't plan to do any more changes.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...