[ad_1]
I want to code a turn-based RPG, and I made a decision to make use of a database to retailer all expertise within the recreation. Now I’ve to determine as properly which class can see this database, and the way lessons move round these knowledge.
My instinct says that nearly each class ought to have the ability to see the database, and an attribute of expertise can be utilized as indicators.
For instance, suppose a talent has attributes skill_name
and dialog
. When a participant character makes use of a talent Strike
, the character
class spits a sign skill_used("Strike")
. Any class obtained this sign will seek for Strike
within the database and does its process. For occasion, the dialogue_manager
reveals dialog
of Strike
. I do not understand how advanced the precise coding is, however conceptually it might work.
However, that is like making a large singleton class DATABASE
. Any class can’t be examined with out the database.
Question: Is it fantastic to permit many lessons to entry the database? If not, what kind of lessons ought to entry the database?
[ad_2]