JakobTischler / MoreRealisticDLCs

A lua/xml project that adds MoreRealistic to the Farming Simulator DLCs
8 stars 0 forks source link

Script adaptions needed #10

Closed JakobTischler closed 10 years ago

JakobTischler commented 10 years ago

This will basically be a TODO list for certain vehicles where we need some extra script stuff. Will be updated.

quadural commented 10 years ago

power consumption base on chopper state is already taken into base "mr engine". Use the "self.chopperActivated" variable of the default game engine. We will see when I start converting on of the axial flow.

JakobTischler commented 10 years ago

@quadural: can I simply use realWorkingPowerConsumption with the combines, or do they need a different variable?

quadural commented 10 years ago

@JakobTischler : I don't get what you are trying to do => "different power based on chopper state" ? or exhaust / flap ?

regarding the "chopper state", it seems to work "naturally" as with the base game "mr" combine. (when I engage the chopper, the power consumption is raised, even for wheat)

JakobTischler commented 10 years ago

I don't get what you are trying to do => "different power based on chopper state" ? or exhaust / flap ?

In this case I was talking about the chopper state. But if what you say is correct, then apparently we don't need a script for that at all :).

quadural commented 10 years ago

i checked it, and it is fine as far as i am concerned

JakobTischler commented 10 years ago

Concerning the exhaust amount: I think the easiest to handle this is to just set the self.motor.lastMotorRpm variable and let the default scripts handle the rest:

-- load():
self.exhaustParticleSystems.maxRpm = 1;

-- update()
self.motor.lastMotorRpm = RealisticUtils.linearFx(self.realLastMotorFx^0.5, 0.1, 1);

Would there be any problems with MR if self.motor.lastMotorRpm actually existed?

quadural commented 10 years ago

I don't think this is a problem for the "mr engine". The exhaust and the flap should depends on the engine load. (IRL, exhaust would depend on the engine rpm and load, but we only have "on" variable in our case) And so, we can adjust the "lastMotorRpm" using the "self.realSoundMotorFx" parameter (available client side) => self.motor.lastMotorRpm = Utils.clamp(self.realSoundMotorFx, 0.1, 1);

JakobTischler commented 10 years ago

I'm a bit confused about the three different variables, all of which are viable lerp variables for the motor load in my opinion:

Could you maybe explain what the exact difference between all those is? I even see in mrDynamicExhaustingSystem.lua (which I'm gonna use for the Ursus tractors) that you use realSoundMotorFx for the cap, but realMotorLoadS for the exhaust system.

quadural commented 10 years ago

only the "self.realSoundMotorFx" is available "client side". ("how much" of the engine sound we want to play => take into account the cuurent engine load and vehicle speed)

JakobTischler commented 10 years ago

Hm, didn't even see your reply until now. So does that mean that realSoundMotorFx is based on realMotorLoadS? And also, that I should use realSoundMotorFx on all occasions?

quadural commented 10 years ago

on server side, you can use the "motorLoad" on client side, you can't, and so, you have to rely on the "realSoundMotorFx"

little example of the "getrpm" script for the JD S650 combine : (headache ?)

--DURAL : mr value
            --local lastRpm = math.max(0, self.motor.lastMotorRpm); 
            local lastRpm = 850;
            if self.realManualGearSet then
                lastRpm = RealisticUtils.linearFx(self.realSoundEngineRevFx, 850, 2300);
            else                
                local engineRpmFx = 0.9*self.realSoundMotorFx;
                if self.realSoundSpdFx>1.05 then
                    --engine braking power => high rpm
                    engineRpmFx = math.max(engineRpmFx, self.realSoundSpdFx);
                elseif self.realSoundMotorFx>1.1 then
                    --engine braking power => high rpm
                    engineRpmFx = math.max(engineRpmFx, 0.2*self.realSoundSpdFx + self.realSoundMotorFx);
                end;            
                lastRpm = RealisticUtils.linearFx(engineRpmFx, 850, 2100);
            end;

Exemple of a "get smoke alpha" script :

-- alpha function of engine load on moreRealistic vehicles
            local alpha = 1;

            if self.realManualGearSet then
                alpha = (self.exhaustingSystem.maxAlpha-self.exhaustingSystem.minAlpha) * math.max(0, self.realSoundMotorFx - self.realSoundEngineRevFx^2)+self.exhaustingSystem.minAlpha;              
            elseif self.isServer then               
                alpha = ((self.exhaustingSystem.maxAlpha-self.exhaustingSystem.minAlpha) * self.realMotorLoadS)+self.exhaustingSystem.minAlpha;                     
            else -- client side, default CVT gearbox
                alpha = ((self.exhaustingSystem.maxAlpha-self.exhaustingSystem.minAlpha) * self.realSoundMotorFx)+self.exhaustingSystem.minAlpha;
            end;
JakobTischler commented 10 years ago

Concerning all the extra specs, do they need any MP adaptation? Like, for example, a broadcast for realCurrentPowerConsumption ?

quadural commented 10 years ago

"realCurrentPowerConsumption" is a server side variable. no need to broadcast it since this variable is not set (or used) client side.

JakobTischler commented 10 years ago

Since, as I mentioned, I have almost no clue concerning MP, I'll ask about the other specs.

quadural commented 10 years ago
  1. no event needed => bale filllevel only used serverside
  2. no event needed, spray usage = only server side
  3. "realSoundMotorFx" is already a "client side" variable. But the "realMotorLoadS" should not be streamed continously like that. That means even if you are not using a tractor with this spec, it uses network bandwith for nothing. I will look at that.
quadural commented 10 years ago

Change uploaded, but it needs mp testing to be validated