Sign in to follow this  
Layne Parlor

Prototyping a text based game

Recommended Posts

Layne Parlor    100
I would like to prototype a semi-complex text based adventure using C++, a scripting language like **python or lua, and a database system. I doing this as an exercise in game development because it will allow me learn more about the programming as well as let me focus on the making a fun game with relative ease because of the lack of a graphics system. another goal of this project is to build a core system that will allow me to put a graphical interface on top of the text based engine with relative ease.

since this is a prototype i want to use easily accessible file formats such as .txt, .csv to input player, enemy, items, and other object data.

the problem i am having is getting my foot in the door as far as design. i have done a couple of tutorials but they came out pretty buggy when it came to reading in files in the txt format.

does anyone have any advice on reading in the files for object and world data??
or any working examples to get me pointed in the right direction in creating a flexible text based adventure game??

**this is feature is completely optional but it is a concept that i would eventually like to implement in the future

Share this post

Link to post
Share on other sites
laztrezort    1058
First off, I would not describe a project utilizing C++, scripting language embedding, and database support as merely "semi-complex." Especially if you are learning C++ (which it sounds like from what you are describing), this is quite a big bite to take at once even for more experienced programmers.

That said, the first thing I would tackle is outlining exactly what data needs to be stored in external files. If it can be represented fairly simple (such as a table), then creating a parser would not be difficult. If a more complex representation is necessary, I would look at incorporating XML, JSON or similar support, most likely by leveraging an existing library.

Your question is fairly broad. Maybe you need to narrow your focus (and your question). Is there a particular, specific issue you are having with reading files? Is it parsing the data, or using the C++ standard IO? If you post some code you have tried (along with a description of what you want it to do), or at least ask more specific questions, someone here may be able to better help you.

Share this post

Link to post
Share on other sites
meeshoo    512
Whenever I learn a new technology, I do the following:

1. Do a few tutorials, just to get me started (the background experience I have helps a lot, but even if you are knew they worth a try).
2. Establish a goal, like a simple project I want to complete using the new technology.
3. Break down the goal into very specific sub-goals and order them to decide which depend on which
4. Start making goals in order and don't let any of them unresolved. Research and learn about the new tech as much as it needed to complete each goal.

I think in your case you did the first two steps, but you didn't break down the main goal into small enough sub-goals. Your question should sound like: "This is my file I want to read, this is the code so far, why it isn't working?". If you can do that, I am sure we will find a way to help you :)

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