{"action":"created","issue":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/19275","repository_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA","labels_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/19275/labels{/name}","comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/19275/comments","events_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/19275/events","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/19275","id":188999190,"number":19275,"title":"Vehicle propulsion overhaul [WIP] [CR]","user":{"login":"mugling","id":12238606,"avatar_url":"https://avatars.githubusercontent.com/u/12238606?v=3","gravatar_id":"","url":"https://api.github.com/users/mugling","html_url":"https://github.com/mugling","followers_url":"https://api.github.com/users/mugling/followers","following_url":"https://api.github.com/users/mugling/following{/other_user}","gists_url":"https://api.github.com/users/mugling/gists{/gist_id}","starred_url":"https://api.github.com/users/mugling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mugling/subscriptions","organizations_url":"https://api.github.com/users/mugling/orgs","repos_url":"https://api.github.com/users/mugling/repos","events_url":"https://api.github.com/users/mugling/events{/privacy}","received_events_url":"https://api.github.com/users/mugling/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2016-11-13T22:17:30Z","updated_at":"2016-11-13T23:45:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/pulls/19275","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/19275","diff_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/19275.diff","patch_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/19275.patch"},"body":"## Overview\r\n\r\nMost of the vehicle code is heavily interdependent so apologies for PR size. I'd appreciate interim review and will probably progress from here to writing acceptance tests.\r\n\r\n### Current problems\r\n\r\n* Fuel types and effects are hard-coded\r\n* Fuel usage is too low and isn't affected by either different engines or speed\r\n* Safe velocity is far too high and maximum velocity is unobtainable\r\n* Serious balance problems (bigger is better leading to V12 wheelchair)\r\n* Minimal documentation with plenty of magic values and arbitrary units\r\n* Two divergent systems for controlling vehicles with lots of menu-spam\r\n\r\n### Rework goals\r\n\r\n* Semi-realistic physics implementation using SI metric units internally (m/s etc)\r\n* Usable display units broadly comparable to real-life examples (horsepower, watts etc)\r\n* Allow definition of new engines and fuel types in JSON\r\n* Meaningful difference between engines and fuel types\r\n* Single intuitive system for controlling vehicles\r\n\r\n## Implementation\r\n\r\n### Gearing\r\n![gears](https://cloud.githubusercontent.com/assets/12238606/20249139/f2156f0c-a9ea-11e6-9cf4-046555f728ad.png)\r\n\r\nCombustion engines are only operable within a narrow range of speeds with gears necessary to extend the usable range. This PR implements gearing for engines using the following syntax:\r\n\r\n```\r\n    \"type\": \"ENGINE\",\r\n    \"gears\": [ 3.166, 1.882, 1.296, 0.972, 0.738 ],\r\n    \"idle\": 800,\r\n    \"optimum\": 2000,\r\n    \"redline\": 4000\r\n```\r\n\r\nAll gearboxes in the cataclysm are automatics and will automatically shift to try and keep as close to the `optimum` as possible. Once you run out of gears the only option for more speed is to increase `rpm` which is both fuel inefficient and results in damage above `redline`.\r\n\r\nDifferent engines are now useful for differing purposes - for example a heavy vehicle will benefit from a powerful engine with low gearing. Engine damage is now much more sensible - you can put a V12 on a wheelchair and achieve some impressive speed but the engine is rapidly damaged due to high `rpm`.\r\n\r\nIf you omit `gears` then a continuously variable transmission is assumed with the efficiency remaining stable independent of road speed. Electrical engines find their niche here (see also below).\r\n\r\n### JSON stats\r\n![diesel](https://cloud.githubusercontent.com/assets/12238606/20249228/cd85683e-a9ec-11e6-8fdb-fde58ffc0ddc.png)\r\n\r\nMuch more can now be specified in JSON, in particular:\r\n\r\n* `ENGINE:power` is specified and displayed in JSON (internally converted to watts)\r\n* `ENGINE:efficiency` controls maximum efficiency at `optimum` rpm\r\n* `ENGINE:fuel` allows implementation of engines using novel fuel types\r\n* `AMMO:energy` specifies energy density of fuel (in kJ per charge)\r\n* Starts migrating fuel properties to json flags, for example diesel engines gain `COLD_START`\r\n\r\nDisplay units are intended to be meaningful and support comparison between items\r\n\r\n### Physics model\r\n\r\n* Is based around kinetic energy (Ek = ½ mv²)\r\n* All internal units are being migrated to SI metric (m/s, watts etc)\r\n* vehicle `mass` is now far more significant\r\n* 1 tile/turn = 10mph\r\n\r\nBefore:\r\n\r\n| Name       | Max velocity (mph) | Safe velocity (mph) |\r\n|------------|--------------------|---------------------|\r\n| Bicycle    | 0                  | 0                   |\r\n| Car        | 196                | 65                  |\r\n| Humvee     | 515                | 141                 |\r\n| Motorcycle | 78                 | 38                  |\r\n| Sports Car | 956                | 321                 |\r\n\r\nAfter:\r\n\r\n| Name       | Max velocity (mph) | Safe velocity (mph) |\r\n|------------|--------------------|---------------------|\r\n| Bicycle    | 17                 | 17                  |\r\n| Car        | 57                 | 57                  |\r\n| Humvee     | 35                 | 35                  |\r\n| Motorcycle | 180                | 97                  |\r\n| Sports Car | 152                | 136                 |"},"comment":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/comments/260222469","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/pull/19275#issuecomment-260222469","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/19275","id":260222469,"user":{"login":"mugling","id":12238606,"avatar_url":"https://avatars.githubusercontent.com/u/12238606?v=3","gravatar_id":"","url":"https://api.github.com/users/mugling","html_url":"https://github.com/mugling","followers_url":"https://api.github.com/users/mugling/followers","following_url":"https://api.github.com/users/mugling/following{/other_user}","gists_url":"https://api.github.com/users/mugling/gists{/gist_id}","starred_url":"https://api.github.com/users/mugling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mugling/subscriptions","organizations_url":"https://api.github.com/users/mugling/orgs","repos_url":"https://api.github.com/users/mugling/repos","events_url":"https://api.github.com/users/mugling/events{/privacy}","received_events_url":"https://api.github.com/users/mugling/received_events","type":"User","site_admin":false},"created_at":"2016-11-13T23:45:16Z","updated_at":"2016-11-13T23:45:16Z","body":"To be clear I'm not bashing your original work on the `k_*` values just making the point that `gears` and `rpm` are relatively intuitive to the player. Any system that limits or extends the usable range of an engine, which we do need to have any meaningful engine variety, is gearing by another name."}}
{"actor":{"display_login":"mugling"}}