FiniteSM and input files

Hi all,

Outrunner suggested something very nice.



The inputs and output variables can be pre-defined for each FiniteSM in a file of sometype.



XML seemed like a nice option, so here’s the suggested structure



monster.txt


<state name="state_calm">
    <pair input="gunFired" output="mad" />
    <pair input="gunPointed" output="annoyed" />
</state>
<state name="state_annoyed" />
    <pair input="gunFired" output="mad" />
    <pair input="calmingDownLiquid" output="calm" />
</state>
.....etc



What do you think?

DP

so this is the .xml file for our TestFiniteSM:



<finiteMachine initialState="monster uncaring">
   <state name="monster uncaring">
      <pair input="player see" output="monster annoyed" />
      <pair input="player shoot" output="monster dead" />
   </state>
   <state name="monster annoyed">
      <pair input="player see" output="monster annoyed" />
      <pair input="player shoot" output="monster dead" />
   </state>
   <state name="monster dead"></state>
</finiteMachine>



And thats finished btw, simply do this:


FiniteSM machine = new FiniteSM("someName");
machine.loadStates(SomeClass.class.getClassLoader().getResource("hello.xml").openStream());



Is that ok?

DP

XML sounds ok for the purpose, but you may want to look into fussy logic.



p.s. I think I spelled fussy incorrectly. I am referring to the system that uses multiple values and graphs to set up the state, There are editor already available that can make designing the system for a game much simpler.

yeah sorry, i was just testing when I posted that code.



Anyway, ive changed it to make it correct.



About the currentState tag, that was just to specify the initial start state of the machine. Ive change it so you set that at the start element.



The current system uses pre-existing methods and classes that a programmer can use without resulting to use XML.



I haven’t implemented a fuzzy state machine yet, as soon as I do (soon), i will implement it in the XML and I suspect it would be similar to the above XML.



pair is the best word I can think of at that time (:?). So any suggestions are welcome. InputData is not much different than “pair”. A friend of mine suggested “doodah” and I can see all three as being viable :wink:



DP

"DarkProphet" wrote:
I haven't implemented a fuzzy state machine yet, as soon as I do (soon), i will implement it in the XML and I suspect it would be similar to the above XML.

I know that there are formats out there that are specific for fuzzy. The advantage of using these languages is that we can use the editors that exists. But If do not want to use these languages xml sounds like a good way to go.