Marciel032 / FarmingSimulatorTelemetry

MIT License
27 stars 5 forks source link

Motor Temperature stuck at 20 when you play as a client #18

Open coolfarmer opened 2 years ago

coolfarmer commented 2 years ago

Hello Marciel!

I'm creating this thread to discuss a problem with you. I just noticed that the telemetry of the Motor Temperature is stuck at 20 when you are playing the game as a client. If you play as the Host, the telemetry details are good, the value moves up and down.

But as a client, the value is stuck at 20. It's pretty weird behavior, maybe I'll post too on Giants Forum to see if I can get more info.

Marciel032 commented 2 years ago

Hello guy!

Interesting... Not really tested in multiplayer. As soon as I have some time I can check if the same happens to me.

Another thing I noticed about the engine temperature, is when you turn off the engine, the temperature should go down little by little, but it gets frozen at the last value.

Edit:

I finded in the class "Motorized" the start value of motorTemperature table:

spec.motorTemperature = { value = 20, valueSend = 20, valueMax = 120, valueMin = 20, heatingPerMS = 0.0015, coolingByWindPerMS = 0.001 }

it's start ever in value 20.

And the method "updateMotorTemperature" only is called when variable "isServer" is equals to true.

So, when you play as client, the value never change.

How to get the correct temperature? I dont no, but the cause of this inssue is this.

coolfarmer commented 2 years ago

Nice find! I just read your answer on Giants Forum. What do you think about building a report on Feedback Giants? https://feedback.giants-software.com

I'm sure it's the same reason for the fuel consumption. The method that updates the fuel cons. must be hidden behind "isServer".

Marciel032 commented 2 years ago

Yes, I will report this, maybe we have some luck!

I have a question for you...

1 - Do you find de Fuel consumption in the script or you calculate it? I will like do it in my code too.

coolfarmer commented 2 years ago

The fuel consumption does the same as the motor temperature because I'm currently using SimDashboard. That application has the same problem with these values. I don't know for now how SimDashboard calculates the fuel usage, but maybe you can find the information in Motorized:loadConsumerConfiguration. Look at the line where consumer.usage is defined. (maybe Motorized:updateConsumers too)

coolfarmer commented 2 years ago

I just found the same problem for fuel consumption:

if self.isServer then
    self:updateConsumers(dt, accInput)

    -- update motor properties on damage change to update the torque reduction
    local damage = self:getVehicleDamage()
    if math.abs(damage - spec.lastVehicleDamage) > 0.05 then
        self:updateMotorProperties()
        spec.lastVehicleDamage = self:getVehicleDamage()
    end
end

I don't know why this is in self.isServer ... self:updateConsumers should be use for clients and server...

EDIT: I just saw in Motorized this portion of code:

-- client receives this information from server
    if self.isServer then
        spec.actualLoadPercentage = spec.motor.rawLoadPercentage
    end

So maybe the server has total control of specific values like motor temperature and fuel consumption, and sent it to each clients through network.

Marciel032 commented 2 years ago

OK, I understand.

Maybe we can read the values that ther server send to the client, if it happens. But it will be hard to do, i think.

coolfarmer commented 2 years ago

I can understand for fuel consumption, but for water temperature, not really. Water Temp. is useless in the game, so I don't understand why they want to send it over the network.

RPM is much more important than Water Temp, and it is not sent over the network. I hope devs will give you some details in the bug report...

Marciel032 commented 2 years ago

You are sure!

They still haven't answered me. Probably next week we will have some answer.

marcelomanzo commented 2 years ago

what does the getRotation(vehicle.rootNode) returns? a quarternion?

LOWEL97 commented 2 years ago

I can understand for fuel consumption, but for water temperature, not really. Water Temp. is useless in the game, so I don't understand why they want to send it over the network.

RPM is much more important than Water Temp, and it is not sent over the network. I hope devs will give you some details in the bug report...

IMO it's just to increase immersion