Remember, you MUST register to post on the Fiesta Fan forums. It's completely free to join. Just click HERE to become a member for free!


REGISTER NOW TO REMOVE ALL ADS ON THIS FORUM!

Reply
 
Thread Tools Search this Thread Display Modes
Old 11-21-2011, 06:51 AM   #11
Phantom Badger
FF's Official Weirdo
 
Phantom Badger's Avatar
 

In-Game Name: [BlackDragonEX - Paladin]
Current Level: [BlackDragonEX - 73]
Server: Teva
Posts: 1,338
Phantom Badger has a spectacular aura aboutPhantom Badger has a spectacular aura aboutPhantom Badger has a spectacular aura about
Send a message via MSN to Phantom Badger

Originally Posted by Vasu View Post
Since we're not going to be displaying any grids anyway, you can use simple location IDs. I DL'ed and played a bit of Zork, and there is not much scope for movement within a location, so we can have it similar to that. You can have various states based on the location ID. Each location can be the object of a class, with the following properties:
  • List of items that can be taken. (We can use actual strings to describe the items rather than IDs since there may be too many).
  • A string (or strings) that holds the description of the location. This string must have well defined delimiters within itself. In Zork, the description of a location would change based on whether or not certain items were still there, so we can use separate strings like "General description of the location", "Description of item 1", "Description of item 2" etc, and just concat all of them or some of them depending on the current state of the location.
  • Accessible areas and their directions.
  • Usable items, interactive characters if any.

Basically the most important thing to do in OOP is to draw out a list of the various types of objects that you may use within the game such as "Location", "Item", "NPC".

Then when it comes to taking the input, you'll need to really be able to work with strings and separate them out and stuff. C and C++ are really 2 of the worst languages for handling strings, so you'll definitely have your work cut out for you. Basically you'll need to form an exhaustive list of verbs, nouns and conjunctions if you're using those which will be checked against each time they type something in. Form a structure for the input. In Zork it seems to be <verb> <noun> or <verb> <conjunction> <noun>.

I realise you may already have a lot of this planned out, I'm just trying to show how I would approach the problem.
What you're suggesting seems similar to what my original plan was, however I found it to be very difficult to create any form of boundary to stop players typing 'East' when in a building and just end up outside for example. So my current plan is a multi-dimensional array with each section of the array correlating to a co-ordinate of a room.
Inside each section of the array will be a string of 4 letters (eg, "FTTF") which the code will use to determine where it is allowed to move, if the first letter is our ability to go North and it equals F then we cant go north from that area, etc. We can use sub strings to enforce this.

Thats my current general plan anyway, this project definitely seems a lot more complex than when I had first envisioned it :P
Phantom Badger is offline   Reply With Quote
Old 11-21-2011, 02:50 PM   #12
Vasu
Malingerer
 
Vasu's Avatar
 
Tournaments Won: 3

In-Game Name: None
Current Level: None
Server: None
Posts: 1,899
Vasu is just really niceVasu is just really niceVasu is just really niceVasu is just really niceVasu is just really nice
Actually, you can just add a single dimensional array as a property within the "location" class which holds 10 integers, each one corresponding to a particular direction. For example, the array could be:

{N,E,W,S,NE,NW,SE,SW,Up,Down}

For a particular room, the array might read:
{1,0,0,1,0,0,0,0,1,0} which means that he can move north, south and up, but not anywhere else.
__________________


Credits to Loveless for the great signature!
We rode on the winds of the rising storm
We ran to the sounds of thunder
We danced among the lightning bolts
And tore the world asunder

Vasu is offline   Reply With Quote
Old 11-22-2011, 06:54 AM   #13
Phantom Badger
FF's Official Weirdo
 
Phantom Badger's Avatar
 

In-Game Name: [BlackDragonEX - Paladin]
Current Level: [BlackDragonEX - 73]
Server: Teva
Posts: 1,338
Phantom Badger has a spectacular aura aboutPhantom Badger has a spectacular aura aboutPhantom Badger has a spectacular aura about
Send a message via MSN to Phantom Badger
Originally Posted by Vasu View Post
Actually, you can just add a single dimensional array as a property within the "location" class which holds 10 integers, each one corresponding to a particular direction. For example, the array could be:

{N,E,W,S,NE,NW,SE,SW,Up,Down}

For a particular room, the array might read:
{1,0,0,1,0,0,0,0,1,0} which means that he can move north, south and up, but not anywhere else.
That was essentially my plan, but surely it would use up less space if I put a string with all those variables in it and then used a sub-string to get the specific character ?
And without a multidimensional array wouldnt all the 'areas' lie across the X axis ? meaning that North/South wouldnt take you anywhere.

EDIT: Since instead of having to initiate all the variables like this:
bool directionUp = true;
bool directionDown = true;
bool directionEast = true;
bool directionNorth = true;
etc...

I could just put
string directionset = "TTTFFT..etc"

Last edited by Phantom Badger; 11-22-2011 at 06:57 AM..
Phantom Badger is offline   Reply With Quote
Old 11-22-2011, 07:06 AM   #14
Vasu
Malingerer
 
Vasu's Avatar
 
Tournaments Won: 3

In-Game Name: None
Current Level: None
Server: None
Posts: 1,899
Vasu is just really niceVasu is just really niceVasu is just really niceVasu is just really niceVasu is just really nice
Yeah, I suppose characters do occupy less space than integers, so you can go with the string.

Also I didn't understand what you were saying about the multi-dimensional arrays earlier, but yeah, I guess you'll need a 3D array of pointers which point to particular location objects on the "map".


EDIT: Actually, I think using a grid map is a little elaborate. You could just alter the permission string you're using from something like "TFFTFFFT" into {"Meadow","F","F","Living Room","F","F","F","Riverside"}, so that you automatically have the list of accessible locations and their direction. Or if you're using location IDs which I suggest, you can just do {23,0,0,18,0,0,0,7} or something like that.
__________________


Credits to Loveless for the great signature!
We rode on the winds of the rising storm
We ran to the sounds of thunder
We danced among the lightning bolts
And tore the world asunder


Last edited by Vasu; 11-23-2011 at 04:04 PM..
Vasu is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The knowledge that you ARE going to hell. Phantom Badger M O S 1 11-02-2009 07:06 AM
Test your knowledge of Fiesta's operation Icy Fiesta General 40 09-04-2008 02:50 AM
Knowledge Blaaaaaaaah M O S 10 05-22-2008 08:32 AM
Knowledge of a class Ralath All the Rage 14 03-18-2008 07:03 PM


All times are GMT. The time now is 01:58 PM.
Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.