Recommended Posts

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!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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"...

Edited by rafael rodriguez

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


  • Forum Statistics

    • Total Topics
      627770
    • Total Posts
      2979002
  • Similar Content

    • By durianodour
      Hi, I am a newbie game developer. I need to develop a simple 2D game, it is really simple. 
      I have a Human model that should jump every n seconds.
      1. User sets different several options in settings. The first option is the game time and the second option is jump count.
      2. The Game engine should determine how much time is required to model one single jump, simply by dividing gameTime/jumpCount. As a result we will find the time per one jump.
      3. Single jump has some kind of physics. When the human model jumps, it should bend the elbow, knees. Jump starts from the bottommost point to some top point. Up and down. But this doesn't really important and all physics should be considered by moving some point up and down. 
      I cannot figure out how should I build my game loop and physics processing to respect user options. If a device cannot draw or process physics at desired time it should be laggy, but the whole game time should as a user has set in settings.
      Please suggest a strategy to implement this correctly.
      Thanks
    • By SvetlanaRosemond
      I was reading on this site about the Liskov substitution principle. It states:
      From my understanding this means that whatever methods are in my base class, they must be implemented in my subclass, and according to this page, if you override a method in the base class and it does nothing or throws an exception, you're in violation of the principle.
      Suppose I had an abstract class called Weapon, and the subclasses ReloadableWeapon and Sword. ReloadableWeapon contains a method that's unique to that class, called Reload(). When declaring objects, standard practice is you do it from the abstract class and then subclass, like so:
      Weapon rifle = new ReloadableWeapon(); Weapon sword = new Sword(); If I wanted to use the reload method for a rifle, I could cast it. Based on numerous articles and textbooks, this could lead to problems later on.
      Also, if I have the reload method in the base class Weapon, then Sword would ignore or throw, which is wrong.
      If I wanted to avoid all that, would using the Strategy Pattern be a viable option?
       
      public final Weapon{ private final String name; private final int damage; private final List<AttackStrategy> validactions; private final List<Actions> standardActions; private Weapon(String name, int damage, List<AttackStrategy> standardActions, List<Actions> attacks) { this.name = name; this.damage = damage; standardActions = new ArrayList<Actions>(standardActions); validAttacks = new ArrayList<AttackStrategy>(validActions); } public int attack(String action){} // - Call any actions that are attacks. public void standardAction(String action){} // - Call aim or reload here. public static Weapon Sword(final String name, final damage, final List<AttackStrategy> standardActions, final List<Actions> attacks){ return new Weapon(name, damage, standardActions, attacks); } Attack Interface and Implementation:
      public interface AttackStrategy{ void attack(Enemy enemy); } public class Shoot implements AttackStrategy { public void attack(Enemy enemy){ //code to shoot } } public class Strike implements AttackStrategy { public void attack(Enemy enemy){ //code to strike } } 'm not asking if I've implemented the Strategy Pattern correctly, but rather can I use the pattern when faced with a subclass that has a method unique to that subclass and I don't want to cast it? or in other words, rather than violate the LSP, can I prohibit the use of inheritance and use the Strategy Pattern to implement the require methods?
      Notes:
      The pattern solves my problem in 2 ways:
      I don't have to downcast, I can store my Weapons in a List<Weapon> collection without worrying about checking the type, and then casting Any weapon that isn't Reloadable, won't have the concrete class Reload. This mean no throwing or leaving the method blank  
    • By JJCDeveloper
      I want to make professional java 3d game with server program and database,packet handling for multiplayer and client-server communicating,maps rendering,models,and stuffs Which aspect of java can I learn and where can I learn java Lwjgl OpenGL rendering Like minecraft and world of tanks
    • By Pillowdo
      Hello, My name Is pillowdo, so I have alot of question but let me first tell you what I'm aiming for.
      1) Making a game Becouse I have ALOT of free time I want to make use to
      2) programming is one of those things I really wanted to learn 
      3) I'm not excpecting anyone to even download my game even if it was good so this isn't aiming for the money
      4) so If I'm not here for the money and just to learn programming then why make a game? insted just learn the language Right? not really I want to make a game for experince too, so if I decided to make a nother game, Then I would know what I'm doing and it would be alot more easier and I would know the amont of work and money it would take, so Experience is another reason
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      Things I don't excpect 
      1) Money, I know this will probebly make nothing but I'm not here for it
      2)Time, I don't excpect this to be easy or short, most good indie games take a long time, Like the famous game stardew valley, it took the developer 4 years and each day around 10 hours =14,000+ hours, he had a part time job too               
      3)Good Game, I know its not possible to make a game as good as GTA5, WoW, God of War, Halo ...etc They take YEARS to make even with hundereds of Artiest and developers but it IS  possible to make a game Like stardew valley if you really put Some Hard work and ALOT of time into it 
      (you Might have relised I keep talking about stardew valley, I won't make a game on the same idea I will be original but The game really insperies me, as well as alot of other games but SV must be one of the most)
      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      (EDIT: I forgot to mension this, I'm going for a 2D art style. it makes BIG diffrence in PL & The Engine so I thought I'd say that)
      The questions:
      1) The Programming Language, There are so many Languages and people say "Its a preferance and there isn't much difference" but I want to make sure about that point, + It also depends on what engine your going to be using which brings me to the second point 
      2) Engine so I've seen ALOT of Engines and it mostly goes down to The price but I don't think that's a issue I can download it for free Online and get The Original if my first game can over it ( considering I make something) 
      3)Art style so I'm reaaaaaly confused on this point and I know there are So mannnyyyy kinds of art style but let me tell you what I'm looking for
      a) I like art styles like , Warcraft 3, stardew valley Maybe, FATE And  GraalOnline classic it dosn't have to be the same but atleast something around that style that I enjoy looking at
      b) I Will go for a 2D style game, like Stardew valley and Graal Online classic, 
      c) I know there are websites that give you there drawings and art and everything but you have to credit them in your game, I want to make everything and all the credit by myself and Maybe one of my relatives will join me IF I understand how this works and find him a role he Might Like (Like art for example ) 
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      Important Note:  I don't mind If the game takes 4-5 years of development, as long as I find passion and enjoyment then It will really pushs my limits to the max 
       
       
       
    • By CodeBro1
      I'm trying to find a way to check which frameworks, tools and game engines are popular, mainly because I'm trying to decide which programming language to learn, which would stem from would stem from which tool I'm going to use. Any advice?
  • Popular Now