Java-Gaming.org Hi !
 Featured games (84) games approved by the League of Dukes Games in Showcase (569) Games in Android Showcase (154) games submitted by our members Games in WIP (618) 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
 How hard (or easy) is a foe?  (Read 2593 times) 0 Members and 1 Guest are viewing this topic.
LordChandar

Junior Devvie

Projects: 1

 « Posted 2012-12-13 22:45:30 »

Howdy all,

I have been trying to come up with a formula based on the stats of a foe in my game (http://www.indiedb.com/games/fabuladivina) to determine how much more dangerous or how much easier a foe is than any other foe (including you.)

I have tried a bunch of different formulas of attack power, defense, health, skills etc... and I can't find one that 'works' for me.

What I am trying to do is figure out whether certain creatures (like a little field mouse) should run away from the big bad dragon, while it may want to attack the cockroach.

Has anyone else tackled this issue?  I was looking for a formula since my spawn are also rolled, and some may be more dangerous, and some may not be.

Thanks.
Riven
« League of Dukes »

« JGO Overlord »

Medals: 953
Projects: 4
Exp: 16 years

 « Reply #1 - Posted 2012-12-13 23:17:09 »

The brute force approach would be to simulate a battle, and see if the little field mouse would win.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
tyeeeee1
 « Reply #2 - Posted 2012-12-13 23:18:10 »

Without having played the game or anything, can't you just compare the level integers and if monster X is level 5 and monster Y is level 50 then have monster X run away?
 Games published by our own members! Check 'em out!
LordChandar

Junior Devvie

Projects: 1

 « Reply #3 - Posted 2012-12-13 23:21:23 »

A level 1 dragon has different stats than a level 1 mouse.  I really need to try and do it at the stat level.  Here is what I have tried currently:

public short rating()
{
short r = this.magic_offense();
r += this.magic_offense();
r += this.offense_physical();
r += this.defense_physical()/2;
r += this.hp/10;
return (short)((r)>0?(r):1);
}
Gjallar

JGO Coder

Medals: 16
Projects: 1

Follower of Nurgle

 « Reply #4 - Posted 2012-12-13 23:25:21 »

Hmm... why should one entity automatically know that the opposing entity is stronger/weaker?

I think it should decide wheter or not to attack it by how intimidating it is, which is most of the time the opposing entities size. So why not make it simple and just compare the two entitie's sizes?
LordChandar

Junior Devvie

Projects: 1

 « Reply #5 - Posted 2012-12-13 23:27:24 »

You have a good point.  I will try that approach.  Maybe I just wanted to make it too smart.

Thanks.
LordChandar

Junior Devvie

Projects: 1

 « Reply #6 - Posted 2012-12-13 23:29:30 »

I will try this approach:

public static final byte lifeSizeXSmall = 0;
public static final byte lifeSizeSmall = 1;
public static final byte lifeSizeNormal = 2;
public static final byte lifeSizeMedium = 3;
public static final byte lifeSizeLarge = 4;
public static final byte lifeSizeXLarge = 5;
public static final byte lifeSizeGigantic = 6;
Gjallar

JGO Coder

Medals: 16
Projects: 1

Follower of Nurgle

 « Reply #7 - Posted 2012-12-13 23:32:44 »

I was thinking about just comparing the sprite's width*height with the other sprite's width*height. Even less effort and more accurate
LordChandar

Junior Devvie

Projects: 1

 « Reply #8 - Posted 2012-12-13 23:39:51 »

I will ponder that approach as well.  I would have to take into account the transparency of the shape as well.

Here is my current approach, I could just switch out the logic in the lifeSize() method if I want to do sprite size

public static class RunAwayFromNearTargetIfStronger extends Thought
{
public RunAwayFromNearTargetIfStronger(LifeFormInventory l)
{
super(l);
this.name = consts.thoughtRunAwayFromNearTargetIfStronger;
}

public void runAway(LifeForm targetToDistance)
{

}

public boolean action(NPC me)
{
if (me.Target != null)
{
if (Math.abs(me.Target.lifeSize() - me.lifeSize())>= 2)
{
runAway(me.Target);
return true;
}
}

LifeForm l = me.findNearestTarget();
if (Math.abs(me.gps.distance(l.gps)) <= 2)
{
if (Math.abs(l.lifeSize() - me.lifeSize()) >= 2)
{
runAway(me.Target);
return true;
}
}

return false;
}
}
tyeeeee1
 « Reply #9 - Posted 2012-12-13 23:45:24 »

Another top-of-my-head suggestion, if it's possible due to the stat differences you mentioned, would be to add up the total amount of stat points and then if monster X is below half the amount of monster Y's stat points then monster X runs away?
 Games published by our own members! Check 'em out!
Ultroman

JGO Knight

Medals: 25
Projects: 1

Snappin' at snizzes since '83

 « Reply #10 - Posted 2012-12-13 23:53:45 »

Another top-of-my-head suggestion, if it's possible due to the stat differences you mentioned, would be to add up the total amount of stat points and then if monster X is below half the amount of monster Y's stat points then monster X runs away?
I think that's basically what he's doing in his second post

- Jonas
LordChandar

Junior Devvie

Projects: 1

 « Reply #11 - Posted 2012-12-13 23:55:18 »

Any easy way to count non-transparent pixels? :-)
sproingie

JGO Kernel

Medals: 202

 « Reply #12 - Posted 2012-12-14 00:08:26 »

Perhaps you want more of an absolute level scale, where bigger and badder monsters start at a higher level.  You're not going to see a Level 1 Dragon, Beholder, or Mind Flayer in D&D after all.

Just simulating the battle for a few rounds and checking the results is a pretty reasonable way to do it too, since it basically models the thought process of "Pray tell, what would perchance be the outcome were I to engage in manly fisticuffs with this Ancient Misshapen Horror From Beyond?  Why it would seem I would be fried to a delicate crisp post-haste.  What say we run away, old chap?"  You're going to need to run automated sims anyway in order to do game balancing.

LordChandar

Junior Devvie

Projects: 1

 « Reply #13 - Posted 2012-12-14 00:14:07 »

@sproingie I laughed so hard at your sample dialogue, I almost asked if you would have done me the honor to write at least one character for me in the game :-)
Pickleninja

JGO Coder

Medals: 10
Projects: 1

I'm tired of working for someone else.

 « Reply #14 - Posted 2012-12-14 10:06:19 »

Perhaps you want more of an absolute level scale, where bigger and badder monsters start at a higher level.  You're not going to see a Level 1 Dragon, Beholder, or Mind Flayer in D&D after all.

Just simulating the battle for a few rounds and checking the results is a pretty reasonable way to do it too, since it basically models the thought process of "Pray tell, what would perchance be the outcome were I to engage in manly fisticuffs with this Ancient Misshapen Horror From Beyond?  Why it would seem I would be fried to a delicate crisp post-haste.  What say we run away, old chap?"  You're going to need to run automated sims anyway in order to do game balancing.

Simulation is definitely what he needs... throw in some random numbers when deciding hit/miss, dmg, etc... and  then have the computer process 1,000 outcomes. It may take a little work, but honestly I don't think it'd be that bad.

But truthfully, if you're going to have a sizeable number of monsters, you want a fast and efficient way to test outcomes.

-Pickle

LordChandar

Junior Devvie

Projects: 1

 « Reply #15 - Posted 2012-12-14 12:04:20 »

Yes, the foe system in this game is kind of like a turnbased Diablo, so there are times quite a few creepy crawlies are on the screen at once.

Junior Devvie

 « Reply #16 - Posted 2012-12-14 22:12:34 »

If the intimidation factor is something you're interested in, you can just give every monster an intimidation stat and automatically level it up with the other stats. Size alone is a bad metric. After all, what would you be most likely to avoid, a scorpion or a panda?
Riven
« League of Dukes »

« JGO Overlord »

Medals: 953
Projects: 4
Exp: 16 years

 « Reply #17 - Posted 2012-12-14 22:17:18 »

If the intimidation factor is something you're interested in, you can just give every monster an intimidation stat and automatically level it up with the other stats. Size alone is a bad metric. After all, what would you be most likely to avoid, a scorpion or a panda?
How intimitating an enemy is, depends on the combination and interaction of various stats of the entity.

So... when he asked how to compare two entities, which is incredibly difficult, you say that he should simply calculate it and push it into a stat. That's no solution, that's exactly the problem he was needing help with, but phrased differently: how to calculate that 'intimidation stat'.

I stick with my (first) reply in this thread: just simulate a battle. It takes out all guessing and heuristics, and it will always be correct, whatever you (radically) adjust later on.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!

Junior Devvie

 « Reply #18 - Posted 2012-12-14 23:11:56 »

The idea would be that you would choose an appropriate base level and level up rate for the intimidation stat the same way you would every other stat. On a per species basis. If you could have a single mouse that was incredibly well equipped with magic abilities and a single dragon with low stats all around or some other random configuration of stats and skills, then intimidation as a stat wouldn't mean anything. That's only the case if stats are random. The case is probably that each species of monster is designed with a specific set of skills, stats, and personality.

There main downside to simulation, (used alone,) is that it may become too mechanistic and symmetrical. Intimidation involves perceived danger, not actual danger. Intimidation allows you to factor in an extra variable for more realism. It depends on the combat system, but I can imagine cases where it would be terrible. If it were one of those games where enemies take turns hitting each other, have the option to retreat, and disappear after the screen fades to black, then the game would be too frustrating if the enemy ran away every time its HP was brought down to near zero. If it were an open combat system were enemies could run around, then you would have enemies that would constantly flee from an opponent and an opponent that would constantly chase the first monster. You would end up with chains of monsters running around the screen and little actual fighting.

You really don't want the computer players to be omniscient. A better method is to use fuzzy logic. A strong intimidating monster may chase opponents weaker than it, a timid monster would avoid risky conflicts, a weak intimidating monster would "trick" it's opponents into avoiding a fight by bluffing, and ordinary monsters would pick fights with either slightly weaker or slightly stronger monsters based on apparent risks and rewards. Their own aggressiveness/timidity would determine how risk averse they were and their opponents' intimidation factor would determine how strong their opponent appeared to them.
Riven
« League of Dukes »

« JGO Overlord »

Medals: 953
Projects: 4
Exp: 16 years

 « Reply #19 - Posted 2012-12-14 23:31:33 »

You really don't want the computer players to be omniscient.
It's a non-issue really. There is (most likely) so much randomized action in the simulation, that the outcome is merely a very rough indication on what your chances are.

And whether a 'timid monster' would even fit in a game, is a whole different issue. Why generalize the problem to such extend that simple solutions no longer work. When you talk about intimidation and appearance, we're entering the realm of bluf and deceat. That requires an intelligence stat, as you can only deceat a resonably intelligent entity - with an enemy too dumb, your clever tricks won't work. Your suggestions are making the problem harder and harder. Keep it simple. As you need to simulate battles at some point, to get the game to function, you could just as well use that existing functionality to make entities estimate their chances among eachother. Added benefit is that, as said, whatever you change in the balance of the game, you don't have to constantly update your heuristic - with a high chance of getting it wrong, as you cannot imagine all effects in a system with so many (asymmetric) variables.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
LordChandar

Junior Devvie

Projects: 1

 « Reply #20 - Posted 2012-12-14 23:55:22 »

I appreciate all the help and points of view.

The game I am creating is kind of a world simulation, and the fear factor is really more for tiny little creatures running around, rather than whether dragon A and defeat dragon B.

Plus in the later levels, if I don't scale the spawn levels, I want the lower level creepy crawlies to fear you and run away from you.

Additionally, there are fights between spawn and creatures in the world completely independent of the character, so I wanted something in the ball park, and not necessarily exactly exact.

I also now have the idea of using this rating in a chance to fear roll in the game as well.

I am continuing to experiment with the algo so I can ball park it.

Cheers for all your thoughts.
HeroesGraveDev

JGO Kernel

Medals: 354
Projects: 11
Exp: 3 years

┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻

 « Reply #21 - Posted 2012-12-15 00:41:16 »

Just mess around with different variables until you get something that works.
There is no more reason to discuss this.
Get back to making your game

deepthought
 « Reply #22 - Posted 2012-12-20 01:34:43 »

have people play the game, and rate the enemies. put that into your intimidation stat.

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
Grunnt

JGO Kernel

Medals: 95
Projects: 8
Exp: 5 years

Complex != complicated

 « Reply #23 - Posted 2012-12-20 10:09:13 »

The game I am creating is kind of a world simulation, and the fear factor is really more for tiny little creatures running around, rather than whether dragon A and defeat dragon B.

Maybe just use an extremely simple approach: give each tiny little creature a "tinyLittleCreature" flag and define behaviour as follows: creatures with tinyLittleCreature == true run away from creatures with tinyLittleCreature == false, but not from creatures with tinyLittleCreature == true.

Pages: [1]
 ignore  |  Print

You cannot reply to this message, because it is very, very old.

 Riven (21 views) 2015-04-16 10:48:47 Duke0200 (34 views) 2015-04-16 01:59:01 Fairy Tailz (25 views) 2015-04-14 20:13:12 Riven (26 views) 2015-04-12 21:36:37 bus hotdog (44 views) 2015-04-10 02:39:32 CopyableCougar4 (45 views) 2015-04-10 00:51:04 BurntPizza (45 views) 2015-04-06 22:06:58 ags1 (49 views) 2015-04-02 10:58:48 Riven (49 views) 2015-04-01 18:27:05 ags1 (66 views) 2015-03-31 10:55:12
 BurntPizza 24x theagentd 21x wessles 15x 65K 12x Rayvolution 12x kingroka123 11x alwex 10x KevinWorkman 9x kevglass 8x SHC 8x ra4king 8x phu004 8x Hanksha 7x Olo 7x chrislo27 7x Ecumene 7x
 How to: JGO Wikiby Mac702015-02-17 20:56:162D Dynamic Lighting2015-01-01 20:25:42How do I start Java Game Development?by gouessej2014-12-27 19:41:21Resources for WIP gamesby kpars2014-12-18 10:26:14Understanding relations between setOrigin, setScale and setPosition in libGdx2014-10-09 22:35:00Definite guide to supporting multiple device resolutions on Android (2014)2014-10-02 22:36:02List of Learning Resources2014-08-16 10:40:00List of Learning Resources2014-08-05 19:33:27
 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