Jump to content

flowgraph xml storage brainstorming


Rick
 Share

Recommended Posts

I have code that reads an xml file that will be generated by a flowgraph. It was working fine, however when I got into an action that has more than 1 input and/or more than 1 output my current design won't work. I was wondering if anyone wanted to brianstorm on how to do set some xml up for these.

 

The thought (and code that I have working) is that each Action would be an LE API function. For those they would simply be an In & Out for the flow, and they would have parameters and results. All that works, but I'm looking at other nodes like "Compare Int" which has 1 in and 5 outs. The 5 outs changes the flow of the logic.

 

 

Here is an example of what I currently have

 

<behavior name="position_entity">
<parameter type="Entity" source="variable" value="cube1" />
<parameter type="float" source="constant" value="0" />
<parameter type="float" source="constant" value="1" />
<parameter type="float" source="constant" value="2" />
<parameter type="int" source="constant" value="1" />
</behavior>
<behavior name="create_cube" >
<result type="Entity" value="cube1" /> <!-- This will make a variable? -->
</behavior>

 

I was using just the order of the behavior tags to control the logic flow (the arrows in the flowgraph), but when you get something that has multiple outputs I can't really do that.

 

Any ideas? I have this code working and it's pretty exciting, but I just need help with ideas.

 

 

Here is a screenshot of UDK's Kismet and what I mean.

 

My link

Link to comment
Share on other sites

This won't answer your question directly, but I can tell you how I do it:

 

Inputs and outputs are of a given type, such as int, TVec3, bool, etc (uh...really?).

Each input is registered to a delegate which will perform whatever is needed. In this sense, all inputs for a given node are non-related.

Similarly, the outputs are non-related to each other. I just have a list of input connections and a list of output connections.

When an input gets wired to an output, it's delegate is registered to the output it's connected to.

 

So, the general flow is when an input receives data, it's delegate is fired. In turn, processing occurs, perhaps outputs are fired, so on and so on.

 

So, how my stuff would work if I understand the Compare Int function (assuming 'In' is a trigger), when the A and B inputs receive data they will store off the data. When 'In' gets triggered if there is valid data at A and B the delegate registered to "In" would set the appropriate data in all the outputs and all the delegates registered to each of the outputs would in turn be fired.

Link to comment
Share on other sites

That helps. What I was doing was just calling things in the order they were in, in the xml file. Each "Action" is a class that overloads the () operator and passes in the parameters and return value (which isn't the flow control like the outputs are, it's just a way to return some values from the Action). The () operator currently wasn't returning anything. But it sounds like I should return what output was fired from said Action (maybe a string name that is an attribute in the xml element) so that the calling controller knows what node to look for next.

 

Currently this all runs real-time from reading xml data (the file is loaded once at startup and the code just reads it to figure out what to do next). I might look into loading the xml and storing the entire flow in code and then running it, instead and if I do that, it would relate nicely with delegates as outputs like you suggested.

 

I'll play around with that to see how it works. Thanks!

Link to comment
Share on other sites

OK, so here is what I'm thinking. Nested behaviors inside their respective outputs from other behaviors. When the behavior is finished running, it'll determine which output name should be used next. In the case of a behavior just having 1 output, it'll just say "out". In the case of the Compare Bool behavior, depending on what happens inside that behavior it'll return "true" or "false" indicating to the calling program what direction the program should go depending on what happened in that behavior. I hope that makes sense. It makes sense in my head :)

 

 

So visually the below would have 2 actions (create_cube & compare_bool) and it would go from create_cube's output to calling compare_bool. Then depending on the result of compare_bool it would branch off to other actions defined.

<behavior name="create_cube">
<parameter type="Entity" value="" />
<result type="Entity" type="variable" value="eCube" />
<output name="out">
	</behavior name="compare_bool">
		<parameter type="bool" value="bVar1" />
		<parameter type="bool" value="bVar2" />
		<result type="bool" type="variable" value="" />
		<output name="true">
			<!-- More nested behaviors if true -->
		</output>
		<output name="false">
			<!-- More nested behaviors if false -->
		</output>			
	</behavior>
</output>
</behavior>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...