Download

More gates!

I’d really love more Boolean gates such as the NOR, XNOR and the NAND etc for blueprint. There are tons of usage for these. Even though you can make them from scratch pretty easily, I cant imagine it will take you guys long to just add inn a few more for our help. Like a NOR is just and OR followed by an invert node. But again, making things more compact makes it easier in the end. these logic gates are heaven to use with nodebased scripting.

Is it bad that the only reason I know what NOR, XNOR, and NAND gates are because of my time using them with redstone in Minecraft? :smiley:

I’d have to agree that these gates would make a very welcomed addition to the engine.

No hehe, but its basics of logic’s within electronics. Without it we would be nowhere. I was a huge redstone user in Minecraft, which actually made it pretty easy for me to get into blueprinting because blueprints are all in all just a set of instructions controlled in different ways.

I was mildly competent with redstone at one point (forgotten most of it by now), I enjoyed the technical challenge. I imagine it will be the same for me with blueprints. I think tomorrow I might make me some gates in blueprint form!

Agreed but not only simple boolean gates. We need binary operations on byte and integer, together with shift, and roll.

Also this would be great addition: Karnaugh map, k-map

Let me explain why: even programmers nowadays have quite hard time with boolean and “Racing conditions”. I have a friend who is quite good programmer. We needed 4 buttons functionality for our prototype: turning left and right, and strafing left and right. We had 2 thrusters: forward and rear. For turning we need +1 and -1 for strafe +1 +1, or opposite. So when you turn you should not strafe or turn opposite (when button pressed), but when you strafe and turn same way we wanted spaceship to do small, tight circle (for dodging), etc. Logic for this all was quite complicated.

I told him about k-map and that i can do it, bit rusty in this but still can manage, and there are programs like matlab that solve this. But he refused because it was “magic” to him. I mean not k-map, but how i turned it into bunch of and’s and xor’s. So we did that logic the bruteforce way. I cannot even imagine pain if my friend was more on artistic side.

K-map node, and solving it (ie. translating to boolean operatios) would be really great and visual way for more artistic people to code complicated conditions. They could give inputs, “paint” results (or connect nodes to different results etc. So think about k-map node as black box, that we connect inputs and outputs, then fill/paint in array our boolean logic.

I strive to always do it as simple as I can but with the possibility of adding more easily. Whenever things get complicated it will always take more time to either fix or rework with new features. So getting new things that can simplify it a lot would be a timesaver. And in all professions, time is money.

Why don’t you implement those yourself, it’s easy pizy

.cpp:



bool NAND(bool A, bool B) { return !(A&&B) }
bool NOR(bool A, bool B) { return !(A||B) }
bool XNOR(bool A, bool B) { return A==B } //as you see this one is actully pointless as you can use is equile (==) node you will have same result


.h:



UCLASS()
class UMyAwesomeBlueprintNodes : public UObject
{
	GENERATED_UCLASS_BODY()

public:
UFUNCTION(BlueprintPure, meta = (FriendlyName = "NAND Gate", CompactNodeTitle = "NAND"), Category = "Logic Gates") 
static bool NAND(bool A, bool B);
UFUNCTION(BlueprintPure, meta = (FriendlyName = "NOR Gate", CompactNodeTitle = "NOR"), Category = "Logic Gates") 
static bool NOR(bool A, bool B);
UFUNCTION(BlueprintPure, meta = (FriendlyName = "XNOR Gate", CompactNodeTitle = "XNOR"), Category = "Logic Gates") 
static bool XNOR(bool A, bool B);

};


BlueprintPure makes nodes without Exec pins
CompactNodeTitle make them look like like other gates
I’m not sure about category don’t want to open UE4 just to check gates location but you can use “|” to make sub categories
Static functions allows to use node without object initiation and without “Target” pin, in other words create global(-like) nodes
See, C++ in UE4 don’t bite as people make it look like

…actully all those is pointless as all “N” do is add NOT gate (invert bool) to corresponding gate output (NOR = OR → NOT) which you can do in blueprint alone, as you may notice even C++ don’t have those for same reason

mostly because I do not really know any kind of coding. I never where able to get into computercraft in minecraft or Unrealscripting. I tried setting up Visual studio to work with UE but somehow I failed at that. I’m just a humble artist who utilize blueprint. If I where to be serious about getting around it I’d just use blueprint function library I think. Require nothing else and would be good enough.

Well as i said you don’t really need C++, you can do blueprint macro with AND gate and NOT gate and there you go, you got NAND

yeah but having it as s simple node makes your life a bit easier, adding those two: the NAND and the NOR should be enough I guess.