Jump to content
  • Advertisement
Sign in to follow this  
cj270608

What next for me?

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

It's time for my fourth C++ project. My first project used random variables. My second project featured a 1D array, and difftime. My third project was a very basic RPG battle, featuring many variables, random numbers, and is pretty good. My next project is an interactive story, where the player seems to be turning into a wolf. The thing is, as the transformation continues, there is an increasing chance that feral instincts will take over, and the choice will be automatically set...

Share this post


Link to post
Share on other sites
Advertisement

#include <cstdlib>
#include <ctime>
#include <iostream>

using namespace std;

int main()
{
srand((unsigned)time(0));

cout << "Welcome to FERAL..." << endl;
cout << "Press enter to start..." << endl;
getchar ();
cout << "THE STORY" << endl;
cout << endl;
cout << endl;
cout << "Something inside you seems to be changing. [>]" << endl;
getchar ();
cout << "Is it you, or is your hair starting to get paler?" << endl;
cout << "Is it you, or are your fingernails becoming harder and sharper?" << endl;
cout << "You have been pondering such strange changes for two days now. [>]" << endl;
getchar ();
cout << "You are currently in your bedroom, lying in your bed." << endl;
cout << "What do you do?" << endl;
cout << "1: Get out of bed" << endl;
cout << "2: Stay in bed: I'm too tired!" << endl;

int action = 0;

while (action<1 || action>2) {
cin >> action;

switch (action) {
case 1:

}



This interactive story will have multiple branches, so would it be best to have multiple sources, or is there another method?

Share this post


Link to post
Share on other sites
Quote:
Original post by cj270608
This interactive story will have multiple branches, so would it be best to have multiple sources, or is there another method?


Do you mean sources as terminology from graph theory?

It seems to me that the story must always start at one particular node(?), so only one source is needed. The story could have multiple endings so you can of course have multiple sinks.

Rather than hard code lots of conditional statements into main, I would actually construct a directed story-graph structure. Each node holds some part of the plot and edges represent plot directions, that way you can easily handle branching plot lines.

You can even make the entire story data driven; keep the story in an easily extensible text file format and just have the application parse, build and iterate the story-graph.

Share this post


Link to post
Share on other sites
dmatter is right btw, but I have a feeling this may be a bit above and beyond the scope of the project he is looking to do.

Maybe just loading things from a text file would be a good next step. But this would involve designing at least a basic form of what dmatter is referring to.

Share this post


Link to post
Share on other sites
I remember your previous thread on the RPG, quite honestly i would suggest something like connect 4 before you delve too deeply into this project. I only suggest this because the current method you're using is very linear and really won't teach you much other than the basic commands that you learned in your last project.

Connect 4 can be done in a single main loop, it requires checking for victory conditions which can be done many ways and can be highly optimized etc. it also gives you the opportunity to learn a little about basic AI.

If you're intent on continuing this project, you could use multiple methods and a case statement or something like that, otherwise your main loop is going to become massive and unreadable.

Just a thought, hope it helps.


Share this post


Link to post
Share on other sites
Quote:
Original post by cj270608
My next project is an interactive story, where the player seems to be turning into a wolf. The thing is, as the transformation continues, there is an increasing chance that feral instincts will take over, and the choice will be automatically set...


You stated you are building a C++ project but then your description of the project is basically game design. I would suggest doing something closer to engine design and specifically detailling what you want in your game. From the code you've supplied you could say:

- Console Based
- Allowable User Input
- User Choices Determine Story

Then elaborate on each, for example, 'User Choices Determine Story' you could think of building a tree and moving down it based on the user decisions, or you could have it in a text document and pull out what they do next, etc... (text document idea is not a very good one) But defining your technology will help you with problems like this. To me, it seems you are focusing to much on the game design while working on the technology.

Share this post


Link to post
Share on other sites
I think you could use this as a good opportunity to learn about file I/O. Maybe even XML...

Write a section of text that is printed to the user inside a file. Then after this, write some instructions about where to go next, depending on the choice. I think XML would be a good option for this; It would teach you XML as well as teach you good file I/O.

Here's a basic implementation you could use:

<Entry id="5">
<Name>UserWentToSleep</Name>
<Description>You have decided to try to sleep it off. You wake up in the middle of night drenched in sweat and notice you know have claws. What do you do?</Description>
<Choice id="1">
<Text>Go back to sleep</Text>
<JumpLoc>12</JumpLoc>
</Choice>
<Choice id="2">
<Text>Go crazy!</Text>
<JumpLoc>13</JumpLoc>
</Choice
</Entry>

Obviously you would need to change the tags to fit your needs, but XML could give you a simple way to organize your data. This would allow your actual C++ code to be concerned with coding and files, rather than hundred of strings.

Share this post


Link to post
Share on other sites
What does Firefox have to do with it?

I guess that was kind of intimidating, but XML is really very simple. It's just a way to organize your text more effectively. Take a quick read about it here: http://www.w3schools.com/xml/xml_whatis.asp

Or even if you don't use XML, I recommend storing your text inside a file. Not only will this teach you a valuable skill, but you won't have to constantly recompile everything.

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!