2 Replies - 3269 Views - Last Post: 09 July 2012 - 07:01 AM Rate Topic: -----

#1 d_man10345  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 31-May 12

Building text based RPG, question about keeping the source neat.

Posted 08 July 2012 - 09:31 PM

Well I'm taking my first shot at a simple text based RPG. I'm not looking for anything fancy just going to use it as a simple exercise. I've been self taught java and some of it has been very broken up. I want to get more organized with my coding. I'm going to list what I believe I need to build this game and I'm asking if the members of this community will help tell me what I did wrong and what I could do to help keep it organized.

Basically the game is going to start off as a simple character with a name, health, and maybe a couple other attributes. There is going to be a story line, may start simple and expand later, that the player can progress through. I would like to be able to save the character file and load it later. Depending on how far I take the development of this game I may add a bigger map. Also depending on how far I take it I plan to add combat maybe with magic.

So this is what I think I'm going to need. Feel free to tell me where I'm wrong and it would be greatly appreciated if you could kindly correct me.
  • Character Class
  • Storyline Class (maybe)
  • Save Class (for specifically saving the attributes and progression of the character into a file)
  • Map Class (If I expand the map)
  • Combat Class or Magic Class
  • Main Class that pulls everything together


Ok so if anyone finds something I'm missing or corrections please let me know. I'm not asking how to build it, I just kind of want to lay an outline before I begin to code the game. My hope is if I can build a neat code several times it will become a habit.

Is This A Good Question/Topic? 0
  • +

Replies To: Building text based RPG, question about keeping the source neat.

#2 Luckless  Icon User is offline

  • </luck>
  • member icon

Reputation: 292
  • View blog
  • Posts: 1,146
  • Joined: 31-August 09

Re: Building text based RPG, question about keeping the source neat.

Posted 09 July 2012 - 05:51 AM

It's hard to say, because it all depends on exactly how you code it.

The Character class is good as an interface that you can branch off of for user character as well as NPCs for you combat or interactions.

Story Line might work if you make it a choice where stories lines are linked together in a tree structure, with the children being decisions that you make leading to differing stories

The characters will have their own attributes, but a save/load class that takes a user character's stats and saves to a text file or database sounds pretty good

If this is a text-based game, I don't know what good a map would do

You should make an Inventory class that a Character will have. Inventory is a list of Item( an interface)

What about a City, that has Buildings for choices with Characters (NPCs) inside to buy things from?

You see, the possibilities are endless with this. Start with a static class diagram and ask yourself, what does such and such need? Nouns are probably going to be classes. Think generic functionality then add more specific function as you create children classes
Was This Post Helpful? 0
  • +
  • -

#3 Storm2059  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 44
  • Joined: 29-June 12

Re: Building text based RPG, question about keeping the source neat.

Posted 09 July 2012 - 07:01 AM

Goodluck with this I'm also developing a TBRPG aswell but I'm having problems right now, might just do my saving and loading for the problem differently but so far it's good :).


Edit: I also recommend an ItemDefinition class used to handle/read items from a .xml or .bin file.

This post has been edited by Storm2059: 09 July 2012 - 07:09 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1