Hello, I have been wondering how to make a efficient, readable, clean architecture for effects.
My current Architecture works as such
THE PHILOSOPHY OF THIS SYSTEM IS TO HAVE ALL EFFECTS VISUALLY MADE ON THE CLIENT TO PREVENT THIS LOAD BEING DUMPED ONTO THE SERVER
The issue is how to improve this effect system in order to make it more readable, debugable, but most importantly, to make it more optimized and take up less memory; this system works awfully in regards to simple effects such as some particles; however, I want this to be a universal system for all effects.
Server requests effect > EffectId generated > Remote and Dump folders are created, remotes created automatically; Effect pointer instance is created for remote interaction with client > The two folders and effect pointer are stored in a cache
Server requests effect > Client recieves effectId, remote Folder and dumpFolder > Client creates effect runtime instance that acts as a wrapper for effect code to provide cleanup and easy remote access.
Server Requests Termination / Client requests termination > Server has effect pointer destroyed, and the Client has its EffectRuntimeInstance Destroyed.
As for each effect module, each effect is a object that inherits from the base effect object.
On the client, there is the run code to prevent memory buildup on the server. On both sides, there is a table of remotes, the effect name, and other data
As for the effect id, it is some random id for each effect ran; There can be two ids for two running fire effects
As for the effect code, it is as such
function (effectRuntimeInstance, ...) end
The effect runtime instance offers the methods as such
local EffectRuntimeInstance = {}
function EffectRuntimeInstance:InsertIntoDump(...) end
function EffectRuntimeInstance:Fire(remote, ...)
function EffectRuntimeInstance:ConnectTo(remote, conn) end
function EffectRuntimeInstance:Cleanup() end -- clears all connections
The effect pointer is similar, but has no “InsertIntoDump” as the server dose NOT manage the actual visual effect to be seen
My other miscellaneous concern is how to avoid over engineering code