Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Need help with game design and structure.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Kyle Biro




PostPosted: Wed Jun 19, 2013 9:56 pm   Post subject: Need help with game design and structure.

What is it you are trying to achieve?
I want to know if this is or should be more organized.


What is the problem you are having?
I'm not the best programmer and I just want to know if this is an OK program design.


Describe what you have tried to solve this problem
Nothing.


Please specify what version of Turing you are using
4.1

https://www.dropbox.com/sh/2xj0q8xnbwz8ifm/WbD2_zdklV
The code is in one file (Turing Text Based Game), and just ignore _itemList.txt, it is just a test file for file I/O
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Wed Jun 19, 2013 10:22 pm   Post subject: RE:Need help with game design and structure.

I only took a brief peek at it, but from what I saw it looks pretty good. However,

-You could remove all of the lines at the beginning that are assigning strings to arrays and put that data in a text file. Then put it in a loop once and read them in from the file. For example, if you put them into a file called 'strings.txt',

Turing:

int stringsFile := File.Open ("strings.txt", "r") %I don't remember the exact syntax here
for i : 1..5
    get : stringsFile, noVisibleItem(i)
end for
for i : 1..5
    get : stringsFile, noItem(i)
end for
%etc


The same can be done with your items. Instead of having variables for 'stealsword', etc, you can store the attributes in a text file and load it directly into the array via a loop. It looks like you aren't using those variables anywhere after you assign them to your array, so it shouldn't be difficult to implement.

Finally, I suggest you think about your command phrases in terms of structure rather than exact content. 'take the' works, but 'take' will not. 'pick up' works, but 'pick up the' does not. How about splitting it into verbs and articles (articles are words like 'a', 'the', 'some', etc). Have a list of articles and a list of verbs. When you parse the command, accept articles that show up but don't worry if they aren't present.


Now don't be discouraged- your code is very clean, and much better than a lot of what we see here. You're doing quite well so far.
Kyle Biro




PostPosted: Wed Jun 19, 2013 10:45 pm   Post subject: RE:Need help with game design and structure.

I have looked at the other option of putting all the commands into a text file, and all the items into a text file. But this would require a large rewrite of adding and dropping and what not, and quite frankly I haven't figured out how to do that yet. My friend still insists on having classes for weapons, armor, consumables, and so on.
Timothy Willard




PostPosted: Thu Jun 20, 2013 11:27 am   Post subject: Re: Need help with game design and structure.

Insectoid, I am not sure why you think "take" and "pick up the" won't work (they are actually one of the commands we have listed). However, I do like your concept of checking for articles seperately (always a fan of removing hard coding). We will work to implement it.

Also, just for reference, I am the friend Kyle was talking about.
Raknarg




PostPosted: Thu Jun 20, 2013 4:32 pm   Post subject: RE:Need help with game design and structure.

classes are only really useful if you're going to bother with inheritance. If not, then it's not really worth your time to bother.
Kyle Biro




PostPosted: Thu Jun 20, 2013 8:16 pm   Post subject: RE:Need help with game design and structure.

Well they're all going to be replaced with text files very, very soon.
Kyle Biro




PostPosted: Thu Jun 20, 2013 11:46 pm   Post subject: RE:Need help with game design and structure.

Okay, all the commands, and items have been moved to a text file and the classes have been removed. Thanks for the suggestions and help guys!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: