The Hive system: version 0.91 released

looking forward to seeing this.
I don’t get much time to play with the bge these days, but I do hope that someone will post a video of this in action.
:slight_smile:
M

Just a question, if i understand this right, it is a visual-only change to somthing that is used in the UDK?

@Molino: There is a screencast of the Hive system with the old GUI + Panda3D, you can find it here:
https://launchpadlibrarian.net/79794930/screencast.swf
I am currently porting the same example to the new GUI + Blender

@Equal: The Hive system is indeed a node system like UDK Kismet, Quartz, Microsoft VPL and others. There are some differences: a node in those systems can have only a single entry point (the Activate() event in UDK Kismet), while a Hive system worker can have multiple entry points.
The Hive system is not visual-only. You can use Python to extend it, just like you can use UnrealScript to extend Kismet.

Hi Sjoerd, I watched the .swf file, and it looks really interesting. I was wondering (maybe it’s been asked all ready), is this going to be put into Blender’s Node Editor? So there will be an icon for Materials, Textures, Compositing, and then Game Engine?
Seems like a logical place to put it.
Any hoooo, thanks for this. I look forward to seeing how this develops.
Thanks again,
M

hey im trying to install spyder and it says python 3.2 isn’t in the registry but i have it installed idk what to do :confused:

I don’t know why it can’t find your Python… is it in C:\Python32 ?

yes :frowning: :spin: it said that last time i tried to install it on my other pc too

:edit: i googled it… its a bug in python it only happens to the 64 bit version of python so i installed 32bit and it works just fine… thought you should know :smiley:

So, I finally got it to compile.
Firstly, using CMake, SCONS doesn’t like SWISS.
Secondly, the spider example needs the sound import removed.
Sjoerd - keep me posted.

Here’s the sort of functionality I would like to see the Hive system have:

.Support for float and string data types, where one node can output a float or string and another can receive it.
.Nodes can also be activated/deactivated by binary pulses, similar to logic bricks.
.A wide variety of mathematical expressions and functions.
.Nodes that can dynamically add and remove constraints, including parenting, slow parenting, delayed rotation copying, delayed location copying etc.
.The ability to easily move or rotate along or around any of another object’s axes.
.Access to more parameters in general(for instance, an object’s absolute position)

And here’s a quick mockup image I made. This node setup would add an acceleration factor to a "fighter"s Y velocity:


sorry to ask a noob question but what is the difference between this and the logic bricks?

Is there more that you can do with the nodel logic?

I believe the goal is to have nodal logic to be a kind of middle ground between logic bricks and Python. For example, if you wanted to save the color of an object and restore it on a key-press, that would need a script. With nodes, it might be possible to simply record the obj.color property to a game logic property, and then restore it later when you need to, or do vector math. At least, that’s my understanding of the kinds of advantages node logic has over logic bricks (not that those particular nodes / setups will be possible in the finished version).

All of these points are in principle there, I think.
Not all possible rotation axes and parenting modes have yet been implemented, and there is no physics yet, but we are working on it (Benoit and Spencer and myself).
Mathematical expressions will take a bit longer; I want the Hive system to run some validation on the expression, and the GUI is not yet smart enough for that.

And here’s a quick mockup image I made. This node setup would add an acceleration factor to a "fighter"s Y velocity:
[ATTACH=CONFIG]192890[/ATTACH]
Here is the hive map. You can unzip the folder and edit the .web file in the GUI.
It won’t actually run under the BGE (for the reasons above; three of the nodes are still stubs), but it should run in a few months or so.

Attachments


fighter.zip (71.1 KB)

so how do i get this into blender and get it working?

All instructions are in the first post.
If it doesn’t work for you, please post the step that went wrong, and I will try to help.

I am back from holidays.
Today I added a little status bar to the GUI, showing the mode (push or pull) and type of the worker antenna. You can find it in trunk (https://launchpad.net/hivesystem).

Here’s my idea of a networking noodle.


Theoretically the client noodle should be identical to the server noodle. I can’t wait to get working on this, once we sort the GUI

Looks interesting! I will convert the node-noodle to a hivemap with mockup workers.

It also shouldn’t be too hard to do it for real, but then you have to explain me what the workers should do :slight_smile:
The “bitstruct node” worker should somehow pack the Boolean values? Into the bits of a single int? As a pickled dict?
And the “packet node”, should it also build a pickled dict? Or encode the data with some kind of network protocol?

Well, as always, I intend to use Struct (Python standard library).

The packet node takes all nodes connected to it, and packages them using struct.
I am not sure if you are aware how struct works, but it’s a dumb packaging library. You define a format string, and pass arguments to pack into bytes.
In order to optimise the setup, it is best to use struct class instances rather than the pack and unpack methods. Thus, you have to determine the format string on runtime. It is important that the server and client (or sender and receiver) have the same format string. Thus, I’m going to base this off my existing system (which is equally as compatibile in theory, not in practice at present):

You get all the connected nodes to the packet nodes. You sort them in the following fashion: Sort by type (e.g node.class.name) that way bitstruct nodes are near the front. Then, within that sorted list, you sort each group by id.
Thus, assuming that both the sender and the receiver has the same noodle, both will realise the same format string.

However, in order to distinguish packets, you give them a header. This header contains the id of the packet itself (I did not include this in the diagram.). In order to unpack the bytes into each packet (if you send >1 packet to the network node, it just concats them to one bytestream) you need to know the size of each packet. At present, i do so like this:

  • Get the header id of the packet (always first byte). Now, look into the connected packet nodes and match the id. Now, look into the children of each packet node, and do the following:
  • Following the order specified in the calculated format string for that packet noodle:
  • Go down from first character to left.
  • If the character is not variable (any type but string or array) then just calculate the size of that character (struct.calcsize(character)). Increment a size counter by that returned value.
  • If it is variable, we do the following: slice the bytes at the index of header_size + current_count_size; the first byte will say how long the variable structure is. You know now that N bytes after that character is the variable structure. Add the value to the current count and also the size of the character (one byte) and continue down the string.

It’s very simple but effective.

Hi Agoose,

Here is your network noodle, converted to a hive map. You can open it with the GUI and have a look at the code: the logic isn’t quite yet functional, but close enough.

cheers

Sjoerd

Attachments


networkhive.zip (183 KB)

There are some updates of the Hive system in trunk, here is a little overview:

Hive system code:

  • Fixed a startup bug and a Py3 compatibility bug
    GUI:
  • Improved parameter editing for a worker: you can rename it, see its type, and edit the meta-parameters
  • A status bar shows the type of each antenna/output hook
  • Connections look nicer. For hooks with multiple connections, they can be rearranged and selected individually