How would I make a responsive combat framework like in popular battlegrounds games?

Greetings all, I’ve been working on my own battlegrounds game for about half a year at this point, and I am currently about 3 rewrites in, as every time I make my combat it feels extremely unresponsive and laggy.

For example, here is some footage from my own game.


As you can see it, it looks stiff, and while playing with a friend, the lag was real.
In my game, the player activates a tool (shown as a move in the hotbar) and it sends a remote event to the server, which does and calculates everything (excluding bodymovers)
, including cooldowns, damage values, animations, etc.
Whereas in a different game (for this example I’ll use Jujutsu Shenanigans), the game has no real lag (excluding voxel lag), no players teleporting around during dashes and combat feels less stiff than in my own game.

Looking into it a bit more, I found that JJS uses Knit in the game: About | Knit
image

What I want to know is, how would using things like Knit (or any other frameworks like it) help with responsiveness or smoothness in general, and what folder structures, coding practices and other things should I use when working on it?
Thanks in advance, sorry if this thread is a bit rambley, I just really want my game to be fun and playable, haha.

Knit is a framework that helps developers eliminate the need of setting up Remote/Bindable Events/Functions. But overall Frameworks (Including Knit) will help organize and structure your code, but it’s your job to optimize the code inside the framework.

Folder Structure really depends on you. Knit has 3 types of modules in my opinion…

  • Services
  • Controllers
  • Components

I’ll share how I organize my folders/modules… (but again it doesn’t really matter as long as you understand how it’s organized)

  • ReplicatedStorage
    • Shared (Folder)
      • This is for modules organized in folders that are open sourced (Such as the promise module, maid module, etc…) or hold information such as my group’s roles. You’d also use this folder to hold the knit modules.
  • ServerScriptService
    • Knit (Folder)
      • Components (Folder) (I also use other folders to organize components that relate to each other)
      • Services (Folder) (I also use other folders to organize services that relate to each other)
      • ServerLoader (Script) (Loads Knit on the Server)
  • StarterPlayer
    • StarterPlayerScripts
      • Knit (Folder)
        • Components (Folder) (I also use other folders to organize components that relate to each other)
        • Controllers (Folder) (I also use other folders to organize controllers that relate to each other)
        • ClientLoader (LocalScript) (Loads Knit on the Client)

Anyway, sorry for the non detailed response, It’s pretty early. As for a conclusion, I think it’s in your best interest to use a framework such as knit, and if you want to take it a step further, you can even use Rojo/Github and code in VSC.

Be careful because some ROBLOX Developers spend all their time to try and find the “perfect” framework, and restart their whole project every time they find a “better” framework.

It’s looking good, keep it up man, if you have any questions feel free to ask!

1 Like

Hello! Thank you for the detailed reply, I’m beginning to understand a bit better now, I do have a few questions:

  1. How would I handle having multiple movesets that the player can select?
  2. How would I handle having slower & faster punch speeds and damage values for different characters?
  3. What would be a good way to handle player inputs?

Thank you in advance, you can reply to this whenever you have free time! :slight_smile:

I haven’t worked on a combat system before, but I’m going to try and go off on a limb here…

  1. You might can do something with the toolbar and have 1 as a move, 2 as another move, etc… (Like Strongest Battlegrounds)
  2. Unsure, I think it would be based on stats and you can preform logic to have your slower/faster punches and different damages. (Maybe a module that holds this information for different characters or a datastore for each player - how ever you set it up)
  3. UserInputService in a controller, I like to divide them based on what each input does, so if I were making abilities be based on number keys, I’d create a controller to listen to numbers keys for the abilities.

There are multiples ways to solve those 3 problems, it’s really just the matter of which solution is more optimized and efficient.

Again, I never made a combat system before, but if you have any other questions regarding the framework or technical side of knit, I can answer them. As for questions relating to the combat system, I’m not sure of, but I’ll try answering them.

1 Like

Alright, thank you! Do you have or know of any other threads or possibly videos that could help with understanding Knit?

Forgot to mention the creator of Knit, sleitnick did say this, it doesn’t mean knit won’t work, it just means it won’t be receiving updates.
567e3041978280db5b53942cf764fa0c0ee12941

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.