Author Topic: Raycast weapons  (Read 3254 times)

It seems some people have issues with instant kill raycast weapons which I suppose is a reasonable criticism. But shouldn't it be fairly simple to use the original raycast as a range finder, divide the range by a constant that represents the velocity to get a time delay, then run a second raycast after the delay to kill? You bypass the universal projectile speed limit and get a gun that shoots bullets at a fair speed instead of instantaneously. It should work fine for non moving targets. I've got a couple ideas for dealing with moving targets and stuff getting in the way of the bullet, but it's late at night and I'm not a programmer so they'll have to wait.

Another cool thing is you could factor in is sever variables for different ammo types with different velocities and damages, as well as variable wind direction (players could figure it out by watching bullet impact or placing a windsock brick or something). You could also have different impact particles, like dust on terrain, plastic chunks on bricks, blood on players, etc. I'm not sure if you can do this with normal projectiles.

Anyway, any thoughts?

Unfortunately all my ideas come back to the concept of "virtual bullets" and some kind of scheduled task that checks the location of the virtual bullet against players and vehicles in the game. I don't really know if that would be bad for performance but my guess is it would, especially if you had 16 people all trying to snipe each other. If you've got any experience with this feel free to share it.

This thread is less of a suggestion and more of an open ended discussion. If it's possible then we can work it out for someone else to use if they want. If it's not easy to do then we can leave it at that.
« Last Edit: September 11, 2010, 02:08:52 AM by Wedge »

So you want realistic bulet types with specific ranges weight and other things?

The only time instant-hit guns get overpowered is if your map is so large that any other weapon is predictable and avoidable. In a smaller map e.g. the largest sniper distance about a 64x plate length in Blockland rather than an entire terrain loop.

I don't think everyone firing these fake bullets would actually be too laggy. The schedule system seems to have been improved or changed v8 to v9 - my very first attempt at the 'projectile trap' items used a repeating schedule per item and lagged immensely when more than five or six ran at once, but the events can be used by everyone in the server with any amount of events on repeating and still work fine.

I really like this idea.

I really like this idea.

Also, Wedge posting a suggestion doesn't happen too often.

A problem I see is on a large map, when you fire and have a clear line of sight to the target, the delay kicks in, but suddenly a plane flies in the way and takes the bullet when it is fired, where if it was a regular projectile, it would have been past where the plane was already.

what about firing smaller raycasts, if the smallest hits, then the next doesn't fire, if it doesn't hit anything, the next does fire?
like:
raycast 1: _
raycast 2: __
raycast 3: ___
and so on, with different delays to simulate it taking time to get to the player