Text Based RPG

Started by
6 comments, last by rafael rodriguez 6 years, 6 months ago

Hello everyone! First if you are taking the time to read this "Thank You!" I'm new to programming (Java and C), and I would like to learn/practice more by making a Text-Based RPG. I have an idea in mind and I kinda started to code it in Java but I'm not sure how to put my bits of code together and would like some help. I'm not asking to make the game for me, but to guide me in the right direction... maybe some books, tutorials or even some one on one if you don't mind.

The game I have in mind is going to contain:

A player, world, leveling system, melee combat system(with some skills), monsters, inventory system, intractable objects(like a tree that you can cut down), item storage system, NPC's that interact maybe a store or something, and a saving and loading system.

After that maybe I would like to add some more Non-Combat skills, a mage and range combat system along with some more skills, and make the world a bit larger with some interesting stuff in it...

Anyways that's a lot so thank you for taking your time to read this, let me know if I can explain anything better or if I didn't explain something enough!

Advertisement

The most important thing in any challenging project is to write down exactly what your goals are so every step of the way you know what you're trying to achieve. Any effort you put into a project when your goals are fuzzy is potentially wasted effort. It often happens that people will start work on a game and never finish because they end up wasting their effort working toward fuzzy goals. To avoid that fate, write down in full detail exactly what you expect from the game, and that process will focus your mind on the specific problems you must overcome and help you find ways to implement your design.

Here's a link to a guide to writing game design documents: How (and Why) to Write a Great Game Design Document

9 hours ago, rafael rodriguez said:

A player,

Start here learn how to create a player class and how to set it's stats.

 

If you're writing it in C and you are new, I find the difficult part to be using structs and pointers to create a 'database' of the world. It can get surprisingly complicated very quickly if you aren't thoroughly grounded in that type of stuff. So I personally would make sure you fully understand and do a few test programs involving linked lists and the like.

If you're really impatient and just want to get some exposure and write a small game quickly. you can cheat like I did and just have a function for every room, then a switch statement for player choice. Although this results in a lot of copy and paste ugly code and is not to be recommended.

Let us know how you get on as I'm still trying to find the best way of doing this in C too.

There is so much structure in this kind of programs that the only sane option is to evolve to an OO-way of writing the code.

You make structs for each kind of data, then for each struct you have a set of functions that take a pointer to "its" struct as the first argument. For keeping track of what function does what, use a name convention for the function name, eg "structname_function(structname *this, ...)".

I found this pattern already before OO was invented (likely I have been writing code too long :P ).

The simple form of the above supports single inheritance, by putting the base struct as its first member. You don't get overloading or polymorphism easily, but usually that's not needed.

 

Now, if you evolve to this kind of code structure anyway, I don't see the point of not simply switching to a language that has "class" in its vocabulary where you get all the above out of the box, inclusive extensive error checking by the compiler.

15 hours ago, Outliner said:

Here's a link to a guide to writing game design documents: How (and Why) to Write a Great Game Design Document

This was the first thing I did, so I already have a basic GGD of my game. Thanks for the info tho!

11 hours ago, Scouting Ninja said:

Start here learn how to create a player class and how to set it's stats.

 

So far I have a very basic player class with all its stats, leveling system, and some other incomplete stuff! I'll attach the file for my player class. Thanks!

Player.java

10 hours ago, ICanC said:

Let us know how you get on as I'm still trying to find the best way of doing this in C too.

I'm doing it in java since its a more "advance language"...

This topic is closed to new replies.

Advertisement