-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 collision unit test design #27283
Comments
May also want to test things like individual frames and shopping carts or office chairs/wheelchairs as collision targets - they may not be driving around but should be significantly different than hitting full vehicles. As for collecting data, maybe % of tiles damaged plus % of total hp of all parts? |
I think the main things that would be important to test for their effects on the collision would be: As for the data being gathered, it seems to me that the things which would need to be checked are the distribution of the damage (Both to the vehicle and the obstacle), the end location/velocity of the vehicle, and the end location of the obstacle. To expand upon the first: I think we would want to make sure that the damage isn't JUST to the tile being hit, but follows some kind of Gaussian distribution. Also, I think we'd want to ensure that the momentum is treated sensibly? I'm imagining something like a quick and dirty inelastic collision calculation, and then damaging both based on the kinetic energy lost. Edit: A thousand apologies if this is in any way how collisions are currently handled, or planning on being handled. |
Collisions are very arcane, I don't blame anyone for not understanding how they currently work. vehicle::part_collision() is the code that determines the amount of collision damage. Collision elasticity starts at 0.3, with 1 being a completely inelastic collision. Impassable furniture has elasticity 0.1; other terrain has varying values of e determined by terrain_collision_data(). vehicle on vehicle collisions are handled somewhat differently but not relevant. post collision velocity is sum of initial momentum of both objects + elasticity * other object mass * difference in velocity / sum of object masses. damage is 1/400th the change in kinetic energy of the two objects. object materials factor in there somehow on the distribution of damage. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered. |
Vehicles need a set of collision unit tests
The vehicle collision code is fairly obscure. I don't think anyone really knows how it all works. It needs to get revised and refactored. First, though, it needs some unit tests so developers can tell what changed and make sure that things that aren't supposed to change didn't and things that are did.
Unfortunately, I'm not sure what the unit test case should involve.
Current plan
Take the following vehicles:
unicycle, shopping cart, beetle, electric scooter, motorcycle, car, solar car, SUV, electric SUV, security van, school bus, RV, apc.
Spawn each vehicle at 60,60 on a map of pavement (possibly other terrains?) facing north with a speed of 10, 20, 40, or 80 mph.
Spawn one of the following furnitures, terrains, or vehicles about 2 turn's of movement north of the vehicle:
long grass, wood wall, rock wall, tree, bench, fridge, flower, zombie, zombie brute, zombie hulk, dog, wolf, moose, and each of the vehicles.
Have the vehicle move 4 times, colliding with the object.
Report the final location and speed of both objects and the damage levels.
Vertical crashes
Also drop the vehicles from 2, 4, and 8 z-levels up.
Help
I would appreciate some help in getting useful data about vehicle crashes.
The text was updated successfully, but these errors were encountered: