News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

r7550 Seasons for Buildings

Started by Leartin, August 29, 2015, 07:21:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Leartin

sooo... I finally tested the new seasons for buildings in the game.

However, while they were definitely there, they did not work properly.
> I created a building with five seasons. It worked all fine - except in Winter, if there was no snow, the game broke down.
> I deleted the fifth season. In response, all the other graphics shifted through seasons. (what was summer before was then fall etc.) - but more importantly, it worked fine except for any snow graphics, in which case the game broke down again.

I used 7550 for Windows from the nightly site and makeobj 55.3 (Might be a newer version is needed, since it said "seasons=5" would be ignored, but it obviously did pack a pak that contained at least 4 season-images.)




By the way, how do older game versions deal with paks which use more seasons? (If what I tested is true: By having only the first defined graphic appear)

Ters

I can't see any changes having been done to makeobj or the pak/dat format with regards to buildings with seasons. The game figures out how many seasons the building has by counting the number of seasonal image sets.

Since you posted a snow covered building with smoke from the chimney recently, is only the winter image animated?

Leartin

Only the snow-image had the animated front-image, so it was only defined with the five-season-graphics and commented out for the four-season-attempt. I also for one attempt changed the animated front-image to summer-season, and the smoke worked fine.

EDIT: Just to make sure, I tested again without the frontimages even in the dat. Same result, breaks down on November 30.

Ters

Buildings are complex, so it's not easy to read the code and imagine what goes wrong. I will probably need at least a stacktrace to figure out what's going on.

TurfIt

I can crash it almost at will trying to place a 4 season building above the snowline. Sometimes it works though...
When it doesn't I've a pointer containing 0xABABABAB which sure ain't right! Will have to continue debugging later.

As for animations, from what I see, all seasons will have to have the same number of animation frames. This doesn't look easy to change.

Leartin

Yes, if I add the smoke and want a different animation in Summer, it needs to have the same amount of frames. But one can work around it - if I had a summer animation with 4 frames and the winter smoke with 3 frames, I can use 12 frames and simply repeat the animation in the dat.

If you don't need any frontimage in other seasons and just leave it out, it also works. Maybe there is still an "internal" animation, but nothing happens on the screen.

I did not yet test if you can have a still frontimage in one season and an animated frontimage in another season. I'd assume it works, since I always do it with a still backimage and an animated frontimage, but if it does not work I simply need to define the still frontimage for each frame and it works again.



I could also crush it at will with a 5-season-building below snowline, is this true for you, too? And do you get the images for each season you expect, or are they mixed up?

TurfIt

r7554 should fix the crashing.

With animations, I suggest you define what is needed to support your intended pak graphics, then we'll see about getting the code to handle if needed.
Right now, I'm pretty sure you must have the same number of animation frames for all tiles and all seasons of a building. (and multi-tile building animation support looks dodgey...)
As you mentioned, you can repeat the same image if you need no animation, or fewer frames for one season, but they must all be defined.
Foreground/background is rather confusing too - background image animation appears to be what things were designed for, not sure if foreground animation with seasons will work sanely.

Ters

Quote from: TurfIt on August 30, 2015, 10:48:57 PM
Right now, I'm pretty sure you must have the same number of animation frames for all tiles and all seasons of a building.

I think you can get away by having no animation at all for some seasons. There is at least code that tries to fall back to the first image if the requested frame does not exist.

Leartin

#8
Sorry, I had to redo some stuff because a total crash wiped the the work of the last few days away. Mostly restored by now though.

So, to answer whether it works: Yes! It works, and it looks amazing. It works even with the smoke for the snow graphic. If it would not take seasons so long to change, I would probably watch it for at least half an hour now. I am very happy, thank you!


EDIT: Using the same pak file in older versions of Simutrans, it will always use the summer image. Just so you know.

Ters

Quote from: Leartin on August 31, 2015, 06:39:53 PM
EDIT: Using the same pak file in older versions of Simutrans, it will always use the summer image. Just so you know.

Strange. The winter image should work as well from what I could tell.