How would I go about making custom client-side characters to reduce lag?

I’m working on a game where each server will have upwards to ~100 players. I was told that adding custom client-side characters could remove the load from replicating every humanoid which takes up a lot of memory. Using “abstraction”, I was told to create a rig for every character and replicate their positions and whatever else I wanted (ex: animations, and cosmetics). I do not fully understand this concept nor how to go about this. Can anyone help?

1 Like

To create custom client-side characters and reduce lag in your game, you’ll want to focus on optimizing the way characters are managed and replicated. Here’s a step-by-step guide to help you understand and implement the concept of abstraction effectively:

Step 1: Understand Abstraction

Abstraction in this context means creating a simplified version of your characters that is only represented on the client side. Instead of replicating all details (like humanoid properties) for each player on the server, you maintain a lightweight representation that only sends necessary data.

Step 2: Create a Rig for Each Character

  1. Character Models: Design your character models (rigs) using a 3D modeling tool. Keep them simple to reduce resource consumption.
  2. Animations: Create a set of animations for these rigs that can be used across different characters. Use a common animation system to avoid duplicating animation data.

Step 3: Implement Client-Side Logic

  1. Character Representation: On the client side, have a script that creates instances of your character rigs based on player data.
  2. Position and Animation Updates: Only send essential data (like position, health, and state) from the server. The client can then use this data to update the character’s position and animations without needing full character data from the server.

Step 4: Replicate Minimal Data

  1. Data Structure: Define a lightweight data structure to represent each character on the client. For example:
    local playerData = {
        playerId = "player123",
        position = Vector3.new(0, 0, 0),
        animationState = "Idle",
        cosmetics = {hat = "None", shirt = "T-Shirt"},
    }
    
  2. Server to Client Communication: When a player’s position changes, the server sends only the necessary information:
    RemoteEvent:FireClient(player, playerData)
    

Step 5: Optimize Network Traffic

  1. Rate Limiting: Control how often you send updates to clients. For example, only update positions at a fixed interval rather than every frame.
  2. Event-Driven Updates: Use events to trigger updates only when significant changes occur, such as a character moving or changing states.

Step 6: Test and Iterate

  1. Profile Performance: Use profiling tools to monitor memory and performance to ensure that your optimizations are effective.
  2. Player Testing: Conduct tests with multiple players to observe the effects of your changes on lag and performance.

If you have any questions ill be happy to help,
Good luck with your project!

chatGPT not helping yk… it’s only for more basic concepts.

1 Like