CitiesSkylinesMods / TMPE

Cities: Skylines Traffic Manager: President Edition
https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252
MIT License
574 stars 85 forks source link

Use empty slots in `Vehicle.Flags2` to store some info on vehicles? #1519

Closed originalfoo closed 2 years ago

originalfoo commented 2 years ago

We could store driver characteristics in Vehicle.Flags2 spare capacity - the remaining 28 flags are unlikely to all get used by any future DLC.

Flags:

The flags would be derived from info about the driver, and thus can be passed to pathfinder (mainly for IgnoresLaneRouting and IgnoreVehicleRestrictions). Mod options such as Individual Driving Styles, Reckless Drivers, Road condition has a bigger impact on vehicle speed, and Dynamic Lane Selection might become obsolete; they'd just be standard features - maybe keep Individual Driving Styles as a master switch?

We could have our own Enum with the flags for use prior to vehicle spawning, then just | it with the vehicle flags2 when necessary, thus making our custom stuff readily available to vehicle AI.

As citizen state changes, their driving style will change. For example, if they become criminal, they ingore more rules. As they get older, they might drive slower and poor eyesight results in some rule violations. Tourists might not be aware of stuff like Old Town policy. Drivers on way to work are more aggressive. More drunk drivers at night/weekends.

krzychu124 commented 2 years ago

Why reuse existing field and fight with limitation? I don't think it's a good idea to leave "invalid" flag values there in case of mod removal. The other problem is you will see them as numbers in ModTools and cannot cast value to get names (you can't add named "entries" to the enum) so any tries of m_flag2 to string will return e.g.: 1892323, not a names separated with commas.

I would see that either as new flags field in ExtVehicle or as new flags to existing (like I've already added in Aircraft DLC support PR - ExtVehicleFlags)

originalfoo commented 2 years ago

ExtDriverFlags? - calculated prior to a cim starting a journey

We'd need a very fast way to cross-reference them to a vehicle b/c vehicle AI will need to interact with them.

krzychu124 commented 2 years ago

There are better options, no need to reuse existing vanilla structure, leave junk when mod gets unsubscribed and most importantly make the mod a way more complex to fix if they decide add few more flags.