I am working on an entity-component system, and I am thinking about this communication protocol:
- The physics component of a game object sends an
UpdateMyStatemessage, with its state attached.
- The physics engine receives this.
- The physics component sends a pointer to its data, and the physics engine changes the state. Because it is a pointer, no messaging back is required.
The standard way involves the physics engine sending back an
UpdatedState message, with the new state attached. This will be processed by the physics component. I am not sure if my way is a good exercise. It is not a complete message-based system, but it decreases the amount of required messages, and it simplifies the system.
What are the advantages and disadvantages of using pointers to change data in my physics engine?