sirkut / InfernalRobotics

Update to r4m0n Dammed Robotics that works on Kerbal Space Program 0.20.2
Other
17 stars 16 forks source link

added EC consumption #25

Closed markushaslinger closed 9 years ago

markushaslinger commented 9 years ago

This is the expected behavior: I added a KSPField (float) ElectricChargeRequired which defaults to 2.5 (more than a light bulb but much less than an electrolysis of water). If only 1 servo is in a group it consumes the timewarp fraction of that every fixedUpdate. If there is not enough EC it first starts to slow down its movement speed (linear). If there is less than 10% of the required amount it still plays the sound and consumes EC but can’t overcome the friction and don’t move (via a speed of 0 to break as few things as possible). If there are multiple servos per group I considered it strange if only some of them move because they were processed earlier when some EC was still available. So I built the whole system on the basis of servo-groups who all move with the same speed reduction applied or don’t move at all (at least they don’t move together). Additionally I added a power consumption display in the action menu and a total amount for each group in the group edit window to allow for easier planning.

Sirkut: I changed/added more than I had planned. If you don’t like something feel free to remove/change. I tried to stick with your style conventions and also did not reformat the file (since my ReSharper is set to a very aggressive refactoring), hope it's understandable.

sirkut commented 9 years ago

I'm fine with the features but can you add a setting in the config file I now have for window positions to ignore the charge feature? I never didnt add charge to IR immediately because I didn't want to nerf gameplay for me. :) a flag like noChargeUse.

Shawn

On Aug 31, 2014, at 1:31 PM, Markus notifications@github.com wrote:

This is the expected behavior: I added a KSPField (float) ElectricChargeRequired which defaults to 2.5 (more than a light bulb but much less than an electrolysis of water). If only 1 servo is in a group it consumes the timewarp fraction of that every fixedUpdate. If there is not enough EC it first starts to slow down its movement speed (linear). If there is less than 10% of the required amount it still plays the sound and consumes EC but can’t overcome the friction and don’t move (via a speed of 0 to break as few things as possible). If there are multiple servos per group I considered it strange if only some of them move because they were processed earlier when some EC was still available. So I built the whole system on the basis of servo-groups who all move with the same speed reduction applied or don’t move at all (at least they don’t move together). Additionally I added a power consumption display in the action menu and a total amount for each group in the group edit window to allow for easier planning.

Sirkut: I changed/added more than I had planned. If you don’t like something feel free to remove/change. I tried to stick with your style conventions and also did not reformat the file (since my ReSharper is set

to a very aggressive refactoring), hope it's understandable.

You can merge this Pull Request by running

git pull https://github.com/marce155/InfernalRobotics master

Or view, comment on, or merge it at:

https://github.com/sirkut/InfernalRobotics/pull/25 Commit Summary

File Changes

Patch Links:

— Reply to this email directly or view it on GitHub https://github.com/sirkut/InfernalRobotics/pull/25.

markushaslinger commented 9 years ago

Sure, I'll give it a shot.

ZodiusInfuser commented 9 years ago

This sounds good. I like the fact that the motors slow down rather than immediately stop as power runs out. Matches the real behaviour of motors fairly well.

In my opinion EC should be a values specified in the CFG, as it should really change with TweakScale. This negates the need for having a separate flag, since zero of a missing field can be used for that. There's some parts such as the uncontrolled ones that should never consume EC, for example.

Also, I assume EC is only consumed when a movement is actually initiated rather than whilst the parts are active? I imagine all IR parts making use of worm gear mechanisms, removing the need for them to apply power to maintain a position.

markushaslinger commented 9 years ago

There is a field defined to set the usage per part in the cfg, yes. This field just defaults to 2.5 if not present since I did not change the part config files and it avoids breaking if the field is missing. However, the additional config flag is quite useful because it hides all EC display as well - it's done anyway already :) And yes, they only consume EC when moving, otherwise they show "offline". If there is not enough power they show "low power!". I hope it's easy to use and understand UX wise.

sirkut commented 9 years ago

If you want to send Zodius a version to test I do not mind. I'm not able to look at the code currently.

Shawn

On Aug 31, 2014, at 3:35 PM, Markus notifications@github.com wrote:

There is a field defined to set the usage per part in the cfg, yes. This field just defaults to 2.5 if not present since I did not change the part config files and it avoids breaking if the field is missing. However, the additional config flag is quite useful because it hides all EC display as well - it's done anyway already :) And yes, they only consume EC when moving, otherwise they show "offline" [xx replaced by the max consumption]. If there is not enough power they show "low power!". I hope it's easy to use and understand UX wise.

— Reply to this email directly or view it on GitHub https://github.com/sirkut/InfernalRobotics/pull/25#issuecomment-53998809.

markushaslinger commented 9 years ago

Fixed a floating point issue and took a few screenshots.

sirkut commented 9 years ago

I pulled the code but screwed up on the pull. Going to close it.