Background
I’m writing a fully custom game engine within roblox, using an entity-component-system architecture. I’ve started learning more programming stuff, so I decided to delve deeper and learn this paradigm. However, since it’s entirely custom, I have to write the networking and stuff myself.
The game is 2D, and there won’t be that much complexity in what I want to replicate to the clients. I’m not using any roblox features apart from GUI and RemoteEvent/RemoteFunction.
The Details, and what is required
Right now I have a simple game world client-side, that holds entities, which hold components. I initialize the world by making an EditableImage
and assigning it to some of the rendering systems, and then I simply attach world:update()
to renderStepped
, and that’s my whole game right now. I have some things like a physBody
component that makes the entity it’s attached to interact with the world.
For some components, I want them to have different behaviour when replicating. For most entities, it’s not that big of a deal to just send the whole entity to the clients, however I do have a terrain
entity which is essentially a huge bitmap. I may want to replicate only the changed parts of the terrain
entity’s bitmap to the clients; which would require a specialized system for just replicating terrain.
The Issue
I don’t even know where to start with writing the networking! I have no idea how I would begin to write the networking in a way that neatly fits into my code, or in a way that’s going to be easy to expand upon later.
I know the basics of networking, prediction, reconcilliation, etc. However, I’m not sure how to integrate this into my entity-component-system driven game.
The main question is; where do I even begin architecture-wise?
I’m not asking for the whole system to be written, I just want to know good tips on how I would structure it.
By the way, this is the ECS library I’m using: GitHub - bakpakin/tiny-ecs: ECS for Lua
Thanks, all