Download

How important are bitwise operators for Unreal developers

Just curious to know how often Unreal game developers need to utilize their Bitwise operator skills.

I use them fairly often. Often times for simple bit flag behaviors/checks, but occasionally to pack/unpack data into smaller fields. In the end, they are just another tool in the toolbox.

I see you work on the hardware side of things with your Async Ability system that uses multi-core processing. Obviously working on the hardware will use bitwise operator. but what about people who don’t plan on working on hardware in C++? I had possibly foolishly assumed that game designers using UE4 would not need to fiddle with bitwise operators because that was already done for them by the developers of the engine, but maybe not…

I’ve only used them in UE4 for RPG gameplay code so far;
In plugins I sometimes use them for dropboxes that needs a bitmask allowing user to pick multiple entries on the dropdown list.

Particularly these functions I’ve used a lot:



#define BITMASK_SET (Property, Mask) (Property|=1<<static_cast<uint32>(Mask))
#define BITMASK_CHECK (Property, Mask) (((Property)&(1<<static_cast<uint32>(Mask)))>0)
#define BITMASK_CLEAR (Property, Mask) (Property&=~(1<<static_cast<uint32>(Mask)))


For gameplay, bitwise operators aren’t necessary. They can however be very useful, for example when considering networking requirements, or working with tight memory or disk constraints.