BydoEmpire Posted March 18, 2021 Share Posted March 18, 2021 (edited) I'm using sprites to show the map screen in Wizard's Dungeon. In js7800 and MAME there's no issue, but in Bupsystem and likely real hardware ( @-^CrossBow^- has tested) we see an issue w/ sprites getting chopped off (see attached picture). It seems more like the rightmost column sprites are usually chopped off, whether I have 10 rooms shown or 30 or 64. It's an 8x8 grid of 8x8 sprites - so 64 total sprites and none should overlap with each other. There are no other sprites on the screen. I'm guessing i'm just trying to draw too much at once, but I'm wondering what options I have. The general idea is 1. draw the background tiles 2. gosub draw_map (which loops through and draws the actual map tile sprites) 3. savescreen 4. drawscreen 5. loop until unpause to go back to the game GameStage_Map /****************************************************/ rem ** copy empty tile here clearscreen memcpy currentmapdata screenmap_pause 280 plotmap currentmapdata 1 0 0 20 12 if (extra_item_bits&ITEM_BIT_MAP)<>0 then pokechar currentmapdata 1 3 20 12 TILE_MAP if (extra_item_bits&ITEM_BIT_KEY)<>0 then pokechar currentmapdata 1 4 20 12 TILE_KEY if (extra_item_bits&ITEM_BIT_RING)<>0 then pokechar currentmapdata 1 5 20 12 TILE_RING if (extra_item_bits&ITEM_BIT_HAT)<>0 then pokechar currentmapdata 1 6 20 12 TILE_HAT if (extra_item_bits&ITEM_BIT_STAFF)<>0 then pokechar currentmapdata 1 7 20 12 TILE_STAFF if (extra_item_bits&ITEM_BIT_CLOAK)<>0 then pokechar currentmapdata 1 8 20 12 TILE_CLOAK if (weapon_available&2)<>0 then pokechar currentmapdata 18 4 20 12 TILE_BOW if (weapon_available&4)<>0 then pokechar currentmapdata 18 5 20 12 TILE_SWORD if (weapon_available&8)<>0 then pokechar currentmapdata 18 6 20 12 TILE_SCROLL rem ** if we're pausing in a room with active gates, keep them on unpause if (room_status_bits&ROOM_BIT_HAS_GATES) then room_status_bits = room_status_bits | ROOM_BIT_PAUSE_DURING_GATES map_initialdraw gosub draw_map rem ** draw dungeon level on map screen temp1=dungeon_level+1 debugroomcode=converttobcd(temp1) plotvalue scoredigits_8_wide_centered 2 debugroomcode 2 76 0 savescreen drawscreen pause_debounce=PAUSE_DEBOUNCE playsfx sfx_gotomap map_waittounpause restorescreen gosub draw_status drawscreen if pause_debounce>0 then pause_debounce=pause_debounce-1 : goto map_waittounpause if switchpause then goto map_unpause goto map_waittounpause map_unpause pause_debounce=PAUSE_DEBOUNCE ;'don't let player immediately jump back to map accidentally clearscreen gosub update_to_new_room savescreen playsfx sfx_gotomap goto mainloop_returnfrompause draw_map for temploop=0 to 63 rem ** if we don't have a map AND it hasn't been visited, don't draw this room ;'if (extra_item_bits&ITEM_BIT_MAP)=0 && (generated_level[temploop]&$80)=$80 then goto draw_map_next ;' don't show unvisited rooms z = generated_level[temploop] & $f ; ' room walls x = temploop & $7 y = temploop/8 tempx = x*12 : tempx = tempx+36 tempy = y*16 : tempy = tempy+42 rem ** maybe use a different palette for gravestones or other special items x=0 ;' flag for "have we plotted" rem ** show gravestone rooms only if we have the map, otherwise get out if temploop=current_room_number then x=1 : plotsprite maptile00 2 tempx tempy z if x=0 && room_item_list[temploop]=TILE_GRAVESTONE then x=1 : plotsprite maptile00 PAL_MAP tempx tempy z if x=0 && room_item_list[temploop]=TILE_STAIRS then x=1 : plotsprite maptile00 5 tempx tempy z ; staff will show any non-coin/gold item rooms t2=0 ;' 1 if it's a treasure we don't want to highlight the location of if room_item_list[temploop]=TILE_GOLD || room_item_list[temploop]=TILE_COINS then t2=1 if room_item_list[temploop]=TILE_CHEST_OPEN || room_item_list[temploop]=TILE_CHEST_CLOSED then t2=1 if room_item_list[temploop]=TILE_GEM || room_item_list[temploop]=TILE_NECKLACE then t2=1 if room_item_list[temploop]<>255 && t2=0 then t1=1 else t1=0 ;' t1 is that's a special item we want to highlight if x=0 && t1=1 && (extra_item_bits&ITEM_BIT_STAFF)<>0 then x=1 : plotsprite maptile00 5 tempx tempy z ;'if (generated_level[temploop]&$80)=$80 then goto draw_map_next ;' don't show unvisited rooms ;'x=0 means we have not yet drawn this room if x=0 then x=1 : plotsprite maptile00 3 tempx tempy z draw_map_next next return Note I've commented out two lines to force drawing all the sprites every time to debug the worst case. Bonus, for those that care to look at the source, you can see which magic item shows special rooms on the map Edited March 18, 2021 by BydoEmpire Quote Link to comment Share on other sites More sharing options...
+-^CrossBow^- Posted March 18, 2021 Share Posted March 18, 2021 I also get this map room issue on A7800 as well. So Bubsystem, A7800 and my actual 7800 will do this. But on my 7800 it looks a little different. I'm going to finally load up the latest BIN you sent me and capture my gameplay to show this. Unless it is my luck that it decides to work now all of a sudden! LOL! 2 Quote Link to comment Share on other sites More sharing options...
BydoEmpire Posted March 18, 2021 Author Share Posted March 18, 2021 (edited) 11 minutes ago, -^CrossBow^- said: I also get this map room issue on A7800 as well. So Bubsystem, A7800 and my actual 7800 will do this. But on my 7800 it looks a little different. I'm going to finally load up the latest BIN you sent me and capture my gameplay to show this. Unless it is my luck that it decides to work now all of a sudden! LOL! I realized I was using 8x16 sprites for each room for no reason. I cut them down to 8x8 - the actual size of the image - and I was hopeful but it didn't change anything. Good to save the space, though, every byte counts at this point. All the versions posted on the official thread draw every sprite every frame, instead of drawing once and then using savescreen, which is the change I sent to you. That didn't fix it either. Edited March 18, 2021 by BydoEmpire Quote Link to comment Share on other sites More sharing options...
+-^CrossBow^- Posted March 18, 2021 Share Posted March 18, 2021 I will just use the BIN you listed here to fix the weapon reset issue and see what I get on my actual 7800. I do recall that on the 7800 it wasn't showing the complete graphic, but it was more than just a straight broken line for each room. More like a letter C look or something. Quote Link to comment Share on other sites More sharing options...
+Muddyfunster Posted March 18, 2021 Share Posted March 18, 2021 I'd guess that your hunch is right and you might be running out of plot time or DL memory. If I'm using RAM I give the DL some extra RAM so that I can plot more stuff. You will always run into a brick wall eventually though as you will run out of cycles no matter how much DL memory you allocate. I think you are using a flat 48k scheme ? do you have anything at $2200 (internal RAM) ? you could try : set extradlmemory on To expand your display list & see if the extra DL memory helps. linky What is your zone size? I had a similar issue on one of my experiments when using sprites instead of baking the tiles in with a save screen. My sprites that I was gridding out were not on the vertical zone boundary so each sprite was overlapping 2 zones meaning more work and not enough time / DL memory (I forget which). I aligned them vertically to work with the zone and the issue went away. Hope that helps. 1 Quote Link to comment Share on other sites More sharing options...
+Karl G Posted March 18, 2021 Share Posted March 18, 2021 The fact that it's the rightmost sprite makes it seem like it's DMA cycles. You could test by not plotting your background and see if the issue is still present. 2 1 Quote Link to comment Share on other sites More sharing options...
BydoEmpire Posted March 18, 2021 Author Share Posted March 18, 2021 Thanks @Muddyfunster - I haven't set zoneheight so I'm assuming it's defaulting to 16. I do have a lot of 8x16 sprites in the game, though not on the map screen. Maybe that can be changed on the fly? Setting zoneprotection on/off doesn't seem to fix anything. I do have lots of data between $2200 and $2642. 1 Quote Link to comment Share on other sites More sharing options...
BydoEmpire Posted March 18, 2021 Author Share Posted March 18, 2021 4 minutes ago, Karl G said: The fact that it's the rightmost sprite makes it seem like it's DMA cycles. You could test by not plotting your background and see if the issue is still present. Yep, if I don't plot the background all the sprites are fine. 1 Quote Link to comment Share on other sites More sharing options...
+-^CrossBow^- Posted March 18, 2021 Share Posted March 18, 2021 6 minutes ago, BydoEmpire said: Yep, if I don't plot the background all the sprites are fine. So no need for me to test with the current released BIN in the original development thread? Quote Link to comment Share on other sites More sharing options...
BydoEmpire Posted March 18, 2021 Author Share Posted March 18, 2021 Just now, -^CrossBow^- said: So no need for me to test with the current released BIN in the original development thread? No, thanks @-^CrossBow^- - I'm sure this is problem w/ the released bin. Looking at options. I really want to show both the map and your items, but maybe there are better ways to do it via pages or something if I can't resolve the display issue. I have a few other things to investigate first. At least now I can repro via BupSystem. if I get something working there I'll post a bin and that's probably worth testing further. Quote Link to comment Share on other sites More sharing options...
+Pat Brady Posted March 18, 2021 Share Posted March 18, 2021 In the zones where the actual map is (i.e. not the top and bottom), are you drawing the background as one large character map that goes all the way across the screen and is blank in the middle, or as two smaller character maps for the left and the right? By my calculation, the latter will save 98 MARIA cycles per line with 2-byte characters (even more with 1-byte characters). 2 1 Quote Link to comment Share on other sites More sharing options...
BydoEmpire Posted March 18, 2021 Author Share Posted March 18, 2021 8 hours ago, Pat Brady said: In the zones where the actual map is (i.e. not the top and bottom), are you drawing the background as one large character map that goes all the way across the screen and is blank in the middle, or as two smaller character maps for the left and the right? By my calculation, the latter will save 98 MARIA cycles per line with 2-byte characters (even more with 1-byte characters). It's one big character map. I'll try splitting it up. I could even eschew the sides of map background entirely if needed. Thanks for the suggestion! Quote Link to comment Share on other sites More sharing options...
BydoEmpire Posted March 18, 2021 Author Share Posted March 18, 2021 9 hours ago, Pat Brady said: In the zones where the actual map is (i.e. not the top and bottom), are you drawing the background as one large character map that goes all the way across the screen and is blank in the middle, or as two smaller character maps for the left and the right? By my calculation, the latter will save 98 MARIA cycles per line with 2-byte characters (even more with 1-byte characters). That did it (at least in BupSystem, where it was 100% before)! Thanks @Pat Brady - this saved me so much time and avoided a much more complicated or less-appealing-for-the-user workaround. 2 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.