Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Help needed on object orientated text adventure?

Author
Message
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Oct 2007 02:00
Remember those old point and click adventure games like Discworld and Loom? I want to make something like that. I haven't decided if I'm actual going to draw the graphics for this or just be a plain text adventure but the main idea is that there are certain objects you can interact with and you must interact with them in the correct way to progress with the story.
I am stumped at how to do these objects, how to store and check their various states and how they affect what the player can do.

For the sake of making it easier for those kind enough to help, here is my first scene:
Quote: "
The game is set in the Wild West American frontier around 1860. You play as a man who has been framed for murder and begin the game locked in a cell awaiting your death.

The items you can interact with are BARS, LOCK, BED and a BUCKET (which acts as a toilet )
You can pee in the bucket to give yourself a small health boost (he is in pretty bad shape at the start of the game) but only once.
By looking under the bed you find a MATCH, and by using the bed you find a NAIL sticking out of it.
You will use the NAIL to pick the LOCK but there is a guard watching you.
So to distract him you strike the match on the rusted bars and toss it onto the bed, the bed bursts into flames and the guard panics and runs off to get help.
Now the guard is gone you can pick the lock, I haven't decide if you will have to distinguish the fire with the bucket first or maybe that just makes lock-picking easier or meh.
And then you are free!
The next trial is to get your personal possessions back, but that's for another time
"

I think there's a good range of actions and possibilities there so hopefully someone can help me do this

thanks

OBese

jthtiger 2006
20
Years of Service
User Offline
Joined: 11th Mar 2006
Location: Somewherein the U.S.
Posted: 21st Oct 2007 02:34
Hey OBese87 i think i have an idea but i want to try it out really quick before i get back to you. good luck though.

jthtiger
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Oct 2007 02:52
thanks dude
wow i posted at exactly midnight

jthtiger 2006
20
Years of Service
User Offline
Joined: 11th Mar 2006
Location: Somewherein the U.S.
Posted: 21st Oct 2007 03:48 Edited at: 21st Oct 2007 06:34
ok here is my version of your scene one. this is the first thing that came to mind. it works and i think someone else will have a different opinion.



The only thing i see wrong so far is that if the user doesn't type Bed (like if he types bed) then it wont work but i think you can fix that. anyways this is just a suggestion!

jthtiger

EDIT: Found some new commands and edited the code a little bit!!!
EDIT AGAIN: Ha i found out the answer to my own problem about the user typing bed instead of Bed. the code was updated accordingly. I found all these answers through TDK's tuts. very good stuff there
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 21st Oct 2007 10:41 Edited at: 21st Oct 2007 10:47
Each object in the game could be a sprite and each one would have a data array associated with it.

Dim DataArray(200,30)

This would give you up to 200 objects, each with up to 30 pieces of information on it.

In the array, you would store things like:

* The room number it is currently located
* The X & Y screen position in the current room
* Whether it can be picked up yet (static or mobile object)
* Whether it is being carried or not
* What other item it can be combined with
* Whether it has been combined already or not
* Which room it needs to go to to be dropped

and so on.

When in a room, mouse pointer sprite collision would tell you the ObjectNum of the item you had clicked on so you can access the correct elements of the array.

TDK_Man

jthtiger 2006
20
Years of Service
User Offline
Joined: 11th Mar 2006
Location: Somewherein the U.S.
Posted: 21st Oct 2007 11:34
ahh wow i was totally wrong. i was thinking about something completely different. oops.

jthtiger
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Oct 2007 15:32 Edited at: 21st Oct 2007 15:33
@JHTiger
Your one isn't too bad.
I would do this

Then you don't have to change it to upper case every time.
I was originally going to make this a text adventure but changed my mind.
Also when you restart, you need to reset all the variables to 0, they should be integers.

@TDK
Thanks that makes sense

demons breath
22
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 21st Oct 2007 19:02
Also JHTiger if you want to do text input, I think the easiest way would be to assign a number to each object. Just have something like:



OK I couldn't remember what you had in your room, so I made up things which I thought of when I thought about rooms. Looking back on that list it seems a bit strange. I mean, who keeps a bed in their room?

http://jamesmason01.googlepages.com/index.htm
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Oct 2007 19:14
@Demon
That might be easier but I wouldn't make the user have to use the numbers though.

jthtiger 2006
20
Years of Service
User Offline
Joined: 11th Mar 2006
Location: Somewherein the U.S.
Posted: 21st Oct 2007 21:36
yeah it may get too complicated maybe ill try to make one where you can just click on the object you want to interact with. just to see if a can do it. i won't steal your ideas obese just going to use it to test out my coding skills(few as they may be). and after that ill try TDK's thing. thanks for the idea obese this gives me some practice in coding!!! i won't publish it though. as i don't know where to do from here in the story.

@demons breath
thats just what obese gave for the user to interact with in a jail cell so thats what i used!

jthtiger
Red Ocktober
22
Years of Service
User Offline
Joined: 6th Dec 2003
Location:
Posted: 21st Oct 2007 21:49 Edited at: 22nd Oct 2007 03:15
Object Oriented... you've got my interest

are you writing this in DB Classic OB...

(will be offline for about the next hour, will try to reply then)

--Mike

Login to post a reply

Server time is: 2026-07-06 00:46:11
Your offset time is: 2026-07-06 00:46:11