Skip to content
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

[WIP] Vehicle Overhaul Part 1a #23560

Closed
wants to merge 22 commits into from

Conversation

Projects
None yet
8 participants
@Isaacssv552
Copy link
Contributor

commented Apr 21, 2018

Vehicles are currently a bit of a hot mess. There is precious little room for JSON customization and many of the hardcoded formulas are arbitrary, nonsensical, or both. Balance is sketchy at best, with V12 bicycles gaining a measure of notoriety. Despite these flaws, vehicles are immensely popular. Seemingly everyone not deliberating looking for a challenge attempts to build a Deathmobile.

Previous attempts to resolve these flaws have encountered a number of problems. Complex and obaque rpm and gearing restrictions proved an inadequate solution to overinflated maximum velocities. In addition, many features such as collisions and multiple engines were removed or broken. These difficulties are non-trivial and must be given due considered lest future projects rediscover them independently.

That said, I believe I can make some progress on the vehicle problem. I've already made good progress on part 1a and I have made an effort to separate features into discrete sections in hopes of controlling PR size. That said, this is very much still WIP. In particular, I need to decrease the size of this PR and tune parameters to avoid disrupting balance. My goal is not to rebalance vehicles but to improve the infrastructure upon which a good rebalancing might be built.

Current PR (1a) Progress:

  • Improved combustion formula with JSON engine customizability.
  • Improved rolling resistance and sinkage formula with JSON wheel and terrain customizability.
  • Improved traction formula with JSON wheel customizability.
  • Basic aerodynamics formula as placeholder.
  • Improved acceleration formula taking into account drag, rolling resistance, and maximum tractive force.
  • Write balance/regression tests to evaluate new mechanics.
    • Ensure reasonable fuel usage.
    • Ensure reasonable engine power.
    • Ensure reasonable acceleration.
    • Ensure reasonable maximum/safe velocity.
    • Ensure reasonable traction.
    • Ensure reasonable rolling resistance.
    • Ensure reasonable drag.
    • Ensure reasonable collisions.
  • Resolve bugs resulting from partial integration of floating point velocity.
    • Collisions.
    • Displayed Velocity.
    • Cruise Control.
    • Low Speed Driving
  • Keep PR below 500 lines of code.
  • Test player vehicles for consistent performance before/after PR. (Minor change is acceptable, but major changes to usability should be avoided. e.g. Max speed of 1000/500tpt is functionally identical but safe speed of 20/10tpt is significant.)

Part 1: Dynamics and Combustion Engines

Combustion engines have very little JSON customizability and 'just work' via a mass of haphazard formulas. Simply improving the absolute basics of the system will have huge benefits. For instance, traction provides a means to limit the utility of large engines on small vehicles while drag can be tuned to prevent excessive maximum velocities.

Part 1a:

Terrain based traction and rolling resistance. Placeholder drag. Improved engine power and acceleration formulas. Physics based formulas where practical. JSON specification of Engine efficiency, Wheel traction and rolling resistance, and Terrain sinkage.

Part 1b:

Improvements which can be independently developed from the base established by 1a.

Part 1b-I:

Improved collisions. (#23000, #20017, #23578)

Part 1b-II

Improved drag.

Part 1b-III

Decibel based noise system. (Lower noise for higher cylinder count.)

Part 1b-IV

Improved smoke system.

Part 1b-V

Improved handling system.

Part 1c:

Improved readability and styling of vehicle.cpp.

Part 1d:

Part 1d-I

#23123

Part 1d-II

#20520

Part 2: Reactors, Electrical Engines, etc.

Reactors, electrical engines, and other devices will need an overhaul to maintain consistency with changes introduced in Part 1. In addition, there are a number of unresolved issues with the current systems. (#21874, #21964, #22191, #22077, #21215, #20321)

Part 3: Multitile Vehicle Parts

The ability for a single part to use multiple tiles would be useful for both current and future parts. It would allows treads to behave as expected. It would also be useful for Part 4. Multitile functionality would allow improvement of the flotation system and simplify the creation of a watertightness system.

I also intend to model armour and distance between the vehicle and the ground. This will resolve certain flaws discussed in #22025, #20847 and improve collision modeling. In particular, it will greatly improve modeling of a vehicle's ability to traverse very rough terrain. e.g. A pickup a quarter meter off the ground would be able to cross rocky terrain while a sports car 0.05 meters off the ground would become stuck.

Part 4: Boats

The vehicle code is littered with todos regarding a unified vehicle framework allowing for amphibious vehicles. Such a framework would be premature at this time; land vehicles barely have a unified framework themselves. However, it would make an excellent future goal.

Part 5: Turrets

Turrets may be seriously broken (#22541, #22512). I haven't look into turrets yet, but if I finish the previous parts it would be worthwhile to make sure turrets aren't broken in some non-obvious way.

Part 6: Modular Vehicle Parts

Allowing more flexibility in part scavenging, creation, and installation would be cool. Engines could have improved control systems attached, kitchens could have waffle irons installed, etc. However, this may not fit design goals and the previous 4 parts will provide many more options for it to utilize. It would be nice to have, but is far behind everything else in priority.

Part Null: What won't be included.

I do not intend to make JSON edits or add new content except as necessary to support code changes. Similarly, I won't be tweaking the vehicle menu except as necessary to maintain current functionality.

@illi-kun

This comment has been minimized.

Copy link
Member

commented Apr 21, 2018

Just a friendly reminder: please keep your PRs as small as possible. Of course, each PR should implement working changes, but doing a single huge PR with a lot of changes is incorrect.

@Isaacssv552

This comment has been minimized.

Copy link
Contributor Author

commented Apr 21, 2018

@illikun this is only for 1a. It’s still a bit large so I’ll be trying to pare back the changes to a minimum.

The part list is just there to provoke discussion and make it easier for reviewers to determine if I’m in danger of putting too much into a single PR.

@AMurkin

This comment has been minimized.

Copy link
Contributor

commented Apr 21, 2018

Shell scripts probably shoud go separately from vehicle overhaul PR.

Isaacssv552 added some commits Apr 21, 2018

...
@Isaacssv552

This comment has been minimized.

Copy link
Contributor Author

commented Apr 21, 2018

@AMurkin They've been moved to another pr.

@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor

commented Apr 21, 2018

I've updated markup a little. Couldn't look into unformatted text.

@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor

commented Apr 21, 2018

I suggest putting out any drastic vehicle changes post 0.D.

@Isaacssv552

This comment has been minimized.

Copy link
Contributor Author

commented Apr 23, 2018

The lines of code I've needed to write to make this work properly has rapidly grown out of control, so I'll probably have to split off as many subcomponents as possible into new PRs.

Isaacssv552 added some commits Apr 23, 2018

@kevingranade

This comment has been minimized.

Copy link
Member

commented Apr 24, 2018

The only places to split this I can see with a brief read:
Split off some of the unit changes.
Split initial drag equations and traction additions.
Split changes to tests (other than values being asserted) into another PR.

Context for the request to split, sometimes you can only make things so small. If splitting your code further is harder than writing it in the first place, yea call it quits and we'll deal with a big PR. That doesn't change the fact that reviewing will be slow, which is frustrating for everyone.
Almost as good as small PRs is good comments, explain what the tricky functions are doing and it makes reviewing a lot faster.

Direct feedback:
Please cite some sources so we can look at the formulas yore basing this on (In comments). I'm not good enough with physics to review the raw formulas without some help, and if you wait for me to find your sources we'll be here a looking time :)

Isaacssv552 added some commits Apr 24, 2018

@Isaacssv552 Isaacssv552 referenced this pull request Apr 24, 2018

Closed

[CR] Floating point velocity and new properties. #23602

5 of 5 tasks complete
@tyrael93

This comment has been minimized.

Copy link

commented May 6, 2018

Hey can you fix the ancient "zombies quantum tunneling through vehicles" bug while you're at it
like when a car is like this
__
|o|
|o|
|o|
__
zombies don't have a chance to enter
but when you turn ever so slightly and have only one layer of frames it turns into
__
\o/(it was supposed to be a \ but the comment won't let me post it for some formatting reason)
\o/
\o/
__
and zombies can go through the \s and eat your face and pull you from your seat unless you double-layer for some reason

@Epictyphlosion

This comment has been minimized.

Copy link
Contributor

commented May 9, 2018

This is a really good PR, and it will fix a lot of issues! Too bad I won't be able to make a bus with 4 V12s anymore...

@thethunderhawk

This comment has been minimized.

Copy link

commented May 15, 2018

@tyrael93
If I were you I wouldn’t hold my breath on that one. It’s an old issue, a limitation of the game engine. It definitely won’t be addressed in this PR. In the meantime you’ll just have to suspend your disbelief and double layer your deathmobiles.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Aug 25, 2018

No progress and craptons of conflicts, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.