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

Spacewar projectile updates. #1097

Merged
merged 1 commit into from
Oct 31, 2023
Merged

Conversation

hemoridos
Copy link
Contributor

  • Modified aiming of weapons, added intentional randomness while taking into account the target's orientation and shape.
  • Added some randomness to the fire rate of weapons, this brakes up the monotonousness when multiple ship fire the same weapons at the time.
  • Restored the pixel perfect hit detection code. I've seen some performance degradation but seemed negligible to the overall spacewar scene.

Originally for random accuracy I tried using to simply get a a random position in the rectangle encompassing the target's image, but that gave unfair advantage to elongated ships(like most empire ships) when facing the enemy.
I ended up creating a method that more or less follows the shape and orientation of the target. When the space objects are loaded at the start, a rectangle size is calculated that is encompassing the trimmed images of the object. This rectangle is then used when aiming at targets. First get a random point in that rectangle then rotate the point around the object's center to follow the orientation of the target image and use that point as on offset when aiming. This of course has little effect on objects that fit in a square.
(Maybe using an oval area based on the trimmed rectangle to get the random point could work better.)

Here's a video showing this with the Thorin, the green dots used for debugging are showing the positions projectiles are aiming at:
Thorin test

I also added some fluctuation to the weapon delays when firing. This gives it more "realistic(?)" feeling that was missing in open-ig. When a weapon fires a random multiplier between 0.5-1.5 is applied to the cooldown. I tried smaller ranges but they did not have the desired effect.
Some videos to illustrate:
Original for reference
This PR
OpenIG-master

Some additional videos with no sound:
Large battle this PR(with debug dots)
Large battle OG IG

- Modified aiming of weapons, added intentional randomness while taking into account the target's orientation and shape.
- Added some randomness to the fire rate of weapons, this brakes up the monotonousness when multiple ship fire the same weapons at the time.
@hemoridos
Copy link
Contributor Author

Also this should make #333 effectively resolved.

@akarnokd
Copy link
Owner

I need permission to view the videos.

@hemoridos
Copy link
Contributor Author

Sorry, corrected it should open now.

@akarnokd akarnokd merged commit 428ea3e into akarnokd:master Oct 31, 2023
@akarnokd
Copy link
Owner

Thanks for tackling these.

Are you working on something else right now? If not, I'd like to release these latest changes.

@hemoridos hemoridos deleted the weapon_changes branch November 16, 2023 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants