Action Graph was missing a big feature: you could only store stuff in properties defined in C#. That's no good if you don't know C# yet, or are making an addon type that doesn't support code.
Before Hackweek I mocked up a quick solution where each GameObject has a Dictionary<string, object>, but I really wasn't a fan. I know that people are going to stubbornly make whole games without any C#, so imagining them only using Dictionaries to store everything makes me cry.
Instead, imagine designing whole Component types without touching C#. That's what I did this week.
attribute 'contenteditable' not allowedattribute 'blocktype' not allowed
After selecting the "New Action Graph Component" template and choosing where to save it, you'll be able to define properties for your custom component type.
attribute 'contenteditable' not allowedattribute 'blocktype' not allowed
This is using System.Reflection.Emit to build a real System.Type, and our existing
Hotload tech to handle it changing. Generating Types like this means it fully integrates with our TypeLibrary stuff, with no ugly hacks or special cases everywhere. Your properties will show up in the inspector, and you can access them in Action Graph of course.
attribute 'contenteditable' not allowedattribute 'blocktype' not allowed
So that was Monday. The next big idea is to let you define methods too.
attribute 'contenteditable' not allowedattribute 'blocktype' not allowedattribute 'data-image-style' not allowed
Methods are implemented as Action Graphs, and inside them you can easily access any properties or other methods on the same component type.
attribute 'contenteditable' not allowedattribute 'blocktype' not allowed
As well as creating custom methods to do whatever job you want, you can override all the virtual methods in Sandbox.Component like OnStart and OnUpdate.
To make everything as fun to use as possible, I've added a bunch of interactions to help you add or modify these properties and methods. It only takes a couple of clicks to refactor a bunch of nodes into a method, or create a new property with the right type to supply an input.
attribute 'contenteditable' not allowedattribute 'blocktype' not allowed
attribute 'contenteditable' not allowedattribute 'blocktype' not allowed
One last thing I'll show off from this week: you can mouse over wires while the game is running to see the value they last transmitted.
attribute 'contenteditable' not allowedattribute 'blocktype' not allowed
To wrap up, I'm super happy with how much I got done. This idea has been stuck in my head for a few weeks, so it's great to see that it can actually work. Bear in mind that this is all on a branch at the moment, and it'll need some review and polish before we can think about releasing it.
Comments