Jump to content

  • Log In with Google      Sign In   
  • Create Account


How can I create a text based adventure game?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 wormhero1   Members   -  Reputation: 107

Like
0Likes
Like

Posted 03 July 2012 - 11:02 PM

I've wanted to make games for a while now. I started learning c# about a week ago. I know some basics, but I'm still learning it. I just wanted to ask how can I start to create a text based adventure game. I have yet to find a real tutorial on it. Can anyone give me some tips on creating one?

Sponsor:

#2 laztrezort   Members   -  Reputation: 954

Like
0Likes
Like

Posted 03 July 2012 - 11:28 PM

There was a similar question I replied to a little while ago, here: http://www.gamedev.n...ork-clone-in-c/

I gave some suggestions in the above link, if you have more specific questions I'll try and help.

#3 DevLiquidKnight   Members   -  Reputation: 834

Like
0Likes
Like

Posted 03 July 2012 - 11:32 PM

Your going to want to make a set of rooms in some sort of format, that have a variety of things in them and then load them from say an XML file. It's somewhat of an advanced thing to build for a beginner to C#. Have you done coding in any other languages?

I would recommend you start smaller then this, perhaps try making a game where their is a grid of locations that are drawn to the screen and it lets you move through the grid somewhat like a map. You can imagine using an array to store the information of where the person is, and then moving them through the array based on where they want to go. Then each area could have say a chance of getting attacked by say a monster, and then it would switch to a combat system. Where you would fight this monster before you can move again.

This thread may also prove useful.

Edited by DevLiquidKnight, 03 July 2012 - 11:34 PM.


#4 CaptainKraft   Members   -  Reputation: 265

Like
0Likes
Like

Posted 04 July 2012 - 09:28 PM

I made a SUPER SIMPLE and probably poorly done text game in Java (which is very similar to C#). If you want to check it out as an example you can see the game and a link to the source on my website.

What I did was build a class for each major concept that I wanted. Items, rooms, entities(players and monsters). The rooms were a bit tough to tackle. The simplest way I could imagine doing it was assigning exits to each room which were just other rooms themselves. When a player went though an exit they were put in the next room. If there was no exit in that direction(N S E or W) then it was null and did not allow traversal.

My source code will explain in better but if you have any questions, feel free to ask: myself and the other programmers here will be able to help. Good luck.

#5 nugget850   Members   -  Reputation: 101

Like
0Likes
Like

Posted 05 July 2012 - 01:19 AM

This is my first coding language. What are some suggestions for creating a game simpler?

#6 CaptainKraft   Members   -  Reputation: 265

Like
0Likes
Like

Posted 05 July 2012 - 07:35 AM

This is my first coding language. What are some suggestions for creating a game simpler?


I think just about everyone would like simpler (read better) code. What I find helps me the most is making sure that I know what I want to do before I start coding. Thinking about what you are going to program is a huge part of programming. Even if you don't know exactly what data structures you will use to solve a problem, just make sure that you understand what needs to get done.

My answer is pretty abstract, but there really is no language specific advice to give for that question. It's all about how you tackle the problem.

#7 kseh   Crossbones+   -  Reputation: 1863

Like
1Likes
Like

Posted 05 July 2012 - 12:58 PM

It's already been mentioned and I'll repeat the fact that there's a lot of techniques that you can probably learn yet that would make it easier to produce a text adventure. However with careful thought about what you already know and some creativity you should be able to come up something that will help you feel like what you're learning is worthwhile and in the direction that you've been hoping for. If I recall, my first text adventure used little more than a couple of switches and a whole lot of if statements. Code wise, it was horrible. But it more or less did what I wanted it to and I was proud of the result.

First I used pen and paper to draw a map which I think was just a 5 * 5 grid. I planned which directions the player could go for each location. I also figured out what text I would print for each location. For whatever location the player was in, I'd print the text, then collect input regarding which direction the player wants to move, if it's a valid direction then move the player to the desired location, and repeat.

As for challenges of some kind to complete, you will need to know what those challenges are and how the player would be expected to beat them. Developing a combat system is one option but it might be a bit early for that. It'd probably be easier to think of something like, there's a giant frog blocking the player's way in one location. You would track the fact that the frog is in this room and so long as it is in this room, attempts to travel through one exit will be disallowed. The player recalls that in another location is a jar of flies. He travels back to the room with the jar. The player is somehow given the option to get the jar. The fact that the player now has the jar in his possession is tracked. The player returns to the frog. The player drops the jar (again tracking the fact the jar is in the player's possession). When the jar is dropped in this specific room, the frog chases the flies and is no longer blocking your path.

You can do the sort of stuff I described above by just setting some variables, using if statements, and printing to the screen. Nothing spectacular at all. If there's one reason to not proceed yet though, it is that using only those techniques, you *will* end up with a large mess of code that will be difficult to manage and identify where problems are occurring. Organizing things into classes and being able to load data from files could help that. Truth be told though. if you have no experience with that sort of thing you're just as likely to end up with a giant mess that doesn't work either. So the best tips I can give would be to; get creative with what you know, plan the best you can, give the plan a try, don't be afraid to fail, learn something about what you did, and repeat.

#8 larspensjo   Members   -  Reputation: 1526

Like
0Likes
Like

Posted 05 July 2012 - 01:16 PM

So the best tips I can give would be to; get creative with what you know, plan the best you can, give the plan a try, don't be afraid to fail, learn something about what you did, and repeat.

I couldn't agree more. Either you succeed with what you want to do, which is fine. Or you don't succeed to get what you want. The failure is unfortunately one of the best ways to learn. That is when you start to appreciate design patterns. Without having done the failure first, it can be hard to understand why a specific design patterns are used.
Current project: Ephenation.
Sharing OpenGL experiences: http://ephenationopengl.blogspot.com/

#9 DavitosanX   Members   -  Reputation: 271

Like
0Likes
Like

Posted 06 July 2012 - 10:25 AM

To the OP, if you think that a text game is easier to do than a graphical one, you may be mistaken. Really, learning to display an image on the screen isn't particularly difficult. If you already have a basic grasp on your language of choice, it's at most a one-day endeavor.

If you like, take a look at Inform 6 or 7. It's a programming language designed specifically to write interactive fiction. You'll realize soon that those games' complexity is staggering. Don't shy away from graphics. Once you start getting the hang of it, the results will be very satisfying.

Of course, if you mean to program a text adventure, do try out Inform. After all, some of the greatest games of all time are interactive fiction (The Lurking Horror, anyone?)

Starting out in game programming? Me too! Check out my blog, written by a newbie, for the newbies. http://myowngamejourney.blogspot.mx/





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS