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

Persist assigned scene after map edit #36

Open
poohcom1 opened this issue Jan 31, 2024 · 2 comments
Open

Persist assigned scene after map edit #36

poohcom1 opened this issue Jan 31, 2024 · 2 comments

Comments

@poohcom1
Copy link
Contributor

As mentioned in the README, currently any modifications to rooms in the Map Editor will remove assigned scenes. I think having some basic scene persistence will be a good QOL improvement, especially for devs who edits their room often.

Since there's a lot of ambiguity of how to maintain assigned scene when editing cells, I have an outline for how the assign scene can be determined after a map edit. The gist of it is to try to maintain assigned scene even when there is ambiguity based on a few factors, to make it as seamless as possible.

Cells Removed

  • If any room remains intact, keep the assigned scene.
  • If any room is split into multiple parts, have a consistent logic to determine how to keep the assigned scene (like always favor the assigned scene of the top-left-most cells).

Cells Moved

  • Always maintain cell assigned scene after the move.
  • If cells are moved on top of another room, prioritize the selected room prior to the move. (I forgot if the behavior here merges room or create border, will check and update later)

Cells Added

  • If any room is expanded, keep the assigned scene.
  • Prioritize assigned scene id of the room closest to the starting point of the draw action. For example, if you start drawing a line from Room A to Room B into a single large room, the logic will assume that the combined new room is Room A.

An alternative, simpler to implement system could also be to only maintain assigned scene when there is no ambiguity, and clear the scene otherwise. I haven't looked into the Map Editor code yet, so that could be a factor on how difficult this is to implement.

Let me know what you think.

@KoBeWi
Copy link
Owner

KoBeWi commented Jan 31, 2024

The reason scene is removed is a technical one. The rooms need to maintain consistency, that is a room may have a single scene assigned and each scene can be assigned only to up to one room.

If any room is split into multiple parts, have a consistent logic to determine how to keep the assigned scene (like always favor the assigned scene of the top-left-most cells).

I'd first need to determine that new rooms were created, which currently is not tracked.

Cells Moved

If you mean drag and drop, it should already retain the scenes. It's impossible to change room composition by dragging them, so there are no problems here.

If any room is expanded, keep the assigned scene.

Like in the first case, I'd have to detect that a room is being expanded and it does not interest with any other room.

if you start drawing a line from Room A to Room B into a single large room, the logic will assume that the combined new room is Room A.

That sounds complicated to do >_>

I may look into what you suggested, but no promises here. The code for assign management is already complex, and I didn't want to complicate it even more.

@poohcom1
Copy link
Contributor Author

Thanks for the clarification, I was also wondering if there were other technical reasons for this limitation. Wasn't aware rooms are retained when cells are dragged; that was one of the main things I wanted since I was planning on moving a large chunk of my map, so that should already address half of this.

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

No branches or pull requests

2 participants