Simply put this is what I plan to do in c++ as my getting started project to understand actor-actor, actor-component interaction.
I want to create three actors.
- The Input Data Actor. The Data should be converted to binary (byte size) data chunks in the actor and be pulled by the processing actor.
- The processing actor should just simply process the binary (byte) data, that it pulls from the input device, not relevant for the question how the processing would work, and push it onward to the ouput device.
- The output device, should hold some kind of texture or material that it can write to based on the data pushed from the processing actor to act as a in game screen.
I have concluded the following. There should be three actors named (AStorage) Storage, (AScreen) Screen and (AComputer) Computer.
Each should hold a Static Mesh Component to be a visible object in game.
For the Input Data Actor for the futures sake I need to make it toggleable, if it’s on the data should be pullable by the processing actor.
class AStorage
{
UPROPERTY
bool On; //on or off
UPROPERTY
TArray<uint8> data; //data buffer.
}
class AInput
{
UPROPERTY
bool On; //on or off
OnTick()
I guess all the processing would go into tick with a obvious check if we are on or off, probly some throttle that would limit computations/sec.
The processing unit is toggleable, once it turns on it will pull the data from the input device(if the device is on), and process it (later logicaly process and compute it) but now it should simply just write to a boolean buffer of a fixed size and push it to the screen.
UPROPERTY
bool displayData[64x32];
}
class AScreen
{
UPROPERTY
UTexture* ScreenDisplay;
This is the texture where we will display the output.
“Event/function call”
void processInput(bool* displayData);
loop trough the boolean data and write to the coresponding texture pixel coord, black or white.
}
The questionmarks I am trying to figure out, are the following. If I want to hook up the connecting pieces trough blueprint once the code is done, would I would define that input, output as predefined UPROPERTIES? What do I need to think of? Maybe it’s bad in the design to depend on the actuall classes, maybe i should break it down, and just have defined ports/sockets intead of the objects? The problem here then is how the screen would know how to update. I currently doesn’t desire for it to process and update it’s texture every frame, only when the data is provided.
UStruct DisplayPort
{
bool displayData[64x32];
}
UStruct DataPort
{
TArray<uint8> data;
}
When it comes to the texture I just expect there are clear examples how to manipulate texture data on the site, and I just need a material for screen that takes said texture as an input or are there any other pitfalls here that I might miss?