Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (121)
games submitted by our members
Games in WIP (577)
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  
  Combined State Machines  (Read 2362 times)
0 Members and 1 Guest are viewing this topic.
Offline darkprophet

Senior Duke




Go Go Gadget Arms


« Posted 2004-09-21 14:41:43 »

G'day,

This is regarding mixing both Finite and Fuzzy State machines to obtain an over all Machine that can do either, both, and a little more.

The idea behind this is that a CombinedSM class is created whereby it only has one current state aptly named the "super state". The "super state" can be have many "inner states" in between which correspond to fuzzy values in that "super state".

Each inner state has a low range, and a high range in which it operates under. And the inner states can overlap in their ranges. The "inner states" will either be sorted using the HighRange or the LowRange (any difference?).

The low/high ranges will be recreated to give the same value but the total range will be from 0 - 2.

The power of this design shines in the input/output. You input an aggression value of that "super state", that does this on the input:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
public float fuzzyTransition(float input) {
            // check to see if the input is more than 1.
            // if it is, then make the input 1
            if (input > 1) {
                  input = 1;
            }
            
            // calculate how far it is from the mean
            float calculatedInput = input + fuzzyLogicEffectiveness;
            if (calculatedInput > 1) {
                  calculatedInput = 1;
            } else if (calculatedInput < -1) {
                  calculatedInput = -1;
            }
            
            float output = 0.5f - calculatedInput;
            fuzzyLogicEffectiveness = 1.0f - (output/0.5f);
            
            // and return it
            return fuzzyLogicEffectiveness;
      }


This gives the average distance away from the mean (0 - 1) the input is and this gives an output from 0 - 2.

Now this output is given back to the "super state" which returns three things:

1) The output from the above method
2) The "inner state" (or states, it any number of inner states overlap) at which that output resides in.
3) The distance away from the mean of each "inner state" that output is (this number(s) ranges from -1 to 1)

Now for the big question, has anyone done anything like this?

Malohkan, this is very useful for your difficulty effects in gaming. Even more powerful than FuzzyStateMachines for your case because you are incoorporating finite states as well, e.g. Angry, Mad, Raging, and they all bleed into each other, so you can be mad and raging at the same time. Say you will increase the accuracy when your in mad and when your in raging, you increase the speed of fire. With this system, the transition is very smooth......Its all for you baby!  Wink


Thx, DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Offline Malohkan

Senior Duke




while (true) System.out.println("WOO!!!!");


« Reply #1 - Posted 2004-09-21 15:50:01 »

awesome!  I hope I have time soon to put that to good use

Admin and Game Developer at
GameLizard.com
Play Rimscape!    |    Play Conquer!
Offline darkprophet

Senior Duke




Go Go Gadget Arms


« Reply #2 - Posted 2004-09-21 18:46:53 »

this should be done in a few days or a weeks time. But im also working on various other things. So it might be a little later than that.  Smiley

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline darkprophet

Senior Duke




Go Go Gadget Arms


« Reply #3 - Posted 2004-09-25 16:00:38 »

OKies, i believe thats done.

But im afraid the classes are wayyyy too long to post here, so ive uploaded all my AI stuff to:

http://www.myjavaserver.com/~digiwired/ai-code.zip

The packages you are interested in are:

com.jme.ai.fsm.CombinedSM
com.jme.ai.fsm.CombinedSMInnerState
com.jme.ai.fsm.CombinedSMOutput
com.jme.ai.fsm.CombinedSMState
com.jme.ai.fsm.CombinedSMStateReader

The best way to use this is through the CombinedSMStateReader which reads an XML file and loads it into a CombinedSM (Combined State Machine).

Then use the machine itself and discard the reader.

DP


Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Offline darkprophet

Senior Duke




Go Go Gadget Arms


« Reply #4 - Posted 2004-09-25 16:04:38 »

oops, forgot to state the XML format:

1  
2  
3  
4  
5  
6  
7  
8  
<combinedMachine initialState="monster aggressiveness">
      <state name="monster agressiveness">
            <innerState name="uncaring" lowRange="0" highRange="40" />
            <innerState name="angry" lowRange="30" highRange="60" />
            <innerState name="mad" lowRange="55" highRange="80" />
            <innerState name="enraged" lowRange="70" highRange="100" />
      </state>
</combinedMachine>


The high range can be capped at anything, it will be normalised anyway, so the max could be 152.3 for all it cares! And yes, they are floats.

If you find any bugs, please PM me.

Thx, DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
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.

theagentd (20 views)
2014-10-25 15:46:29

Longarmx (53 views)
2014-10-17 03:59:02

Norakomi (47 views)
2014-10-16 15:22:06

Norakomi (35 views)
2014-10-16 15:20:20

lcass (39 views)
2014-10-15 16:18:58

TehJavaDev (69 views)
2014-10-14 00:39:48

TehJavaDev (69 views)
2014-10-14 00:35:47

TehJavaDev (61 views)
2014-10-14 00:32:37

BurntPizza (74 views)
2014-10-11 23:24:42

BurntPizza (47 views)
2014-10-11 23:10:45
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!