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

Make Bullet projectile extensible #20931

Merged
merged 1 commit into from Aug 13, 2023

Conversation

michaeldgg2
Copy link
Contributor

@michaeldgg2 michaeldgg2 commented Jun 23, 2023

This PR makes Bullet projectile extensible, so mods can adjust and modify its behavior.

Proposed changes would be used in OpenE2140 mod to implement debris flying out of spot, where original projectile (i.e. the one fired by actor's weapon), hits the target.

Draft implementation of new FreezingBullet projectile (based on the new, extensible Bullet) can be seen in this commit: michaeldgg2/OpenE2140@5a37d20. This commit, however, contains only the use of this new projectile (not the entire implementation of the debris).

This is how the debris with FreezingBullet looks like. Heavy tank with three cannons shooting at the ground. Notice the small pieces of debris flying out of spots, where the bullets from the tank's cannons hit the ground.

opene2140_freezingbullet

Current version of this feature in OpenE2140 uses CreateEffect warhead as can be seen here:

https://github.com/OpenE2140/OpenE2140/blob/master/mods/e2140/content/core/weapons/debris.yaml#L14

This implementation has however two bugs:

  1. there's one tick delay before CreateEffect warhead kicks in and creates SpriteEffect
  2. sometimes the appearance of Bullet and SpriteEffect created by CreateEffectWarhead doesn't match

First issue is visible only on low FPS. The second is caused by both Bullet and CreateEffectWarhead picking different random sequence for rendering.

opene2140_debris_current

Both issues cannot be worked around and require changes in OpenRA (unless Bullet and CreateEffectWarhead are reimplemented from scratch).

Copy link
Contributor

@anvilvapre anvilvapre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to do what the title sais and cleanly.

Feels like bullet is, was already, very custom/hacky. Makes me wonder if it couldn't be cleaned up.

OpenRA.Mods.Common/Projectiles/Bullet.cs Show resolved Hide resolved
yield break;

var world = args.SourceActor.World;
foreach (var r in RenderAnimation(wr))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will likely also have quite a negative peformance overhad with many bullets flying around.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did take inspiration from Actor.Renderables(), but I can quickly turn it into standard (non-iterator) method.

abcdefg30
abcdefg30 previously approved these changes Jul 27, 2023
Copy link
Member

@abcdefg30 abcdefg30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Untested. Code changes lgtm those two nits aside.

OpenRA.Mods.Common/Projectiles/Bullet.cs Outdated Show resolved Hide resolved
OpenRA.Mods.Common/Projectiles/Bullet.cs Outdated Show resolved Hide resolved
@PunkPun PunkPun merged commit a14cc8c into OpenRA:bleed Aug 13, 2023
3 checks passed
@PunkPun
Copy link
Member

PunkPun commented Aug 13, 2023

Changelog

@michaeldgg2 michaeldgg2 deleted the BulletExtensibility branch September 20, 2023 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants