Jump to content
IGNORED

Help using tilemaps


BydoEmpire

Recommended Posts

Hi all. @aaron1677 and I are trying to get something working using mapfiles generated with Tiled in a banked 7800basic game.

 

First, the sample tileset is in xml format (attached). I'm not sure what it's looking for.

 

odyssey_tree_test.tmx

 

code is:


    incgraphic gfx/tilesets/tileset_trees.png 160A 0 1 2 3
    incmapfile gfx/tmx/odyssey_tree_test.tmx

Error is:

image.thumb.png.6d40409438779f9717716f855139ae7a.png

 

I must be doing something silly.

 

Second, the tmx file is referencing individual "tree" tiles. Can I assume naming limitations exist (no spaces, special characters) and is it recommended to have each tile be its own png, or can we make one big tileset containing them all, the way we'd do with alphadata?

Link to comment
Share on other sites

The png files you use in Tiled need to be the same png files (with the same names) that you're using in 7800basic. It doesn't really matter if you use a bunch of png files, or one big one, but you just have to use the same files for tiled and 7800basic. And yes, no spaces in the filenames -  you need to name them with the same naming restrictions you would follow if you were dim'ing a variable.

  • Like 2
Link to comment
Share on other sites

Couple of extra things I'd suggest to also check :

 

Check you have XML set correctly in the map properties on Tiled. It should look something like this

image.png.2bb75c507e51963fd0ab3b871155a30c.png

 

Where you load the .png file in 7800Basic to use with a tilemap from Tiled, you also need to define the palette number to be used for the png.

 

e.g. : incgraphic gfx/tilesets/tileset_trees.png 160A 0 1 2 3 number

 

Where "number" is the palette you will use for that .png

  • Like 3
Link to comment
Share on other sites

@aaron1677 - with the latest version I'm getting the same error.  Is there anything Muddyfunster posted above that might help?  The tmx file you most recently sent sure looks right to me, it's certainly an XML file. I tried with 7800basic-0.19 just to see if it's something broken in whatever older version I happened to still be using, but I get the same error either way.

Link to comment
Share on other sites

16 hours ago, BydoEmpire said:

@aaron1677 - with the latest version I'm getting the same error.  Is there anything Muddyfunster posted above that might help?  The tmx file you most recently sent sure looks right to me, it's certainly an XML file. I tried with 7800basic-0.19 just to see if it's something broken in whatever older version I happened to still be using, but I get the same error either way.

 

Ah...this may be the culprit. The default was set to "CSV" and not "XML". These were my previous settings:

 

old.png.2dac76618af5d92e4935f4a57c17efc5.png

 

 

I've now updated them to this:

 

new.png.dfe76d27320b609bdf2910b2af3147ac.png

 

 

@BydoEmpire I'll send you the updated .tmx and .png files in our other thread. Hopefully this solves it!

 

Thanks to @RevEng and @Muddyfunster

 

Forest_Map_20x14_R2_xml.tmx

  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...

Two steps forward, one step back. I got a tilemap loaded (above) and sort of running with the XML(deprecated) format so that's good.  Aaron gave me 3 more screens, two of them build fine. The 3rd one gives me this error but I don't see anything particularly wrong with the file.

image.png.215dc2af2be253a3ee7980a735687995.png

 

Here's the asm:

.L0427 ;;  plotmapfile gfx/tmx/forest_20x14_screen1.tmx currentmapdata 0 0 20 14
 
 lda #(<plotmapfiledata19)
 sta temp8
 lda #(>plotmapfiledata19)
 sta temp9
 jsr plotcharloop
 jmp skipplotmapfiledata19
plotmapfiledata19
 .byte <(currentmapdata+0), >(currentmapdata+0), $2c, 0, 0
 .byte <(currentmapdata+20), >(currentmapdata+20), $2c, 0, 1
 .byte <(currentmapdata+40), >(currentmapdata+40), $2c, 0, 2
 .byte <(currentmapdata+60), >(currentmapdata+60), $2c, 0, 3
 .byte <(currentmapdata+80), >(currentmapdata+80), $2c, 0, 4
 .byte <(currentmapdata+100), >(currentmapdata+100), $2c, 0, 5
 .byte <(currentmapdata+120), >(currentmapdata+120), $2c, 0, 6
 .byte <(currentmapdata+140), >(currentmapdata+140), $2c, 0, 7
 .byte <(currentmapdata+160), >(currentmapdata+160), $2e, 0, 8
 .byte <(currentmapdata+178), >(currentmapdata+178), $1e, 288, 8 <-- this line
 .byte <(currentmapdata+180), >(currentmapdata+180), $0c, 0, 9
 .byte <(currentmapdata+200), >(currentmapdata+200), $0c, 0, 10
 .byte <(currentmapdata+220), >(currentmapdata+220), $0c, 0, 11
 .byte <(currentmapdata+240), >(currentmapdata+240), $0c, 0, 12
 .byte <(currentmapdata+260), >(currentmapdata+260), $0c, 0, 13
 .byte 0,0
skipplotmapfiledata19

 

I don't know what each parameter in that line represents, nor why one row would have an out of bounds value.  Here's the file in question.  There's nothing unique about the 10th row versus other rows in the tilemap as far as I can tell.

forest_20x14_screen1.tmx

 

FWIW, here's one that does not give me the same problem. Same tileset.

forest_20x14_screen2.tmx

Edited by BydoEmpire
Link to comment
Share on other sites

For the one that does run (screen2) I'm not sure exactly why it displays a whole screen of tile 0 (the tree).  Any thoughts on that?  I'm wondering if it's something with the data, or something else I'm doing in code.

 

Tilemap in Tiled:

tiled_screen2_intool.PNG.35143f67942473e71ee46cedec377932.PNG

Screenshot using

   plotmapfile gfx/tmx/forest_20x14_screen2.tmx currentmapdata 0 0 20 14

 

Looks like this (nevermind the one empty tile in the center column, I manually plot that)

tiled_screen2.thumb.PNG.499000f69d5851fc7401a21909f79a15.PNG
 

Link to comment
Share on other sites

I don't use plotmapfile much so I don't have any definite answers, but I did notice a couple of things. Firstly in your maps you have tiles that aren't explicitly defined so that they're listed as '<tile/>' rather than for example '<tile gid="1"/>' and presumably 7800basic interprets these as zeroes but it may be best to specify. Secondly, in your plotmapfile call you're telling it to read the tile data from 'currentmapdata' instead of 'forest_20x14_screen2' so unless you're copying the tile map across at some point I believe it'll use whatever tiles are set at currentmapdata while splitting the objects and palettes based on the contents of the TMX file.

  • Like 2
Link to comment
Share on other sites

18 hours ago, RevEng said:

Have you actually drawn graphically blank tiles in tiled, rather than leaving the tiles unused?

They were unused, and that was most of the problem - both with the one value being 288 and the screens not displaying properly.  I replaced the empty tiles with a 'solid color' tile and it mostly worked, except:

 

18 hours ago, SmittyB said:

in your plotmapfile call you're telling it to read the tile data from 'currentmapdata' instead of 'forest_20x14_screen2' so unless you're copying the tile map across at some point I believe it'll use whatever tiles are set at currentmapdata while splitting the objects and palettes based on the contents of the TMX file.

This was the other part. I was still using plotmap to plot currentmapdata afterwards. When I just did this:

    plotmapfile gfx/tmx/forest_20x14_screen5.tmx forest_20x14_screen5 0 0 20 14

it showed up correctly!

 

Thanks for your help, getting these things to finally work is so rewarding!

-Bydo

Edited by BydoEmpire
  • Like 4
Link to comment
Share on other sites

Can you share a tileset across multiple maps? For instance, if we had a tileset for the status bar, or common trees or something, could we share that across a screen (tilemap) that also has its own unique tiles? Or does each screen/tilemap need its own independent tileset.

Link to comment
Share on other sites

21 minutes ago, BydoEmpire said:

Can you share a tileset across multiple maps? For instance, if we had a tileset for the status bar, or common trees or something, could we share that across a screen (tilemap) that also has its own unique tiles? Or does each screen/tilemap need its own independent tileset.

Yes is the short answer I think.

 

With E.X.O, each world/level had a bunch of maps all using common tilesets (usually 20 screens for each world). Not all maps used all tiles.

 

For example, I would usually have a background tileset, foreground tileset (sometimes 2 or 3), font/UI tiles, detail or greeble tiles. These were shared across all maps in that particular world, all the reused assets like ship, explosions etc, went in the last bank. E.X.O. World 1, 2 & 4 had 6 shared tilesets, World 5 had 8.

 

I'm working on a new project where for a given screen, I have the common tiles shared by all screens in the level, then a couple of screens also have an extra tileset present, but only on those couple of screens. 

 

 

 

 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

41 minutes ago, Muddyfunster said:

Yes is the short answer I think.

 

With E.X.O, each world/level had a bunch of maps all using common tilesets (usually 20 screens for each world). Not all maps used all tiles.

 

For example, I would usually have a background tileset, foreground tileset (sometimes 2 or 3), font/UI tiles, detail or greeble tiles. These were shared across all maps in that particular world, all the reused assets like ship, explosions etc, went in the last bank. E.X.O. World 1, 2 & 4 had 6 shared tilesets, World 5 had 8.

 

I'm working on a new project where for a given screen, I have the common tiles shared by all screens in the level, then a couple of screens also have an extra tileset present, but only on those couple of screens. 

 

@aaron1677 - we should try having a tileset for common tiles like the status bar, "walkable" tiles, etc. and see if we can share that across different screens. It'd also let us use a different palette for the status bar which would be huge.

  • Like 2
Link to comment
Share on other sites

On 4/17/2022 at 6:28 PM, BydoEmpire said:

@aaron1677 - we should try having a tileset for common tiles like the status bar, "walkable" tiles, etc. and see if we can share that across different screens. It'd also let us use a different palette for the status bar which would be huge.


Good idea. Question about the top status bar that is shared throughout the entire game - can that be on black? Is it possible for that background (the top 3x20 tile area) to be black, while the actual game background is a different color? 

I'm creating it with a unique palette, so just thought to ask. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...