Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: [AI] Adding Housing Support #122

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

hooh-hooah
Copy link

@hooh-hooah hooh-hooah commented Oct 5, 2020

This is a Draft Pull Request. requires constant review of code until all checklists are checked

Adding Housing support for AI

Since AI's main game requires some nice touch when it comes to the main game, I decided to do some action to add some new features for the game.

But since this is the first time to be a contributor for the bepis plugins, I've made this "WIP" pull request.

Origin Branch

hooh-hooah:master
https://github.com/hooh-hooah/BepisPlugins

Related Plugin

https://github.com/hooh-hooah/IL_MapIntegrationPlugin

Checklists

  • Loading housing information from the CSV file in the zipmod files.

    • Housing Zone Data
    • Housing Zone Type Data
    • Housing Furniture Data
    • Housing Category Data
  • Adding Extended Save for the main-game files

    • Extended Save for the Housing Card Data
  • Housing Item Sideloader ID Resolver

    • Embedding GUID and LocalSlot Data to the Housing Card Data
    • Embedding GUID and LocalSlot Data to the Current Housing Zone Data
    • Resolving Furniture ID when Saving/Loading housing information (Card Load/Game Load)

Testing

Downloading AI_MapIntegrationPlugin and the AI POC mod
https://mega.nz/folder/po0QRaSZ#xrXPDDynGtS81LqCgyIXYA

  • Housing Item Category, Housing Zone, Housing Zone Type does not need requires ID resolving feature. - they'll be manually reviewed by the mod creators.

@hooh-hooah
Copy link
Author

Leave a comment when it looks like going wrong.

@ManlyMarco
Copy link
Collaborator

ManlyMarco commented Oct 8, 2020

@hooh-hooah Looks good so far, but needs some more work before it's fully usable like you've mentioned. Thanks for working on this!

@hooh-hooah
Copy link
Author

Ye it's not going to be done in a short time but I expect it's going to be done in a month I guess. Summarizing the concepts and milestones before adding id resolve on furniture.

@hooh-hooah
Copy link
Author

hooh-hooah commented Oct 29, 2020

Aww heck
The housing data and the main-game save data are glued together!

@hooh-hooah
Copy link
Author

Well finally, analysis of the AI Shoujyo's Save File is done.
It's bit weird but i'll try to post the structure of file

@hooh-hooah
Copy link
Author

@ManlyMarco I have a question at this moment, Since my changes are solely for AI's main-game, am I going right direction with keeping asome resolvers and listloaders inside of "AI_Sideloader" instead of "Core_Sideloader"?

I'm trying to match the style with rest of the code but this is the one of few things that makes me confused.

Copy link
Collaborator

@ManlyMarco ManlyMarco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work on the PR so far, thank you!

I noticed some things that could be improved, it would be great if you could give it a look. If you have any questions about my comments, you can ping me on discord whenever.

To add to the comments:
Since the main game and housing ext data code is for the most part stand-alone, it would be nice to have it be separated into separate .cs files, like I did with the main game save data in KK here https://github.com/IllusionMods/BepisPlugins/tree/c5916e67973a7bc01d4bd78e585b58c9972f9989/src/KK_ExtensibleSaveFormat

If you want, I can ask others to review the changes as well, so we can find issues and get it merged faster.

src/AI_ExtensibleSaveFormat/AI.ExtendedSave.Events.cs Outdated Show resolved Hide resolved
// Minimizing the interference between games to limiting the harmony hook initialization
// MainGame Save/Load - PostFix
harmony.Patch(
typeof(SaveData).GetMethod("Load", new[] {typeof(BinaryReader)}),
Copy link
Collaborator

@ManlyMarco ManlyMarco Feb 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either use AccessTools or throw an exception on null when getting types like this, because if the type for some reason can't be found then it's impossible to know which type is missing without further debugging since all you get is a null reference exception. (AccessTools will log a warning to the log if a type can't be found, or you can do ?? throw new ArgumentException("Type.Method couldn't be found"))

src/AI_ExtensibleSaveFormat/AI.ExtendedSave.Hooks.cs Outdated Show resolved Hide resolved
src/AI_ExtensibleSaveFormat/AI.ExtendedSave.Hooks.cs Outdated Show resolved Hide resolved
src/AI_ExtensibleSaveFormat/AI.ExtendedSave.Hooks.cs Outdated Show resolved Hide resolved
src/Core_Sideloader/Core.Sideloader.cs Outdated Show resolved Hide resolved
src/Core_Sideloader/Core.Sideloader.cs Outdated Show resolved Hide resolved
src/Core_Sideloader/Core.Sideloader.cs Show resolved Hide resolved
src/Core_Sideloader/Core.Sideloader.cs Show resolved Hide resolved
);

// HousingData Save/Load - Transpiler
// Based on 2021 Version
Copy link
Collaborator

@ManlyMarco ManlyMarco Feb 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it work on the Steam version, and Japanese versions both with and without DX?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well currently I don't have multiple versions of AI atm. I need to figure out how to obtain old versions first

@ManlyMarco
Copy link
Collaborator

@ManlyMarco I have a question at this moment, Since my changes are solely for AI's main-game, am I going right direction with keeping asome resolvers and listloaders inside of "AI_Sideloader" instead of "Core_Sideloader"?

I'm trying to match the style with rest of the code but this is the one of few things that makes me confused.

Yes, since it's only useful for AI it's better to keep it in the AI project. Like I mentioned in the massive dump above, you can separate this functionality into a bunch of new files so it's easy to refactor in the future if necessary.

@hooh-hooah
Copy link
Author

Thanks for the review, that was really helpful. I'll commit the fix when it's ready.

Added more exception handlings for Main-Game ExtendedSave Data Serialization.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants