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

Unable to set origin coordinate for objects for GameMaker room export #1427

Closed
kevintrepanier opened this Issue Jan 5, 2017 · 15 comments

Comments

Projects
None yet
3 participants
@kevintrepanier

kevintrepanier commented Jan 5, 2017

It is frequent in GameMaker to use the center of an object as it's origin for easy placement and collisions. However in Tiled the origin seems to always be the top-left corner of the object.

Being able to set an origin point would be very useful.

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Jan 10, 2017

Owner

Hmm, I guess this could be implemented by supporting two custom tiles properties, originX and originY, and taking those into account when writing the positions of the instances. It would be a little cumbersome to make sure these values match the origin set on the sprite in GameMaker, of course.

And rather than having them as custom properties, it would be nice to actually support setting the origin for each tile in Tiled as well of course. This partly covered by #1323 (it still needs to be finished, and there's no convenient way to set it).

Owner

bjorn commented Jan 10, 2017

Hmm, I guess this could be implemented by supporting two custom tiles properties, originX and originY, and taking those into account when writing the positions of the instances. It would be a little cumbersome to make sure these values match the origin set on the sprite in GameMaker, of course.

And rather than having them as custom properties, it would be nice to actually support setting the origin for each tile in Tiled as well of course. This partly covered by #1323 (it still needs to be finished, and there's no convenient way to set it).

@TrunXGIT

This comment has been minimized.

Show comment
Hide comment
@TrunXGIT

TrunXGIT Feb 7, 2017

Contributor

The missing originX and originY parameters for objects is the only reason why I'm not using Tiled for placing objects in Tiled for my current game project. It would be really great to ditch the build in level editor and use Tiled for everything realted to level building.

My work flow now is:

  1. Build a level only using the tileset in Tiled.
  2. Import it into GM
  3. Place hundreds of objects
  4. Find out that some parts of the level need a redesign
  5. Be a bit frustrated that the build in level editor doesn't support selecting and moving whole parts of a level.
  6. Go back to the Tiled level file in Tiled which only consists of the Tiles and make the adjustment
  7. Import it into GM again
  8. Do all the work with the objects again and hope you don't need to change something in the middle of a level.

Regarding the originX and originY parameters. Wouldn't it be possible to select the .gmx project file and read in all the already set values from the GM project and use them? Just a spontaneous idea.

Thanks for the great work!

Contributor

TrunXGIT commented Feb 7, 2017

The missing originX and originY parameters for objects is the only reason why I'm not using Tiled for placing objects in Tiled for my current game project. It would be really great to ditch the build in level editor and use Tiled for everything realted to level building.

My work flow now is:

  1. Build a level only using the tileset in Tiled.
  2. Import it into GM
  3. Place hundreds of objects
  4. Find out that some parts of the level need a redesign
  5. Be a bit frustrated that the build in level editor doesn't support selecting and moving whole parts of a level.
  6. Go back to the Tiled level file in Tiled which only consists of the Tiles and make the adjustment
  7. Import it into GM again
  8. Do all the work with the objects again and hope you don't need to change something in the middle of a level.

Regarding the originX and originY parameters. Wouldn't it be possible to select the .gmx project file and read in all the already set values from the GM project and use them? Just a spontaneous idea.

Thanks for the great work!

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Feb 7, 2017

Owner

@TrunXGIT That workflow is so totally unacceptable. :-(

Reading in the existing object and sprite definitions from the GameMaker project would of course be ideal, but it won't be trivial since Tiled currently has no similar functionality. I think the closest thing would be to implement it as custom tileset format.

And then of course, the origin stuff still needs to be done as well.

In any case, I do hope to get around to it eventually. And contributions in code are welcome too of course!

Owner

bjorn commented Feb 7, 2017

@TrunXGIT That workflow is so totally unacceptable. :-(

Reading in the existing object and sprite definitions from the GameMaker project would of course be ideal, but it won't be trivial since Tiled currently has no similar functionality. I think the closest thing would be to implement it as custom tileset format.

And then of course, the origin stuff still needs to be done as well.

In any case, I do hope to get around to it eventually. And contributions in code are welcome too of course!

@kevintrepanier

This comment has been minimized.

Show comment
Hide comment
@kevintrepanier

kevintrepanier Feb 8, 2017

@TrunXGIT If it can help : use "select-all" (ctrl+a) in the original room copy and then paste them all at once into the new room.

But yeah, there's several steps between Tiled and GM.

kevintrepanier commented Feb 8, 2017

@TrunXGIT If it can help : use "select-all" (ctrl+a) in the original room copy and then paste them all at once into the new room.

But yeah, there's several steps between Tiled and GM.

@TrunXGIT

This comment has been minimized.

Show comment
Hide comment
@TrunXGIT

TrunXGIT Feb 9, 2017

Contributor

Thx for the tip kevintrepanier. In some cases it might be helpful, in others there would be still a lot of adjustments to do.

By the way, before somebody is thinking the GM exporter needs to be changed for the origin points.
It only concerns the display coordinates of objects in the Tiled editor itself. Objects in GM don't have their own origin parameters. It's just the sprites assigned to the objects that have these parameters. Most likely this was already clear before, but just to make it sure ;)

Contributor

TrunXGIT commented Feb 9, 2017

Thx for the tip kevintrepanier. In some cases it might be helpful, in others there would be still a lot of adjustments to do.

By the way, before somebody is thinking the GM exporter needs to be changed for the origin points.
It only concerns the display coordinates of objects in the Tiled editor itself. Objects in GM don't have their own origin parameters. It's just the sprites assigned to the objects that have these parameters. Most likely this was already clear before, but just to make it sure ;)

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Feb 9, 2017

Owner

In some cases it might be helpful, in others there would be still a lot of adjustments to do.

Can you elaborate on what kind of adjustment? I noticed there are quite a bit of additional features in GameMaker rooms, like repeating image backgrounds and other options. Do you mean setting those up? I'd like to support as many of them as possible in a meaningful way in Tiled, to avoid the need for repeating setup in GameMaker after each export.

By the way, before somebody is thinking the GM exporter needs to be changed for the origin points.
It only concerns the display coordinates of objects in the Tiled editor itself. Objects in GM don't have their own origin parameters. It's just the sprites assigned to the objects that have these parameters. Most likely this was already clear before, but just to make it sure ;)

Right, most of the work for supporting this will be to finish #1323, which is the equivalent of setting up the origin on a sprite in GameMaker.

Owner

bjorn commented Feb 9, 2017

In some cases it might be helpful, in others there would be still a lot of adjustments to do.

Can you elaborate on what kind of adjustment? I noticed there are quite a bit of additional features in GameMaker rooms, like repeating image backgrounds and other options. Do you mean setting those up? I'd like to support as many of them as possible in a meaningful way in Tiled, to avoid the need for repeating setup in GameMaker after each export.

By the way, before somebody is thinking the GM exporter needs to be changed for the origin points.
It only concerns the display coordinates of objects in the Tiled editor itself. Objects in GM don't have their own origin parameters. It's just the sprites assigned to the objects that have these parameters. Most likely this was already clear before, but just to make it sure ;)

Right, most of the work for supporting this will be to finish #1323, which is the equivalent of setting up the origin on a sprite in GameMaker.

@kevintrepanier

This comment has been minimized.

Show comment
Hide comment
@kevintrepanier

kevintrepanier Feb 9, 2017

Settings I usually have to change when importing or creating a new room :

  • Room Speed (in FPS)
  • Backgrounds
    • Background color
    • Up to 7 Backgrounds selected from "Backgrounds" assets
  • Views
    • Check "Enable use of views"
    • Check "Visible when room starts"
    • View in room (X, Y, W, H)
    • Port on screen (X, Y, W, H)
    • Object following (select object, Hbor, Vbor, Hsp, Vsp)

There are also physics properties that can be set for the room for those who use it.

kevintrepanier commented Feb 9, 2017

Settings I usually have to change when importing or creating a new room :

  • Room Speed (in FPS)
  • Backgrounds
    • Background color
    • Up to 7 Backgrounds selected from "Backgrounds" assets
  • Views
    • Check "Enable use of views"
    • Check "Visible when room starts"
    • View in room (X, Y, W, H)
    • Port on screen (X, Y, W, H)
    • Object following (select object, Hbor, Vbor, Hsp, Vsp)

There are also physics properties that can be set for the room for those who use it.

@TrunXGIT

This comment has been minimized.

Show comment
Hide comment
@TrunXGIT

TrunXGIT Sep 20, 2017

Contributor

This seems to be solved now with the next update? :)

Contributor

TrunXGIT commented Sep 20, 2017

This seems to be solved now with the next update? :)

@bjorn bjorn closed this in 9e1023e Sep 21, 2017

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Sep 21, 2017

Owner

For now the implemented solution to this is to support two additional custom properties, originX and originY, that you can set up to match the object origin you're using in GameMaker and then Tiled will adjust the exported position of the object accordingly. In doing this it even takes into account the object rotation and its flipped state (flipping translates to a negative scale in the export).

It's not ideal, but in combination with 1524072, which allows those properties to be specified on tiles or templates, you can at least avoid having to set up these properties for each instance.

Settings I usually have to change when importing or creating a new room:

@kevintrepanier I guess you have found out in the meantime that most of those settings can actually be specified in Tiled using custom properties. All except the backgrounds, which are still not supported (I think it would make sense to export the image layers as backgrounds). You can now also find these properties documented at http://doc.mapeditor.org/en/latest/manual/export/#gamemaker-studio-1-4. And now of course the new properties added in 9e1023e should still be documented...

Owner

bjorn commented Sep 21, 2017

For now the implemented solution to this is to support two additional custom properties, originX and originY, that you can set up to match the object origin you're using in GameMaker and then Tiled will adjust the exported position of the object accordingly. In doing this it even takes into account the object rotation and its flipped state (flipping translates to a negative scale in the export).

It's not ideal, but in combination with 1524072, which allows those properties to be specified on tiles or templates, you can at least avoid having to set up these properties for each instance.

Settings I usually have to change when importing or creating a new room:

@kevintrepanier I guess you have found out in the meantime that most of those settings can actually be specified in Tiled using custom properties. All except the backgrounds, which are still not supported (I think it would make sense to export the image layers as backgrounds). You can now also find these properties documented at http://doc.mapeditor.org/en/latest/manual/export/#gamemaker-studio-1-4. And now of course the new properties added in 9e1023e should still be documented...

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Sep 21, 2017

Owner

Documentation added in a70489a! It will be live soon at the above link.

Owner

bjorn commented Sep 21, 2017

Documentation added in a70489a! It will be live soon at the above link.

@kevintrepanier

This comment has been minimized.

Show comment
Hide comment
@kevintrepanier

kevintrepanier Sep 27, 2017

I've downloaded the Alpha 4 snapshot (Version 2017.09.13) and tested the originX and originY custom properties for GameMaker but it does not seem to work properly. In GameMaker, the X is equal to the X in Tiled and the Y is offsetted by -32 pixels (32 being my object's height). The originX and originY does not seem to affect the X and Y at all (I've tried changing their value but it does not change the result).

Side note : I also have an object that I've long ago deleted in Tiled but that keeps appearing in my imports in GameMaker. I can't reproduce that bug but it makes me wonder if there is other residual informations that might cause the origin problem?

test_originxy

kevintrepanier commented Sep 27, 2017

I've downloaded the Alpha 4 snapshot (Version 2017.09.13) and tested the originX and originY custom properties for GameMaker but it does not seem to work properly. In GameMaker, the X is equal to the X in Tiled and the Y is offsetted by -32 pixels (32 being my object's height). The originX and originY does not seem to affect the X and Y at all (I've tried changing their value but it does not change the result).

Side note : I also have an object that I've long ago deleted in Tiled but that keeps appearing in my imports in GameMaker. I can't reproduce that bug but it makes me wonder if there is other residual informations that might cause the origin problem?

test_originxy

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Sep 27, 2017

Owner

I've downloaded the Alpha 4 snapshot (Version 2017.09.13) and tested the originX and originY custom properties for GameMaker but it does not seem to work properly.

That is because the release date of the Alpha 4 snapshot is before this functionality was implemented (6 days ago). These custom properties will be supported starting with the Alpha 5 snapshot, which I plan to release today.

Side note : I also have an object that I've long ago deleted in Tiled but that keeps appearing in my imports in GameMaker. I can't reproduce that bug but it makes me wonder if there is other residual informations that might cause the origin problem?

I have no idea how something like that could happen. What is deleted in Tiled doesn't show up in the exported file, so maybe this object was coming from somewhere else? Or maybe you missed a hidden object?

Owner

bjorn commented Sep 27, 2017

I've downloaded the Alpha 4 snapshot (Version 2017.09.13) and tested the originX and originY custom properties for GameMaker but it does not seem to work properly.

That is because the release date of the Alpha 4 snapshot is before this functionality was implemented (6 days ago). These custom properties will be supported starting with the Alpha 5 snapshot, which I plan to release today.

Side note : I also have an object that I've long ago deleted in Tiled but that keeps appearing in my imports in GameMaker. I can't reproduce that bug but it makes me wonder if there is other residual informations that might cause the origin problem?

I have no idea how something like that could happen. What is deleted in Tiled doesn't show up in the exported file, so maybe this object was coming from somewhere else? Or maybe you missed a hidden object?

@kevintrepanier

This comment has been minimized.

Show comment
Hide comment
@kevintrepanier

kevintrepanier Sep 27, 2017

Ok, thanks for the info. Looking forward to test it in the new snapshot!

You are right about the other "residual" object. It was individually hidden in a layer I didn't expect to find it. So no problems here.

kevintrepanier commented Sep 27, 2017

Ok, thanks for the info. Looking forward to test it in the new snapshot!

You are right about the other "residual" object. It was individually hidden in a layer I didn't expect to find it. So no problems here.

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Sep 27, 2017

Owner

Ok, thanks for the info. Looking forward to test it in the new snapshot!

And it's out! https://thorbjorn.itch.io/tiled/devlog/11050/tiled-11-alpha5-and-documentation :-)

Owner

bjorn commented Sep 27, 2017

Ok, thanks for the info. Looking forward to test it in the new snapshot!

And it's out! https://thorbjorn.itch.io/tiled/devlog/11050/tiled-11-alpha5-and-documentation :-)

@kevintrepanier

This comment has been minimized.

Show comment
Hide comment
@kevintrepanier

kevintrepanier Sep 28, 2017

Tested and it's working perfectly! Thanks a lot!

kevintrepanier commented Sep 28, 2017

Tested and it's working perfectly! Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment