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

Import Tiled maps into the game #480

Closed
Luis-Tavares opened this issue Oct 1, 2021 · 9 comments · Fixed by #511
Closed

Import Tiled maps into the game #480

Luis-Tavares opened this issue Oct 1, 2021 · 9 comments · Fixed by #511
Assignees
Labels
code for programmers

Comments

@Luis-Tavares
Copy link
Contributor

Luis-Tavares commented Oct 1, 2021

The maps of the game are being built on Tiled. Its files are on kcg\luis\tiled files
We need to import different Tiled maps into the game. On the first version, the player is going to select on the load screen which map he's going to play and it'll load an entire map of Tiled.
Later we maybe incorporate Tiled maps into some procedurally generated areas, but you don't need to worry about that right now.
Tiled is free, so I advise you to also download it, so you can check how the map should look like and how the layers are organized.

@Luis-Tavares Luis-Tavares added the code for programmers label Oct 1, 2021
@Luis-Tavares Luis-Tavares added this to To do in cx-game (Project) via automation Oct 1, 2021
@ted537 ted537 self-assigned this Oct 1, 2021
@ted537
Copy link
Collaborator

ted537 commented Oct 1, 2021

Looking through the TMX file format, populating the layers should be a straightforward task. The trickier element will be mapping the .tsx resources to the in-game tiles.

@ted537
Copy link
Collaborator

ted537 commented Oct 4, 2021

.png spritesheets hold many sprites. .tsx files map sprites to spritesheets. Our custom sprite .yaml files also map sprites to spritesheets. Our custom tile .yaml files map tiles to sprites.

Perhaps we should replace our custom sprite .yaml files with the same .tsx files that we are already using within Tiled. Adopting a single source of truth will reduce the friction in adding/updating assets.

Additionally, Tiled supports custom properties. We may be able to embed tile information within these properties to further consolidate the map information.

@ted537
Copy link
Collaborator

ted537 commented Oct 4, 2021

According to the Tiled documentation on Tile layers, properties only exist on tiles - they cannot be defined on a specific instance of a tile. This is ideal for our purposes.

@ted537
Copy link
Collaborator

ted537 commented Oct 4, 2021

Perhaps each tile in a Tiled map could have a "cx" property which contains the name of the CX-game tile to insert.

@ted537
Copy link
Collaborator

ted537 commented Oct 4, 2021

Of the two libraries listed by Tiled, go-tiled appears to be more mature / fully featured.

@ted537
Copy link
Collaborator

ted537 commented Oct 4, 2021

Note that go-tiled does not currently support infinite maps.

@ted537
Copy link
Collaborator

ted537 commented Oct 17, 2021

progress

image

@ted537
Copy link
Collaborator

ted537 commented Oct 17, 2021

image

Further progress. Still buggy but sprites for tiles are now being detected automatically

@ted537
Copy link
Collaborator

ted537 commented Oct 18, 2021

image

still need to get walls working

cx-game (Project) automation moved this from To do to Done Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code for programmers
Projects
Development

Successfully merging a pull request may close this issue.

2 participants