Writing an FPS framework, part 2 (2020)

I do sprinting with sine waves but you can just export it to blender or use the default animator/new MAS if you’re only doing animation

1 Like

OOF, sorry for being like the most annoying person in the world but I notice you are doing ammo with tables, and I am not sure how I would make an “ammo HUD” if the ammo is in a table.
mk quick update I found out how but I have some problems, It only updates it when I shoot so when I reload its still at “0/0”
i put the line of code below “RenderStepped”

well anyways sick tutorial :smiley:

And just for clarification, the ID thing is to basically stop exploiters from just firing random hit remotes to the server by making sure the firing client has the same ID they sent from when the gun was fired, right? Or did I understand it wrong?

@TheFearlessMe
confirming every shot was actually fired when there was ammo inside of the gun, plus hit verification for when it hits and needs to compare against where it was fired from
@BottomLess_VORTEX
If i remember correctly ammo in the current magazine is a table value referenced by the current weapon name. If you don’t want to do this you may want to use a whole table that’s weapon-specific and store the ammo there (I have been doing this for a few months, but I would need to update the tutorial)

1 Like

why can’t I upload the animation

Hi, thanks for the tutorial, it’s been incredibly useful. I have no past experience with making frameworks and it would take me ages to figure all this out.

Based on your code and diagram I made some sort of client-server security, but I don’t think i understood it correctly and I’m not sure whether the thing I came up with has holes in it:

  • As the client shoots, a local bullet on his side is fired instantly and along with it a server-sided fire event gets triggered.
  • The client’s shot has pure cosmetic purpose and only generates a visual effect upon hit.
  • The triggered server fire function validates whether this shot is possible by the client.
  • Server fires it’s own plain invisible shot without generating any effects. The server’s shot deals damage upon hitting a player.
  • Along with firing the server shot, the server notifies all the other clients to generate their own cosmetic version of the shot.

In the fps script you have the canFire, firing, reloading and ammo variables. Should the server keep track of this data as well to determine a shot’s validity?

I don’t understand what the bullet IDs are intended to be used for.

The server can keep it’s own track of ammo data based on fire and reload requests from the client.
In the diagram you have indicated client to server communication when the bullet reaches it’s destination. What is it for? Isn’t the server’s hit detection enough?

What I used the bullet IDs for is generating reproducible and hopefully by exploiters not editable bullet spread angle, as described in this post.

I’ll be grateful for any advice.

In the fps script you have the canFire, firing, reloading and ammo variables. Should the server keep track of this data as well to determine a shot’s validity?

your choice, ammo should stay synced between the 2 sides though

I don’t understand what the bullet IDs are intended to be used for.

IDs are intended to keep track of the bullet’s original stats to compare them against where the client/server hits the shot after casting it, stated below in my quoted message

The server can keep it’s own track of ammo data based on fire and reload requests from the client.
In the diagram you have indicated client to server communication when the bullet reaches it’s destination. What is it for? Isn’t the server’s hit detection enough?

it’s not. clients are often desynced between what the server and individual players see so for good hitreg you need to let the client deal damage sometimes, hence the communication

edit: looking at your understanding, the “only generates a visual effect upon hit” seems to be the only incorrect thing, the original person firing also sends a request to damage a humanoid if it hits one (passed through server verification as stated in the diagram and above)

2 Likes

Thank you, that is the explanation I needed.

A useful thing for you or for others may be, that the up-to-date version of FastCastRedux has a UserData table attached to each cast, which can be the alternative to keeping a table of bullet data indexed with IDs.

1 Like

I use this in my current bullet module

2 Likes

What’s still not clear to me is, how can the server possibly validate the hit, if the server is desynced and the client claims to have hit someone. An exploiter could just fire random shots dealing damage to certain humanoids and “convince” the server it’s desynced.

A solution I thought of is, to count the amount of times the client had to be trusted like this and if it happens too often, the client would be marked as sus.

Also would you check for client’s hit detection even on the replicated shots?

What’s still not clear to me is, how can the server possibly validate the hit, if the server is desynced and the client claims to have hit someone. An exploiter could just fire random shots dealing damage to certain humanoids and “convince” the server it’s desynced.

“desync” in point-blank range is often not bad enough for a hit to not be verifiable via the sanity checks, there is no “convincing” other than straight up teleport exploits

A solution I thought of is, to count the amount of times the client had to be trusted like this and if it happens too often, the client would be marked as sus.

amogus

3 Likes

send help
mr doge man

RobloxStudioBeta_UEkf2S4y7r

oDazKKYaE9

2 Likes

You don’t have a variable named “players” created.

4 Likes

Can you reply with the link of the “Weld Editor” Plugin you were using here?

2 Likes

If rigedit works, use that, otherwise an old version of moon animator

2 Likes

For some reason, the event always says that the bullet is nil
Code:

function rayUpdated(_, segmentOrigin, segmentDirection, length, velocity, bullet)
	local BulletLength = bullet.Size.Z / 2 -- This is used to move the bullet to the right spot based on a CFrame offset
	bullet.CFrame = CFrame.new(segmentOrigin, segmentOrigin + segmentDirection) * CFrame.new(0, 0, -(length - BulletLength))

end

(this also happens with the ray hit function)

Has anybody tried making crouch/laying and sprinting for this framework? I’m trying to make my own system for that but i always end up giving up.

1 Like

Either

  • grab and modify an existing foot planting script (it doesn’t have to be inside the framework at all, as long as you have a Crouching/Prone variable to modify)
  • modify the character’s RootJoint C0/C1 to look like they’re crouching
  • play animations for each stance

I have not tried the last one, but the base thing is adding a :crouch() function to the framework and doing whatever in there

2 Likes

The first option sounds the easiest, thank you BlackShibe! I didn’t think of using something outside the framework so i just overcomplicated everything.

2 Likes

How would I go about making the arms look the same as my characters arms? I understand that I could just change the Arm’s BrickColor but how would I go about making the shirt visible there too? instead of just a being naked arm.

like make the blue sleeve show up

2 Likes