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 Professional Discussion / First Time Coder... How do I Make a Text Adventure?

Author
Message
Cormorant5
16
Years of Service
User Offline
Joined: 25th Jan 2010
Location: Gotham City
Posted: 3rd Dec 2010 01:23
If you know me from geek culture, you more then likely know that I am obsessed with Batman. I've been meaning to make a game about Batman, and I've recently set my sights on a text adventure. So I decided that the best way to do it would be Dark Basic Pro. I got it, and so fair all I know is
Print ... or Print "..."
and Wait Key.

So what can i do to allow them to type an action, and how do i set it to "print" certain things when they enter certain things?

Sorry if this seems like... noobish, in a way.

Travis Gatlin
17
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 3rd Dec 2010 01:34
use variables say for example

remember to use the $ symbol because that stands for "string" which is text, welcome to the world of DarkBASIC Pro, hope this helps!

It's Not My Money but i need it NOW!!!!!!!!
MSon
22
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 3rd Dec 2010 01:35 Edited at: 3rd Dec 2010 01:40
If it a text adventure, then i find writing the story line down first helps so you know exactly what needs to be done.

Here is an examle of how to make a text adventure and it seems to cover all the basics.
http://forum.thegamecreators.com/?m=forum_view&t=143099&b=7

Also if you do a forum search under "Text Adventure", Theres are loads of samples and other tutorials, ect

EDIT: i dont know if your capable of doing this, but for a batman text adventure, if it had comic book style pics for the locations, ect, i think that would look very nice.

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 3rd Dec 2010 01:55
If you want a real text adventure with rooms and items check out the Zork tutorial by Pluto.

http://forum.thegamecreators.com/?m=forum_view&t=129931&b=7

Or do you want something like a choose your own adventure novel with multiple choices to go to different pages of the book?

http://en.wikipedia.org/wiki/Choose_Your_Own_Adventure

Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 3rd Dec 2010 18:11 Edited at: 3rd Dec 2010 18:19
The Zork tutorial is a very good read and should set you on the right path for making a text adventure.

But you should write up some design documents for yourself, before you even start coding. Discuss the plot (synopsis), how big you think you want to make the game (how many hours of playtime, and how many rooms in the game) and what kind of things you want to be able to do in the game with your character(s).

Planning out stuff like object interactions, potential party-based combat, or solo combat; how you want that combat to work, etc. What kind of inventory system you want, and what kind of puzzles you might think of adding to the game (find the key? find the hidden path? Defeat a certain enemy to unlock something? whatever you can think of, really).

After that's all said and done, you want to consult as much example code as you can find. Also you want to read through your DBpro help files to learn about the various features the language supports for graphics, text, data storage in memory and on disk, etc. User input will be important as well. You should decide whether you want your game to run in "real time" or not, before you do anything. If you want real-time changing world around the player even if they sit idle, then you will need to use an appropriate player input routine, because the standard DBPro input routine will not work for this - it will pause execution of your program until your player enters something and hits return, and it will do this each time the player is prompted for input.

I use an input routine I got from the codebase that takes input from the Windows Keyboard Entry Buffer. This allows it to check the buffer as someone types and simply move the buffer data into a variable that you then print out on the screen, where you want to show your player what they are typing. There are no pauses waiting for an entire input -> enter pressed scenario.

You are doing to have to design a lexer/parser system to interpret commands given by the player as well. This can be as disgustingly simple or complex as you like.. I haven't even begun work on that part of my game yet, but right now I am just going to go with a simple solution that tokenizes an input string and checks it from left to right for "key words" that are searched for either with an IF/THEN loop, or a CASE SELECT loop.

The tree itself can become complex once you start stacking up possible keyword combinations to make various commands, but if you have a minimal set of commands I believe it is a realistic solution at least for a beta phase of production.

A text adventure is a big undertaking. I started mine several months ago (granted I don't have a lot of free time to work on it) and design documents and having a clear vision of what you want to do, as well as how to tackle those problems in code, will be a big help to you.

Text adventures are/can be some of the most complex and difficult systems to develop for any programmer. They usually aren't recommended to new folks, even though that may seem strange. Due to the sheer level of mechanics going on with most games, it does become overwhelming to a lot of people.


So don't give up too easily if you have your heart set on it! I've gotten lots of help on the forums here when I was stuck or wanted opinions on doing something a certain way. People here are very helpful and very friendly to new coders.

Cormorant5
16
Years of Service
User Offline
Joined: 25th Jan 2010
Location: Gotham City
Posted: 3rd Dec 2010 22:50
I am thinking that I may want to start out simpler, because someone recently convinced how, although it seems simple, just time consuming, it is very hard. I just don't know how to start simpler. Until then, I'll read that tutorial.

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 4th Dec 2010 07:43
Check out TDKs Tutorials to learn the basics of Darkbasic.

http://forum.thegamecreators.com/?m=forum_view&t=99497&b=10

A simple text adventure would be like a choose your own adventure book. All you need is an array to store each question and all possible choices and the room number (page number) each answer would go to (using a SELECT/CASE statement to print out the new text.).

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Dec 2010 12:09
Quote: "I am thinking that I may want to start out simpler,"


Have you looked at the one suggested by MSon? That's about as simple as a text adventure can get.

I suggest you try that example and then experiment by adding your own texts and options - even simply correcting the spelling mistakes in the text messages will help you understand how that code works. When you're happy with that you can move on to more complicated examples.

Have fun.
Cormorant5
16
Years of Service
User Offline
Joined: 25th Jan 2010
Location: Gotham City
Posted: 4th Dec 2010 13:48 Edited at: 4th Dec 2010 14:00
Yeah I think I'm going to make a layout, then mostly edit that text adventure, see how it all turns out... then later I can add or take away certain variables.

EDIT: Second thoughts, thats okay right?

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Dec 2010 14:43
Yes, of course. If you're not sure just add a comment near the top of the code saying something like



Most people here post code that they expect others to use - and an acknowledgement helps put everyone in a good mood.

Of course a lot of code is so standard that acknowledgements are hardly necessary, but when you borrow a lot of code from one specific source it's courteous to acknowledge that and the acklowledgement is usually appreciated.
Cormorant5
16
Years of Service
User Offline
Joined: 25th Jan 2010
Location: Gotham City
Posted: 4th Dec 2010 15:39
Okay, things were looking up because I mastered adding variables, and I was almost done too!

Then when I wanted to test it wouldn't compile, it just kind of froze. So I saved it, closed out, and tried to open it back up, see if it would work then. Then I opened it and all I saw was
Rem ***** Included Source File ***** .
Where'd my adventure go D:
Did I do something wrong?

MSon
22
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 4th Dec 2010 17:19 Edited at: 4th Dec 2010 17:32
If you mean all the source disappeared, Then you could try one of the following.
1. DBPro usually creates a backup wherever the source is
2. DBPro creates a source dump file for the last compiled project somewhere in the dbpro install directory

I'd also make sure you have the latest version of DBPro, I use to have this problem, but only on the old editor.

EDIT: Your not the only person who has this problem
http://forum.thegamecreators.com/?m=forum_view&t=171371&b=15

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Dec 2010 20:42
Yes, this sort of thing still happens to me occasionally. I find one safe way to start a new project is to do the following steps:

1. Open DBPro.
2. Use Save Project As to give the project a sensible name in a folder of your choice.
3. Use Save As to give the dba code a sensible filename in the same folder.
4. I usually give the exe file a new name as well and then use Save Project again.
5. Then I start entering code.

Things go wrong if I do things in the wrong order (or am thinking about something else and miss a step ) - but as MSon says, the dba code might still be somewhere and might even be in the project folder you specified.

But you do need the latest update (U7.5) to be safe.

If you're really worried about losing code, always keep a backup copy somewhere.
Cormorant5
16
Years of Service
User Offline
Joined: 25th Jan 2010
Location: Gotham City
Posted: 4th Dec 2010 22:18 Edited at: 4th Dec 2010 22:28
When was it? I only downloaded this last Monday or so. Maybe more recently.

EDIT: Also, so is there no way that I can save my current code? i spent so much time on it ;-;

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 4th Dec 2010 22:43
Quote: "Also, so is there no way that I can save my current code? i spent so much time on it ;-;"


Do you mean you haven't found it yet? If you can find it you should be able to save it safely.

If it was the last thing you did then it should be in a file called FullSourceDump.dba in the Dark Basic Professional/TEMP folder. Have you found that?

Login to post a reply

Server time is: 2026-07-21 13:37:47
Your offset time is: 2026-07-21 13:37:47