AI Dev-Log 5: NPC Definitions Part 3
Well, seems blogger deletes posts that are being saved when a power surge occurs.
So here comes yet another problem, signal handling...
What were we doing? Ah yes. Creating the nodes themselves.
For this purpose I made a function that parses the contents of a NPCDefinitions file. This logic is managed in the main singleton of the project: Nodes.gd
#The contents of this part of the post were deleted by blogger, and I'm trying to remember the order things were
Back to the problem at hand. I decided to make sure the code will work for many cases, so I defined a quite complex function that has already been presented on the nodes: Trivalent decision.
The node would take any type and would return the same type that was input. For that purpose I implemented a new Type, the type 28 would serve that purpose.
So in Nodes.gd : const TYPE_ANY = 28
I defined the node as follows:
"Tri-v Decision" : {
"_category" : "inhibitor",
"_code" : "FuncRef?",
"_input_ports" : [
{"_lablel_title":"Value", "_type" : Nodes.TYPE_ANY},
{"_lablel_title":"Weight 1", "_type" : TYPE_REAL},
{"_lablel_title":"Weight 2", "_type" : TYPE_REAL},
{"_lablel_title":"Weight 3", "_type" : TYPE_REAL}
],
"_output_ports" : [
{"_label_title" : "", "_type" : TYPE_NIL },
{"_label_title" : "Output 1", "_type" : Nodes.TYPE_ANY },
{"_label_title" : "Output 2", "_type" : Nodes.TYPE_ANY },
{"_label_title" : "Output 3", "_type" : Nodes.TYPE_ANY }
]
}
"_category" : "inhibitor",
"_code" : "FuncRef?",
"_input_ports" : [
{"_lablel_title":"Value", "_type" : Nodes.TYPE_ANY},
{"_lablel_title":"Weight 1", "_type" : TYPE_REAL},
{"_lablel_title":"Weight 2", "_type" : TYPE_REAL},
{"_lablel_title":"Weight 3", "_type" : TYPE_REAL}
],
"_output_ports" : [
{"_label_title" : "", "_type" : TYPE_NIL },
{"_label_title" : "Output 1", "_type" : Nodes.TYPE_ANY },
{"_label_title" : "Output 2", "_type" : Nodes.TYPE_ANY },
{"_label_title" : "Output 3", "_type" : Nodes.TYPE_ANY }
]
}
I'll use this one as a stress tester, if there's something wrong, this function will make it evident.
So far Signals:
- can be added by code (in the same fotrmat we define input and output ports, but limited to types 0 to 26)
- can be contained in GraphNodes
- can be listed by code
I need to come up with a structure so I can get into the functions... I guess I'll have to do it in parallel.