How to make smooth and flexible physics for a smash bros-esque combat game?

I am trying to develop a platform/combat game that contains a heavy use of physics in the future (WASD dodges, jumps, boosts, ragdoll flinging). I have so far made an unfinished character controller based off of @EgoMoose’s platforming character controller. However, the elephant in the room I need to address before I can get on with development is my mediocre understanding of video game physics and being able to fit physics into my character controller in a clean and flexible way that achieves what I want. Ideally, I want to make some type of module that my scripts can call on to fire whatever force it would need on the character. In that module,

  • I need a system that I can give information to, that I can control the force and acceleration of said force, to allow for smoother and better looking actions.
  • I need for that force to be able to change depending on nearby obstacles, if a small ledge messes up the force and makes the action land in a weird spot, it should correct for that.
  • it needs to be flexible enough to work with any action I need, (being able to create a really powerful, stiff and unmovable force like a bullet, but also a weaker force like a throw)
  • It needs to stay clean, work smooth, and bug out as little as possible

If anything above is unrealistic, please give me an idea on how to realistically create this module.

I know enough about Roblox’s old and new body movers to get an idea on how to make a force happen. My problem is more about controlling that force and how to make a variety of forces happen in the right direction, at the right distance, every time its fired.

I have taken a look at the @EgoMoose’s physics tackling modules, and I get the general idea on how they work, but im not math savvy enough to dissect and alter it for my own project.

If anyone can give me a better idea on how to tackle handling roblox game physics in general, any essential tools to keep in mind, it would be greatly appreciated.

2 Likes

I would recommend making your player physics into a state machine in a module where every renderstepped, the physics is updated based on the current state. If your character inputs an attack in a standing state, you could set the state to “standing attack”; if someone else were to make contact with you while you are in the standing attack state, you could use a priority system where every state has an assigned priority to determine which attack/movement is interrupted.

Maybe it’s just me, but I find that writing custom physics where you take the current state (position, velocity, acceleration) and do your calculations to find the next state gives you much more freedom to create very precise and nuanced actions, rather than attempting to work with default roblox physics. Doing your own calculations every renderstepped or update cycle can also enable you to do cool effects like slowing down time for all players or freezing the game, like with some Smash Bros specials and also the freeze that occurs on perfect parries and the final kill moment.

If you want easy, clean interaction between different player physics, I would recommend going for modules and organize everything in an object-oriented way.

3 Likes