Guys tell me how this game i made
it is not finished
please tell me how it is so far
Guys tell me how this game i made
it is not finished
please tell me how it is so far
Well it's not really a game is it?
But I suppose apart from disgusting use of indentation, it's fine.
There isn't really much of a program to even comment on.
Well, hehe, you have context, but, try to think more object oriented...
Right now your code is procedural, meaning, you do everything 1 line at a time...
Try making a "context" class, a class that determines what is said when, etc etc... all this class does is handle strings..
now think, you have, conversation.... make a class that inherits context and holds all the data for the conversational strings..
now think again, context also has questions, make a class that holds all question strings...
Now, questions have answers! Answers is a class that will inherit context AND questions, make sure you "virtualize" the constructors to all these classes, so none are repeated and redeclared...
now that, my friend, is object oriented, and its much faster in the long run
btw, i picked the baseball bat... 4tw
Last edited by Shamino; 11-05-2005 at 11:49 PM.
Eh, the class structure illustrated here is quite ackward.Originally Posted by Shamino
Try working from the bottom up instead of top down.
IE:
The most basic structure you have - a sentence.
A sentence is simply a string.
A sentence could be a:
Question, Answer, or Statement.
A sentence might be the same as another sentence.
A sentence might need to be tailored for "listener";
A sentence has to be "said".
We will ned a sentence class.
Questions generally require an answer. IE: What's your favorite color?
Answers usualy require a context to make sense but basically can be said matter of factly. IE: My favorite color is blue.
Statements don't necessarily require contexts to make sense. They can always be stated mater of factly.
So, we can draw the conclusion we will probably need to make a class for questions, but not for answers or statements.
A conversation consists of Questions, Answers, or Statements.
We will need a convesation class.
So, some psuedo code
With that class structure we can create a conversation for any designated Non-Player-Character by setting up an instance, and assigning it the NPC.Code:class sentence: string Words; function equals(strcompare); function parse(); funciton display(); end; class Question extends sentence: sentence Question; sentence[n] PossibleAnswers; sentence Answer; sentence ResponseCorrect; sentence ResponseIncorrect; setAnswer(sentence); addOptions(sentence); setCorrect(sentence); setWrong(sentence); end; class Conversation: sentence[n] Dialog; function append(sentence); function display(); end;
And then, the end result might be something like this in game:Code:// set up our variables conversation Greeting = new Conversation(); // create conversation sentence hello = new sentence("Hello there <name>."); question statecheck = new Question("How Are you today?"); statecheck.addOption(new sentence("Great!")); statecheck.addOption(new sentence("Horrible!")); statecheck.addOption(new sentence("Meh.")); statecheck.setAnswer(new sentence("Great!")); statecheck.setCorrect(new sentence("Wonderful, glad to hear it.")); statecheck.setWrong(new sentence("Well poo on you then!")); // gather it into a conversation Greeting.append(hello); Greeting.append(statecheck); // assign conversation to some NPC SomeNpc.conversation = Greeting; // player targets our set up npc during the game PlayerTarget = SomeNpc; // have a conversation with some one if(playerTarget.hasConversation()) playerTarget.display(); // calls Greeting.display();
Of course, with that structure you can make some pretty complex conversations. By simply making responseCorrect and responseIncorrect also questions.Code:You see some npc standing in front of you. Action? -> talk to Some Npc: Hello there Jeremy! Some Npc: How are you today? 1) Great! 2) Horrible! 3) Meh. -> 3 Some Npc: Well poo on you then! You see some npc standing in front of you. Action? -> talk to Some Npc: Hello there Jeremy! Some Npc: How are you today? 1) Great! 2) Horrible! 3) Meh. -> 1 Some Npc: Wonderful, Glad to here it!
Last edited by Jeremy G; 11-06-2005 at 09:00 PM.
c++->visualc++->directx->opengl->c++;
(it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)
It's spelled sentence
Sorry but that was bugging me
"Think not but that I know these things; or think
I know them not: not therefore am I short
Of knowing what I ought."
-John Milton, Paradise Regained (1671)
"Work hard and it might happen."
-XSquared
Originally Posted by JaWiB
Yeah, what do you mean? Thats how I spelled it.
J/k. There use to be a time when I could spell correctly on the first attempt but then I was introduced to spell check and I just got lazy.
Honestly, about 1/4 of the way through my post I had this exact thought
Oh well.Originally Posted by my brain
c++->visualc++->directx->opengl->c++;
(it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)
Nice work Jeremy G!