Fast scrolling game howto, anyone?

Want to talks about games you like, would like to see developed on the Oric, it's here.
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Fast scrolling game howto, anyone?

Post by Chema »

Nice. I am using now the first 5 rows, as hires (40 lines). Can't remember if that wa a maximum or simply something I set for the test. Then I have a play area of 18 rows in text mode, probably because they were just enough, but it can be extended to 20, and leave the last three text lines with A pseudo hires mode by using 40x3 characters... Does this make sense?
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Fast scrolling game howto, anyone?

Post by Chema »

Just did another try. Still nothing very exciting, though.

I added a sub-character scroll on the starfield (in fact pixel by pixel) by redefining the character just to see how it worked. I think that, as the battelship is so massive, it does not give the effect I expected. Anyway it is working.

First I had to find out where to make the shifts to the star pixel, because of the horrible glitches that were seen onscreen (as we discussed). After finding a way to minimize them, they were only noticeable evey now and then, and did not disturb too much.

The possitive point is that it is quite possible to have a real paralax effect, maybe even with more than two planes, if we have enough characters to redefine, that is.

Then, being fed up with the tearing and glitches, I tried the small program to let the user sync the vertical retrace timer. And voilá. Tearing and glitches disappeared. However the process is quite tedious and difficult. Still not convinced :(

BTW the trick works quite well in Oricutron, not in Euphoric.

Here is the video: http://youtu.be/D-xBrUQPMd0

Would like to test more of the tricks you sent me, I just need time...
User avatar
ibisum
Wing Commander
Posts: 1646
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: Fast scrolling game howto, anyone?

Post by ibisum »

I have to say that this looks *quite* usable to me! So now its time to stop discussing this and just get on with making a game out of it!! :P
User avatar
Silicebit.
Flight Lieutenant
Posts: 313
Joined: Thu Jan 12, 2006 10:18 pm
Location: Madrid, Spain
Contact:

Re: Fast scrolling game howto, anyone?

Post by Silicebit. »

Chema, I can see that the small antiflicker program works fine. The program is the next:
Start a new generation of flicker-free arcade games!

Have you seen Jonathan Bristow's new game ? "Magnetix" specifications (parallax scrolling on 75% of the screen, sonix music...) prove that you can push the limits !

Have you tried the small routine below ? It changes the background color from red to green and green to red, BUT, it is synchronized with your TV, and you can see this materialized ! Enter the program on a real Oric1 or Atmos (it should work on the TeleStrat too), but not on an emulator.

Save it on tape or disk, then RUN. Use F key to raise the frequency of the timer, S key to slow it down, and Q to quit. It brings the detail Oric missed : an interrupt signaling the vertical screen retrace.

So, think about what you can do with a 50 frames/s animation, or a double-buffered technique... Just add a small routine like this one in your program asking the user to graphically calibrate the timer at the top or bottom of the screen, and you will never seen again those flickering sprites!.
Program:

Code: Select all

     10 DATA133,4,134,3,169,128,133,0
     20 DATA169,187,133,1,160,0,24,165
     30 DATA4,145,0,166,3,202,208,253
     40 DATA152,105,40,168,144,241,169,0
     50 DATA101,1,133,1,201,192,144,231
     60 DATA96,120,78,223,2,169,64,44
     70 DATA13,3,240,251,169,17,162,1
     80 DATA32,0,8,169,18,162,18,32
     90 DATA0,8,0,0,173,223,2,201
     100 DATA211,208,8,238,6,3,208,3
     110 DATA238,7,3,201,198,208,11,174
     120 DATA6,3,208,3,206,7,3,206
     130 DATA6,3,201,209,208,196,88,96
     200 FORI=#800TO#867
     210 READA
     215 S=S+A
     220 POKEI,A
     230 NEXT
     240 IFS<>10819THENPRINT"ERROR IN DATAS":END
     1000 DOKE#306,19966
     1010 CALL#829
The routine disassembled:

Code: Select all

    ]; 0800 85 04    STA $04     '
    ]; 0802 86 03    STX $03     '
    ]; 0804 A9 80    LDA #$80    '
    ]; 0806 85 00    STA $00     '
    ]; 0808 A9 BB    LDA #$BB    '
    ]; 080A 85 01    STA $01     '
    ]; 080C A0 00    LDY #$00    '
    ]; 080E 18       CLC         '
    ]; 080F A5 04    LDA $04     '
    ]; 0811 91 00    STA ($00),Y '
    ]; 0813 A6 03    LDX $03     '
    ]; 0815 CA       DEX         '
    ]; 0816 D0 FD    BNE $0815   '
    ]; 0818 98       TYA         '
    ]; 0819 69 28    ADC #$28    '
    ]; 081B A8       TAY         '
    ]; 081C 90 F1    BCC $080F   '
    ]; 081E A9 00    LDA #$00    '
    ]; 0820 65 01    ADC $01     '
    ]; 0822 85 01    STA $01     '
    ]; 0824 C9 C0    CMP #$C0    '
    ]; 0826 90 E7    BCC $080F   '
    ]; 0828 60       RTS         '
    ]; 0829 78       SEI         '
    ]; 082A 4E DF 02 LSR $02DF   '
    ]; 082D A9 40    LDA #$40    '
    ]; 082F 2C 0D 03 BIT $030D   '
    ]; 0832 F0 FB    BEQ $082F   '
    ]; 0834 A9 11    LDA #$11    '
    ]; 0836 A2 01    LDX #$01    '
    ]; 0838 20 00 08 JSR $0800   '
    ]; 083B A9 12    LDA #$12    '
    ]; 083D A2 12    LDX #$12    '
    ]; 083F 20 00 08 JSR $0800   '
    ]; 0842 00       BRK         '
    ]; 0843 00       BRK         '
    ]; 0844 AD DF 02 LDA $02DF   '
    ]; 0847 C9 D3    CMP #$D3    '
    ]; 0849 D0 08    BNE $0853   '
    ]; 084B EE 06 03 INC $0306   '
    ]; 084E D0 03    BNE $0853   '
    ]; 0850 EE 07 03 INC $0307   '
    ]; 0853 C9 C6    CMP #$C6    '
    ]; 0855 D0 0B    BNE $0862   '
    ]; 0857 AE 06 03 LDX $0306   '
    ]; 085A D0 03    BNE $085F   '
    ]; 085C CE 07 03 DEC $0307   '
    ]; 085F CE 06 03 DEC $0306   '
    ]; 0862 C9 D1    CMP #$D1    '
    ]; 0864 D0 C4    BNE $082A   '
    ]; 0866 58       CLI         '
    ]; 0867 60       RTS         '
Happy experimentation. :-)
Oric user since 1984. YouTube
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Fast scrolling game howto, anyone?

Post by Chema »

Yep, that is the routine I used, as you told me about it in retrowiki. It is a bit cumbersome to use, so a better approach for user calibration should be found. What surprised me a lot was the fact that it worked on Oricutron! Still have not tested on a real Oric.

Btw I guess that this technique of text mode graphics for fast scroll, was what Twiligte used in Magnetix. Probably he has a good insight about the problems and possibilities.

Ibisum, :) yeah, I have a couple of things in mind, but nothing solid enough as to start programming. I don't like the idea of simply porting Uridium. It won't add much and I had bad experiences with copyright issues. One possibility is doing a variation over that game, with procedurally generated ships, different game objectives and gameplay, for instance allowing you to jump over obstacles, etc.

Another possibility is planning a game similar to Cobra or Super Mario, in the sense of a hero fighting around in a scrolling world.

But I want to make sure that it is doable and that the result will be nice looking :)

I need to add more sprites, for instance, to check movements and evaluate tile usage.

I need free time!
User avatar
Xeron
Emulation expert
Posts: 426
Joined: Sat Mar 07, 2009 5:18 pm
Contact:

Re: Fast scrolling game howto, anyone?

Post by Xeron »

Chema wrote:What surprised me a lot was the fact that it worked on Oricutron!
This is not so surprising... Even though the oric has no vsync, I decided to do full raster emulation in oricutrons video code. This adds a little overhead, but more accurately emulates tearing etc.
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Fast scrolling game howto, anyone?

Post by Chema »

Xeron wrote: This is not so surprising... Even though the oric has no vsync, I decided to do full raster emulation in oricutrons video code. This adds a little overhead, but more accurately emulates tearing etc.
It was surprising for me :) I did not know that. Another excellent feature of your wonderful emulator. I think I discover incredible things about it each time I try something new. Like loading a wav produced with tap2cd, or counting cycles...

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

Re: Fast scrolling game howto, anyone?

Post by Dbug »

Well, there was at least one released application using this:
http://www.pouet.net/prod.php?which=24190

To my knowledge it's the only (so far) vsync controlled double buffered animation done on the Oric :)
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Fast scrolling game howto, anyone?

Post by Chema »

Dbug wrote: To my knowledge it's the only (so far) vsync controlled double buffered animation done on the Oric :)
Yep, I think it is the only one. Am I wrong or it made use of the vsync hack only (no option for software calibration for those not having the cable)? I might offer both possibilities, as IIRC you can detect if the vsync cable is present...

I have been tidying things up a bit in my code so I can make further testing. I put another three ships moving around and timed the main engine routines:

clearing the backbuffer: 3650 cycles
rendering the background: 7763 cycles
painting sprites (5, as the shadow under the hero is a sprite): 7454 cycles
dumping everything: 6053 cycles.

That is something a bit above 25000 cycles, so 40 fps are possible, but 50 are not. That means that, when I add the waiting for synchronizing with the vertical retrace, it takes nearly 15000 cycles and the result is a game at 25 fps.

(Yeah, I know I can do some optimization but I doubt, with all the extra stuff needed in a game, I could keep at 50 fps.)

It is taking me around 1500 cycles per 2x2 sprite, so I think that, even adding the AI and other details, I should be able to manage 5-7 enemies while keeping the frame rate at 25 fps. This is the first time I deal with synchronization with the retrace, so I am not sure if I am being optimistic.

I was about to post another video, but I need to face a horrible bug I am experiencing. The speed of the hero defines when to scroll, usually every n game frames (n being something 2,3, or 4; 1 is reserved for shots, which must be the quickest thing). Enemies also have a speed, which moves them around the map.

The thing is that it is possible to have a situation in which you update the enemies, moving them one square to the right while it is no time to scroll yet; then, at the following frame, you scroll and they don't move, so there is an ugly effect if this repeats, as if they moved back and forth.

There must be some obvious solution for this... I know scroll must be synchronized with enemy movement to avoid this error, but you want your hero to accelerate/decelerate, so you get out of sync quite easily.
User avatar
Cristian
1st Star Corporal
Posts: 14
Joined: Wed Dec 06, 2006 11:49 am

Re: Fast scrolling game howto, anyone?

Post by Cristian »

It's simply amazing!!!!!!
THX!!
+-------------------------+
|REGARDS FROM |
|ST@FF |
|WWW.IOCERO.COM |
+-------------------------+
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Fast scrolling game howto, anyone?

Post by Chema »

I guess everybody is playing Murder on the Atlantic with that Microdisc unit in mind :)

I made a couple of things more for the engine. As I needed to add the automatic actions for the future IA (commands) and a straightforward case is the looping when you change direction, I put it in. Looks nice in my opinion. I had to slow it down (animate every two screen frames) because it was too fast.

I also added more sprites, as I told you, to check speed. It still runs fast, but in the video you will see the ugly 'back and forth' effect that appears sometimes. Need to check how to minimize it.

Still all are tests, but I am starting to figure out the possibilities and limitations. Small steps...

http://youtu.be/C6OjtA0cnTk
User avatar
barnsey123
Flight Lieutenant
Posts: 379
Joined: Fri Mar 18, 2011 10:04 am
Location: Birmingham

Re: Fast scrolling game howto, anyone?

Post by barnsey123 »

Chema, that looks really nice. If you sacrificed the ability to change direction would that speed things up a bit? I'm thinking that the battleships could be shaped like an "O" and you go "round and round" until all targets destroyed. Bonus points for destroying all targets in one pass? Countdowns etc

Put in a "radar" screen at the top or bottom...so you can see what target's you've missed etc.

Loads of powerups, warp to next sector and so on..

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

Re: Fast scrolling game howto, anyone?

Post by Chema »

Thanks barnsey, the ability to change direction does not add any delay, it only consumes memory because you have to keep the whole map. But this is also preliminary. Who knows what it would look like in the end.

Besides I don't think more speed is needed. It is fast enough, quite fast in my opinion. I would like it to be smoother, as we have discussed earlier, but we will see.

A radar is a good addition, although at this moment I am only testing things. I will have a look. It is funny that the folder where I keep the developing files is called Oricium :)
User avatar
ibisum
Wing Commander
Posts: 1646
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: Fast scrolling game howto, anyone?

Post by ibisum »

Load it up with 100 enemies, lets see how it does then .. ;)
User avatar
barnsey123
Flight Lieutenant
Posts: 379
Joined: Fri Mar 18, 2011 10:04 am
Location: Birmingham

Re: Fast scrolling game howto, anyone?

Post by barnsey123 »

Please have it finished by Saturday because I really want to play it... :D
Post Reply