SimpleCast - An Alternative to FastCast

You should tell what is your CPU not GPU. That’s because this code runs on your processor. Roblox doesn’t support Running code on GPU yet.

1 Like

yeah, I realized that, but decided not to say it :skull:

1 Like

How would validating hit registration work, should be the same as fastcast right? Also would recommend adding an rbxm file to the post, it’s much more convenient than using roblox site modules

please stop, this is a bad idea, links are more convenient because you don’t need to fill your computer files, like this is what it looks like if you downloaded too many .rbxm files

2 Likes

it’s my personal preference, i said they can keep the roblox model

Whot happenin with the calculations? some are falling some are bouncing. Also can you add a way to set the cache folder? and when documentation

1 Like

The calculations come from the GetPosition function. The update method moves the balls based off of the GetPosition function using time as an input. When a ball collides in the demo I calculate a new init velocity and have the ball go in that direction. (this logic occurs in the OnHit function) (yes, I did consider signals I felt they did not fit the simple concept I was going for) Bouncing is not a default behavior. If you want bouncing, projectile piercing, or any kind of custom logic to occur you have to code it yourself. All this module does is take in your projectile object, the settings, and move the ball.

1 Like

No problem! If you make anything with it post it. I would love to see it in action. : )

I am probably going to add a github repo, and a rewrite of the post. I just have to wait for my classes to finish up this semester first.

1 Like

I set it up like in your post and I’m getting this error: “SimpleCast:160: invalid argument #1 to ‘clone’ (table expected, got nil)”

image

Fixed it by changing it to this:

function CastCache:ExpandCache(size)
	for i = 1, size do
		local obj = self._obj:Clone()
		obj.Parent = self.CacheDump

		table.insert(self._dead, {
			Object = obj,
			InitVelocity = ZERO_VECTOR,
			InitPosition = ZERO_VECTOR,
			LifeTime = 0,
			Data = table.clone(self._customData or {})
		})
	end
end
3 Likes

This is a wonderful module, works very well. I do have an issue with attempting to create a passing sound for when a projectile passes a player, to initiate other things like suppression, etc. Could anyone help me in finding out how to accomplish this using this module?

1 Like

So I was actually thinking about this a few days ago. I think this can be handled many ways actually. One is was comparing the distance of the characters and if they are within the proper distance do the suppression. (use OnCastMove for this)

There may be another method you could use with dot product. On firing find out if the player is in the proper angle range. Keep track of all the players within that range and check when the bullet passes by them. This is similar to the last method but you are not checking the entire list of players every time the projectile moves. (Use CustomData and OnCastMove for this)

Info on dot product:

To further add onto the power of dot product you can add bullet magnetism using dot product. I actually implemented that in a really old version of FastCast a few years ago. (you see bullet magnetism in COD and Halo it is to help projectile bullets hit their targets. You can see the effect quite a lot in the Needler from Halo.)

Exactly what I was looking for!

1 Like

Am needing a bit of help if like networking a gun cause the gun system i made prior was all server based with fastcast, however I want to swap to something client based (as this) to make the guns more responsive and not dependant on ping

In the demo place it has some basic networking. Let me know if you have any other questions.

Hi, I want to start off with thanking you for making such a great asset free.

I would like to use this module to replace the FastCast module within my gun kit and I’d like to edit this to suit my needs. Is that okay? Would I be allowed to release said edits as well?

Of course I’d give you credit but if you’d prefer that I not release it that’s perfectly fine!

Thanks for this though. :smiley:

1 Like

That is totally fine. I would like to know what edits you are making because I am always looking to improve the module. If they are specific to your project I do not need to know.

2 Likes

Thanks for the quick response,

My edits are specific to my project - I’m trying to make a really realistic gun system. I want to re-add penetration with some improvements (in my opinion) and add ricocheting as a function within the module. I could just use FastCasting but I think this is a great groundwork and is far more readable and user-friendly.

Also, are any future updates for this module planned / in the works already or will you just do updates when features are requested?

2 Likes

That sounds pretty cool! I probably won’t ever added penetration or ricocheting since like you observed I am trying to lay good groundwork for people’s projects.

Let me know how your project goes. I love to see videos or play demos. :slight_smile:

I also do not have any major updates planned as of now. I do plan to put a repo on Github and probably rewrite the original post. I will do updates if requested. (depends on the update. If it strays to far away from the original goal of being “simple” then I will not add it.) Do you have any suggestions?

Edit: I do have one update in mind. It is the ability to have a SharedCache between Casters.

2 Likes