OType

Want to talks about games you like, would like to see developed on the Oric, it's here.
User avatar
Algarbi
Pilot Officer
Posts: 122
Joined: Thu Mar 19, 2009 10:47 pm

Re: OType

Post by Algarbi » Tue Jun 26, 2018 10:33 pm

So awesome...

Twilighte we miss you. :(

User avatar
8bit-Dude
Pilot Officer
Posts: 74
Joined: Tue Mar 14, 2017 1:33 pm
Location: Japan

Re: OType

Post by 8bit-Dude » Fri Apr 19, 2019 12:39 am

I have just seen the video and am blown away by the sprite animation Twilighte achieved.
Was the code for the OType gfx made available? Or do any other Twilighte game contains the same technique and has code availability?

User avatar
ibisum
Wing Commander
Posts: 1093
Joined: Fri Apr 03, 2009 8:56 am

Re: OType

Post by ibisum » Fri Apr 19, 2019 2:58 pm

I believe the O-type project started off as SWIV, and when Twilighte renamed it, he nevertheless didn't change his repo .. so the code is in the miniserve SVN, under "/users/twilighte/Swiv" ..

User avatar
NekoNoNiaow
Flight Lieutenant
Posts: 272
Joined: Sun Jan 15, 2006 10:08 pm
Location: Montreal, Canadia

Re: OType

Post by NekoNoNiaow » Sat Apr 20, 2019 3:25 am

Dbug wrote:
Mon May 28, 2018 5:46 pm
For the details, Chema is correct: It is AIC; so the scroll vertically need to be in multiple of two steps, sprites move by 6 pixel laterally, there's no attribute conflicts because it's AIC so all the attributes are on the left side of the play field.
Oki, so the scroll step is two lines because AIC uses one paper/color combination for the even lines and another for the odd ones.
This said, if one is willing to also copy the color attributes at the left side of the play field, then it becomes possible to only scroll by one line.

The inconvenient is obviously that the top line of the screen may stick out like a sore thumb since it will initially appear alone, without being complemented by its "parent" line (which has not yet scrolled into the screen). But I presume it should be relatively simple to alter this first line to use slightly muted colors to simulate a "fade in".

User avatar
Dbug
Site Admin
Posts: 2930
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: OType

Post by Dbug » Sat Apr 20, 2019 8:23 am

NekoNoNiaow wrote:
Sat Apr 20, 2019 3:25 am
Oki, so the scroll step is two lines because AIC uses one paper/color combination for the even lines and another for the odd ones.
This said, if one is willing to also copy the color attributes at the left side of the play field, then it becomes possible to only scroll by one line.
The problem is that the scroll is far from 50fps, so there's a large probability that copying the line and attribute will not happen atomically, so you can get bright flashes caused by having some of the graphics displayed with the wrong set of colors.

User avatar
NekoNoNiaow
Flight Lieutenant
Posts: 272
Joined: Sun Jan 15, 2006 10:08 pm
Location: Montreal, Canadia

Re: OType

Post by NekoNoNiaow » Sat Apr 20, 2019 5:25 pm

Dbug wrote:
Sat Apr 20, 2019 8:23 am
The problem is that the scroll is far from 50fps, so there's a large probability that copying the line and attribute will not happen atomically, so you can get bright flashes caused by having some of the graphics displayed with the wrong set of colors.
Damn, you are right, I completely forgot about the absence of vsync.

User avatar
Chema
Game master
Posts: 2447
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: OType

Post by Chema » Sat Apr 20, 2019 9:40 pm

Scrolling the attributes will alter the colours of the ships when they are at a fixed location.

About the syncing it is possible to do it, but what Dbug says is that it takes longer than the blank period to update the scroll. Probably longer than a frame time.

I think I managed to scratch 7000 cycles for updating by using only part of the screen height. What scroll size could you have as a best case (bunch of lda/sta pairs) in that time?

User avatar
NekoNoNiaow
Flight Lieutenant
Posts: 272
Joined: Sun Jan 15, 2006 10:08 pm
Location: Montreal, Canadia

Re: OType

Post by NekoNoNiaow » Mon Apr 22, 2019 9:10 pm

Chema wrote:
Sat Apr 20, 2019 9:40 pm
Scrolling the attributes will alter the colours of the ships when they are at a fixed location.
Yes, which is why I suggested to copy the attributes, not just the pixel data. This way the colors are preserved.
Chema wrote:
Sat Apr 20, 2019 9:40 pm
About the syncing it is possible to do it, but what Dbug says is that it takes longer than the blank period to update the scroll. Probably longer than a frame time.
I seem to be interpreting what DBug says differently than you do. To me (I may be wrong obviously), it seems that he is saying that since the copy cannot be aligned to vsync, there are bound to be lines where the attributes and pixel data will not be in sync, which will lead to color artifact.
This would probably take the form of a line of colored pixels scrolling up (or down) across the screen at a speed proportional to the VSYNC mismatch.

Moreover, I do not think copying the attributes would increase the copy time unreasonably.
Only two additional bytes to be copied per line need to be copied, one for the ink attribute and one for the paper attribute.

The O-Type scrollable area where graphics are drawn seems to consist at first glance of 18 characters horizontally.
Adding two bytes per line would increase this to 20, that is a 2/18 = 1/9th increase, that is around 10%.
This said, these bytes do not strictly need to be copied since we already know in advance what they must be. A dedicated routine could simply output them directly which would be much faster than a copy since no read would be needed.

So, yup, that would slow down the copy, but this would allow smoother and slower scrolling.
That compromise would not necessarily suit every game obviously.
Chema wrote:
Sat Apr 20, 2019 9:40 pm
I think I managed to scratch 7000 cycles for updating by using only part of the screen height. What scroll size could you have as a best case (bunch of lda/sta pairs) in that time?
The O-Type video seems to show that the copy is already not VSYNC aligned: there is ample tearing as the screen scrolls along so copy time is not the issue.
As far as I understand it, the issue is that the ULA could catch up to the copy (or the reverse), this is likely/possible since there is no VSYNC. The consequence would be that it would display a line of old pixel data with the new attributes (or the reverse, depending on when ULA/copy intersect).

I completely agree with you that screen copy time is important and tricky to reduce, I would even wager that this idea would deserve its own thread. ;)

User avatar
Chema
Game master
Posts: 2447
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: OType

Post by Chema » Tue Apr 23, 2019 1:12 pm

NekoNoNiaow wrote:
Mon Apr 22, 2019 9:10 pm
Chema wrote:
Sat Apr 20, 2019 9:40 pm
Scrolling the attributes will alter the colours of the ships when they are at a fixed location.
Yes, which is why I suggested to copy the attributes, not just the pixel data. This way the colors are preserved.
I understood. What I mean is that the player's ships (enemies too?) also use AIC, so if they are still at, say, the bottom of the play area and you scroll attributes one row up, their colors will change.

About the vsync thing, I am sorry if I misunderstood. In any case, it is possible to get an interrupt in sync with the vertical retrace, as was proposed here viewtopic.php?f=8&t=78&hilit=vsync&start=15#p15173

User avatar
NekoNoNiaow
Flight Lieutenant
Posts: 272
Joined: Sun Jan 15, 2006 10:08 pm
Location: Montreal, Canadia

Re: OType

Post by NekoNoNiaow » Sat Apr 27, 2019 3:12 am

Chema wrote:
Tue Apr 23, 2019 1:12 pm
I understood. What I mean is that the player's ships (enemies too?) also use AIC, so if they are still at, say, the bottom of the play area and you scroll attributes one row up, their colors will change.
Hum... ok, I now understand what you mean. Nothing better than a good example! Thanks. ;)

In the context of OType this is indeed an issue since enemies and player are moving in increments of two lines, so to avoid having them jiggle up and down one line as scrolling occurs they would have to be copied one line down compared to the scrolling copy, thus inverting their attributes.

I can envision two possible solutions:
  • unproven: invert the odd and even lines of sprites every frame.
    Since sprites have an effective color granularity of two lines, swapping the lines should hopefully lead to the same blended color effect.
    This obviously needs to be verified graphically but I am hopeful that this would work, although this could result in annoying flickering if the frame rate is too low.
  • guaranteed: have two versions of each sprite, one aligned on even lines, one aligned on odd lines.
    This way, we are guaranteed to have correctly colored sprites for each possible Y position of the sprites on screen.
    The inconvenient is that this requires double the RAM for moving sprites but this might be worth it.
I would not be surprised if there were other methods to work around this issue though.
Chema wrote:
Tue Apr 23, 2019 1:12 pm
About the vsync thing, I am sorry if I misunderstood. In any case, it is possible to get an interrupt in sync with the vertical retrace, as was proposed here viewtopic.php?f=8&t=78&hilit=vsync&start=15#p15173
Do not be sorry! ;)
Oh, nice technique. If it really works, this would indeed be great and would solve the vsync flickering issue.

Post Reply