Maximum spritesheet width is 8192, but image is 1024 wide

Place to get help with not working mods / modding interface.
SprocketCreations
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Dec 29, 2022 8:18 pm
Contact:

Maximum spritesheet width is 8192, but image is 1024 wide

Post by SprocketCreations »

Hello, I am out of ideas on how to get past this, so I have come here for help. My mod includes a bunch of sprite sheets, but no matter how I resize or recombine them, I always get this error on launch:

Code: Select all

1.072 Error ModManager.cpp:1560: Error while loading entity prototype "flatbed_wagon" (cargo-wagon): Width of a spritesheet (__mod__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-01.png) is too large. Maximum spritesheet width is 8192.
The file in question is 1024 x 1024 at 113KB
I tried originally with 2k square, but lowered it to 1k x 2k, then to 1k square. Idk why it is saying it is bigger than 8k. My best guess is I have something set up wrong somewhere else, but I have no idea how to go about diagnosing or even finding the problem.
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: Maximum spritesheet width is 8192, but image is 1024 wide

Post by Deadlock989 »

Post the code which is trying to reference this spritesheet and tell us how the spritesheet is organised (how many rows and columns, the size of each sprite within the sheet etc.). Mostly likely you are trying to reference too many columns of too large a sprite width which is totalling >= 8192 pixels.
SprocketCreations
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Dec 29, 2022 8:18 pm
Contact:

Re: Maximum spritesheet width is 8192, but image is 1024 wide

Post by SprocketCreations »

The definition for the prototype (with comments removed) is as follows:

Code: Select all

local empty_flatbed_wagon = util.table.deepcopy(data.raw["cargo-wagon"]["cargo-wagon"]);
empty_flatbed_wagon.name = "flatbed_wagon";
empty_flatbed_wagon.inventory_size = 0;
empty_flatbed_wagon.minable = { mining_time = 1, result = "flatbed_wagon" }
empty_flatbed_wagon.horizontal_doors = nil;
empty_flatbed_wagon.vertical_doors = nil;
empty_flatbed_wagon.weight = 250;

empty_flatbed_wagon.pictures =
{
	layers =
	{
		{
			priority = "very-low",
			width = 256,
			height = 256,
			direction_count = 128,
			allow_low_priority_rotation = true;
			back_equals_front = true;
			lines_length = 4;
			lines_per_file = 4;
			filenames =
			{
				"__intermodal-containers-and-gantry__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-01.png",
				"__intermodal-containers-and-gantry__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-02.png",
				"__intermodal-containers-and-gantry__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-03.png",
				"__intermodal-containers-and-gantry__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-04.png",
				"__intermodal-containers-and-gantry__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-05.png",
				"__intermodal-containers-and-gantry__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-06.png",
				"__intermodal-containers-and-gantry__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-07.png",
				"__intermodal-containers-and-gantry__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-08.png",
			},

			hr_version =
			{
				priority = "very-low",
				width = 256,
				height = 256,
				direction_count = 128,
				allow_low_priority_rotation = true;
				back_equals_front = true;
				lines_length = 4;
				lines_per_file = 4;
				scale = 1;
				filenames =
				{
					"__intermodal-containers-and-gantry__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-01.png",
					"__intermodal-containers-and-gantry__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-02.png",
					"__intermodal-containers-and-gantry__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-03.png",
					"__intermodal-containers-and-gantry__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-04.png",
					"__intermodal-containers-and-gantry__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-05.png",
					"__intermodal-containers-and-gantry__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-06.png",
					"__intermodal-containers-and-gantry__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-07.png",
					"__intermodal-containers-and-gantry__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-08.png",
				},
			},
		},
	},
};

data:extend({empty_flatbed_wagon});
At this point, there are 8 images. Each is 4 x 4 sprites. Each sprite is 256px sqr. The sheets are 1024px x 1024px.
SprocketCreations
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Dec 29, 2022 8:18 pm
Contact:

Re: Maximum spritesheet width is 8192, but image is 1024 wide

Post by SprocketCreations »

Interestingly, that did change my error.

Code: Select all

1.397 Error AtlasSystem.cpp:1543: The given sprite rectangle (left_top=1024x0, right_bottom=1280x256) is outside the actual sprite size (left_top=0x0, right_bottom=1024x1024).
See the log file for more information.: __mod__/graphics/entity/empty-flatbed-wagon/empty-flatbed-wagon-01.png;
I feel I must be missing something here.
SprocketCreations
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Dec 29, 2022 8:18 pm
Contact:

Re: Maximum spritesheet width is 8192, but image is 1024 wide

Post by SprocketCreations »

I tried changing the width and height to something really small, like 12, and that let me into the game with no errors. But when I placed down my modded wagon, it was invisible.
SprocketCreations
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Dec 29, 2022 8:18 pm
Contact:

Re: Maximum spritesheet width is 8192, but image is 1024 wide

Post by SprocketCreations »

I tried replacing the settings to match the vanilla cargo wagon's but it is still throwing the same error (max width 8192).

Code: Select all

empty_flatbed_wagon.pictures =
{
	layers =
	{
		{
			priority = "very-low",
			width = 222,
			height = 205,
			dice = 4,
			direction_count = 128,
			allow_low_quality_rotation = true;
			back_equals_front = true;
			lines_length = 4;
			lines_per_file = 8;
			filenames =
			{
				"__base__/graphics/entity/cargo-wagon/cargo-wagon-1.png",
				"__base__/graphics/entity/cargo-wagon/cargo-wagon-2.png",
				"__base__/graphics/entity/cargo-wagon/cargo-wagon-3.png",
				"__base__/graphics/entity/cargo-wagon/cargo-wagon-4.png",
			},
		},
	},
};
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 532
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: Maximum spritesheet width is 8192, but image is 1024 wide

Post by Silari »

Looks like you misspelled 'line_length' in all your attempts as 'lines_length'. That means the game is assuming these are all on one line.
SprocketCreations
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Dec 29, 2022 8:18 pm
Contact:

Re: Maximum spritesheet width is 8192, but image is 1024 wide

Post by SprocketCreations »

Yup. Just noticed it myself after copy-pasting the prototype definition of the vanilla cargo wagon over mine. Thank you all for the help!

line_length defaults to 0, which means one row. Hence the bigger than 8k issue. It wasn't actually bigger than 8k, it just thought it was.
Post Reply

Return to “Modding help”