New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vehicle Too Heavy for Engines #22118

Closed
Shinino opened this Issue Oct 10, 2017 · 11 comments

Comments

Projects
None yet
7 participants
@Shinino
Contributor

Shinino commented Oct 10, 2017

Game version: 6841 and 6846

Operating system: Windows 10

Tiles or curses: Tiles

Mods active:
Extended Realistic Guns
Makeshift Items Mod
More Survival Tools
Cataclysm++
Beta National Guard Camp
More Locations
Urban Development
Boats
Folding Parts Pack
Vehicle Additions Pack
Extended Buildings
Classes and Scenarios Mod
Disable NPC Needs
Filthy Clothing
Simplified Nutrition
ZSFIXED_C:DDA Extra Professions

Expected behavior

Vehicles should move as expected

Actual behavior

10000 pound vehicle with 2 V8 engines will not move due to 'being too heavy for its engines'. This occurs even after editing to change displacement on V8 engines to 10000 from 650.

Steps to reproduce the behavior

Not sure, I had a Mobile Meth Lab van that I was replacing frame parts (from normal frame to HD frame with HD boards and Military Composite plating) -- somewhere in this process this issue happened.

@Shinino

This comment has been minimized.

Show comment
Hide comment
@Shinino

Shinino Oct 10, 2017

Contributor

Attaching save file:
Woodston.zip

Contributor

Shinino commented Oct 10, 2017

Attaching save file:
Woodston.zip

@ituluwituluwzev

This comment has been minimized.

Show comment
Hide comment
@ituluwituluwzev

ituluwituluwzev Oct 10, 2017

Contributor

Probably related to issue #20039 .

Contributor

ituluwituluwzev commented Oct 10, 2017

Probably related to issue #20039 .

@Shinino

This comment has been minimized.

Show comment
Hide comment
@Shinino

Shinino Oct 10, 2017

Contributor

Commenting on #20039

Contributor

Shinino commented Oct 10, 2017

Commenting on #20039

@DanmakuDan

This comment has been minimized.

Show comment
Hide comment
@DanmakuDan

DanmakuDan Oct 12, 2017

Contributor

When you start the car's engines, the game checks the vehicle cache to see if you are still in a car when your action finishes. The car is not being found in the cache, and the too heavy message is the default response for failing to find the car (no car, no engines). My guess is that when you removed the frame where the initial point of the car was (where the cursor is when you examine a car), the game readjusts the initial point to the corner of the car, but it updated the internal vehicle x/y coordinates incorrectly (flipped x/y?).

Contributor

DanmakuDan commented Oct 12, 2017

When you start the car's engines, the game checks the vehicle cache to see if you are still in a car when your action finishes. The car is not being found in the cache, and the too heavy message is the default response for failing to find the car (no car, no engines). My guess is that when you removed the frame where the initial point of the car was (where the cursor is when you examine a car), the game readjusts the initial point to the corner of the car, but it updated the internal vehicle x/y coordinates incorrectly (flipped x/y?).

@ituluwituluwzev

This comment has been minimized.

Show comment
Hide comment
@ituluwituluwzev

ituluwituluwzev Oct 13, 2017

Contributor

Why does it do that? How can it be fixed?

Contributor

ituluwituluwzev commented Oct 13, 2017

Why does it do that? How can it be fixed?

@DanmakuDan

This comment has been minimized.

Show comment
Hide comment
@DanmakuDan

DanmakuDan Oct 15, 2017

Contributor

There is a specific location on the car that gets checked when you start the engines. Installing a frame at this location would let it start up again.
carbug1
I don't think this specific location on the car gets updated other than from driving.

Contributor

DanmakuDan commented Oct 15, 2017

There is a specific location on the car that gets checked when you start the engines. Installing a frame at this location would let it start up again.
carbug1
I don't think this specific location on the car gets updated other than from driving.

@Coolthulhu

This comment has been minimized.

Show comment
Hide comment
@Coolthulhu

Coolthulhu Oct 15, 2017

Contributor

Driving should not update the location checked. Its position is calculated on unrotated vehicle.

Traction can never drop vehicle acceleration to 0 (currently hardcoded to avoid painful accidents), meaning this message must mean that acceleration() returned <10.
This can happen when:

  • The engine_on is false
  • The vehicle has no non-muscle engine and is to heavy for a muscle engine
  • safe_velocity() returns 0, meaning engines are weaker than alternators
  • The vehicle has 0 wheel_area, meaning no non-broken wheels
  • The product of all the acceleration factors and traction is below 1, which rounds down to 0

Note that the "engines too heavy" message does not happen in any other case. If this message is printed, it implies that floor( acceleration() * traction ) == 0.

Contributor

Coolthulhu commented Oct 15, 2017

Driving should not update the location checked. Its position is calculated on unrotated vehicle.

Traction can never drop vehicle acceleration to 0 (currently hardcoded to avoid painful accidents), meaning this message must mean that acceleration() returned <10.
This can happen when:

  • The engine_on is false
  • The vehicle has no non-muscle engine and is to heavy for a muscle engine
  • safe_velocity() returns 0, meaning engines are weaker than alternators
  • The vehicle has 0 wheel_area, meaning no non-broken wheels
  • The product of all the acceleration factors and traction is below 1, which rounds down to 0

Note that the "engines too heavy" message does not happen in any other case. If this message is printed, it implies that floor( acceleration() * traction ) == 0.

@DanmakuDan

This comment has been minimized.

Show comment
Hide comment
@DanmakuDan

DanmakuDan Oct 15, 2017

Contributor

engine_on is false because activity_handlers::start_engines_finish checks for the presence of the car as specified by the engine start action parameters, but the car has been hollowed out and there is no part at that specific location.

        const tripoint pos = act->placement + g->u.pos();
        veh = g->m.veh_at( pos );
        if( !veh ) { return; }

act->placement is set up in vehicle::start_engines

    g->u.assign_activity( activity_id( "ACT_START_ENGINES" ), start_time );
    g->u.activity.placement = global_pos3() - g->u.pos();
    g->u.activity.values.push_back( take_control );

The placement location is pointing to the red circled location on the image.

Separately, testing with freshly spawned meth_lab vehicles, the act->placement offset is 0,0 for a vehicle facing north, -4,1 for a vehicle facing east, 4,-1 for a vehicle facing west, and -1,-4 for a vehicle facing south. When the player is facing north, the offset matches with the driver seat, but the other cardinal directions are centered on the red circle location of the meth lab. Maybe this means that global_pos3() needs rotation applied to it before generating the act->placement offset.

I think you can demonstrate another instance of this bug by having a vehicle face north, removing the parts in the center of the vehicle, and then driving it and turning it away from north and turning it off. The vehicle will probably fail to start.

Contributor

DanmakuDan commented Oct 15, 2017

engine_on is false because activity_handlers::start_engines_finish checks for the presence of the car as specified by the engine start action parameters, but the car has been hollowed out and there is no part at that specific location.

        const tripoint pos = act->placement + g->u.pos();
        veh = g->m.veh_at( pos );
        if( !veh ) { return; }

act->placement is set up in vehicle::start_engines

    g->u.assign_activity( activity_id( "ACT_START_ENGINES" ), start_time );
    g->u.activity.placement = global_pos3() - g->u.pos();
    g->u.activity.values.push_back( take_control );

The placement location is pointing to the red circled location on the image.

Separately, testing with freshly spawned meth_lab vehicles, the act->placement offset is 0,0 for a vehicle facing north, -4,1 for a vehicle facing east, 4,-1 for a vehicle facing west, and -1,-4 for a vehicle facing south. When the player is facing north, the offset matches with the driver seat, but the other cardinal directions are centered on the red circle location of the meth lab. Maybe this means that global_pos3() needs rotation applied to it before generating the act->placement offset.

I think you can demonstrate another instance of this bug by having a vehicle face north, removing the parts in the center of the vehicle, and then driving it and turning it away from north and turning it off. The vehicle will probably fail to start.

@Night-Pryanik Night-Pryanik added the <Bug> label Oct 15, 2017

@BevapDin

This comment has been minimized.

Show comment
Hide comment
@BevapDin

BevapDin Oct 21, 2017

Contributor

vehicle::global_pos3 only returns an arbitrary point that acts as origin for the mount points of the vehicle parts. In other words: the location of the vehicle parts is stored as relative to the "origin" of the vehicle (and that origin is returned). If there is no vehicle part mounted at (0,0) - which is possible when you remove those parts - global_pos3 will return a point that does not contain the given vehicle.

IMHO, one solution would be to store the global position of an engine part in the activity instead. This would ensure the placement always refers to an existing part of the vehicle.

Contributor

BevapDin commented Oct 21, 2017

vehicle::global_pos3 only returns an arbitrary point that acts as origin for the mount points of the vehicle parts. In other words: the location of the vehicle parts is stored as relative to the "origin" of the vehicle (and that origin is returned). If there is no vehicle part mounted at (0,0) - which is possible when you remove those parts - global_pos3 will return a point that does not contain the given vehicle.

IMHO, one solution would be to store the global position of an engine part in the activity instead. This would ensure the placement always refers to an existing part of the vehicle.

@AMurkin

This comment has been minimized.

Show comment
Hide comment
@AMurkin

AMurkin Oct 21, 2017

Contributor

@BevapDin What about vehicle::shift_if_needed() function?

Contributor

AMurkin commented Oct 21, 2017

@BevapDin What about vehicle::shift_if_needed() function?

@BevapDin

This comment has been minimized.

Show comment
Hide comment
@BevapDin

BevapDin Oct 21, 2017

Contributor

What about vehicle::shift_if_needed() function?

The whole vehicle position/part index/cache etc. system used to be fragile and caused some bugs. I'd be careful and I'm not up to date with the vehicle code, so I won't touch it, but you can try it.

Contributor

BevapDin commented Oct 21, 2017

What about vehicle::shift_if_needed() function?

The whole vehicle position/part index/cache etc. system used to be fragile and caused some bugs. I'd be careful and I'm not up to date with the vehicle code, so I won't touch it, but you can try it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment