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

[Tiled] MGCB not handling reference properly #774

Open
kaltinril opened this issue Jun 26, 2022 · 15 comments
Open

[Tiled] MGCB not handling reference properly #774

kaltinril opened this issue Jun 26, 2022 · 15 comments
Assignees
Milestone

Comments

@kaltinril
Copy link

kaltinril commented Jun 26, 2022

I'm not sure if I'm missing a step, or if I'm doing something wrong, but after I add my MonoGame.Extended.Content.Pipeline.dll in the editor (before I save/close the editor) I can add a tmx file and change it's content processor to tiled, but once I save and close it, the tmx reference dissappears from the content.mgcb file, and when I open it again, the editor displays an odd folder path, as if it's trying to load the reference like a content asset?

[blank folder]
-> [build=]

  • -> [build=]
    • -> MonoGame.Extended.Content.Pipeline.dll

Fresh brand new project (MonoGame.Framework.DesktopGl)
VS 2019
.net core 3.1.420 installed along with 5.0.408
MonoGame.Extended 3.8.0
MonoGame 3.8.0.164

Complete Content.mgcb file:

#----------------------------- Global Properties ----------------------------#

/outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform)
/platform:DesktopGL
/config:
/profile:Reach
/compress:False

#-------------------------------- References --------------------------------#

/reference:..\..\..\..\Users\myusername\.nuget\packages\monogame.extended.content.pipeline\3.8.0\tools\MonoGame.Extended.Content.Pipeline.dll

#---------------------------------- Content ---------------------------------#

#begin Levels/level1.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:Levels/level1.tmx

Before:
image

After:
image

Error if trying to "build" with no content":
image

However, if I add a tmx file, it shows me all the Extended content importers, but fails to build still:
image

Project structure:
image

@kaltinril
Copy link
Author

UPDATE: I copied MonoGame.Extended.Content.Pipeline.dll to the root of the project in the solution, and referenced it there instead.

Now the reference stays put, however, when I add a TMX file, there is no option for Tiled in the Importer.

image
image

@sandord
Copy link

sandord commented Jul 26, 2022

I think that a relative path to the MonoGame.Extended.Content.Pipeline.dll cannot be determined when your repository is not located under C:\Users\myusername.

In my case, I'm using the exact same location for the repository (C:\Git) and I'm suffering from the same problem you're having.

Since MonoGame.Extended.Content.Pipeline.dll is a NuGet tool, it isn't copied to the bin directory when the .NET project is built. This means that we'll need to reference it in the .nuget directory, which is located under C:\Users\myusername by default. But, since our repository isn't located under C:\Users\myusername, we'll need to include C:\Users\myusername in the path because we can't reach like we otherwise could've done using a relative path that stays inside the user directory.

Having your username hardcoded in a path is of course unacceptable (especially if you're sharing code across machines or with other people) but I have no idea how to work around this without moving my repository somewhere under C:\Users\myusername (e.g. Documents\Git).

If you were to move your repository, you shouldn't need to copy the dll to your project root anymore and use the following reference instead:

/reference:..\..\..\..\.nuget\packages\monogame.extended.content.pipeline\3.8.0\tools\MonoGame.Extended.Content.Pipeline.dll

I took the reference from this demo. You might need to adjust the number of ..\s to match your situation.

@kaltinril
Copy link
Author

Was this resolved ever or is it still in a work-around status?

@AristurtleDev AristurtleDev added this to the v4.0.0 milestone May 20, 2024
@AristurtleDev
Copy link
Collaborator

@kaltinril can you try one of the following and confirm if this is resolved now

  1. Use the source code of MonoGame.Extended directly and reference it in your project
  2. Use the most recent (at the time of writing this) prerelease NuGet https://www.nuget.org/packages/MonoGame.Extended/3.9.0-prerelease.4

@AristurtleDev AristurtleDev self-assigned this May 29, 2024
@tomislav12
Copy link

tomislav12 commented May 29, 2024

@AristurtleDev Installing 3.9.0 from NuGet does not help. I get "Processor 'TiledMapTilesetProcessor' had unexpected failure!" and some other errors as well:
Screenshot 2024-05-29 213027
EDIT: It work now. I had to change reference to 3.9.0 dll

@AristurtleDev
Copy link
Collaborator

AristurtleDev commented May 29, 2024

EDIT: It work now. I had to change reference to 3.9.0 dll

@kaltinril so everything is good? Good to close this issue out?

@kaltinril
Copy link
Author

kaltinril commented May 29, 2024 via email

@AristurtleDev
Copy link
Collaborator

Oh sorry @kaltinril i thought the reply above was from you but it was from @tomislav12 , my mistake.

but you were the original issue opener, if you don’t mind checking as well that would be great so we can close out the issue

@kaltinril
Copy link
Author

kaltinril commented May 29, 2024 via email

@kaltinril
Copy link
Author

kaltinril commented Jun 3, 2024 via email

@kaltinril
Copy link
Author

kaltinril commented Jun 7, 2024

Alright, sorry for the delay.

I am getting similar or same issues. Perhaps I am not setting up the project correctly.

Here are the steps to reproduce the issue:

  1. Open VS 2022
  2. Create a new MonoGame Cross Platform Desktop Project
    1. (I did notice documentation states extended doesn't work with monogame 3.8.1.303 on the github page getting started for extended, so perhaps I am not doing a valid test? I'm hoping this development build does)
  3. Once the new solution/project opens, press play to verify it compiles and runs.
  4. In the PM window, I CD'd down to the folder containing the project to avoid the error "Could not find any project in ...path"
  5. I installed the following nuget packages per extended.tiled documentation:
    1. dotnet add package MonoGame.Extended --version 3.9.0-prerelease.4
      1. From this page https://www.monogameextended.net/docs/getting-started/installation/
    2. dotnet add package MonoGame.Extended.Content.Pipeline --version 3.9.0-prerelease.4
      1. From this page https://www.monogameextended.net/docs/getting-started/installation/
    3. dotnet add package MonoGame.Extended.Tiled --version 3.9.0-prerelease.4
      1. https://www.monogameextended.net/docs/features/tiled/
  6. I then followed the steps under section Using the MonoGame Pipeline GUI
    1. From this page https://www.monogameextended.net/docs/getting-started/installation/

At this point, I copied a TMX file into the directory and opened the MGCB editor again, and it doesn't show the Importer or processor for TMX files, and it has the odd build= build= folder structure.

So I can only assume:
A) I did something wrong
B) or, it's still broken.

Please let me know what steps I'm doing wrong, or, missing.

EDIT: I just checked and the MGCB editor is version 3.8.0.1641 and it says its "mgcb-editor-wpf" in open with. I ran dotnet tool restore from the project sub-folder, and it shows dotnet-mgcb-editor is available with command dotnet mgcb-editor. I ran this command from the project folder and it opened version 3.8.1.303 and the help says "MGCB Editor" instead of "wpf". However, even this tool has the same issue/behavior.

If it helps...

Here is the actual PATH
C:\Users\username\.nuget\packages\monogame.extended.content.pipeline\3.9.0-prerelease.4\tools

And the entry that the GUI adds to my content file:
/reference:........\Users\username\.nuget\packages\monogame.extended.content.pipeline\3.9.0-prerelease.4\tools\MonoGame.Extended.Content.Pipeline.dll

Here is where my solution file lives:
C:\git\mge_tiled_learning2\mge_tiled_learning2.sln

Here is where the project file lives:
C:\git\mge_tiled_learning2\mge_tiled_learning2\mge_tiled_learning2.csproj

image

@kaltinril
Copy link
Author

kaltinril commented Jun 7, 2024

Alright, I got it to work, but essentially this issue break down to 1 thing:

The attempt to use "relative paths" to move up and then back down to the files.

How I got it working:

  1. Manually edit the Content.mgcb file to remove the ........\ and just put c:\ instead
    1. BROKEN: /reference:..\..\..\..\Users\username\.nuget\packages\monogame.extended.content.pipeline\3.9.0-prerelease.4\tools\MonoGame.Extended.Content.Pipeline.dll
    2. WORKING: /reference:C:\Users\username\.nuget\packages\monogame.extended.content.pipeline\3.9.0-prerelease.4\tools\MonoGame.Extended.Content.Pipeline.dll
  2. That then made it so the Editor could finally see the dll and would allow me to build, but it failed because the Tiled tsx file was also using ../../../ etc I fixed this the same way, by hard coding the c:/
    1. BROKEN: ../../../Users/username/Downloads/assets-6a3b3a06d9df585805d29f6f45628bcd/tiled/[Base]BaseChip_pipo.png
    2. WORKING: C:/Users/username/Downloads/assets-6a3b3a06d9df585805d29f6f45628bcd/tiled/[Base]BaseChip_pipo.png

@AristurtleDev
Copy link
Collaborator

Thanks for responding back @kaltinril

Unfortunately the relative pathing issue that's created in the Content.mgcb file is how the MGCB Editor choose to add the path. It's not something that can be managed from the MonoGame.Extended side.

The documentation needs to be updated to better inform about setting up a nuget.config file to get the package to download locally to the project instead of the obscure nuget global directory cache.

However, I have plans to automate this in 4.0 so I don't think it will be an issue in the future.

As for having to edit the tsx file, this is also a Tiled thing. I can think of a few ways to resolve it on the MonoGame.Extended side, but better documentation is needed for that.

I'm going to keep the issue open for now and mark it as documentation.

@kaltinril
Copy link
Author

kaltinril commented Jun 7, 2024 via email

@AristurtleDev
Copy link
Collaborator

AristurtleDev commented Jun 7, 2024

To answer your questions

  1. What change was made in this dev version?

There's been some changes made, mostly structural project changes, but also a few bug fixes. You can find all the information in the new change changelog as I'm working through things https://github.com/craftworkgames/MonoGame.Extended/blob/develop/CHANGELOG.md

  1. Is extended sticking around?

Yea, extended is sticking around. The previous maintainer was unable to commit time to the project, and the backlog kinda pilled up. I've taken ownership of the project now and am working through the backlog of known issues and bugs to get a new release out so it's up-to-date with current MonoGame 3.8.1.303. You can track the progress for that here https://github.com/orgs/craftworkgames/projects/6/views/1

  1. When's the plan for ditching the content pipeline? (or has that changed)

The content pipeline is a controversial topic within the MonoGame community in general. However, despite this, many users still use it and it's not going away in the main MonoGame repo as far as I know. So support for the pipeline will remain, however it will most likely move to being a second class citizen within MonoGame.Extended. What I mean by this is the functionality to load and/or preprocess various asset types should exist on its own, without the pipeline first and foremost.

This is something I've done in other MonoGame libraries I maintain, and allows users to choose if they want to incorporate the asset preprocessing into their own custom workflow or hook it into the MonoGame pipeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Pending Response
Development

No branches or pull requests

4 participants