Not sure if its a problem with FastCast or my use of it, but AutoIgnoreContainer will add the CosmeticBulletContainer to the RaycastParam table, even if its set to whitelist.
Here in the API it states it will not work if its using a whitelist. This caused my bullets to hit each other, and setting AutoIgnoreContainer to false fixed it for me.
I’m using fast cast for my mech game and I’m having a few problems I just want to know if it’s me or just limitations of the module.
My mech character can wield up to 4 guns simultaneously and fire simultaneously. In studio this is not an issue but in live servers even having only two players with the same loadout makes ping start to skyrocket.
Do we have any stress test references to see if it’s just me or limitations of the module?
Probably worth noting that the weapons have a pretty high fire rate of around 1 shot every 1/100 of a second.
I find it hard to believe that fast cast would have trouble with 8 high fire rate guns so I’m hoping it’s just me and my terrible code…
Fast cast doesn’t use remote events or deal with networking at all so it should be up to user implementation.
Remote events is usually what causes Ping to sky rocket depends on rate and the amount of information you are sending.
Also automatic replication from server → client can cause ping to sky rockets which I have learnt from @Alvin_Blox problem, ex: creating part from server.
Perhaps you are creating the bullets on server with part cache being on the server?
Nope, not necessarily. For my game the fastcast is on the client to handle the visuals only.
If it is on the server then everything has to replicate to the client including the bullets projectile motion for every position and orientation changes.
Vs telling the client once to create the bullet and then letting the client simulate by itself without needing the server to tell it every position and orientation change as the bullet travels.
I recommend you try it out yourself and see if it makes a difference.
This method of using fast cast on the client for client effects I took notes from FPS framework 2.
You could do this from detecting when the player shoots the gun, then the server will send data’s of the bullet (e.g: Origin, Direction, Velocity, etc) from the player that shoots to other players to draw the visuals (e.g: bullet model, bullet trace, etc), so basically
I decided to go with your advice and I managed to get some really interesting results. Send-Receive rates of under 1KB/s for both clients on both rates. However my only issue now is that spread is of course randomly generated which means that if the spread isn’t accurate enough for the receiving client, the attacking player will have killed the client but the defending client would be fine which is less than ideal. Thanks for the advice, Ill do my best to develop this system but I am not without my concerns as I am sure how to defend against exploits through this way.
any good way to get spirals or circular motion? I’ve read that it could be a bad idea to update the cast physics every frame. assuming at most 50 projectiles on the screen, how expensive could this be? am I better off just using traditional hit detection?
I’ve tried figuring this out myself, but haven’t been able to…Does anyone know why when the FirePointObject on the Tool seems to either collide or be very close to colliding with another part, the bullet will fire at a completely different angle?
Sorry for the small Gif, but this showcases what I mean. You can see my first few bullets fire in random directions when touching or nearly touching another object, as well as the last few bullets. You also see one shot actually go in the correct direction when I’m further away from the object.
This is a roblox issue with cursor detection sadly.
I personally have this issue with EVERYTHING thats cursor-based.
As far as I am aware there is no direct solution (I may be wrong)
You could attempt the following though.
~ Raycast from the camera origin to get the hit cframe of the mouse. (unsure if this will work.)
~ Or just detect if the gun is very close to something and make it shoot infront of the barrel by default instead of going to the cursor.
In a way, I believe I’m already doing what you’re suggesting, but slightly different. Rather than using the Cursor for getting the Mouse.Hit.Position, I began using a Raycast from the center of the screen and then returning that position.
local function GetCenterOfScreen()
local position = Camera.ViewportSize / 2
local unitRay = Camera:ViewportPointToRay(position.X, position.Y)
local rayParams = RaycastParams.new()
rayParams.FilterDescendantsInstances = {Character}
rayParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = Workspace:Raycast(unitRay.Origin, unitRay.Direction * 1_000, rayParams)
local hit = CFrame.new(raycastResult.Position)
return hit.Position
end
Although even with this, the issue still persists, unfortunately.
I was curious if you had an idea of how to get the direction forward of barrel? Currently I calculate the direction using the following equation fireDirection = (mousePoint - FirePointObject.WorldPosition).Unit.
Additionally, for anyone else who might be curious about the issue, as my previous Gif might not have shown it off greatly, here’s a better one: