text game

Started by
19 comments, last by GameDev.net 17 years, 9 months ago
I think i know what i need to know to make a text game. i use c++ devcpp and im on windows i wanna make a text game or evene possible an online text game but where do i start or how do i start
Advertisement
Hey bro, Devcpp is cool but i just want to spread some luv, and give you a good link.

VC8

Its only free for a limited time....

I guess i would suggest just doing a text game offline since you dont know where to start, i dont what to say besides thats the most easiest thing a coder can do(i think) Where you should start? Its a text based game, you can start anywhere really, start on the classes that hold your items, or weapons and armor, and character info. I dont know anybody who actually writes everything out on as a rough draft, unless they're doing a MUD(Something really big) A text based adventure doesnt sound too much fun to code, i ve done one myself, and the way i did it was:

*
1.) Created my Classes , with just writing a few variables within them..
i.e. Items, Weapons Armor, Charcters, NPC's, Relics, Messages.

*
2.) Started the story
i.e
Welcome to EpicDragons
Enter your name blah blah blah

You are in the middle of the Asrhobi Shrine, where you see 2 faires, a Scroll hanging on a fountain glittering of Gold and many colors, Pouring out water as clear as an opaque puke covered windshield!!(LOL)

Input Selection Player
1 - Talk to faire 1 2- Talk to faire 2 3 - read scroll 4 - puke on faire
5 - Walk south 6 - Walk north 7 - Attack Fairie 8 - Open Treasure chest

*
3.)Then i would goto my classes and add in an item to put in the treasure chest



So you see just go along and fill in the blanks i hope thathelps.....
I f ya need anyhelp just let me know im actually willing to revise what i know!!!
Hey bro, Devcpp is cool but i just want to spread some luv, and give you a good link.

VC8

Its only free for a limited time....

I guess i would suggest just doing a text game offline since you dont know where to start, i dont what to say besides thats the most easiest thing a coder can do(i think) Where you should start? Its a text based game, you can start anywhere really, start on the classes that hold your items, or weapons and armor, and character info. I dont know anybody who actually writes everything out on as a rough draft, unless they're doing a MUD(Something really big) A text based adventure doesnt sound too much fun to code, i ve done one myself, and the way i did it was:

*
1.) Created my Classes , with just writing a few variables within them..
i.e. Items, Weapons Armor, Charcters, NPC's, Relics, Messages.

*
2.) Started the story
i.e
Welcome to EpicDragons
Enter your name blah blah blah

You are in the middle of the Asrhobi Shrine, where you see 2 faires, a Scroll hanging on a fountain glittering of Gold and many colors, Pouring out water as clear as an opaque puke covered windshield!!(LOL)

Input Selection Player
1 - Talk to faire 1 2- Talk to faire 2 3 - read scroll 4 - puke on faire
5 - Walk south 6 - Walk north 7 - Attack Fairie 8 - Open Treasure chest

*
3.)Then i would goto my classes and add in an item to put in the treasure chest



So you see just go along and fill in the blanks i hope thathelps.....
I f ya need anyhelp just let me know im actually willing to revise what i know!!!
Quote:Original post by Bluseed
Its only free for a limited time....

No, it's not. [edit: Err, the link was "Visual Studio Express Editions are Free Forever!", the article isn't very clear on that, the FAQ is clearer]
o ok correction!! lol even better...
I'll just say that I use Bloodshed's Dev-C++ and I also have the "free" Visual C++ Express Elite Uber-Lite Edition...

I'll stick with Bloodshed.

On that note, creating a text adventure is fairly easy, usually these work along the lines of the old "Choose Your Adventure" books where you'd read to a point and then be given a choice that would have you either "Turn to Page 28 if you're secretly evil" or "Turn to page 162 if you're the paradigm of angelic perfection".

This is basically what happens in a text-adventure game. So what you'll need first are some classes as Bluseed mentioned, off the top of my head, I'd say you need a class that will represent items, characters and perhaps weapons if you want to get into an actual combat system which may be a bit too complicated at this point, if you're going for the most bare-bones implementation you can.

Your player would be a character and would probably contain a variable to say which "room"(read part of the plotline) he is in and some manner of container (vector, array, doesn't really matter much) to hold all the objects in his inventory.

When we start the game, we display the first "room" object to the player, which is a class/struct that has something like a "Description" string variable that will comprise the bulk of our game. This could be something like Bluseed suggested but I'll expand on it just a bit.

Quote:
Walking through the dank entryway you find yourself in a large cavern. A huge treasure chest stands along the eastern wall surrounded by a group of pixies twinkling with laughter. Gaping black holes in the souther and western walls lead to tunnels heading deeper into the heart of the fortress.


This would of course be the room's "description" probably a generic string for the sake of allowing them to be longer or shorter dynamically. After this description is shown to the player, we present them with a list of possible "paths" that they can follow, for example:

Quote:
1. Approach the pixies and attempt to make conversation.
2. Sneak past the pixies and down the southern tunnel.
3. Attack the pixies!
What do you do? /*get player input here*/


The function for this choice can be as simple as a switch statement along the lines of:

int decision = 0;cin >> decision;switch(decision){    case 1:        do this;    case 2:        do this instead;    case 3:        do something else;    default:        cout << That's not a valid option! << endl;}


Depending on the path that the player chooses we flash them the next update of text or "room" if you will, even though their imaginary physical presence in our made up fortress may not have moved. We continue this process until the player reaches a termination point in the "game" that is a specific place that we have decided either they will succeed or fail.

Using my shoddy psuedo-code/psuedo-writing above, you could most likely make the entire game without ever needing anything more than #include <iostream> and #include<string>.

<Advanced>

Of course, you could always circumvent the string header/usage entirely and just use string literals, but I always like to think towards future expansion and storing things as string variables will allow greater flexibility in the long run.

</Advanced>

My two cents, something to chew on,

Vopisk
Just like Vopisk said:

Quote:
Of course, you could always circumvent the string header/usage entirely and just use string literals, but I always like to think towards future expansion and storing things as string variables will allow greater flexibility in the long run.


As ur going through your text based adventure game, think of, and create things that kinda go further then just a text based game, really challenge the language and use it to your advantage...
i.e when you come to a scene in your gam, like when the army starts rushing into Narshe(Final Fantasy3/6 village), as the player is typing in the input have the text shake like an earthquake to give the player a feeling of being in Narshe. I know thats a challenge, lol, but your learning how to do things within the C++ enviroment.

Do crazy things to advance your knowledge...
Quote:Original post by Bluseed
Just like Vopisk said:

Quote:
Of course, you could always circumvent the string header/usage entirely and just use string literals, but I always like to think towards future expansion and storing things as string variables will allow greater flexibility in the long run.


As ur going through your text based adventure game, think of, and create things that kinda go further then just a text based game, really challenge the language and use it to your advantage...
i.e when you come to a scene in your gam, like when the army starts rushing into Narshe(Final Fantasy3/6 village), as the player is typing in the input have the text shake like an earthquake to give the player a feeling of being in Narshe. I know thats a challenge, lol, but your learning how to do things within the C++ enviroment.

Do crazy things to advance your knowledge...


(S)He only THINKS he has the necessary knowledge to make a simple text-based game and you want font-shaking?! Haha! Remind me never to work for you :p

I'm pretty sure there's no way to actually do that in the console... pretty sure... and that's where the 99th percentile of your text-based adventures will fall into, to give us that good ol' DOS feeling :) Unless of course we want to create a custom GUI with spiffy graphics and whatnot, but that might be overkill for a text game :)
Personally have always found the MUD-like games, not in scale, but in mechanic ,where instead of reading, and choosing between x number of possible options for advancement, you instead type things like 'pick up the lantern', and are presented with a ascii map with descriptions of where you are. I did one of these, and found it to be an absolutely invaluable experience in learning parsing and parsing methods, along with state machines and crude AI.

Also gave me huge experience when i wanted the player in my more advanced games to be able to talk to NPC's by typing, and have them actually respond to what the player typed, which sure beats the pants off of a number of other methods, like listing chat options, or click-to-open-a-shop-window options, and allows your NPC's to fill multiple roles.

Its a hard task if you take this route, and if you're looking for choose-your-own-adventure kind of things then you'll have a much easier time of things.[which is good to get your feet wet, and for learning how to make your games data-driven, and force your to organize your data well, which is absolutely required in larger games]
I'd agree with you there Peachy, a mud-type interface is the next logical step up from a choose your own adventure style game. However, I like the choose-your-own-adventure style game because it provides the basis of collecting input from the user, using it in someway to affect the next set of output from the game and as you mentioned data and program management, since we also threw a couple of classes in there for extra confusion and good measure.

I've come more and more to believe in the practice of taking the simplest steps first, even if it seems like you can breeze right through them with whatever rudimentary knowledge you have, because nothing substitutes for real-world experience and it's better to figure out the smaller problems that can be resolved with these simpler excercises so as to avoid the headache of finally trying to figure out manipulating player input and classes on the larger scale of a mud-type interface.

This topic is closed to new replies.

Advertisement