Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (526)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  Textadventure (Newb Questions)  (Read 6179 times)
0 Members and 1 Guest are viewing this topic.
Offline EatenByAGrue

Junior Devvie


Medals: 3



« Reply #30 - Posted 2011-09-14 21:50:18 »

Yes of course I know that you can run jars from the console. I just meant if it's okay to post a game in the "Showcase" that solely runs in the console ... I thought you should only put more "advanced" games there Wink

EDIT: I will have a finsihed version (if you can call it like that) by tomorrow.

Greetings

P.S.: Can't you 'un'-appreciate it... or maybe a mod?

It is pitch black. You are likely to be eaten by a grue.
Offline ReBirth
« Reply #31 - Posted 2011-09-15 02:52:06 »

For shopwcase maybe you can ask Kappa the mod. Game is rated not only based to graphics but also in term fun of gameplay, story, replayablity etc. I dont think some of us will shout you in showcase like "wtf is this?! your game is suck! burn it! you got to the hell and bring along this crap!" so dont worry too much  Cool


EDIT: D'oh! I clicked the appreciate button before I clicked the quote button xD free medal for you

I didn't see that. Do it again now trying to quote me  Tongue

Offline ra4king

JGO Kernel


Medals: 355
Projects: 3
Exp: 5 years


I'm the King!


« Reply #32 - Posted 2011-09-15 03:37:42 »

I didn't see that. Do it again now trying to quote me  Tongue
Nice try Wink

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline EatenByAGrue

Junior Devvie


Medals: 3



« Reply #33 - Posted 2011-09-15 11:11:41 »

Okay, maybe I'll make a thread in showcase when I improve it further. For now I'll just post it here.

I also included the source code so feel free to criticise and comment. I know that there is a lot of room for improvement (for example the way I included the items is very ugly).

I also added "blocking" to the fights, but I think it threw the balancing off and also made them even longer. Anyways I hope you can enjoy it at least a little bit Smiley

EDIT: Removed Link

greetings

P.S.: Oh and I would love to see how far you come with your characters Smiley

It is pitch black. You are likely to be eaten by a grue.
Offline aazimon
« Reply #34 - Posted 2011-09-15 15:59:37 »

This pretty good so far.
I think in the "Event menu" you should move the save feature near the bottom of the list, making the top items the ones used more frequently.
I'm not sure the continue after an attack is needed, maybe just go back to the event menu. It feels like an extra step.
Offline EatenByAGrue

Junior Devvie


Medals: 3



« Reply #35 - Posted 2011-09-15 19:53:28 »

Thank you very much Smiley

You are right, I moved the save feature down.

I'm not sure the continue after an attack is needed, maybe just go back to the event menu. It feels like an extra step.

Do you mean the Continue option after each of the enemy's attack? I included it because a friend of mine said, that it was annoying to always scroll up to see what the enemy did to him Smiley
But I guess it's not really interesting after the first few fights.

Greetings

EDIT: I think I will rewrite the game once again, trying to put the newly learned stuff to use (make Items work, improve Menus, etc.).

It is pitch black. You are likely to be eaten by a grue.
Offline aazimon
« Reply #36 - Posted 2011-09-16 15:58:07 »

Yes, the continue after the attack. Perhap condensing the results so they are visible on less lines would help.
Offline ReBirth
« Reply #37 - Posted 2011-09-18 04:27:36 »

I was lvl 4 Human brawler before ide out of potion Smiley

some little advice:
- fill HP when Level up
- cut down each turn info. I think the info about dice result isnt necessary.
- menu to buy items anytime
- show chance to win on every turn
and a bug, I bought big potion but it said "you now have 1 small potion". Maybe you did typo.

Overall, I really like the battle system where you use dice to determine the chance (guess that char's stats affect number required to some actions right???)

Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #38 - Posted 2011-09-18 14:38:59 »

When you are confident enought, try to do an applet version : a JTextEditor to show the text (I say JTextEditor so you can add some html tag  Wink) and a JTextField to enter commands.

But beware that it is not a simple modification. You will have to deal with event (when entering a commad) and it will change how your engine works. May be it is a good time to do it, later on it will be more difficult... well it is up to you and up to what you have plan to do.
Offline EatenByAGrue

Junior Devvie


Medals: 3



« Reply #39 - Posted 2011-09-18 15:11:43 »

@ aazimon:

Thank you, I'm going to change this in the next update. I thought that it would be interesting to see what actually went on "behind the scenes" alomst like playing a tabletop or D&D-kind of game. But I realised myself that sooner or later you just spam "1." again and again till the fight is over Smiley

@ Rebirth:

These are good ideas. Much appreciated Smiley

Quote
- show chance to win on every turn

Although I'm not sure how to do that, I'll try to come up with a solution.

Quote
Overall, I really like the battle system where you use dice to determine the chance (guess that char's stats affect number required to some actions right???)

Indeed. Basically it works somewhat like the Warhammer tabletop rules.

First Strike:
Whoever has the highest Initiative strikes first each turn - If the Initiatives are equal a die decides the outcome).

Chance to Hit:
This decides if the attack hits the target. Therefore both the player's and the mob's Weapon Skill are compared based on
the following rules.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
   
// Calculate the chance to hit based on the Weapon Skill of the Attacker and Defender
// attWS = attacker's weapon skill
// defWS = defender's weapon skill

      if(attWS == defWS) {
         neededToHit = 3;
         }
      else if(attWS >= (defWS + 1) && attWS < (defWS + 5)) {
         neededToHit = 2;
      }
      else if(attWS >= (defWS + 5)) {
         neededToHit = 1;
      }
      else if(attWS <= (defWS - 1)) {
         neededToHit = 3;
      }
      else if(attWS <= (defWS - 2) && attWS > (defWS - 5)) {
         neededToHit = 4;
      }
      else if(attWS <= (defWS - 5)) {
         neededToHit = 5;
      }


After that a die is thrown and the total is compared to neededToHit. If the total >= neededToHit the attack hits.

Damage:

The damage is based on the attacker's strength (and luck of course Smiley).

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
      rnd = dice.rollDice(1, 6);   // roll a W6 dice
     
      System.out.println("> The die comes up with " + rnd + ".");
      System.out.println("");
     
      if(rnd == 1)
      {
         System.out.println("Weak hit.");
         damage = (int) (attStr/2);
      }
      else if(rnd == 2 || rnd == 3 || rnd == 4 || rnd == 5)
      {
         System.out.println("Normal hit.");
         damage = (int) (attStr);
      }
      else if(rnd == 6)
      {
         System.out.println("Critical hit.");
         damage = (int) (attStr + attStr/2);
      }


Block Damage:
And last but not least the damage can be blocked. This is decided by comparing the defender's resistance
and the attacker's strength:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
      /* Calculate chance to block damage based on attacker's strength and defender's resistance */
      if(defRes == attStr) {
         neededToBlock = 5;
         }
      else if(defRes >= (attStr + 1) && defRes < (attStr + 5)) {
         neededToBlock = 4;
      }
      else if(defRes >= (attStr + 5)) {
         neededToBlock = 3;
      }
      else if(defRes <= (attStr - 1)) {
         neededToBlock = 5;
      }
      else if(defRes <= (attStr - 2) && defRes > (attStr - 5)) {
         neededToBlock = 6;
      }
      else if(defRes <= (attStr - 5)) {
         neededToBlock = 6;
      }


@ Bonbon-Chan:

I'm just starting on GUIs but I'm not sure if I already try to use them ... yet. Especially as I'm still struggling with objects (super, subclasses, where to use them, how to use them, etc...)   Grin.

Greetings,
EatenByAGrue

It is pitch black. You are likely to be eaten by a grue.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline EatenByAGrue

Junior Devvie


Medals: 3



« Reply #40 - Posted 2011-09-18 22:51:07 »

I openend a new "Showcase" - Thread for the game here:

http://www.java-gaming.org/topics/fight-for-arcadia-text-based/24793/view.html

It is pitch black. You are likely to be eaten by a grue.
Offline ReBirth
« Reply #41 - Posted 2011-09-19 03:49:16 »

oh yeah dont forget to try implement custom engine for random number generation.

Offline EatenByAGrue

Junior Devvie


Medals: 3



« Reply #42 - Posted 2011-09-19 11:00:35 »

You mean instead of using the java-pseudorandom number generator I should use a true random number generator?
I already changed the "dice"-code from
1  
 die = (int) (sidesOfDie*Math.random() + 1); 
to use the java.util.Random API instead yesterday, if you meant that Smiley.



P.S.: I would really appreciate if any suggestions regarding the game would be made in the other thread but I would still like to keep this thread for asking general questions  Smiley.

It is pitch black. You are likely to be eaten by a grue.
Offline sproingie

JGO Kernel


Medals: 202



« Reply #43 - Posted 2011-09-19 16:16:39 »

java.util.Random is lrand48 which as modern PRNG's go is pretty crummy, but it's way more than enough for rolling dice in a game like this.  Do not use anything but a PRNG (you may want to save a seed at some time), and do not write your own PRNG (they are devilishly hard to get right).  Write the game first before you start bikeshedding details like this. 
Offline EatenByAGrue

Junior Devvie


Medals: 3



« Reply #44 - Posted 2011-09-21 10:04:40 »

Write the game first before you start bikeshedding details like this. 

Yes I also don't see why I should write a custom engine for a simple game like that Smiley

I have two new questions:

I still don't understand Objects 100%. For example what if I have my "player object" and the "enemy object" and want them to communicate. The way I do it now only the "enemy object" can get information about the "player" via Getters and Setters (but not vice versa). I created them in the main game file like this:

1  
2  
3  
4  
5  
6  
7  
8  
private Player player;
private Mob mob;

public Main()
{
        player = new Player();
        mob = new Mob(player);
}


Is there a way I can get them to share information??

and No. 2:
When i have an class e.g. one that handles the player's input is it also good to make an instance in the main class or is it also okay to just create it in the class you really need it (since all the other objects don't need to see it) instead of passing it into a constructor.

Greetings, EatenByAGrue

It is pitch black. You are likely to be eaten by a grue.
Offline sproingie

JGO Kernel


Medals: 202



« Reply #45 - Posted 2011-09-21 19:06:20 »

Two objects communicate with each other by one having a reference to the other.  Let's move away from Player and Enemy, which is actually kind of a complicated situation, and on to objects more directly related.  Let's go with the worn out car analogy, because hey, I can't be original.  This is java-flavored pseudocode below, I'm leaving out the definition of getters/setters.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
class Car {
    Engine engine;
    public void stepOnTheGas() {
       Engine.rev(5000);
    }
}

class Engine {
   DriveTrain drive;
   void rev(int rpms) {
      int force = reallyComplexEquationOfTorqueAndWhatever(rpms);
      drive.applyForce(force);
   }
}

class DriveTrain {
    // We're leaving out all that complex transmission and differential stuff
    List<Wheel> wheels;
   
    void applyForce(force) {
        for (Wheel w: wheels) { w.spin(force / wheels.size()) }
    }    
}


Aside from being the world's worst mechanical simulation, what this demonstrates is how you build a system out of references from one part of it to another.  Notice how the Car doesn't even know about its wheels.  It talks to the engine, the engine talks to the drivetrain, then the drivetrain spins the wheels.  If you decided to break up the drivetrain later into a transmission and a differential, Car and Engine don't have to know about it -- it's not Car's responsibility to know.

Bureaucracy is the name of the game when it comes to good Object Oriented Design: every object has a job description that outlines its responsibilities, and those objects only ever talk to their immediate peers.  Car never talks to Drivetrain without going through Engine.  The technical name for this in software engineering is the Law of Demeter (http://en.wikipedia.org/wiki/Law_of_Demeter).  The wikipedia page on the subject goes off on a lot of tangents, but the three bullet points at the top are worth taking to heart.

Now, how does this relate to getting mobs and players to interact with each other?  Simple: they don't.  What you need is at least one middleman, a GameState of sorts, that knows about both, and is able to hook them up.  Chances are there will be all sorts of rules involved, like whether the player is aware of the mob being there (e.g. can they see it?) so that access will involve some more interesting methods than a mere getter and setter.  I'll see if I can dig up some of the interesting MUD designs I had from years back and share some with you.
 
Offline aazimon
« Reply #46 - Posted 2011-09-21 19:50:42 »

What information are you wanting to share between the player and enemy?
In doing the battle, I would recommend that the player will call the enemy.attack(). And the enemy can call player.attack(). These methods would take what information they need to know when being attack. (The attack roll; How many points of damage) and then respond with a "I'm still alive" or "I'm dead, you killed me".
  To get the player and the enemy together, like suggeted, the GameState (or maybe the BattleGround object), will get the enemy and call player.setOpponent(enemy) and enemy.setOpponent(player), to get the two to interact with each other.
  Is that what you were thinking?
Offline EatenByAGrue

Junior Devvie


Medals: 3



« Reply #47 - Posted 2011-09-22 20:09:15 »

I guess Player and Enemy was a bad example ... I just picked them because I was in a hurry yesterday. But your posts made it pretty clear to me in general.
I ran into this problem while creating Items (like Armor, Potion, etc.) but solved that now by creating a "middleman" who can get information from both the player and the item class via accessors - why I didn't find that solution myself earlier... I don't know Clueless Sorry for that !

Considering my second question maybe a good example is my UserInput class which I use to get (who could've guessed it) all the user's input throughout the game and return it as a value (int or String). Besides that it doesn't have any fields nor accessor methods to communicate with other objects. What I want to know is, if it's still reasonable to create only one instance of that object at a higher level (e.g. in the main class similar to how I do it now with my player class) and pass it into the constructors of those classes who use it OR would it also be okay to create it in each class seperatly because (the way I see it) for those objects it isn't important to have access to one specific object  ... I hope you understand what I mean - it's really hard for me to explain it in english (so please forgive me if I use the wrong expressions occasionally :/).

It is pitch black. You are likely to be eaten by a grue.
Offline sproingie

JGO Kernel


Medals: 202



« Reply #48 - Posted 2011-09-23 00:50:08 »

There's certainly nothing wrong with singleton classes that are passed on to other objects.  A true singleton doesn't actually need to be passed though -- if you follow the classic singleton pattern , you can get at it via UserInput.getInstance().

If your objects have fancier wiring needs, where you have a whole web of classes that need references to each other, you can use a DI container like Spring or Guice, but that tends to be seen as overkill for most games (and for Spring at least, I'd certainly agree). 
Pages: 1 [2]
  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.

toopeicgaming1999 (72 views)
2014-11-26 15:22:04

toopeicgaming1999 (62 views)
2014-11-26 15:20:36

toopeicgaming1999 (15 views)
2014-11-26 15:20:08

SHC (29 views)
2014-11-25 12:00:59

SHC (27 views)
2014-11-25 11:53:45

Norakomi (32 views)
2014-11-25 11:26:43

Gibbo3771 (27 views)
2014-11-24 19:59:16

trollwarrior1 (40 views)
2014-11-22 12:13:56

xFryIx (78 views)
2014-11-13 12:34:49

digdugdiggy (56 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!