Passing data between engine layers
- by spaceOwl
I am building a software system (game engine with networking support ) that is made up of (roughly) these layers:
Game Layer
Messaging Layer
Networking Layer
Game related data is passed to the messaging layer (this could be anything that is game specific), where they are to be converted to network specific messages (which are then serialized to byte arrays).
I'm looking for a way to be able to convert "game" data into "network" data, such that no strong coupling between these layers will exist.
As it looks now, the Messaging layer sits between both layers (game and network) and "knows" both of them (it contains Converter objects that know how to translate between data objects of both layers back and forth).
I am not sure this is the best solution.
Is there a good design for passing objects between layers? I'd like to learn more about the different options.