Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Entity-based projectiles is inevitable... #25

Closed
ClobberXD opened this issue Mar 27, 2019 · 7 comments
Closed

Entity-based projectiles is inevitable... #25

ClobberXD opened this issue Mar 27, 2019 · 7 comments

Comments

@ClobberXD
Copy link
Owner

ClobberXD commented Mar 27, 2019

While gunslinger uses Deferred Raycasting for improved realism without much of a performance hit, there are still some potential inconsistencies or edge-cases like the one below:

screenshot_20190327_122016

Deferred Raycasting works by initially performing a raycast to obtain the distance to the point being aimed at. If the player in the screenshot is moving, the shooter has to compensate for the player's movement by shooting ahead of the player. But due to the position and angle of the shooter, the initial dummy raycast will return a pointed_thing pointing to a very distant node. This results in the delay being wrongly calculated, which means that the second and actual raycast will be performed after a wrongly-calculated delay, making this technique worse than instant-hit.

As much as I hate it, gunslinger would have to start using entity-based projectiles, for the sake of consistency. :|

@LoneWolfHT
Copy link

How does the shooter mod do it?

@ClobberXD
Copy link
Owner Author

shooter predicts the position of the projectile after shooter.config.rounds_update_time, and performs a raycast to that intermediate position. This process is repeated every shooter.config.rounds_update_time, until the raycast-returned pointed_thing actually points to a node or object.

See functions fire_weapon, process_round, and process_hit in https://github.com/stujones11/shooter/blob/master/shooter/api.lua

While this is a very neat idea, I still haven't understood the mechanics to the level required to successfully implement it in gunslinger. I suppose there's no harm in also trying out shooter's approach alongside the entity-based one.

@ClobberXD
Copy link
Owner Author

See #27

@LoneWolfHT
Copy link

Why not do a series of raycasts over time to cover the bullet's travel in steps? Maybe running a series of 5-node raycasts with slight delays in-between to let the particle catch up? At the end of each step you could change the direction very slightly in order to simulate bullet drop too

@LoneWolfHT
Copy link

Or did I just suggest what shooter does?

@ClobberXD
Copy link
Owner Author

That's similar to how shooter works after v6.0, and is exactly what #27 suggests. :)

@ClobberXD
Copy link
Owner Author

Entity-based projectiles is NOT inevitable. Screw entities. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants