Jump to content

Rick's Blog

  • entries
    65
  • comments
    96
  • views
    26,141

Start of flowgraph dev


Rick

2,444 views

 Share

<?xml version="1.0" ?>
<root>
<behavior name="create_cube" >
	<result type="Entity" value="cube1" />
</behavior>
</root>

 

These 6 lines are the start of a flowgraph system I'm working on. I've been playing with UDK's Kismet and enjoying what it can do. Now UDK's Kismet is pretty specific to UDK functionality for the most part. They have things like SpawnPlayer, which LE obviously doesn't have. LE gives you much lower level control than SpawnPlayer type stuff. So what I've decided to do is create every function LE has into an xml tag, that can be read in and executed. Then a flowgraph UI can be placed on top of that as the editor that lets you visually generate said xml. The user however, never needs to be concerned with the underlying xml.

 

In UDK functionality is split into a few things. Namely Actions & Events. It also lets you create variables. My flowgraph will function the same way. Like in the above xml, you would have dragged the CreateCube action onto your canvas. Then created a variable object of type Entity, and linked it to the result node sticking out of the CreateCube action. Now when it's called, you have a variable that you can reference anywhere else. For example, you can then drag in a PositionEntity action and use the prior created variable as the entity parameter to this.

 

So the result is just how a person would program LE, but it would be visual. If people will like this I don't know, but it's fun and interesting to get it working.

 Share

4 Comments


Recommended Comments

Added PositionEntity. This file will create a cube and position it.

 

<?xml version="1.0" ?>
<root>
<behavior name="create_cube" >
	<result type="Entity" value="cube1" />
</behavior>
<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>
</root>

 

Now that I have these 2, I'll work on the UI so that one can make this file via a flowgraph UI.

Link to comment

Got events working now. You would drag on the behavior "attach_entity_event" & the event you want to attach to, like "update_entity", and then link which entity you want to attach to that event. The out connector of that event is where you define the functionality inside that event.

 

The xml would look like:

<root>
<behavior name="create_cube" >
	<result type="Entity" value="cube1" />
</behavior>
<behavior name="attach_entity_event" >
	<parameter type="Entity" source="variable" value="cube1" />
	<parameter type="xml" source="variable" value="event:on_update_1" />
</behavior>
<event name="on_update_1" type="UpdateEntity" >
	<behavior name="test">
	</behavior>
</event>

Link to comment

This looks cool! I had an idea that was similar to this,

 

What's the difference between an Action and an Event? Is an action a function pointer of some sort?

Link to comment

An action is basically a function that you must call in your chain. Think of something like CreateCube(). An event is something that gets called by the game or engine. Think of something like on a collision. LE will call a function callback. This is an event. In the terms of the flowgraph system your "main" function is called automatically and you chain actions together to start your program. Since events get called at random times nothing has to proceed and event. It's the starting point that can happen at any given time when it gets fired.

Link to comment
Guest
Add a comment...

×   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.

×
×
  • Create New...