Jump to content
  • Advertisement
Sign in to follow this  
goolulusaurs

Quest completion help

This topic is 3763 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm making a text rpg in c# and I'm having trouble with how to check if a quest was completed. Each quest has a monster you have to kill a certain number of times. I was wondering if there was a better way of checking if the right monster was killed than just looping through all the quest to see if any monster was related to that quest. I figured it would be very slow if you had a bunch of quest and had killed a lot of monsters. I was reading about delegates because it sounded like it would help but I don't really understand them.

Share this post


Link to post
Share on other sites
Advertisement
First off I want to take a second off to help you out with programming in general. You always want to go in and have a good idea of the general architecture of your application before starting to program it. Jumping face first into code and trying to add feature after feature you will end up with a cluttered, hacked, and difficult to use design, that will often require a massive rewrite anyways.

I would have approched the situation completely differently. Instead of having a seperate "list" of quests and monsters, I would have attached "triggers" to events. In other words, monsters, buttons , etc, could have triggers assigned to them which modify certain variables in the system. You can then store your quests in a simple database-like design (even as much as a simple mapping of boolean variables to ids, or a casual array). Now, each event can generate a trigger, which can get and set those variables. For instance, an event will fire when monsterX is killed, this event will trigger variable qvars[1500] to be set to true, which identifies that the quest is complete. This allows you to make much more complex quests then you could have with your original design, and simplifies the whole process considerably.

Share this post


Link to post
Share on other sites
Although some sort of trigger system would be more flexible and more efficient, I don't think looping through all the quests and checking for specific monsters would be a performance problem, and it's a simple solution for a simple game.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!