WIP: [AI] Adding Housing Support #122

Draft
hooh-hooah wants to merge 9 commits from hooh-hooah/master into master
hooh-hooah commented 2020-10-05 02:16:01 +00:00 (Migrated from github.com)

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

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.
**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 - [x] Loading housing information from the CSV file in the zipmod files. - [x] Housing Zone Data - [x] Housing Zone Type Data - [x] Housing Furniture Data - [x] Housing Category Data - [x] Adding Extended Save for the main-game files - [x] Extended Save for the Housing Card Data - [x] Housing Item Sideloader ID Resolver - [ ] Embedding GUID and LocalSlot Data to the Housing Card Data - [x] Embedding GUID and LocalSlot Data to the Current Housing Zone Data - [x] 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 commented 2020-10-05 02:32:41 +00:00 (Migrated from github.com)

Leave a comment when it looks like going wrong.

Leave a comment when it looks like going wrong.
ManlyMarco commented 2020-10-08 23:12:25 +00:00 (Migrated from github.com)

@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 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 commented 2020-10-18 07:13:44 +00:00 (Migrated from github.com)

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.

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 commented 2020-10-29 11:32:56 +00:00 (Migrated from github.com)

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

Aww heck The housing data and the main-game save data are glued together!
hooh-hooah commented 2021-02-09 10:46:08 +00:00 (Migrated from github.com)

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

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 commented 2021-02-10 02:56:17 +00:00 (Migrated from github.com)

@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.

@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.
ManlyMarco (Migrated from github.com) requested changes 2021-02-12 22:22:20 +00:00
ManlyMarco (Migrated from github.com) left a comment

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 IllusionMods/BepisPlugins@c5916e6797/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.

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.
@ -0,0 +1,103 @@
using System;
ManlyMarco (Migrated from github.com) commented 2021-02-12 21:53:32 +00:00

Maybe rename these events to follow the existing main game save data events for KK? IllusionMods/BepisPlugins@c5916e6797/src/KK_ExtensibleSaveFormat/KK.ExtendedSave.SaveData.cs (L55-L60)

Maybe rename these events to follow the existing main game save data events for KK? https://github.com/IllusionMods/BepisPlugins/blob/c5916e67973a7bc01d4bd78e585b58c9972f9989/src/KK_ExtensibleSaveFormat/KK.ExtendedSave.SaveData.cs#L55-L60
@ -11,2 +19,4 @@
const string MainGameSaveMarker = "WD";
//Override ExtSave for list loading at game startup
[HarmonyPrefix]
ManlyMarco (Migrated from github.com) commented 2021-02-12 21:59:25 +00:00

Why LogMessage? I assume it's leftover debug code.

Why LogMessage? I assume it's leftover debug code.
ManlyMarco (Migrated from github.com) commented 2021-02-12 22:00:17 +00:00

Missing docs, either fill in or remove completely. There's no need to add docs in internal and private classes unless it's useful for other developers.

Missing docs, either fill in or remove completely. There's no need to add docs in internal and private classes unless it's useful for other developers.
ManlyMarco (Migrated from github.com) commented 2021-02-12 22:02:46 +00:00

It's better to use a constant for the marker to avoid mistakes in the future, also a longer marker like extWD would be safer

It's better to use a constant for the marker to avoid mistakes in the future, also a longer marker like `extWD` would be safer
ManlyMarco (Migrated from github.com) commented 2021-02-12 22:15:06 +00:00

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

Does it work on the Steam version, and Japanese versions both with and without DX?
@ -22,0 +60,4 @@
try
{
string marker = br.ReadString();
int version = br.ReadInt32();
ManlyMarco (Migrated from github.com) commented 2021-02-12 21:55:56 +00:00

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"))

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")`)
@ -0,0 +9,4 @@
{
internal static partial class Hooks
{
internal static void InstallMainGameHooks(Harmony harmony)
ManlyMarco (Migrated from github.com) commented 2021-02-12 22:05:53 +00:00

Unnecessary method or forgot to patch?

Unnecessary method or forgot to patch?
@ -0,0 +8,4 @@
{
internal static partial class Lists
{
// internal main game furniture data
ManlyMarco (Migrated from github.com) commented 2021-02-12 22:06:37 +00:00

Move above to be a comment of class Lists or it can get lost if someone does any refactoring

Move above to be a comment of class Lists or it can get lost if someone does any refactoring
@ -0,0 +13,4 @@
/// <summary>
/// Currently only resolving
/// </summary>
/// <param name="stream"></param>
ManlyMarco (Migrated from github.com) commented 2021-02-12 22:07:28 +00:00

Remove any empty parts of docs when the PR is ready for merging so there's a warning if it does need to be filled in

Remove any empty parts of docs when the PR is ready for merging so there's a warning if it does need to be filled in
@ -13,6 +13,7 @@ using System.IO;
using System.Linq;
ManlyMarco (Migrated from github.com) commented 2021-02-12 22:10:41 +00:00

It's best to avoid unnecessary changes since it's harder to see what parts actually matter and it messes with git history

It's best to avoid unnecessary changes since it's harder to see what parts actually matter and it messes with git history
ManlyMarco (Migrated from github.com) commented 2021-02-12 22:11:14 +00:00

Missing code inside the #if ?

Missing code inside the #if ?
@ -299,1 +311,4 @@
#endif
#endif
#if AI
// AI Main-Game Loading Procedure
ManlyMarco (Migrated from github.com) commented 2021-02-12 22:13:08 +00:00

This will only work in Japanese version of the game since the Steam version has a different name. Compare to the studio name instead.

This will only work in Japanese version of the game since the Steam version has a different name. Compare to the studio name instead.
ManlyMarco (Migrated from github.com) commented 2021-02-12 22:13:42 +00:00

Broken #if ?

Broken #if ?
ManlyMarco commented 2021-02-12 22:30:27 +00:00 (Migrated from github.com)

@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.

> @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 (Migrated from github.com) reviewed 2021-02-15 12:38:57 +00:00
@ -0,0 +1,103 @@
using System;
hooh-hooah (Migrated from github.com) commented 2021-02-15 12:38:57 +00:00

Oh man I didn't noticed those one. I'll follow the name.

Oh man I didn't noticed those one. I'll follow the name.
hooh-hooah (Migrated from github.com) reviewed 2021-02-15 12:39:51 +00:00
@ -11,2 +19,4 @@
const string MainGameSaveMarker = "WD";
//Override ExtSave for list loading at game startup
[HarmonyPrefix]
hooh-hooah (Migrated from github.com) commented 2021-02-15 12:39:51 +00:00

Yeah, I've tested almost everything is working as intended i'll clean up the rest of the code to make it fit more nicer.

Yeah, I've tested almost everything is working as intended i'll clean up the rest of the code to make it fit more nicer.
hooh-hooah (Migrated from github.com) reviewed 2021-02-15 12:40:02 +00:00
@ -11,2 +19,4 @@
const string MainGameSaveMarker = "WD";
//Override ExtSave for list loading at game startup
[HarmonyPrefix]
hooh-hooah (Migrated from github.com) commented 2021-02-15 12:40:01 +00:00

noted.

noted.
hooh-hooah (Migrated from github.com) reviewed 2021-02-15 12:40:53 +00:00
@ -11,2 +19,4 @@
const string MainGameSaveMarker = "WD";
//Override ExtSave for list loading at game startup
[HarmonyPrefix]
hooh-hooah (Migrated from github.com) commented 2021-02-15 12:40:53 +00:00

Well "WD" was totally random token in my mind when i wrote this one. I'll try to make it as constant when there is no other better way to separate world data

Well "WD" was totally random token in my mind when i wrote this one. I'll try to make it as constant when there is no other better way to separate world data
hooh-hooah (Migrated from github.com) reviewed 2021-02-15 12:41:09 +00:00
@ -13,6 +13,7 @@ using System.IO;
using System.Linq;
hooh-hooah (Migrated from github.com) commented 2021-02-15 12:41:09 +00:00

Oof okay

Oof okay
hooh-hooah (Migrated from github.com) reviewed 2021-02-15 12:41:52 +00:00
hooh-hooah (Migrated from github.com) commented 2021-02-15 12:41:52 +00:00

Probably left over while moving code from the common codebase. As I stated, the code cleanup will be done soon since the most of features are working.

Probably left over while moving code from the common codebase. As I stated, the code cleanup will be done soon since the most of features are working.
hooh-hooah (Migrated from github.com) reviewed 2021-02-15 12:42:14 +00:00
@ -299,1 +311,4 @@
#endif
#endif
#if AI
// AI Main-Game Loading Procedure
hooh-hooah (Migrated from github.com) commented 2021-02-15 12:42:14 +00:00

Thanks for the tip. I'll keep that in my mind.

Thanks for the tip. I'll keep that in my mind.
hooh-hooah (Migrated from github.com) reviewed 2021-02-15 12:42:30 +00:00
hooh-hooah (Migrated from github.com) commented 2021-02-15 12:42:30 +00:00
https://github.com/IllusionMods/BepisPlugins/pull/122#discussion_r576165332
hooh-hooah (Migrated from github.com) reviewed 2021-02-15 12:44:09 +00:00
@ -11,2 +19,4 @@
const string MainGameSaveMarker = "WD";
//Override ExtSave for list loading at game startup
[HarmonyPrefix]
hooh-hooah (Migrated from github.com) commented 2021-02-15 12:44:09 +00:00

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

Well currently I don't have multiple versions of AI atm. I need to figure out how to obtain old versions first
hooh-hooah commented 2021-02-15 12:44:58 +00:00 (Migrated from github.com)

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

Thanks for the review, that was really helpful. I'll commit the fix when it's ready.
hooh-hooah (Migrated from github.com) reviewed 2021-03-01 12:01:12 +00:00
@ -13,6 +13,7 @@ using System.IO;
using System.Linq;
hooh-hooah (Migrated from github.com) commented 2021-03-01 12:01:12 +00:00
https://github.com/IllusionMods/BepisPlugins/pull/122/commits/a57e34b7c5f0c984a134ea1e0023d8c6bfee7d86
hooh-hooah (Migrated from github.com) reviewed 2021-03-01 12:01:33 +00:00
hooh-hooah (Migrated from github.com) commented 2021-03-01 12:01:33 +00:00
https://github.com/IllusionMods/BepisPlugins/pull/122/commits/a57e34b7c5f0c984a134ea1e0023d8c6bfee7d86
hooh-hooah (Migrated from github.com) reviewed 2021-03-01 12:01:36 +00:00
@ -299,1 +311,4 @@
#endif
#endif
#if AI
// AI Main-Game Loading Procedure
hooh-hooah (Migrated from github.com) commented 2021-03-01 12:01:36 +00:00
https://github.com/IllusionMods/BepisPlugins/pull/122/commits/a57e34b7c5f0c984a134ea1e0023d8c6bfee7d86
hooh-hooah (Migrated from github.com) reviewed 2021-03-01 12:01:40 +00:00
hooh-hooah (Migrated from github.com) commented 2021-03-01 12:01:39 +00:00
https://github.com/IllusionMods/BepisPlugins/pull/122/commits/a57e34b7c5f0c984a134ea1e0023d8c6bfee7d86
hooh-hooah (Migrated from github.com) reviewed 2021-03-01 12:01:42 +00:00
@ -11,2 +19,4 @@
const string MainGameSaveMarker = "WD";
//Override ExtSave for list loading at game startup
[HarmonyPrefix]
hooh-hooah (Migrated from github.com) commented 2021-03-01 12:01:41 +00:00
https://github.com/IllusionMods/BepisPlugins/pull/122/commits/a57e34b7c5f0c984a134ea1e0023d8c6bfee7d86
hooh-hooah (Migrated from github.com) reviewed 2021-03-01 12:01:44 +00:00
@ -11,2 +19,4 @@
const string MainGameSaveMarker = "WD";
//Override ExtSave for list loading at game startup
[HarmonyPrefix]
hooh-hooah (Migrated from github.com) commented 2021-03-01 12:01:44 +00:00
https://github.com/IllusionMods/BepisPlugins/pull/122/commits/a57e34b7c5f0c984a134ea1e0023d8c6bfee7d86
hooh-hooah (Migrated from github.com) reviewed 2021-03-01 12:01:46 +00:00
@ -11,2 +19,4 @@
const string MainGameSaveMarker = "WD";
//Override ExtSave for list loading at game startup
[HarmonyPrefix]
hooh-hooah (Migrated from github.com) commented 2021-03-01 12:01:46 +00:00
https://github.com/IllusionMods/BepisPlugins/pull/122/commits/a57e34b7c5f0c984a134ea1e0023d8c6bfee7d86
hooh-hooah (Migrated from github.com) reviewed 2021-03-01 12:01:53 +00:00
@ -0,0 +1,103 @@
using System;
hooh-hooah (Migrated from github.com) commented 2021-03-01 12:01:53 +00:00
https://github.com/IllusionMods/BepisPlugins/pull/122/commits/a57e34b7c5f0c984a134ea1e0023d8c6bfee7d86
This pull request has changes conflicting with the target branch.
  • src/AI_ExtensibleSaveFormat/AI_ExtensibleSaveFormat.csproj
  • src/AI_Sideloader/AI_Sideloader.csproj
  • src/Core_ExtensibleSaveFormat/Core.ExtendedSave.Hooks.cs
  • src/Core_Sideloader/Core.Sideloader.cs
  • src/Core_Sideloader/UniversalAutoResolver/Core.UAR.Hooks.cs
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin hooh-hooah/master:hooh-hooah/master
git switch hooh-hooah/master

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff hooh-hooah/master
git switch hooh-hooah/master
git rebase master
git switch master
git merge --ff-only hooh-hooah/master
git switch hooh-hooah/master
git rebase master
git switch master
git merge --no-ff hooh-hooah/master
git switch master
git merge --squash hooh-hooah/master
git switch master
git merge --ff-only hooh-hooah/master
git switch master
git merge hooh-hooah/master
git push origin master
Sign in to join this conversation.
No description provided.