[Solved] What should be starting_frame_deviation?

Place to post guides, observations, things related to modding that are not mods themselves.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1197
Joined: Wed May 18, 2016 4:55 pm
Contact:

[Solved] What should be starting_frame_deviation?

Post by Mooncat »

Does anyone know what should be value of "starting_frame_deviation" in "create-smoke" effect?

I have a smoke with 6 frames and its animation_speed is 0. Then I have a projectile that create the smoke with starting_frame_deviation = 6. I expected there will be equal chance for displaying any of the 6 frames. But during my test, only the first 3 frames were displayed.

Here is the smoke prototype:

Code: Select all

	{
		type = "smoke",
		name = "huge_spark",
		flags = {"not-on-map"},
		duration = 100,
		fade_away_duration = 100,
		movement_slow_down_factor = 0,
		spread_duration = 0,
		color = {r = 1, g = 0.95, b = 0, a = 1},
		cyclic = true,
		affected_by_wind = false,
		show_when_smoke_off = true,
		animation =
		{
			filename = mod_directory .. "/graphics/entity/huge-spark.png",
			flags = {"compressed"},
			priority = "very-low",
			width = 300,
			height = 300,
			frame_count = 6,
			line_length = 6,
			scale = 10 * 2 * 32 / 240,
			shift = {0, 0},
			--blend_mode = "additive",
			animation_speed = 0
		}
	}
And here is the projectile that create the smoke:

Code: Select all

	{
		type = "projectile",
		name = "glowing-capsule-projectile",
		flags = {"not-on-map"},
		acceleration = 0.005,
		action =
		{
			type = "direct",
			action_delivery =
			{
				type = "instant",
				target_effects =
				{
					{
						type = "create-smoke",
						entity_name = "huge_spark",
						starting_frame_deviation = 6
					}
				}
			}
		},
		light = {intensity = 0.5, size = 4},
		animation =
		{
			filename = mod_directory .. "/graphics/entity/glowing-capsule.png",
			frame_count = 1,
			width = 32,
			height = 32,
			priority = "high"
		},
		shadow =
		{
			filename = mod_directory .. "/graphics/entity/glowing-capsule-shadow.png",
			frame_count = 1,
			width = 32,
			height = 32,
			priority = "high"
		},
		smoke = capsule_smoke
	},
I have tried other values like 5, 100, 0.1... but still can't get the expected result.
Any help will be appreciated. :mrgreen:
Last edited by Mooncat on Tue Mar 07, 2017 1:51 am, edited 1 time in total.
User avatar
Mooncat
Smart Inserter
Smart Inserter
Posts: 1197
Joined: Wed May 18, 2016 4:55 pm
Contact:

Re: What should be the value of starting_frame_deviation?

Post by Mooncat »

Oh, now I have also tried starting_frame_deviation = 12 (and also 11) and all the 6 frames can be shown. Why?
And the first frame has obvious higher chance to display. :?

Edit: so it turned out the problem is solved by setting starting_frame = 3 and starting_frame_deviation = 6. Don't know why it has to be 6 instead of 3, because I thought the math behind it should be starting_frame +- starting_frame_deviation, but it turns out to be starting_frame +- starting_frame_deviation/2. :?
Anyway, it is solved now.
Post Reply

Return to “Modding discussion”