Original Post
So I've been wondering about this lately and before I evolve my game even further I wonder if this is an effective way of passing data through my event functions.
So I've mainly been doing this in event and command handling where I do a network packet-like way of sending my events to my entities, and then my entities do the work of parsing that information.
This is an example before I start making a binary serialization class that returns the same string.
Don't care about the X and Y being only 1 byte, this is just an example of something I would make. I also don't remember on the fly of writing this if I have to use memcpy but whatever.
So my question is: Is this an effective way of doing this? Speed wise? I mean, I could make structures but they are not so great in course of being dynamic data containers. I had a vague idea about passing void* pure data, but that brings me back to the same idea of using my approach since a string is basically pure data in the form of bytes.
So I've mainly been doing this in event and command handling where I do a network packet-like way of sending my events to my entities, and then my entities do the work of parsing that information.
This is an example before I start making a binary serialization class that returns the same string.
char event[4];event[0] = EVENT_EXPLOSION; // Value 11event[1] = 32; // X event[2] = 75; // Yevent[3] = 20 // MagnitudeEventHandler::Instance()->handleEvent(event,NULL); //Send the event to entities who care about EVENT_EXPLOSION;Don't care about the X and Y being only 1 byte, this is just an example of something I would make. I also don't remember on the fly of writing this if I have to use memcpy but whatever.
So my question is: Is this an effective way of doing this? Speed wise? I mean, I could make structures but they are not so great in course of being dynamic data containers. I had a vague idea about passing void* pure data, but that brings me back to the same idea of using my approach since a string is basically pure data in the form of bytes.