Sign in to follow this  

Text Game Design Flaw

This topic is 3464 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

So I'm making text base game and I wanted to implement a feature where when you kill a monster in a certain room it stays dead. As of now if you walk into a room, fight a monster, kill it, leave the room, and come back the monster would have miraculously respawned. I tried a few methods of implementing the feature by adding a bool to the structure that makes the rooms as well as the monster class but it ends up making every monster dead in every room. I believe the problem is the I have an external text file to read the data from and I read all the data into variables in tRoom. This really makes the rooms a set of variables and not very "tangible" or "individual" My only solution to this would be to make a room class instead of a structure so each room could have its own monster and thus I could kill or respawn the monster with a simple bool. Here in lies my problem. Making a room class would require me to take an axe to pretty much all of the 400 lines I've already written and I just wanted to know if there was a better way before I went along and destroyed it all, haha.

Share this post


Link to post
Share on other sites
IMO having it as a class from the start and vectorising that class would have saved you a lot of headache.

Your issue is inherited from the way that your calling the rooms, when you are referring to your external file i would assume that your not updating that file when the creature is killed? then when you move from room 1 to room 2, it is pulling room 2's information directly from the file. Move back to room 1 where the monster was killed and reload the room from the file to find it still alive.

As a solution if you load all the rooms information into memory when you start the program into an array, vector, list, whatever... and have the rooms be referenced to in memory and not from file each time. If you want to save, you have it output the data in memory to a file in the same format that you have pulled it in from the starting file.

Share this post


Link to post
Share on other sites

This topic is 3464 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this