[posila] target_type = "position" doesn't work for projectiles

This subforum contains all the issues which we already resolved.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

[posila] target_type = "position" doesn't work for projectiles

Post by Mooncat »

Bug:
If you set the "particle_buffer_size" property of a "stream" prototype to 1, the particle will not be displayed properly.
Setting it to 2 does not have display error, but it creates at least 2 particles for each shot, regardless of the values of "particle_spawn_interval" and "particle_spawn_timeout"

This bug is not likely to happen in vanilla games, so it is fine if you fix it for 0.15. ;)

Steps to reproduce:
1a) Change the "particle_buffer_size" of "flamethrower-fire-stream" to 1.
1b) start a game and observe when any flamethrower turret fires.
It will be like this:
Image
2a) Now change the value of "particle_buffer_size" to 2, "particle_spawn_interval" to 60 and "particle_spawn_timeout" to 1.
2b) Also give flamethrower turrets a very long cooldown.
2c) Observe. (May need to turn on debug info to see the problem.)

Alternatively
You can download this mod:
steam-particle_0.1.0.zip
(1.2 KiB) Downloaded 129 times
It has carried out step 1 for flamethrower turret, and step 2 for the handheld flamethrower gun.
Plus, it has also changed the actions of the flame particles so they now create smoke entities on hit, triggering messages to be printed.
"smoke" = flamethrower turret
"smoke-fast" = handheld flamethrower

Also load this save for quick start:
StreamParticleBug.zip
(1.76 MiB) Downloaded 122 times
It is specifically made for this bug report, no other mod is needed.
(Creative Mode was used to create the entities, but it is not needed anymore.)
Image
As you can see, 2 messages "smoke-fast" are printed for each shot from handheld flamethrower.


I use stream to make bullets without the need of collision box, so walls will not block their path. :mrgreen:
posila
Factorio Staff
Factorio Staff
Posts: 5362
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: stream prototype particle_buffer_size=1 causes display bug

Post by posila »

Hi, I am afraid you are trying to use stream prototype in a way it was not designed to work.
It is supposed to create illusion of continuous stream of fluid by drawing line segments to form parabolic shape. The line segments are drawn between particles generated in regular interval and while the turret is shooting segment between last particle and muzzle of the turret is also drawn. When the turret stops shooting one last particle is generated as "tail" so the stream is not detached from the turret rapidly.

To keep track of the particles it uses circular buffer of size particle_buffer_size, so in your case "tail" particle overwrites head. With single particle there is no segment to draw.

Real bugs here are that the game lets you set particle_buffers_size to 1, and that it still draws shadow for single particle.
Mooncat wrote:I use stream to make bullets without the need of collision box, so walls will not block their path. :mrgreen:
Every turret in the game shoots over walls (including worms), so I still don't understand what you try to achieve.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: stream prototype particle_buffer_size=1 causes display bug

Post by Mooncat »

posila wrote:Hi, I am afraid you are trying to use stream prototype in a way it was not designed to work.
It is supposed to create illusion of continuous stream of fluid by drawing line segments to form parabolic shape. The line segments are drawn between particles generated in regular interval and while the turret is shooting segment between last particle and muzzle of the turret is also drawn. When the turret stops shooting one last particle is generated as "tail" so the stream is not detached from the turret rapidly.

To keep track of the particles it uses circular buffer of size particle_buffer_size, so in your case "tail" particle overwrites head. With single particle there is no segment to draw.

Real bugs here are that the game lets you set particle_buffers_size to 1, and that it still draws shadow for single particle.
Mooncat wrote:I use stream to make bullets without the need of collision box, so walls will not block their path. :mrgreen:
Every turret in the game shoots over walls (including worms), so I still don't understand what you try to achieve.
Ah, ok. So you are saying the minimum value of particle_buffers_size is 2? I guess it is acceptable since it is the original design, like you said.

I am making a non-homing projectile that hits on a targeted position instead of object, while preventing ally walls blocking its path.
Like the artillery in the Additioanl Turrets mod.

It is also related to this API request: viewtopic.php?f=28&t=14966
Looks like we will have to wait Rseding91 to implement a proper solution. :mrgreen:
posila
Factorio Staff
Factorio Staff
Posts: 5362
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: stream prototype particle_buffer_size=1 causes display bug

Post by posila »

ammo_type structure has property target_type, which defaults to "entity". Other possible values are "direction" and "position". If "position" is used, I believe it should cause projectiles to be non-homing. Then you can give them empty collision box, so they will hit their target position and nothing in between.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: stream prototype particle_buffer_size=1 causes display bug

Post by Mooncat »

posila wrote:ammo_type structure has property target_type, which defaults to "entity". Other possible values are "direction" and "position". If "position" is used, I believe it should cause projectiles to be non-homing. Then you can give them empty collision box, so they will hit their target position and nothing in between.
Unfortunately, it seems that "position" does not have any effect on turret if the projectile is not "stream".

If the projectile is really "projectile":
If it does not have direction_only = true, it will still be homing.
With direction_only = true, it travels through a straight line, but
a) with collision box, it is blocked by walls, or
b) without collision box, it only detonates at the end of the line.
So it cannot do the same as "stream".

Also, I see no properties that can make the projectile travels in an arc. But I think this will be another API request. ;)


Edit: oh, I thought the "position" thing on turret is for modding only, so didn't expect this subject to appear in bug report. But thanks for changing it. Good to hear it will be fixed for 0.15. :D
posila
Factorio Staff
Factorio Staff
Posts: 5362
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [posila] target_type = "position" doesn't work for projectiles

Post by posila »

This should work since 0.15.0
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: [posila] target_type = "position" doesn't work for projectiles

Post by Mooncat »

posila wrote:This should work since 0.15.0
Thanks. :D
I will use this feature when I have time.

(Surprised to see this topic being bumped up. lol)

Edit: I have already used it in Supportive Weapons v0.2.0!
Post Reply

Return to “Resolved Problems and Bugs”