How can I create a text based adventure game?
#1 Members - Reputation: 107
Posted 03 July 2012 - 11:02 PM
#2 Members - Reputation: 789
Posted 03 July 2012 - 11:28 PM
I gave some suggestions in the above link, if you have more specific questions I'll try and help.
#3 Members - Reputation: 680
Posted 03 July 2012 - 11:32 PM
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 Members - Reputation: 247
Posted 04 July 2012 - 09:28 PM
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.
#6 Members - Reputation: 247
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 Members - Reputation: 966
Posted 05 July 2012 - 12:58 PM
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 Members - Reputation: 1408
Posted 05 July 2012 - 01:16 PM
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.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.
#9 Members - Reputation: 207
Posted 06 July 2012 - 10:25 AM
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?)






