• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
alexfeetham

Text based adventure game Microsoft Visual Studio c#

16 posts in this topic

So i've recently started on a college course for games development, for my programming unit which has so far focused on Event drive programming using c# (about 2 months in now) i have to create a text based adventure game, something along the lines of a zork type game. My initial attempts were using a if statements to manage where the character goes e.g. "If (txtIn.Text = "left")

                                                                                                                                          lblOut.Text = "You have gone left.......Insert next part...;"

 

My tutor semi hinted at a better way to do this having the information on a different file or page with the locations and the items at those locations which i've narrowed down to either being a class page or XML file. Had a friend briefly explain how to store information on a class page and made a basic one for character information. I have no idea how to take information and use it from these pages in the game itself though which is the issue, google has been of little help in this case (allthough it did allow me to stumble upon this forurm =D). Can anyone point me in the right direction? Will keep looking and trying to figure it out myself regardless.

Cheers, Alex.

0

Share this post


Link to post
Share on other sites

Not sure what a class page is (Google only brought up Microsoft's Page class, which looks like something entirely different).  XML is a viable option though and the quickest/easiest way to work with XML is via an available XML parser.  One of the easiest to get started with is TinyXML.

1

Share this post


Link to post
Share on other sites

Wow, thanks for the responses =D Gonna see if i can get a room class going, one thing I don't understand is how I can actually use that in the game, you may have already mentioned in your reply and on one of the links so if you have i'll get to it at some point =) edit: Got a basic dictionary for storing the rooms, now I just gotta figure out how to create a currentRoom variable and how to use it.

Edited by alexfeetham
0

Share this post


Link to post
Share on other sites

Again, this is a school assignment, so I'm going to be specifically vague...

 

A "Room" class, listing all information (Description, exits (hint: Enums), and items)

 

Your basic map is 2D.  North/South & East/West...  A multidimensional array to handle your multi-dimensional map.

 

(Also, your NORTH, SOUTH, EAST, WEST enumeration should be checked to see if it's a valid exit).

2

Share this post


Link to post
Share on other sites

Well i guess im going into object orientated programming much sooner than we were going to be in class, nice to get a head start =P Means whilst the rest of the class is learning I can just sit back and do some programming.

After a few hours of research, talking to a friend (mainly him confusing me with code I can't even comprehend) i've stumbled across a few sites with similar projects that actually explain their code and how it all works giving me the necessary tools to get cracking with my own. 

Aspirer I understand what you mean by the 2D map N/S/E/W and how to implement that and i'm currently working on it. Soon as that's up and running and there's some basic navigation within the game I can start to expand it adding objects and how they are needed to progress within the game.

All in all programming rocks, I only wish I had hopped onto this course years ago rather than faffing around with A-Levels and such (god what a waste of time that was, I could have been neck deep in programming by now and at uni).

0

Share this post


Link to post
Share on other sites


That style of text adventure is easy to implement as a state machine.Since you are just entering your studies, you probably won't learn about state machines for another year or two.
Perhaps a good time to mention your article "State Machines in Games" from earlier this year.  Might make for good "further reading". cool.png
0

Share this post


Link to post
Share on other sites

Frob, read through your article that jbadams linked. Its for sure something I will look into in the future and have the link bookmarked =). Got the framework for the game built including a way for the user to exit the game and a message being output before they do rather than the game just closing.

In essence all i need to do to have working navigation is add rooms to the game and their respective exits, before I do that though theres plenty more for me to add such ass items that the user can find and ways they interact with the game, also thinking of adding traps to the world e.g. "You have enter blah blah room, in front of you is a trap, there is a chance you can skillfully navigate your way past it but you may fail." With a preset chance for the user to fail or succeed with failure resulting in the user taking a hit to their health.

I would also like to add monsters to the map but thats something I will look into later. Considering when I made this post my knowledge of how to even go about this was slim to non I don't think i've done bad =P

Cheers to everyone who has posted in this thread, some really useful information here.

1

Share this post


Link to post
Share on other sites

Great progress Alex, congratulations!

 


In essence all I need to do to have working navigation is add rooms to the game and their respective exits, before I do that though [...]

 

If you haven't already done so I'd add at least two or three rooms and exits to the game to at least verify everything is really working correctly.  It shouldn't take you long, and you can then proceed to add all those other cool ideas, but if you add all the other features first you might have more trouble tracking down any problems with your existing code. It's always good to verify that what you've done seems to be working correctly before proceeding. smile.png

1

Share this post


Link to post
Share on other sites

Already done that =) Added a few filler rooms to test the code works, so far everything works fine. Had a few little issues early on that I fixed easily enough.

1

Share this post


Link to post
Share on other sites

Well I feel that C# is beating me right now. here's my progress so far.

 

Done:

- Method for creating rooms in the game and adding exits to them.

- Game loop

- Intro including storing character name as string (dunno if i'll use it again its more a hello so and so your adventure starts here type thing)

- Put the level list into the room class rather than having it in the program class (was easier than I thought)

- Put a few tester levels in to make sure everything works and navigation is possible

- Basic commands such as "help", "go", "quit" all working as intended.

To Do;

- Add items in (currently working on and its frustrating)
- Add inventory display to the game

- Add Player health to the game (shouldn't be hard to do to be honest, just gonna do it later)

- Add Traps to the game that have can affect player health

- Add monsters that need to be defeated to progress (will add weapons, easy once items are in)

- Finish the game!!

 

My first idea for adding items in was using a method within a separate class as I did with the rooms to list the items in the game and link them together. I can list them but i'm currently working out how to actually link them together e.g. If the players writes the command "take item" it will look to see if there is an item linked to this room and if so display that the item has been picked up and also write that it has been taken. I can't seem to link a level to an item (from class to class). 

Also this is due in next week so I have decided I will hand in the bare minimum required to pass the criteria and keep this as an ongoing personal project. I want to eventually have this as a finished game that I can keep adding to =P

Starting object orientated programming next month so im sure a lot of this stuff will become clearer on how I should approach them.

Cheers for any help that anyone has given so far it's been much appreciated.

TL;DR?

 

1

Share this post


Link to post
Share on other sites

Well as of tomorrow (provided I finish it up in time to a good standard) this becomes a personal project =) So no time restraints can just change it to my hearts content =D

2

Share this post


Link to post
Share on other sites

Congratulations on completing the project sir. :)

 

I'd also like to say that this thread was much better than many of the other homework help threads out there. So thumbs up there as well. 

 

- Eck

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0