I am porting some code from another engine to Unreal for some tests. I could do it as code, but I thought it would be a fun experiment to do it as Blueprint instead. I keep hearing more and more how entire games are being made in BP and I just wanted to see how far I could go with it.
Unfortunately in my case I very quickly ran into a potential roadblock after just one day. BP doesn’t appear to have special values such as Inf and -Inf, or even things like Float.Max or Float.Min all of which are darned useful things to have. They are specified in the IEE standard for a reason after all
In my specific case I have code that calculates orbital data, and a function that returns the Semi Major Axis of an orbit, which could be a parabola, which has an infinite SMA and that is how it should be specified. Yet I can find no way to do so in Blueprint.
I’d recommend making your orbital calculation function in C++ and export it as a node to BP. That is how it is usually done when people say that “their entire project is done in BP” ))
But if you really want to make everything in BP, you have an option to make pure functions which would return Inf, -Inf and NaN in c++ and use them from BP. But I am not 100% sure it will work, but should, if Blueprint Engine will not interfere, and I expect it would not.
Seems like a bad limitation of Blueprint to not have these special values. Sure I can drop into C++ and most assuredly will because like I said this was more of an experiment than anything. The fact that it very quickly exposed a hole though kind of makes me wonder about the truth behind claims of games being made without writing any C++ code.
To be fair, your requirement is a niche thing. I’m sure most game concepts wouldn’t even get close to requiring infinities.
Still, it would be nice to have that option.
I myself struggled quite a bit with blueprint thanks to certain limitations. The only real blocker that I have come across is the bug that prevents struct arrays from being set if they are passed as function parameters, though.
Blueprints have built-in limitations because many things are not exposed to them. But for prototyping purposes, you really have everything you need.
Usually:
Prototype -> You can do everything in Blueprints
Simple project -> You can do everything in Blueprints
Medium project -> You can do everything in Blueprints but you usually end up with several custom C++ nodes to speed up the process and enable features not exposed in Blueprints
Big project -> All architecture and big code chunk is usually done in C++, Blueprints are used to build prefabs / tweak variables and for the HUD (and other small features not performance intensive), in this case C++ and Blueprints are a very synergistic team
But with good programming practices, you could build an entire complex game using Blueprints and some custom C++ nodes. It’s just that a good programmer will likely build such an architecture quicker in C++ (and of course C++ is less performance intensive).
Old thread, but in case anyone comes across this, my workaround for this was to use a string-to-float conversion node with the string [FONT=courier new]inf in it. It is far from ideal, as it’s not really a zero-cost operation, but may do the trick for some cases.