Page 1 of 1

Building animation only showing half

Posted: Mon Jun 09, 2014 7:55 pm
by Alphasoldier
Hello Factorioians,
Due to my love for this game, I decided to actually get into modding of the game, starting off simple by making my own slightly overpowered mining machine.

I have gotten far enough to actually get an entirely working building, but I have a single issue.
The ingame graphics aren't properly working, it's only half working. To avoid confusions I have made a simple mspaint mockup to explain what I think is happening.

My animation is 11 frames (mostly because it's from another very old game seeing I'm no blender wizard).

Image

The red filled boxes are the frames that aren't seen, and the blue ones are the ones that ARE showing up.
The thin orange lines are what I think the game has constructed the animation as somehow, that it's going out of bounds for no reason, or has some kind of weird offset that I'm not aware of.
The code I use is this, only with repeated code for East, South and West. I was also curious if I can simply let out the rest and only have that piece of code seeing the object doesn't change graphics while rotating.

Code: Select all

animations =
    {
      north =
      {
        priority = "extra-high",
        frame_width = 84,
        frame_height = 54,
        line_length = 4,
        shift = {0.0, -0.5},
        filename = "__superdrill__/graphics/entity/super-mining-drill.png",
        frame_count = 11,
        animation_speed = 0.2,
      },
Am I missing a piece of code that configures the graphic in more detail? Or am I missing something else? If anyone has any clue as to why this is happening, please let me know.

Re: Building animation only showing half

Posted: Tue Jun 10, 2014 8:32 am
by YuokiTani
you mess-up something - but you already know this,

your animation-sheet should be (4 x 84 px = 336 px ) x ( 3 x 54 px = 162 px ) - if not, different errors happens. factorio still play a animation but sometimes the picture walk, out of size error and so on.

best way to test your animation is to line it to a single line, with 11 line_length.
other way to fix, maybe set your frame-count to 12 and use last or first frame in last position twice.

Re: Building animation only showing half

Posted: Tue Jun 10, 2014 10:12 am
by Alphasoldier
My first png was in fact with all the sprites on a single line, all 11 next to each other. The entire sprite was invisible then.
It was only when I moved the sprite sheet on 2 lines, and then on 3 lines, that I noticed it was only half working and something was going wrong.

My animation sheet is indeed 336 by 162. I even went as far as to take an original png, and then modifying the size and copying the content, just so it would be the same kind of png file. (Does interlaced matter?)

I will try the 12 frames, perhaps there's something wonky going on when you have an odd amount of frames.

EDIT: Nope, that did also not work.

I'm still open for options and suggestions. I should probably just post the entire mod, but I don't like being forcefed while learning, I'd rather just hear "This and there is where things that control graphics are and thus can go wrong".
The thing that confuses me the most is that I pretty much copied everything from an already existing building.

Re: Building animation only showing half

Posted: Tue Jun 10, 2014 10:20 am
by drs9999
Posting the complete entity prototype might be usefull

Re: Building animation only showing half

Posted: Tue Jun 10, 2014 2:10 pm
by Alphasoldier
It's mostly just copied from the basic-mining-drill and adjusted, but here you go:

Code: Select all

data:extend(
{
  {
    type = "mining-drill",
    name = "super-mining-drill",
    icon = "__superdrill__/graphics/icons/super-mining-drill.png",
    flags = {"placeable-neutral", "player-creation"},
    minable = {mining_time = 1, result = "super-mining-drill"},
    max_health = 500,
    resource_categories = {"basic-solid"},
    corpse = "small-remnants",
    collision_box = {{ -0.4, -0.4}, {0.4, 0.4}},
    selection_box = {{ -0.5, -0.5}, {0.5, 0.5}},
    working_sound =
    {
      sound =
      {
        filename = "__base__/sound/electric-mining-drill.ogg",
        volume = 0.75
      },
      apparent_volume = 1.5,
    },
    animations =
    {
      north =
      {
        priority = "extra-high",
        frame_width = 84,
        frame_height = 54,
        line_length = 4,
        shift = {0.0, -0.5},
        filename = "__superdrill__/graphics/entity/super-mining-drill.png",
        frame_count = 12,
        animation_speed = 0.2,
      },
      east =
      {
        priority = "extra-high",
        frame_width = 84,
        frame_height = 54,
        line_length = 4,
        shift = {0.0, -0.5},
        filename = "__superdrill__/graphics/entity/super-mining-drill.png",
        frame_count = 12,
        animation_speed = 0.2,
      },
      south =
      {
        priority = "extra-high",
        frame_width = 84,
        frame_height = 54,
        line_length = 4,
        shift = {0.0, -0.5},
        filename = "__superdrill__/graphics/entity/super-mining-drill.png",
        frame_count = 12,
        animation_speed = 0.2,
      },
      west =
      {
        priority = "extra-high",
        frame_width = 84,
        frame_height = 54,
        line_length = 4,
        shift = {0.0, -0.5},
        filename = "__superdrill__/graphics/entity/super-mining-drill.png",
        frame_count = 12,
        animation_speed = 0.2,
      }
    },
    mining_speed = 1.0,
    energy_source =
    {
      type = "electric",
      -- will produce this much * energy pollution units per tick
      emissions = 0.1 / 1.5,
      usage_priority = "secondary-input"
    },
    energy_usage = "150kW",
    mining_power = 3,
    resource_searching_radius = 3.49,
    vector_to_place_result = {0, -0.85},
    module_slots = 4,
    radius_visualisation_picture =
    {
      filename = "__superdrill__/graphics/entity/mining-drill-radius-visualization.png",
      width = 12,
      height = 12
    }
  }
}
)

Re: Building animation only showing half

Posted: Tue Jun 10, 2014 2:46 pm
by drs9999
Well, the code you rpovided works fine for me...
The only thing I changed was the animation speed to see the transition between the frames.

Oh wait... Another idea can you delete your crop-cache and try again, pls?

Re: Building animation only showing half

Posted: Tue Jun 10, 2014 3:10 pm
by Alphasoldier
That worked perfectly! Thank you so much.
Now my question would be, what the heck is a crop-cache and why did it just screw that up?