I am currently creating a browser based game, and was wondering what was the standard approach in making diverse conditions and status bonuses database wise. Currently considering two cases.
- Event Conditions
- Needs min 1000 gold
- Needs min Lv 10
- Needs certain item.
- Needs fulfillment of another event
- Status Bonus
- Reduces damage by 20%
- +100 attack points
- Deflects certain type of attack
I wish to be able to continually change these parameters during the process of production and operation, so having them hard-coded isn't the best way.
All I could come up with are the following two methods.
Method 1 Create a table that contains each conditions with needed attributes
Have a model named conditions with all the attributes it would need to set them
conditions condition_type (level, money_min, money_max item, event_aquired) condition_amount prerequisite_condition_id prerequisite_item_id
Method 2 write it in a DSL form that could be interpreted later in the code
Perhaps something like yaml, have a text area in the setting form and have the code interpret it.
condition_foo: condition_type :level min_level: 10 condition_type :item item_id: 2
At current Method 2 looks to be more practical and flexible for future changes, trade off being that all the flex must be done on the code side.
Not to sure how this is supposed to be done, is it supposed to be hard coded? separate config file? Any help would be appreciated.
For additional info, it will be implemented with Ruby on Rails