Jump to content

Photo

Can we have tiles of different height?


12 replies to this topic

#1 asdronin OFFLINE  

asdronin

    Space Invader

  • 26 posts

Posted Mon May 13, 2019 12:52 AM

Hi all,

Im stil in the process of feeling confortable enough to start making the actual code and graphics for my first game for the 7800, but I found another doubt regarding the plotmap tiles, I notice that yes we can specify normal or double wide for the tiles either for one particular set or for all of them, but I dont see anywhere if we can define different height for these, I mean maybe someone could be interested in using 8x8 tiles and later use plotmap the usual way, of course that would lead to have more tiles on screen but just would be better for some details maybe (unless it has a very important performance hit), so is it possible to have our tiles like 8x8? thanks a lot beforehand and really Im really sorry I find so many doubts in my path of learning

 

PS I forgot to mention that I tried of course to use a image with the tiles that was 64x8 and indeed its plotted on screen fine but the trouble is it separates lines too much so map is crossed by some stripes made of background color so I assumed that its either change somewhere the font size (height actually) or just its not possible

 

Edit: I know we can use zone height but I dont want to limit the height of other images as I think it does


Edited by asdronin, Mon May 13, 2019 12:59 AM.


#2 SmittyB OFFLINE  

SmittyB

    Moonsweeper

  • 373 posts

Posted Mon May 13, 2019 1:26 AM

Everything the 7800 draws is exactly one zone high even if it doesn't look like it. When you're drawing your 8 pixel high tiles it's still drawing them as high as the zone.

The 7800 does allow for zones of different heights, and this is actually how vertical scrolling is achieved, but 7800BASIC doesn't give you control over the display-list list which sets it.

#3 asdronin OFFLINE  

asdronin

    Space Invader

  • Topic Starter
  • 26 posts

Posted Mon May 13, 2019 10:04 AM

Thanks a lot SmittyB for the explanation, its quite clarifying then we have to stick with one zone height in everything from tiles to sprites etc well one could find workarounds for this like I have seen in some source codes making the zone height 8 and then using 2 sprites one on top of the other to make sprites of 16 pixels height, more work maybe but depends on the cases I guess



#4 SmittyB OFFLINE  

SmittyB

    Moonsweeper

  • 373 posts

Posted Mon May 13, 2019 10:33 AM

As you move sprites vertically across the screen that's sort of what already happens in a way. The zones themselves cannot move and all graphics are aligned with the zone, so when a sprite moves across a zone what you're actually seeing is multiple objects, just where they get the graphics from is offset.

#5 asdronin OFFLINE  

asdronin

    Space Invader

  • Topic Starter
  • 26 posts

Posted Mon May 13, 2019 3:44 PM

I see, thanks for the explanation =), I remember I saw something about the zones somewhere, and I went now to the manual and with your explanation I understand everything, but then I wonder is it correct to make vertical scrolling just by applying y-offset when plotting the map? I notice that this way it jumps one line of course as we specify the offset like that not coordinates, but we cant get a smaller offset in plotmap, right? I mention this because you said the way to make vertical scrolling is related to that feature of using different heights, well I dont fully understand how it could be achieved, I know its off-limit for me using the 7800Basic but just wonder about the theory behind what you said, Im sure you know how is everything done so Im not having doubts about your knowledge, dont take me wrong, just want to do things right.



#6 SmittyB OFFLINE  

SmittyB

    Moonsweeper

  • 373 posts

Posted Tue May 14, 2019 12:41 AM

Not a problem, before a couple of years ago I was clueless on this subject.

When I said the zones can't move I should have said the zones will always start immediately after the previous zone. By shrinking the uppermost zone the others will move up to fill the gap. By shrinking the uppermost zone and expanding the lowermost you can shift everything up enough that on the next frame you put everything back and then change which tiles are drawn in the manner you're doing now. Shrinking the lowermost zone etc will let you scroll down.

#7 asdronin OFFLINE  

asdronin

    Space Invader

  • Topic Starter
  • 26 posts

Posted Tue May 14, 2019 1:07 AM

Thanks for explaining yes it makes a lot more sense now, I had no idea it could work that way, but in relation to how it looks like, Im using the y-offset in plotmap you know, but this value seems to always be a integer value, I mean Im using a variable for that of course, but if I declare it as floating point and increment 0.1 it still will make the map jump one line always the same as if I increment it by just 1, according to what you explained the scrolling technique should be able to show intermediate positions to make it not like a jump I mean smoother, or am I missing something in relation to how the plotmap should be used to scroll the background? as said right now the tiles move just one line shift each step, not bad but dont know if this could look better so I hope you can shed some light into this doubt



#8 Mord OFFLINE  

Mord

    River Patroller

  • 2,697 posts
  • Location:Canada

Posted Tue May 14, 2019 2:47 AM

When you're using plotmap, you're plotting things with the indirect method for drawing sprites. That method doesn't have the ability to offset it's graphics off of a zone the same way a direct plotting like with plotsprite does.  As a result you'll see the graphics jump a full zone up or down when you inc/dec the starting Y position.  This is why you have to play tricks with changing the size of the top and bottom zones to make it look like everything's scrolling smoothly.

 

Normally changing the Display List List isn't possible with 7800Basic although if you know what you're doing and where the display list list is stored in memory, you can use assembly to edit them.  I did that in at least one of the rpgtile demos. Not easy to accomplish and it required making some edits to 7800Basic's interrupt - which I didn't do a great job with so wasn't able to get a perfect pixel scroll. 

 

Likewise if you plan things properly and know how the display lists are stored you can edit the lists directly to get faster results.  For example, when you see the walls moving in Graze Suit Alpha, that's done by me knowing where the sprites for the walls are in the display lists and editing their X-coordinate entries.  A lot faster than re-plotting them every time I move them.  Assuming I ever get back to the game I'll be able to update the walls with animations in a similar way.



#9 asdronin OFFLINE  

asdronin

    Space Invader

  • Topic Starter
  • 26 posts

Posted Tue May 14, 2019 5:21 PM

I see, thanks a lot for the explanation Mord, I had no idea it was like this, so with just 7800Basic we can make the tiles jump one zone each step, my assembly knowledge is really low and its a pitty but I have no plans to learn more assembly right now. then Im ok with the one zone jump I guess, by the way you did a great job in the Rpg tile demo and the Graze Suit Alpha sure looks nice in that movement you implemented.

 

Then as I can somehow see, it could be better to use a zone height of 8 (smaller jumps) but then this way we are limited to use sprites of 8 pixels height, right?



#10 SmittyB OFFLINE  

SmittyB

    Moonsweeper

  • 373 posts

Posted Wed May 15, 2019 1:12 AM

As 7800BASIC compiles to assembly which is then assembled into the final ROM you can write something in 7800BASIC and then see what the assembly equivalent is.


If you use banners rather then sprites you can have things taller than one zone. As far as the 7800 is concerned they're the same thing but 7800BASIC makes a distinction between the two because they can be optimised in different ways, for example a sprite will only ever cover 1 or 2 zones and where the graphics are loaded from doesn't have to be changed while setting up the display list.

#11 asdronin OFFLINE  

asdronin

    Space Invader

  • Topic Starter
  • 26 posts

Posted Wed May 15, 2019 10:21 PM

I see, I had no idea assembly code was generated, well I heard something but as my assembly knowledge is really low I tend to ommit all that. Good to know for the moment I find myselft with enough time to deal with assembly =).

 

And I had no idea a banner could be used as a sprite, I mean as you said the 7800Basic makes a clear distinction and I have always seen banners in programs being used for title screen mainly. So according to what you say its ok to make a 16 pixels tall banner and use it in a zone height set to 8 for smaller tiles and there shouldnt be any trouble in terms or performance which is something Im always worried while coding in the 7800Basic



#12 SmittyB OFFLINE  

SmittyB

    Moonsweeper

  • 373 posts

Posted Thu May 16, 2019 12:41 AM

If you're already drawing multiple sprites to create a large object then a banner would be a more efficient way of drawing as it would cut out some of the overhead, otherwise banners would have an impact on performance just because there's more to calculate and draw.

Don't worry about performance too much, if things start to slow down there's usually something you can tweak in your code to speed it up again providing you're not trying to draw tens of objects to the screen.

#13 asdronin OFFLINE  

asdronin

    Space Invader

  • Topic Starter
  • 26 posts

Posted Thu May 16, 2019 11:09 PM

I see, thanks a lot for the explanation, I see that somehow its try and see rather than worry about the possible performance issues. Well I would like to make first a shmup and for that I tend to like those bullet hell type but of course I know the limit here is in the number of bullets I will be able to display added to ships etc so as you said I will try my way and hopefully I will find a way to make it work fast enough =).






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users