As would be expected, OpenMW should offer the ability to add NPC schedules in a more native, far better (and bug-free) and seamless way than possible with vanilla mods. There's questions of how to go about implementing schedules, attaching them to NPCs, and allowing loaded mods to modify them (and easily provide new schedules for their new NPCs), as well as how to maintain compatibility with quests, mods that may make NPCs move around or become able to be temporary or permanent followers of the player, and as such. As well as how our implementation and results will compare to those of the later TES games.
I don't know much about Oblivion and Skyrim's implementation of schedules. I understand that they are implemented as sort of passive AI packages, which are made functional by keeping such AI active in the background even when the NPC is not loaded (i.e. not in a loaded cell). Keeping AI active may be useful anyway to allow such things as reacting to the player leaving the cell (following or pursuing beyond the cell, or maybe retreating to a safe spot or healing, or perhaps in a certain location actually going up to the roof or a watchtower to snipe at the retreating player from), but do we want to implement schedules in a similar way, or a different one? How is the moddability and compatibility of that approach?
On the topic of per-NPC schedule creation, it's possible to use the existing schedules that were created for Morrowind so far (for LCV) as a base, in fact it is possible to directly use the LCV Schedules.etxt base file that defines them, and convert it to whatever data we would be using, perhaps even in the end we could take a similar approach and use loaded data in such a format that dynamically defines schedules. We could have schedule records in a mod file that would use such a (similar or not) text format, which would obviously be expanded.
Schedule records could be named (have IDs), and there could be some sort of setup to attach certain schedule records to a certain NPC or group of NPC by default, as well as to add and remove them dynamically from an NPC by scripting functions. This could be reminiscent of how dialog works; include possibilities to be based on conditions such as the NPCs location, faction membership(s?), race and class, even Disposition to the player, journal entries/quest progress, global vars et cetera.
It should be mentioned that the Living Cities of Vvardenfell project does more things which we could also want to support, and not all are included in the aforementioned LCV Schedules.etxt file; here is the LCV feature list from its readme, I think said etxt file only pertains to the first item on it:
Some things (like training, brawls and eating) could actually be directly added with new markup to the schedule text format in OpenMW with little issues - as well as missing things, such as sleeping (and working animations, such as fishing and mining?).• Adds schedules to the NPC's in many of the towns in Vvardenfell (see Areas Covered), but does not modify, in any fashion, individual NPC's (thus avoiding incompatibility with other mods). NPC's will go home at night, go to bars, go out at night, go shopping, go walking, and live their little lives on a daily basis. More guards come out at night (works brilliantly with mods such as TLM), and the schedules of NPC's have been done so as to imply who is sleeping with who, who is the shady business elf, so on and so forth.
• Adds training sessions at several locations.
• Adds fishing boats at fishing villages.
• Adds NPC lodging at some locations.
• Dims lighting for many cells at night.
• Adds schedules to door locks. Homes and places of business will now be locked at night.
Door lock scheduling is almost a separate thing (which is also handled by a separate ESP in LCV), but we definitely want a more robust and flexible method of implementing it than present in the Morrowind engine, so that any cities and city overhaul mods can be supported by it, without the need for specifically-made patches for any modified or new city.
A possible idea on this is to affect (dynamically) all doors within a city, allowing for some exceptions depending on the door's parameters (i.e. id/mesh, position, destination), so that doors leading into tavern cells are never automatically locked, also with the possibility to control it from quests/scripting as well so that a place can stop getting locked at night after an event happened or the player befriended the owner or a faction or has a high rank. The implementation might include adding a flag to door instances whether they should be autolocked or not...
Another, different way to go about it could be better, though: simply include the door locking as a actual part of the NPC's schedule, so it is a task in it just like 'eat' or 'sleep' or 'go to a new location or cell'. It could just be an invisible task that happens whenever the player is outside of the NPC's house (but doesn't start on time if the player happens to be inside it at the moment, so he isn't locked in - the same could apply to the sleeping task). It would work in the following dynamic manner: the NPC's private schedule would specify which buildings (interior cells) belong to the NPC, and at which time(s) he locks and unlocks them. The schedule doesn't need to include anything more on the matter (except perhaps the exterior cell(s) of where those owned buildings reside, if that cannot be reliably gotten automatically - but it should be possible to keep an index of all the doors leading to a given cell, if nothing else) - the lock and unlock actions will automatically effect all doors in the exterior that point to an owned cell (so city overhaul/re-landscaping mods that move around doors to existing interiors, delete some doors and add new ones, are automatically supported without a hitch).
This way, door locking is opt-in per door (it won't be locked if the schedule doesn't say so, so taverns are automatically exempt), and also will cease on its own if all the owners of a building are now dead (if you add ownership to the Mages Guild guildhall to all guild members in it, then if any one of them is alive it will continue to be relocked, but won't once they're all dead), since dead NPC's schedules wouldn't process. Exceptions could be added so that doors are only auto-unlocked if they are currently locked as a result of automatic scheduling, doors which are always locked by default (i.e. locked in the ESP/ESM that added them) are not touched, and further, specific/manual per-door exceptions might be made in some manner, again based on door parameters (id, mesh/type, etc). So some careless NPC could lock all the doors leading into his house, but not the trapdoor(s).
Thoughts and ideas?