Technical Questions on Tiled, Github, other software

Avatar

By Sanglorian 7 Aug 2017 13:44

Champion · 422 comments

Hi team,

I'm starting to teach myself Github and Tiled to make maps with events, NPCs, encounters, and so on. I thought it might be easiest if I posted my questions here, and others can post their questions too.

Thanks for your help!

How do I send a pull request to the development branch?

I used Github Desktop to clone the Tuxemon repository, then I switched to the development branch. I then made changes to some files in that branch and committed those changes.

Now I'm looking to send those changes to the Tuxemon repository on the cloud, but it only gives me the option to pull from development to master, not from the development version on my computer to the development version hosted on Github.

What am I doing wrong?

Are there default event sets?

I noticed that ledges are set up as collisions with a few custom properties. These would presumably be common to all ledges (well, all ledges facing a particular way). Is there a way to define that centrally, and then I can just apply that every time?

A way to automatically knit maps together?

I'm wondering if there's a way for the program to display adjacent maps without me having to manually copy-paste a margin. If not, how many squares should I copy-paste to make sure that there's no black visible in the viewport?

Able to set teleport on a line rather than a square?

Linked to the above question, if the adjacent maps could be displayed automatically, then I'd want the event to trigger as a person touches the edge of the map, rather than the final file in it.

Avatar

By Sanglorian 9 Aug 2017 10:30

Champion · 422 comments
Sanglorian wrote

How do I send a pull request to the development branch?

I used Github Desktop to clone the Tuxemon repository, then I switched to the development branch. I then made changes to some files in that branch and committed those changes.

Now I'm looking to send those changes to the Tuxemon repository on the cloud, but it only gives me the option to pull from development to master, not from the development version on my computer to the development version hosted on Github.

What am I doing wrong?

I think I figured this one out. I needed to fork the repository, then clone it, rather than cloning the original.

Avatar

By Sanglorian 10 Aug 2017 22:11

Champion · 422 comments

A few others:

Where are the Python error logs stored?

The game sometimes crashes, with text showing up in the Python window - but too quick for me to read it. Is this saved in a log file somewhere so I can post an issue?

Events on the tile being interacted with instead of the tile the player is on?

It looks like some events are placed on the tile that is the target of the interaction and others on the tile the player is interacting from. What determines which of these is used? The former is not described on the "map editor events" page.

Sets of tilesets?
Is there a way to save all your tilesets so for each Tiled map you can load them all at once?

Avatar

By ShadowApex 13 Aug 2017 21:57

Lead Developer · 368 comments
Sanglorian wrote

How do I send a pull request to the development branch?

Yeah, you need to fork Tuxemon into your own repository. Then you can use your Git client to change to the development branch.  From your own repository you can make as many changes as you want.

Instead of making changes to your copy of the development branch though, you should try creating a new branch from development with a new name for a specific change that you're doing. For example, if you want to add a new map to the game, you can create a branch called add-map-route45 (or any name you want). Then you can add everything you need for that single map you're adding and commit it to your repository. Then when you open a pull request to have your new map included in the main Tuxemon project, you can select your add-map-route45 branch as the source you want Tuxemon to pull from.

If you do it that way, when you want to add a different map or other changes, you can use your Git client to switch back to the development branch and create a new branch from it called add-other-map and add a different map there. Doing it this way makes it so each pull request only has a few changes in it, which makes it much easier to review and accept, and will be less likely to conflict with other people's changes.

Sanglorian wrote

Are there default event sets?

I noticed that ledges are set up as collisions with a few custom properties. These would presumably be common to all ledges (well, all ledges facing a particular way). Is there a way to define that centrally, and then I can just apply that every time?

Unfortunately there's no current way to automatically make ledges have those properties. The tileset images themselves don't have any data inside them to tell us what tiles should be considered a ledge and what shouldn't be. It may possible to include that kind of functionality if we modified Tiled, or made some complex system inside Tuxemon, but that is a very serious undertaking and the amount of work needed to implement it might be more than it's worth right now. If anyone wants to try and build out this functionality though, the change would be welcome!

Sanglorian wrote

A way to automatically knit maps together?

I'm wondering if there's a way for the program to display adjacent maps without me having to manually copy-paste a margin. If not, how many squares should I copy-paste to make sure that there's no black visible in the viewport?

This kind of functionality is actually on the road map for Tiled:
https://github.com/bjorn/tiled/issues/1669

Unfortunately right now there's no way in Tiled to display adjacent maps. sad

Sangloarian wrote

Able to set teleport on a line rather than a square?

Linked to the above question, if the adjacent maps could be displayed automatically, then I'd want the event to trigger as a person touches the edge of the map, rather than the final file in it.

Right now I believe teleport will only work with square event objects. This shoudn't be too hard to implement though. If you create an issue on the Tuxemon GitHub, myself or some contributors might be able to help implement this.

Sanglorian wrote

Where are the Python error logs stored?

The game sometimes crashes, with text showing up in the Python window - but too quick for me to read it. Is this saved in a log file somewhere so I can post an issue?

Right now Tuxemon doesn't log to a file. We should probably have a setting in tuxemon.cfg to enable file logging. To get around this right now, try running Tuxemon by opening a command line window and running it with python tuxemon.py. That will keep the terminal window open with the log output.

Sanglorian wrote

Events on the tile being interacted with instead of the tile the player is on?

It looks like some events are placed on the tile that is the target of the interaction and others on the tile the player is interacting from. What determines which of these is used? The former is not described on the "map editor events" page.

It all depends on the conditions used in the event. Some events with conditions like npc_exists can be placed anywhere, because that condition only checks for whether or not an NPC exists on the currently loaded map. Events with the player_at condition use the event square's position on the map. The player_facing_tile condition checks to see if the player is facing the tile that the event square is on. The event reference page has some good documentation on all the conditions and actions:
https://github.com/Tuxemon/Tuxemon/wiki/event-reference

Sanglorian wrote

Sets of tilesets?
Is there a way to save all your tilesets so for each Tiled map you can load them all at once?

I'm not sure about this, I'll have to dig a little deeper. One thing to be careful of when doing this is to make sure that unused tilesets aren't saved in the map file. Right now Tuxemon will load all tilesets listed in the map file, which will unnecessarily increase the amount of memory Tuxemon uses. We might be able to fix this in the future by inspecting each tile in the map and only load tilesets that are used in the map.


Avatar

By Sanglorian 14 Aug 2017 08:36

Champion · 422 comments

Thanks ShadowApex!

ShadowApex wrote
Sanglorian wrote

Are there default event sets?

I noticed that ledges are set up as collisions with a few custom properties. These would presumably be common to all ledges (well, all ledges facing a particular way). Is there a way to define that centrally, and then I can just apply that every time?

Unfortunately there's no current way to automatically make ledges have those properties. The tileset images themselves don't have any data inside them to tell us what tiles should be considered a ledge and what shouldn't be. It may possible to include that kind of functionality if we modified Tiled, or made some complex system inside Tuxemon, but that is a very serious undertaking and the amount of work needed to implement it might be more than it's worth right now. If anyone wants to try and build out this functionality though, the change would be welcome!

Hmm, I was thinking it would be as simple as setting the Type to "ledge-right" or something, and having the properties of all "ledge-right" boxes set centrally. Agreed it's not a priority if it's not that simple!

Sanglorian wrote

A way to automatically knit maps together?

I'm wondering if there's a way for the program to display adjacent maps without me having to manually copy-paste a margin. If not, how many squares should I copy-paste to make sure that there's no black visible in the viewport?

This kind of functionality is actually on the road map for Tiled:
https://github.com/bjorn/tiled/issues/1669

Unfortunately right now there's no way in Tiled to display adjacent maps. sad

Interesting. Would that come through to the Tuxemon game itself, once the feature is implemented? I.e. could we knit the maps in Tiled and it could automatically display adjacent maps?

Otherwise I did find an alternative, but it could increase the memory costs:

1. Save each map as a png
2. Load each map png as a tilesheet in any maps adjacent to that map
3. Paint the relevant part of that map (about five rows or columns of tiles, by my count) as tiles in the adjacent maps

Then any time you save a map, you could save it as the png, and all adjacent maps would automatically adjust.

(Does that description make sense?)

Sangloarian wrote

Able to set teleport on a line rather than a square?

Linked to the above question, if the adjacent maps could be displayed automatically, then I'd want the event to trigger as a person touches the edge of the map, rather than the final file in it.

Right now I believe teleport will only work with square event objects. This shoudn't be too hard to implement though. If you create an issue on the Tuxemon GitHub, myself or some contributors might be able to help implement this.

I think I've figured a work-around for this, which is just to set the teleport to the square beyond the current square, even if that's just blank.

Sanglorian wrote

Where are the Python error logs stored?

The game sometimes crashes, with text showing up in the Python window - but too quick for me to read it. Is this saved in a log file somewhere so I can post an issue?

Right now Tuxemon doesn't log to a file. We should probably have a setting in tuxemon.cfg to enable file logging. To get around this right now, try running Tuxemon by opening a command line window and running it with python tuxemon.py. That will keep the terminal window open with the log output.

That sounds good. How do I do this? I used cd to navigate cmd.exe to the folder that tuxemon.py is in, but when I typed python tuxemon.py it said "'python' is not recognised as an internal or external command, operable program or batch file'.

Avatar

By bitcraft 14 Aug 2017 15:04

Champion · 129 comments

Tiled can set properties on tileset images/tiles, and the map loader is able to read those values.  With some planning, it would be possible to set collision parameters on the tileset images directly, and let Tuxemon create collions in game based on that data, ie, no manual collision layer.  I wouldn't mind implementing it, but we should have clear guidelines on what properties are added to the tiles to make sure it is consistent.