Jump to content

More fun in visual programming


Rick
 Share

Recommended Posts

Thought I would share my crazy "invention". Metatron once talked about a 3D flowgraph. I thought he was crazy mainly because I didn't want to make the editor to handle that BUT since LE already has an editor I thought I'd make some use of it in a game as some kind of proof of concept. The 2 below screenshots look insane, I'm aware of that :D, but that one scene, my level selection scene, only took about 10 mins to setup once the reusable components were created. It was actually kind of fun and refreshing to get some functionality from combining components.

 

The scene functionality:


  •  
  • Background music starts up right away
  • A SQLite file is read looking for a specific table that holds variable/value data. That's what the P-Var components do. I think P-Var is pretty slick as you don't have to do anything yourself with SQLite. In the settings you point to a file, or put a name that doesn't exit. You put in a variable name, and initial value. If the SQLite file doesn't exist it creates it, makes a table called persistent_variables and adds the variable with the initial value. If the component is enabled when it starts it'll get the value and fire it's outputs (sendmessage to targets). It can also be set by an L-Var component (not shown) which is a local variable to the scene that you can give a value to. So P-Vars can be used across scenes and stay when the game exists. I still have to make a G-Var which is a variable across scenes but goes away when the game exists.
  • The picture looking this is just that, an image. I have sets of 2 because I have a closed image and open image which indicate if the level is unlocked or not
  • There are 2 IFCompare components per P-Var component that read the P-Var component (which was from the SQLite file so it's persistent) and based on the value (open or close) it enables the correct image component. It's a very basic control structure. You set the value it will compare against when variable components send their values as inputs. If they match exactly the IFCompare's outputs are fired.
  • The image components are clickable as well. The closed images play a bad sound to indicate they are closed, and the open images play a good sound when clicked to indicate it's valid.
  • There are sound components that are getting enabled to play their sound when they should
  • The round button looking things on the top left are just that. Buttons. I plan on having GUI elements all separate components. So to handle drawing order they all have a Sort Order setting which is handled automatically by my Pi-Main script which is the basic, non-game specific main loop file.
  • There is an Exit Game component tied to the Exit button which ends the game when enabled which the Exit button does when it's clicked.
  • There are Level Load components tied to all the open images which gets enabled when they are clicked, and also one tied to the Main Menu which loads the main menu scene

 

 

I'm kind of excited about this. My new Crazy Marble game is designed 100% like this. Once the components are created it actually goes pretty fast to make things. There are a couple things that I hope LE3D bring to help a system similar to this:

 


  •  
  • Load new levels inside 1 master editor. Currently to test level loading between scenes I can't use the editor
  • Game project wide prefabs. Re-configuring logic that is used in all levels is kind of a pain
  • Targeting system works for this but not ideal as each component can basically have only 1 event that triggers it's output.

 

This is index 0 selected

vp_index0.png

 

This is index 1 selected

vp_index1.png

 

This is the visual result, but there is functionality explained above as well

vp_result.png

 

Note that the position of the components in the editor aren't related to how it looks when it's done. These visual components all have the x,y,w,h settings. I just placed them in the editor that way to get the basic idea of what I wanted and to make some sense out of the chaos. :D

 

Also the final result doesn't take up the entire screen because for now I'm using 800x600 dimensions when I load the game from engine.exe.

Link to comment
Share on other sites

  • 1 month later...

Thread back from the dead ;)

 

I should really release the 1 level I had made for this game with the components so people can see it in action. I'll do that tonight.

 

With a better input/output system this component style programming can work. The hardest part is representing what's going on so you can see it at a glance. With the target system it gets messy. With other systems like how Value's Hammer works you can't see the interactions unless you look at the properties of each item. Some kind of middle ground between the 2 would be nice I think.

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