Updating Immutable-ish DataYou are correct to be wary of modifying the DOM in a production environment (as this is very much not recommended).
There are two ways you might handle this situation:
- Update the DOM during a planned maintenance outage and keep the max skill level immutable
- Make the max skill level mutable and store it either in the skill spec or a separate oracle which you could reference from your skills
If you choose the first option, you can safely ignore the ambiguous nature of the max skill level and - if it changes - just perform a scheduled maintenance outage (making sure you take into account any consequent effects of raising the skill level).
If you choose the second option, this becomes slightly more dynamic and could handle changes to the maximum skill level while the world is running.
Instantiating Spec-derived ObjectsIf indeed there is a significant amount of mutable data involved in your skills, I do agree that instantiating spec-derived objects is the way to go. If, on the other hand, all you need to keep track of are skill levels - it may be more appropriate simply to keep a data structure mapping skill id to skill level (as an example). This is kinder on the programmer to code and less of a resource hog than creating objects for each skill simply to track its level.
Skill NotificationsTwo comments on this point:
- Using ChatArea is almost certainly wrong, as that will message every player in the area. If you must use the chat system to deliver messages, use ChatPlayer.
- Better yet would be a specific call in your (theoretical) $SKILLS system node, perhaps $SKILLS.notifyPlayerOfSkillEvent(...), which would then call the client-side $SKILLS node, which would then notify any listening GUIs, etc. Far better to use your system nodes as public interfaces than to rely on the chat system or something similar.
Let me know if there are any other questions you have regarding specs, spec oracles, etc.
Thanks,
-Jay