Animations - #36
Conversation
…invalidation bug when loading save or starting new game
# Conflicts: # injected_code.c
# Conflicts: # civ_prog_objects.csv # injected_code.c
# Conflicts: # injected_code.c
|
Ok, just to follow up on our earlier conversation, this branch should be good to review now. I've merged in changes from master and cleaned up line endings, etc. I've also tested extensively on multiple games as well. One thing I'm not sure about is the Also, I put "r28" and "r29" in these branch names to help me track them, and don't mean to presume they should necessarily be in any version. I know there have been a ton of other great changes lately so if you want to put these on a different schedule and release the current code sooner, etc. that's totally fine. |
Awesome! Thank you very much for reviewing. And please let me know nitpicks when you're ready; I'm happy to update.
15c24c0. - Yeah this was wacky. I have only the vaguest memory of, at some point, realizing that there is - commonly but not always - an "e" in the plural of volcano and added that in as allowed by the parser. Why that was only in the
f7d2058 - Thanks for pointing this out. I found this extremely strange, as I never intended custom animations to tie in or rely on districts, but inadvertently they did. Essentially, the custom resource animation hook could suppress the normal static resource draw, but only reliably fell back to the original resource renderer inside the districts/natural wonders code path. I had only been testing in my scenario with districts on, so I never noticed this. Please give it another go and let me know if this doesn't resolve the issue. |
Alright, that's fixed now. I've finished reading the code and have found a couple more issues:
I'm not sure how much work these issues deserve so I'll leave it up to you to decide. I haven't confirmed any bugs around the first one, and for the second I've only confirmed that resource anims persist for exhausted resources. If you don't think it's worth the hassle to update terrain animations as soon as a forest is cleared, that's fine with me. Now for the nitpicks:
|
|
Thanks for reviewing, I'll follow up on all of these. Just a quick note on (2) though: the intent of this PR was non-temporal animations, essentially those we don't have to worry about clearing during the turn, only interturn. The intent is for the latter to be handled by additions in the next PR, the temporal animations one. That's a great point about exhausted resources though, I hadn't realized that. |
|
Alright. I was wondering what "temporal animations" meant but obviously haven't looked into that PR yet. |
…r check in patch_Leader_reveal_tile
Sure, please see attached zip/save here, and gifs below. I wasn't able to recreate the "showing both static PCX and animation at the same time" bug that I'd run into the past (not sure what I had changed there, but that was earlier in dev), but in any case, we'd still have a timing/sync issue. But I take your point and liked your idea around using Note that I did end up rolling the logic to check if the tile needed any animation into a new function, |
…ld; Inline read_tile_animation_direction_value into read_direction_value; Drop unnecessary p_main_screen_form null checks; Rely on table_deinit to clear PCX lookup tables; Simplify tile_animation_rule_matches_tile draw/non-draw flow
Thank you, please see c723d61 and ae84dad
Please see 8fd1d58 for this one. I don't think the logic for clearing resource animations should be in I don't have a handy save though where a resource was exhausted, so I haven't been able to test a before and after, and am not sure how best to verify that. Can you do a quick test, if you still have that handy, or let me know what you did so I can reproduce the check? |
Alright, I see it now. My earlier test was to look at a fish resource after it's been revealed from the fog by third-ring vision from a fortified galley. I figured that ought to show the bug since the hacky fix in
Looks good to me. I verified just in case that this also works for units with extra visibility beyond what's possible in the base game, which the original fix wouldn't have. This all looks good too.
Sure, I reran my previous test and found that this bug is now fixed. My test setup is quite simple actually. I created a small scenario with only one visible, animated, connected resource on the map. I chose ivory and made it a strategic resource so it could be exhausted. Then in a debugger I put a breakpoint at 0x4F4E44 which is the instruction after the call to |
|
Got it, sounds great. Any other changes you want me to make, or looks ok? |
|
None, this all looks good to me. Thanks for the contribution. I'm thinking of posting R28 Preview 1 soon-ish. It's a good time as this was the last PR that was originally tagged as part of R28, as I recall, and it's been quite a while since the last release. I'll make it a preview version since a lot has been added like the combat counter system and configurable visibility, and there could still be bugs. There's just one more change I want to make that I've been putting off. |



PR three of three for R28. This PR is less dramatic in terms of changes than it seems, as most of the 7.8k line additions are INI, config, and Python files for processing animations outside of the game. About 2.5k lines are in injected_code.c (and much of that is config parsing).
The general approach is to piggyback on Civ3’s existing tile-effect machinery instead of creating a new animation workflow from scratch. When a tile matches a configured ambient animation rule, we use
Tile_spawn_animated_effectto spawn a normal built-in tile effect (AE_Disorder) as a carrier. So we use a vanilla animated effect path that already knows how to allocate, position, update, and draw an effect. While AE_Disorder is being loaded, I set a temporary override soUnits_Image_Data_load_animated_effectignores the AE_Disorder’s normal art and instead loads the configured custom Art\Animations...*.INI. After vanilla finishes constructing the effect, we rewrite the effect id back to the custom id and apply per-animation direction and pixel offsets. So just as with smolder & disorder, the native animation system still owns lifetime, frame advancement, AMB/FLC handling, and rendering; we just swap in an INI and decide which tiles should spawn or clear those effects.Here are the main features:
#Animationentries, for example:Note that natural wonders can have multiple animation entries.
pick_tile_animation_winner_for_tileandget_tile_animation_type_priority) for tiles with multiple matching candidate animations, using this priority order:If still tied, animations with day/night or season filters take precedence, then the later config entry wins.