How to Achieve Realistic Bullet Physics

Hello,

I am wondering how the bullets from games like Phantom Forces are created. I understand there is lots of math to it, but I feel like there are easier ways (and if not, I’d like to know what to do).

Difficult or not, I want to achieve something that isn’t hard on the server and will run very well (locally at least.) I don’t necessarily want tracers as my game will not be using tracers, but rather bullets (for the effect, I will just be adding smoke trails).

If possible, I’d like to know what the basic things I should learn for starting this kind of system because I would like to understand how I can modify it myself and fix it, without it looking gibberish to me. Not any free model ModuleScripts, kind of lazy to me.

Anything helps.

1 Like

you will want to use raycasts
and you can just shift the bullet position slightly down according to the distance (you could also slightly rotate the ray cast, i would recommend this as it wouldn’t glitch in certain places), if you’re making projectiles like rockets you could use body movers

2 Likes

Most games fake their bullet!

I also wanted to get into weaponSystem designing, and at first, it looks extremely complicated, but its actually plenty of simple concepts put together.

Most weaponSystems use 1 Ray to determine wether they hit a player or not. This is called HitScan and it is used with workspace:Raycast.

All of the effects are created by the client such as beam, hit particles and animations.

If you are not an advanced programmer, I would recommend you don’t start your own weaponSystem because it takes a lot of time to get it to look good. But if you think you have the skill and the time, go for it!

4 Likes

Not exactly sure what you mean by bullet physics.

Generally bullets in FPS games have a few physic related elements:

  • Bullet fall (bullets going downwards)
  • Bullet penetration (bullets going through thin objects often with lower speeds)
  • Bullet bouncing (bullets bouncing off hard surfaces)
  • Bullet spread (bullets going different directions when shot, can involve more complex math to get the distribution correct, but with a static spread list its pretty simple)
  • Gun recoil (just a spring, you can get this from a spring module)

The physics parts of bullets obviously involve math, specifically super basic physics equations and vector math.

You can simplify bullets as much as you want. If you want a realistic game like PF, there will be some math involved. It’s not too complicated, but it would definitely be easier if you’ve had a intro physics class.

This is where bullets get complicated. FPS games use a lot of well researched tricks to get bullets to replicate well. I notice you have a slight misunderstanding though: the pain point of bullets as far as processing is from the replication tricks. Raycasting is pretty cheap, but doing something like backwards simulating can be very expensive, especially in Roblox which isn’t set up for that.

Conclusion:

  • The math behind bullet physics is pretty simple. The programming can be more difficult but is also very doable.
  • The techniques behind covering up the network latency are diverse and the best are very complicated. They can be processing intensive and difficult to learn.

If you’re looking specifically for bullet visuals, this thread is pretty good:

A much simpler solution that the much more optimized solution in that thread is just to use a beam with a limited max length.

Here is another great thread if you’re wanting to make an FPS game:

This tutorial is very in-depth and explains the math well.

3 Likes