Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hitscan weapons #47

Closed
cxong opened this issue Jan 30, 2013 · 6 comments
Closed

Hitscan weapons #47

cxong opened this issue Jan 30, 2013 · 6 comments

Comments

@cxong
Copy link
Owner

cxong commented Jan 30, 2013

This will also require drawing the bullet, in a way that has nothing to do with its hit detection.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@cxong
Copy link
Owner Author

cxong commented May 20, 2015

On updating the bullet, it will need to draw out a line to the destination, checking collision at each tile, and step (if tile is not empty). An easy way to do it is to give it a suitable speed, then update in a loop until its range is complete.

To represent, add a bullet attribute IsHitscan. This way we can still reuse the speed/range variables for pushback and range calculation.

For drawing, we'd probably want a new attribute: HitscanFrames. This controls which % of the flight path we want to draw the bullet sprite per frame. That is, if the value is 3, the first frame will draw the bullet 1/4 of the way between shooter and target, the second frame 1/2, and the third frame 3/4. Add a random offset so repeated shots actually look like an unbroken path instead of discrete points. Will probably need to experiment with this to get it to look right.

Weapon ideas:

  • Laser
  • ~~~Rework the nuke fun gun to use laser indicator~~~ Add laser pointer
  • Stun gun (short range, petrify effect - rework petrify to an electrocute effect instead?)

@cxong cxong added gameplay and removed feature labels Nov 30, 2016
@cxong
Copy link
Owner Author

cxong commented Dec 7, 2016

Depends on #372

Since hitscan weapons play nicer with antilag, we may want to change some existing weapons to be hitscan too, like:

  • Pulse rifle
  • Pistol
  • New shotgun?
  • New sniper?

Also, with the addition of bullet mass (#444) it doesn't make sense to use speed/range anymore. Instead:

  • Speed = "Inf" - not really valid JSON double, but since we're parsing using atof, this works
  • Range still used, but purely for animation now (see comments on the HitscanFrames)
  • RangeHitscan used for the actual range now, in subpixel units

@cxong
Copy link
Owner Author

cxong commented Mar 27, 2017

Actually, with #372 (almost) done, hitscan weapons aren't any different from normal weapons - they just move really fast. So they are still represented using Speed and Range - range just being 1 usually for an instantaneous movement, and Speed being how many subpixel units they move.

But then there's the question of how to draw the trail. This could be done using SDL_RenderCopyEx, possibly with a new TrailPic attribute. But be careful - SDL_RenderCopyEx may not be compatible everywhere.

@cxong cxong added the engine label Mar 27, 2017
@cxong
Copy link
Owner Author

cxong commented Apr 21, 2017

Another cheap option is to draw a simple line with SDL_RenderDrawLine

@cxong cxong modified the milestones: 0.6.6, Backlog Apr 23, 2017
@cxong
Copy link
Owner Author

cxong commented May 17, 2017

This is actually going to depend on #440, since trails need to be part of the map, occluded by walls etc.

@cxong
Copy link
Owner Author

cxong commented May 20, 2017

Warning: GCW-Zero has a bug where SDL_RenderCopyEx is broken - it always renders unrotated at 0,0. Will need a workaround, or disable trails for GCW-Zero.

@cxong cxong modified the milestones: 0.6.6, Backlog Jul 11, 2017
@cxong cxong added the blocked label Jul 16, 2017
@cxong cxong modified the milestones: Backlog, 0.6.8 May 7, 2018
@cxong cxong removed the blocked label May 7, 2018
cxong added a commit that referenced this issue Sep 21, 2018
cxong added a commit that referenced this issue Sep 21, 2018
cxong added a commit that referenced this issue Sep 28, 2018
Fix bullet bounce pos/vel for destroyed bullets, so that trails render correctly
cxong added a commit that referenced this issue Oct 18, 2018
cxong added a commit that referenced this issue Oct 30, 2018
cxong added a commit that referenced this issue Oct 30, 2018
Fix animated particle rendering
@cxong cxong closed this as completed in 9d8788e Oct 30, 2018
@cxong cxong mentioned this issue Oct 30, 2018
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant