Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (568)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Working On first Text based RPG game.  (Read 1087 times)
0 Members and 1 Guest are viewing this topic.
Offline cloudwindgate

Senior Newbie





« Posted 2013-07-02 19:46:06 »

Quick background: I've learned from some books such as head first java. I have a few other books which I've started, but I want to try my hand at this again. I've only made one application that was all my own and it was a list randomize all other programs I've made are out of books.

So please remember I'm still very newbie to all this so yeah.

So I want the game to contain locations, a basic item like a potion, and an enemy with very very simple AI. (i.e attack)
So this is all I understand I would greatly appreciate any advice. One of the biggest issues I'm having a hard time figuring out is how to set up and change button based on what can be done. Does it need to be simplified in some way.

List of known classes that are needed
Escape
-Escape();-"Constructor" constructs gui and basic settings
-main();
- go(); -starts game
-battle(); - battle loop
LifeForm
holds basic common states of every being

Player (extends LifeForm)
-getItem() - gets a specific item out of ArrayList<item> bag

Baddie (extends LifeForm)
event(); - holds special information for when baddie enters a battle.  

Location (holds info about current area)
-Room();-holds info on current room

Room
BaddieList<> holds a list of baddies present in the room
ItemsPresent<> hold list of items in the room for the player to search for.
isExit()- tells if this room is an exit from this floor. (currently game end)
getBaddie(i)- gets a baddie from the arraylist at index i
getItem(i) gets an item at index i to give to player

Item
basic states and information about a given item.



Honestly I'm a little overwhelmed feel already Sad am I just not ready yet? Any advice would be greatly appreciated thank-you.
Offline scanevaro
« Reply #1 - Posted 2013-07-02 19:49:19 »

i really dont get what are you asking or saying :S
Offline RobinB

JGO Ninja


Medals: 44
Projects: 1
Exp: 3 years


Spacegame in progress


« Reply #2 - Posted 2013-07-02 19:51:22 »

Seems good, best advice would be to start jamming code.
Its always overwhelming when you start at some new programming techniques, but trail and error is really the best way.
Just make sure you got something what works, architecture comes later, when you're more advanced.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline cloudwindgate

Senior Newbie





« Reply #3 - Posted 2013-07-02 20:43:12 »

I'm going too I guess I can ask more specific question as I get stuck.
Offline h3ckboy

JGO Coder


Medals: 5



« Reply #4 - Posted 2013-07-03 09:19:36 »

like RobinB said you're off to a good start, just remember your structure as you code because if you code the core of your program with everything in mind it'll be really easy to add extremities Smiley
Offline davidc

Senior Member


Medals: 5
Projects: 2



« Reply #5 - Posted 2013-07-03 10:59:17 »

Strip it down to something simpler to begin with. Just have rooms, and exits (or "portals" if you will) that lead from one room to another. Implement simple navigation between rooms.
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 133
Projects: 4
Exp: 3 years



« Reply #6 - Posted 2013-07-04 01:59:32 »

If LifeForm defines states it should be an enum Pointing but I don't think that's what you intended. As a superclass for enemies and the player, just include the stuff that's common to both - moving, attacking, depends on the game.
Also, what you've learned in "Head First Java" is not enough to make a good game without further instruction. It's a good book, but standard java serves only as the base to learn game development. Beginning java books like that don't teach essentials of gamedev like the game loop, so I suggest you look at some tutorials (fyi, you're using java2d).
Offline cloudwindgate

Senior Newbie





« Reply #7 - Posted 2013-07-06 19:43:55 »

If LifeForm defines states it should be an enum Pointing but I don't think that's what you intended. As a superclass for enemies and the player, just include the stuff that's common to both - moving, attacking, depends on the game.
Also, what you've learned in "Head First Java" is not enough to make a good game without further instruction. It's a good book, but standard java serves only as the base to learn game development. Beginning java books like that don't teach essentials of gamedev like the game loop, so I suggest you look at some tutorials (fyi, you're using java2d).

-_- wouldn't I use enum if I had predefined states that I didn't want changed? Yeah I've noticed that the two beginner books I have no matter how in depth they go haven't fully prepared me
Offline cloudwindgate

Senior Newbie





« Reply #8 - Posted 2013-07-06 19:49:49 »

So I've been working on it and I've got some simple stuff going however I'm curious if I should move the battle loop out of the main class. This is what it looks like


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
private void battle(Player bPlayer, Baddie badguy) {
      System.out.println("A " + badguy.getName() + " jumps out at you!");
      boolean playerAlive = true;
      boolean baddieAlive = true;
     
      System.out.println("On your turn type Attack defend or item to take an action");
      fight:
      while(playerAlive == true || baddieAlive == true){
         if((bPlayer.getHealth() <= 0)){
            playerAlive = false;
            break fight;
         }else{
            System.out.println("It's your turn.");
            String action = input.nextLine();
            if(!action.equalsIgnoreCase("attack") && !action.equalsIgnoreCase("defend") && !action.equalsIgnoreCase("item") && !action.equalsIgnoreCase("block") ){
               System.out.println("What? Lets try that again.");
               break fight;
            }
            move(action, bPlayer, badguy);
           
         }
         if(badguy.getHealth() <= 0){
            baddieAlive = false;
            System.out.println(badguy.getName() + " has fallen to your might.\nYou've gain "+ badguy.getXpReward() + " EXP.");
            //if(badguy.hasItem() == true){
             
            //}
           bPlayer.addExp(badguy.getXpReward());
            break fight;
         }
         
         if(bPlayer.getHealth() <= 0){
            playerAlive = false;
                                break fight;
         }else{

            String bAction = badguy.makeMove();

            bMove(bAction, player, badguy);
         }
      }
     
   }


I realize I would only be passing a reference of player to the method to make changes so I'm guess having battle in a separate class would be good, but I wanted to see what others have to say.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (6 views)
2014-10-02 14:36:20

Pippogeek (41 views)
2014-09-24 16:13:29

Pippogeek (32 views)
2014-09-24 16:12:22

Pippogeek (22 views)
2014-09-24 16:12:06

Grunnt (47 views)
2014-09-23 14:38:19

radar3301 (30 views)
2014-09-21 23:33:17

BurntPizza (65 views)
2014-09-21 02:42:18

BurntPizza (37 views)
2014-09-21 01:30:30

moogie (44 views)
2014-09-21 00:26:15

UprightPath (53 views)
2014-09-20 20:14:06
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!