Extreme Example:
- The server creates a car.
- To keep performance low, it only handles the necessary physics;
- Imagine a simple Part for the base and four Balls acting as wheels.
Now, this car is supposed to be extremely detailed, though.
Imagine the craziest contraption you can think of: extremely high fidelity, multiple animations firing off, particle emitters going wild, dancing NPCs hanging off it, doors and meshes being tweened, and so on -
basically, a performance‑destroying beast.
Handling all of this on the server wouldn’t be smart.
50 of these cars, and you have your servers running like 100 ms slower.
If I want to handle all of these things on the client, what would be the smartest way to do it?
Ideally, I’d like to encapsulate the car as an OOP object on the client to make actions and interactions easier to manage.
Normally, you could send the client the necessary information - like which models you want loaded only on the client, or details such as how fast a propeller is spinning, what animations are playing and so on…
However, StreamingEnabled makes this tricky. How can you locally apply this information / ‘skin’ to the server‑version of the car if it doesn’t even exist on the client yet? What would be the ideal way to solve this?
Ideas I had:
-
Using individual attributes per model, which means having all of the necessary data be loaded in immediately once the model is loaded in, so an OOP object can be created locally. Each individual attribute would be listened to for changes.
For functions that the cars might trigger, which might send large amounts of data, I can save the cars in a table on the client / server and listen to a RemoteEvent.
Attributes that hold complicated data, such as e.g. large tables, could be passed down as JSON. -
Same as above, but having one single attribute per model which saves everything as JSON
-
:
- Client loads in server object
- Client sees Tag / Attribute of it being a special object
- Client sets it invisible / it was invisible on the server already
- Client Requests information from → Server, needs data
- Server sends it back → Client creates an OOP object and renders the object
Option 3 probably isn’t good because of the extra back-and-fourth communication between server and client..
Should I go for the first / second approach? Or is there something better? Is this unnecessary overthinking in general?