Maruno17 / pokemon-essentials

A heavily modified RPG Maker XP game project that makes the game play like a Pokémon game. Not a full project in itself; this repo is to be added into an existing RMXP game project.
Other
208 stars 398 forks source link

Dependency system on compiler #204

Closed FL- closed 1 year ago

FL- commented 1 year ago

What is it?

This Pull Request change the compiler system to use a dependency system.

It only recompiles the changed text file, and it's dependencies (recursively). So, if you edit Ability PBS, it only recompiles Species1 and Species files (who recompiles SpeciesMetrics, ShadowPokemon, RegionalDex, Encounter and Trainer).

This greatly decrease compile time for PBS like town_map.txt and trainers.txt, since changing these files now doesn't recompiles other files.

Notes

I didn't tested every single text file or combination, since it gonna be retested anyway.

I changed the system for deleting data files (.dat) on errors. Now it only deletes the data files current on compile list.

The dependencies are listed on a method, but I can move it into GameData classes if is preferred.

I'm using a method to get data files by PBS names, but I can change to pick these files my it classes if is preferred.

For making a long boolean check, because I can't easily found Essentials pattern/style, I did as:

if !mustCompile
    if latest_text_time >= latest_data_time
        add_to_compile_list(key, compile_list)
    elsif key == :BattleFacility 
        if check_battle_facility_files_update_time(latest_data_time)
            add_to_compile_list(key, compile_list)
        end
    end
end

Please request changes.

Maruno17 commented 1 year ago

I can see what the idea is here, but ultimately I don't think it's worth it. Users have a hard enough time already with compiling, and making the auto-compiler a partial thing wouldn't help with that. For example, if they update one file but roll back another, the auto-compiler could run and process the updated file but ignore the rolled-back file, which will confuse the user as they saw it compile yet their rolled-back file wasn't compiled.

Plus, I've just made a change that drastically speeds up compiling, so trying to keep the compile time down isn't quite so urgent as it once was.

FL- commented 1 year ago

At your example, if one file is rolled back, it will do a chain delete on all the data to be recompiled.

But I understand your point, I hope that you consider people who have a slow HD.

If you change your mind, let me know.