RP Art Utilities


Helper functions for using RP Art mods

Internal
1 year, 7 months ago
1.1
12.2K

i [closed] Artillery Turret animation spawn points

2 years ago
(updated 2 years ago)

Hi,

I've been fiddling with the artillery turret animations. The artillery turret gun (not the entity itself) has in it's attack_parameters this:

projectile_creation_parameters = require("prototypes.entity.artillery-cannon-muzzle-flash-shifting"),

and that file is /base/prototypes/entity/artillery-cannon-muzzle-flash-shifting.lua. The contents:

return
{
{0.0,util.by_pixel(-0.0,-145.0)},
{0.004,util.by_pixel(3.5,-144.5)},
... etc until end.

There are 256 entries, corresponding to the 256 different cannon positions. I haven't figured out how to create and call a custom version yet, but I think it's possible...if probably very tedious. But this method won't work as something to include with the art, the turret makers would have to do it.

2 years ago

I appreciate the help. I have struggled with the artillery animations so much.

As far as I can tell there are a couple of factors that go into it. The projectile_creation_parameters is one of the most important ones for artillery turrets. I recently modified rp_art_util's formula to use them better. In my tests it now looks close enough for some of the turrets at some scale values. The rp_art_util:set_muzzle_location_for_attack_parameters function controls this. Please let me know if you figure out the magic formulas to make it look better. I have spent an unbelievable amount of time trying to figure this out.

I actually include the projectile creation points in the turret art data under attacking.attachment_points.muzzle. However, I discourage reading the raw data directly (as opposed to using rp_art_util to interpret it) as I may need to change the structure over time.

2 years ago

Great art pack by the way, I do appreciate having them. Going to upload a few patches to use them for other mods later today, I just was waaay too optimistic last night about getting the artillery on barrel :D

I was wondering what those muzzle values corresponded to, that should help. Though deleting that file didn't seem to change anything in Factorio or cause errors...does rp_art_util have hardcoded defaults to fall back on?

2 years ago

I had to plot factorio's muzzle values in excel to figure out what they mean. Artillery turrets have a few other lists of magic numbers that my mods don't support yet.

I believe the muzzle values are the muzzle's location in factorio world units (32 pixels to the tile) with respect to the turret's location. My mods export those coordinates in several different formats & coordinate systems but only one is useful in practice. It exports the coordinates for each rotation and each frame in the animation. The animation frames are useful if I ever want to get artillery barrel shift animations to work.

  • raw_position & raw_forward are the position & direction of the muzzle in the rendering pipeline. They are true 3D coordinates and are relative to the turret's base. I don't use them anywhere but I like to include the raw data because you never know when it will come in handy.
  • pixel_position & pixel_forward are the position & direction of the muzzle projected onto the sprite. Point (0,0) here is the turret's position in the world. Point (0,1) is one pixel up, but might be going up towards the sky or along the ground plane. The difference is often immaterial and these coordinates are what factorio generally prefers (there are a handful of exceptions).

I don't know what you mean by "deleting that file" but deleting those coordinates should result in it shooting from the origin (or throwing an error).

1 year, 7 months ago

I think I finally figured out the bleeping formula. You can see it in set_muzzle_location_for_attack_parameters_using_raw_points

I'll also try and write up a description at https://forums.factorio.com/viewtopic.php?f=15&t=103616

1 year, 7 months ago

Hah, congrats. Thing drove me nuts til I eventually gave up.

1 year, 28 days ago

I re-read the license terms of the original store and I do NOT think you can use these. I will add a DRM-esq thing to them later today.

New response