• Advertisement
Sign in to follow this  
  • entries
    5
  • comments
    2
  • views
    2554

Entries in this blog

OK this is what I came up with at work:

My basic plan is to have one class that parses through the input buffer and puts each word into a vector. It then finds the token for each word.

There is another class which holds the noun and verb and uses them to call an action.

All the verbs are instances of general verb classes inherited from the base class verb. The base class verb contains the virtual function activate. This function is overridden in each verb type class to perform the specific actions of the verb typ (like attack, add to inventory etc.).

All the pointers to the verb instances through the base class are contained in a vector. The verb token number can be used to access them through their index. The noun token is passed to the activate function so the object can be manipulated by the verb function.

Classes:
Parser
Data:
Buffer-contains the input
whitespace-contains the whitespace characters
word[]-vector of words parsed from buffer
token[]-vector of tokens taken from the words
Functions:
Parse[Buffer,#]-returns a word
GetToken[word[]]-returns a token for the word

TakeAction
Data:
verbToken
nounToken
inTokens[]-vector of the tokens parsed from input

Functions:
getVerb: iterate through inTokens to get the verb
getNoun: iterates through inTokens to get the noun
action: takes the tokens as input and calls the verb class function activate using the verb token as the index to th array of pointers to verbs

There will also be a base class Verb and verb type classes inherited from it.

There will also be a dictionary that can be used to find the tokens and a Noun base class with different nouns.

Well I am just beginning on all this and may be going about it all wrong so I would aprecciate any comments.
I know my plan may not be very clear but I will be working on it more in the next few days.

Baby Step 1

I have decided to revise my parser and make it OOP. I think I can have a class that would be the input buffer. This class would have functions that parsed out the noun and the verb.

I think I might make noun and verb classes as well. They would be based off of a word base class. I could use this so that in the program I would only have to use a command like verb->action without having to specify which verb I was using.

Still thinking about this, need to plot out my idea on paper at work tomorrow.
After doing some research I have decided that I will use tokens for my text adventure. This will make it very easy to handle synonyms.
It has also become obvious that I will be handling a lot more data than I have ever had to deal with before (rooms, items, monsters etc.) I wll need to research some better ways of doing this.

I am considering using an array to make a text based map with different numbers or letters standing for different things that can be in a space.

First entry

Got signed up for GDNet+ today. I am graduating in a few days with a BA in Mechanical Engineering (resume) and hope to spend a lot of time between now and when I get a job working on my programming skills.
My main goals:
1.Finish up my Allegro Tic-Tac-Toe game
2.Work up a design plan for a text adventure. I want to make this as modular as possible so that I have a seperate parser (I am thinking about tokenizing all the words into numbers), dictionary, and world data levels.
3. Begin coding the text adventure engine.
Sign in to follow this  
  • Advertisement