Colorful Nodes, Bugs, and Complexities

I just finished coloring the different nodes. This has proven to be useful. At first glance, I could see right away what type of node it is. The color could also provide meaningful description to the node when a different label would be provided (which I plan to implement later).

It looks like DNA!
It looks like DNA!

I’ve ran into some complexities that should be implemented into the editor. First, a decorator can only have one child. There was no problem when adding a child using the right-click menu. But I forgot that dragging a node to a decorator is also adding a child. I’ve fixed it using an observer pattern.

Second, when a node is moved up/down along its sequence, the data counterpart should be updated as well. I use a different tree for the rendering part and data part. I just can’t have one object that contains both the rendering data and behaviour tree data. I made a promise to myself that the tree control should be decoupled as much as possible so I could easily extract it for my future editors. The consequence is that I have to make a system to sync the two tree-like data and keep them consistent. I also added an assertion that the two data should be consistent whenever there are updates to the tree.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s