Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
2
Question by ReedSchneider · Jul 07, 2017 at 02:54 AM · scripting beginnersystemmodularadventure

Method for Creating a "Choose Your Own Adventure Game" C#

First off, I'm not looking for a super in depth solution to the question.

Basically I was just trying to make a Choose your own adventure game and aside from making a continuous set of If Then statements to create the branching story (which is extremely unfeasible), I 'm not sure how else to store information to allow the story to go forward.

I was just kind of curious if anyone has had luck or if there is a method that someone could point me towards where I could set up some sort of script that would be easily editable and allow for a story to take place with branching stories to happen.

(I'm thinking it may have something to do with different states being present in the script representing where the player is in the story, and somehow the player should be able to choose an option that throws them into a different state)

Any general ideas or any place where I could go to figure this out?

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Leonstar0 · Nov 10, 2017 at 05:31 AM 0
Share

@ReedSchneider Honestly, this is a really good question, because I'm struggling with figuring out how to deal with this too.

I think your initial assessment is on the right track, but I'm not too certain there is an easy solution for what you are asking for.

Right, so... the whole thing that we want is to have branching story paths. By it's very nature, there will need to be some branching if/conditional logic... but how to structure that in an easily maintainable and modular way?

After a quick search online, I found this: http://program$$anonymous$$gisfun.com/learn/c-sharp-adventure-game/c_sharp_08_branching_narrative/ Which seems to have some good ideas on how to go about it.

Right... I think that, maybe one way to do it, is to think of a plot point/story event like "quests". A quest may have prerequisites before the player can acquire it/ the quest marker will show up... or in this case, before a story event will trigger (For example, prerequisite quests, level of the player, etc).

So... we need a way to store/track the player's progress/state so a 'quest' can deter$$anonymous$$e if it can be obtained/triggered... which is pretty normal. To keep track of previous quests, we can just attach a quest log to the player... or, in the case of branching stories, a story log! The story log might just be a list/dictionary/collection like ([Quest, Status], [Quest, Status])... where status is a Boolean to see if it's complete or not complete. Although that raises an issue where a quest might have multiple outcomes, so maybe you might need to store more complex logic, or you need to break the different outcomes into different sub-quests.

I dunno, it's tricky ¯_(ツ)_/¯

Huh, the next... chapter thingo by the same dude as the last link goes on about the sort of 'questing' system I was trying to elaborate... in a more elegant and diagrammed way.

http://program$$anonymous$$gisfun.com/learn/c-sharp-adventure-game/c_sharp_10_content_arrays/

Well... partly, as the guy warns:

However, what if we later want to add more scenarios and make the game play longer? We would need to find this loop in our code and manually update it. Since our project is so small, this isn't too much trouble. But if we keep expanding our project, or work on another project that is much larger that has several references to a number that might change later, we would want to have a better solution than having "hard coded" data.

So it needs to abstracted/generalized to the point you can load in an arbitrary number of story points, with arbitrary 'trigger' conditions.

avatar image Hatsuko · Nov 10, 2017 at 07:05 AM 0
Share

Haven't used this before, I just remembered seeing this. I am currently trying to use csv, but have nothing to share XD Because I'm also thinking about how I should implement the system. About the "where the player is in the story" thing, because I can get current csv file name and line number, so it's doable for me. I guess for my system, every story branch will be a text file... and I load them dynamically. (ps. if you search "Unity Visual Novel" you might find something helpful)

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

114 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Disable and enable emission property of a material via C# script? 0 Answers

Quiz Game Management 0 Answers

Acessing function in another script C# - just dont get it - code shown 1 Answer

Need help with project architecture (specifically store/access static values) 0 Answers

script an delay 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges