Database relationships question

Hello.

For fun, I’m making a text based web MMO.

I have the following tables to consider.

characters
quests
objectives

So right now my quests can have many objectives (ie: kill 10 wolves,
kill pack leader).

So that’s easy enough.
But many characters can have the same quests. So I made

characters_quests

Ok that’s fine. But since quests have multiple objectives that I need to
track how do I do this?

characters_quests_objectives ?

I don’t know why but I can’t wrap my head around this relationship
right now.

I think this is the relationship model?

character has_and_belongs_to_many quests
character has_many objectives, :through => quests

quest has_and_belongs_to_many characters
quest has_many objectives

TomRossi7 wrote:

I think this is the relationship model?

character has_and_belongs_to_many quests
character has_many objectives, :through => quests

quest has_and_belongs_to_many characters
quest has_many objectives

I think I have to make a separate table. tracked_objectives which
belongs to character through quests.

As multiple people can do the same quests and will be at different steps
at different times, they’ll need the same objectives but at different
counts.

It sounds like you should avoid has_and_belongs_to_many since you are
tracking attributes of the join relationship. Maybe something like
this:

character has_many objective_assignments
character has_many objectives, :through => objective_assignments
character has_many quest_assignments
character has_many quests, :through => objective_assignments

Does that seem right?