Lavalamp Posted September 23, 2018 Share Posted September 23, 2018 (edited) Hi Peeps, having issues with getting tiling to work, the below results in a black screen...what have i missed? The Map has tiles set to emended and is XML, 8x16, and 20 x 12 in size. Thanks guys. set doublewide on set basepath gfx_morph set romsize 48k set tv pal displaymode 160A rem Color Palettes P0C1=$02: P0C2=$06: P0C3=$0F : rem grey, light grey & white rem Graphics Import incgraphic tileset_level_1.png incmapfile level_1.tmx main_init clearscreen plotmap level_1 0 0 0 20 12 savescreen drawscreen main_loop BACKGRND=$00 restorescreen drawscreen goto main_loop Edited September 23, 2018 by Lavalamp Quote Link to comment Share on other sites More sharing options...
+SmittyB Posted September 23, 2018 Share Posted September 23, 2018 It took me a lot of staring but I think I know the issue. You need to call 'characterset tileset_level_1' so that when the screen is drawn it's loading the graphics from the right place. At the moment it's probably picking an arbitrary point in ROM that happens to be empty. 1 Quote Link to comment Share on other sites More sharing options...
RevEng Posted September 23, 2018 Share Posted September 23, 2018 [edit] I believe SmittyB has it. Quote Link to comment Share on other sites More sharing options...
Lavalamp Posted September 23, 2018 Author Share Posted September 23, 2018 Awesome thanks guys. Also can I expect a huge performance drop when using a tiled background? I only mention this because I had the global frame counter drop from 60 to 10 to get the speed up again :/ might be my code though. Quote Link to comment Share on other sites More sharing options...
+SmittyB Posted September 24, 2018 Share Posted September 24, 2018 If you're just using plotmap then unless you're redrawing the display over and over it shouldn't have much of a noticeable difference. If you're using plotmapfile then that's another story, because plotmapfile allows drawing tiles with different pallettes it has to manage a new object for each pallette change. It's hard to say what the problem is without looking at the rest of the code but it shouldn't just be because you're using a tilemap. Quote Link to comment Share on other sites More sharing options...
Lavalamp Posted September 24, 2018 Author Share Posted September 24, 2018 If you're just using plotmap then unless you're redrawing the display over and over it shouldn't have much of a noticeable difference. If you're using plotmapfile then that's another story, because plotmapfile allows drawing tiles with different pallettes it has to manage a new object for each pallette change. It's hard to say what the problem is without looking at the rest of the code but it shouldn't just be because you're using a tilemap. Thanks that's what I conlcuded, but its performing badly with the tile code removed so something I have introduced has done something. But its pretty clean early code so dunno. I got the map to appear so CHARACTERSET was the missing piece thanks! I didn't know that PLOTMAPFILES allowed the multi pallette support, nice! Quote Link to comment Share on other sites More sharing options...
Lavalamp Posted September 24, 2018 Author Share Posted September 24, 2018 If you're just using plotmap then unless you're redrawing the display over and over it shouldn't have much of a noticeable difference. If you're using plotmapfile then that's another story, because plotmapfile allows drawing tiles with different pallettes it has to manage a new object for each pallette change. It's hard to say what the problem is without looking at the rest of the code but it shouldn't just be because you're using a tilemap. The DRAWSCREEN command below was the culprate, I thought this needed to be called after plotting sprites? main_loop BACKGRND=$00 restorescreen globalFrameCount = globalFrameCount + 1 if globalFrameCount = 30 then globalFrameCount = 0 if globalFrameCount = 15 then gosub moveplayer gosub drawplayer rem drawscreen goto main_loop Quote Link to comment Share on other sites More sharing options...
+SmittyB Posted September 24, 2018 Share Posted September 24, 2018 (edited) You are correct in thinking that drawscreen should be called after you've finished plotting everything for the frame. It does a bit of setup and waits until the screen finishes drawing which is where your delay might be. I think what might be actually happening is that the rest of your code takes slightly too long so that the 7800 is already drawing the next frame before drawscreen is called, so drawscreen would have to wait for the screen to finish, wait for vblank to finish, and then continue at the start of the NEXT frame. A strategy to make the most of the time you have on each frame is to have all of your logic at the start of your loop, then restore the screen, then do all your plotting, then drawscreen. What you don't want to do is have anything graphics related near the start because 7800BASIC will wait for the screen to finish drawing before making changes to prevent the display being scrambled while it's being drawn, meaning all your code has to finish within the small amount of time that vblank takes. For example, if your drawplayer routine does anything not directly related to drawing then that code can be run earlier in the loop during the visible screen time leaving just the plotting to be done between frames. Edited September 24, 2018 by SmittyB 2 Quote Link to comment Share on other sites More sharing options...
Lavalamp Posted September 25, 2018 Author Share Posted September 25, 2018 You are correct in thinking that drawscreen should be called after you've finished plotting everything for the frame. It does a bit of setup and waits until the screen finishes drawing which is where your delay might be. I think what might be actually happening is that the rest of your code takes slightly too long so that the 7800 is already drawing the next frame before drawscreen is called, so drawscreen would have to wait for the screen to finish, wait for vblank to finish, and then continue at the start of the NEXT frame. A strategy to make the most of the time you have on each frame is to have all of your logic at the start of your loop, then restore the screen, then do all your plotting, then drawscreen. What you don't want to do is have anything graphics related near the start because 7800BASIC will wait for the screen to finish drawing before making changes to prevent the display being scrambled while it's being drawn, meaning all your code has to finish within the small amount of time that vblank takes. For example, if your drawplayer routine does anything not directly related to drawing then that code can be run earlier in the loop during the visible screen time leaving just the plotting to be done between frames. Thanks I will re-engineer the code based on your recommendations, makes sense. I'll introduce you guys to my game Morph once I have the basics controls and collision detection working. Thinking about it I think my STOS Game Makers manual has a good example of this. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.