Jump to content

Photo

Smooth scrolling

Scrolling Assembler

347 replies to this topic

#1 Asmusr ONLINE  

Asmusr

    River Patroller

  • 3,036 posts
  • Location:Denmark

Posted Sat Apr 6, 2013 7:21 AM

Does anyone know how the smooth scrolling in Warzone 2 was done? Are there other examples of games using smooth scrolling?

#2 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • 4,203 posts
  • Location:Denmark

Posted Sat Apr 6, 2013 11:34 AM

In Classic99, with Scroll Lock ON, then F9 will swap between ordinary screen and character dump (repeated 3 times). You'll get something like the animation below. In the Debugger you'll see the SIT and PDT updated about every 8th pixel/frame. So for every pixel move you have character patterns being updated/scrolled. Every 8th pixel move the characters and screen have been prepared and are then swapped into place. Characters alternate between >0800 and >1800, and screen at >0000 and >0400.

At least Parsec, TI Invaders, Moon Patrol, Buck Rogers, Moon Mine, Frogger, Moon Sweeper and Jungle Hunt (Diving) use some kind of smooth scrolling in parts.

:)

Posted Image

Edited by sometimes99er, Sat Apr 6, 2013 11:57 AM.


#3 RXB OFFLINE  

RXB

    River Patroller

  • 3,511 posts
  • Location:Vancouver, Washington, USA

Posted Sat Apr 6, 2013 4:20 PM

I was shown the original concepts by Quinton when we taught a Assembly class to other TI people.
I used to go over to his house a few times a month.
Also saw the start of his other games too.

#4 Tursi OFFLINE  

Tursi

    Quadrunner

  • 5,496 posts
  • HarmlessLion
  • Location:BUR

Posted Sat Apr 6, 2013 5:43 PM

Huh! I didn't know we had a Xevious clone. :)


#5 nanochess OFFLINE  

nanochess

    Processorus Polyglotus

  • 5,796 posts
  • Coding something good
  • Location:Mexico City

Posted Sat Apr 6, 2013 9:26 PM

I'm reposting from a similar subject in Colecovision forum http://atariage.com/...ll#entry2616436

For the more technical involved, a small discussion of how I did the scroll in Princess Quest.

In the highest resolution VDP mode (mode 2) the screen as you see is composed of 8x8 tiles, there is a frame of 32 columns by 24 rows, each eight rows can have 256 different tiles.

In order to do smooth scroll, you should define tiles shifted by pixel AND combined with following tile (by example, 6 pixels of tile plus 2 pixels of following tile)

For fast update you change the screen (32x20 tile indexes or so) each two frames so you leave one frame for internal game logic (no way to do it updating pixels, that would be 4K-6K bytes, and VDP is very slow)

Need to say that VDP limits colors roughly and you should play tricks to combine different colors, like leaving at least 8 pixels space between tiles of different color.

If your game uses less graphics, you can redefine a small number of tiles continuosly.

And of course I saved some "untouched" tiles to draw letters for score, record, energy and lifes.


By the way, the vertical scrolling is even better because it's not so limiting in terms of color but it's more limited in number of available tiles.

Also a good tip for programmers is the use of automated tools to calculate combinations of tiles and removing duplicated tiles in order to get more scene complexity.

Here are two videos of my games with smooth scrolling using these techniques running in Colecovision.

Princess Quest
http://www.youtube....h?v=mPQ3PsrqpeU

Mecha-8
http://www.youtube....h?v=hsAUDZpJc0A

Edited by nanochess, Sat Apr 6, 2013 9:27 PM.


#6 nanochess OFFLINE  

nanochess

    Processorus Polyglotus

  • 5,796 posts
  • Coding something good
  • Location:Mexico City

Posted Sat Apr 6, 2013 9:35 PM

I forgot to say that the TI/99-4A has the same video chip as Colecovision, so VDP techniques apply to both. :)

Of course the games cited are very big (mostly because 1K of memory in Colecovision), so Princess Quest sizes up to 256K and Mecha-8 to 128K.

For MSX (another similar machine but with more memory) I was able to compress each game in 64K ROM cartridges.

Edited by nanochess, Sat Apr 6, 2013 9:36 PM.


#7 Gemintronic OFFLINE  

Gemintronic

    Jason S. - Lead Developer & CEO

  • 9,310 posts

Posted Sat Apr 6, 2013 10:00 PM

My brain can't take the awesomeness in those pics and video links.

#8 Asmusr ONLINE  

Asmusr

    River Patroller

  • Topic Starter
  • 3,036 posts
  • Location:Denmark

Posted Sat Apr 27, 2013 5:28 AM

Thank you sometimes99er and nanochess for guiding me in the right direction. I have been playing around with scrolling for a few weeks, and here is my first demo of pixel smooth scrolling in half bitmap mode:

http://www.youtube.com/watch?v=XGc_ZwbnXQ4

Note that the video is doing a bad job of showing how smooth the scrolling really is: the screen moves only 1 pixel row at a time - even at the highest speed of 60 FPS.

The attached disk contains the E/A 3 file (SCO). Use the joystick to control the speed and move the sprite. On emulators it looks pretty good and on a real console it's even more smooth. However, on the console the top of the screen is flickering - at least on my console with the F18A. If this was to be used in a game I think you could use the top of the screen as text/status area to prevent the flickering.

Attached File  Scrolling.zip   4.38KB   51 downloads

This is basically just pattern updating and name page flipping, and it only works with relatively simple graphics. If you're interested in more details I can write some notes...

The map/graphics was made in Magellan 1.6:
http://atariage.com/...n/page__st__275

#9 Opry99er ONLINE  

Opry99er

    Quadrunner

  • 10,598 posts
  • Location:Hustisford, WI

Posted Sat Apr 27, 2013 8:27 AM

That's a pretty amazing video, man... Very impressive!!! Are you planning to build a game out of that demo?

#10 retroclouds OFFLINE  

retroclouds

    Stargunner

  • 1,689 posts
  • Location:Germany

Posted Sat Apr 27, 2013 9:08 AM

I'm impressed! :-o

That is very nice!

#11 rocky007 OFFLINE  

rocky007

    Moonsweeper

  • 395 posts
  • Location:Belgium

Posted Wed May 1, 2013 4:38 PM

really incredible, i can't believe my eyes !!! please don't stop coding !

#12 InsaneMultitasker OFFLINE  

InsaneMultitasker

    River Patroller

  • 2,364 posts

Posted Wed May 1, 2013 4:54 PM

Thank you sometimes99er and nanochess for guiding me in the right direction. I have been playing around with scrolling for a few weeks, and here is my first demo of pixel smooth scrolling in half bitmap mode:


Very nicely done. Would your scrolling allow you to do the same horizontally or at a diagonal? Just curious :)

#13 Asmusr ONLINE  

Asmusr

    River Patroller

  • Topic Starter
  • 3,036 posts
  • Location:Denmark

Posted Wed May 1, 2013 10:57 PM

Horizontally, yes, but you would not be able to scroll the colors smoothly so different colors would have to be one character apart. Diagonal would be difficult, I think you would run out of characters.

I'm working on another version of the scroller using four buffers that doesn't have any flickering problems. I will post the source code when it's working.

#14 InsaneMultitasker OFFLINE  

InsaneMultitasker

    River Patroller

  • 2,364 posts

Posted Wed May 1, 2013 11:28 PM

Horizontally, yes, but you would not be able to scroll the colors smoothly so different colors would have to be one character apart. Diagonal would be difficult, I think you would run out of characters.

I'm working on another version of the scroller using four buffers that doesn't have any flickering problems. I will post the source code when it's working.

I was thinking along the lines of simulating a diagonal scroll by scrolling vertically then horizontally.. or horizontlly then vertically. Looking forward to seeing how you are working the magic :)

#15 Asmusr ONLINE  

Asmusr

    River Patroller

  • Topic Starter
  • 3,036 posts
  • Location:Denmark

Posted Wed May 15, 2013 1:11 PM

I have improved my scrolling algorithm, and it's now flawless on real TI-99/4A. Could someone let me know how it looks on a 9918A, please?



Don't look at the jerky video, try it on hardware or at least in Classic99!

I have attached a zip file with a disk image (use Editor/Assembler option 3 to run DSK1.SCO) and the source code (assemble with WinAsm99).

When running the demo, use the joystick to control the ship. Note that the map wraps around after a while.

I'm working on some (quite lengthy) notes that I can post if you're interested in how the algorithm works.

Attached Files



#16 retroclouds OFFLINE  

retroclouds

    Stargunner

  • 1,689 posts
  • Location:Germany

Posted Wed May 15, 2013 1:17 PM

Impressive! Absolutely, please share your notes. How much RAM does the demo need?

#17 Asmusr ONLINE  

Asmusr

    River Patroller

  • Topic Starter
  • 3,036 posts
  • Location:Denmark

Posted Wed May 15, 2013 1:29 PM

It uses >42B2 bytes.

I have attached my notes, I warned you they were long! Please let me know if anything is unclear or incorrect, or you have suggestions for how the algorithm could be improved.

Attached Files



#18 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • 4,203 posts
  • Location:Denmark

Posted Wed May 15, 2013 3:40 PM

Awesome. Love it. :thumbsup:

#19 matthew180 OFFLINE  

matthew180

    River Patroller

  • 2,606 posts
  • Location:Castaic, California

Posted Wed May 15, 2013 6:32 PM

Fantastic! I would have flipped for a game like that on the 99/4A. That is on par with something Konami would have made. :-) Are you going to make a whole game?


#20 Opry99er ONLINE  

Opry99er

    Quadrunner

  • 10,598 posts
  • Location:Hustisford, WI

Posted Wed May 15, 2013 7:48 PM

My God, that is beautiful.....

#21 marc.hull OFFLINE  

marc.hull

    Stargunner

  • 1,297 posts
  • Location:Oklahoma CIty.

Posted Wed May 15, 2013 8:19 PM

I have improved my scrolling algorithm, and it's now flawless on real TI-99/4A. Could someone let me know how it looks on a 9918A, please?

http://www.youtube.com/watch?v=0_Dtz2F5cIk

Don't look at the jerky video, try it on hardware or at least in Classic99!

I have attached a zip file with a disk image (use Editor/Assembler option 3 to run DSK1.SCO) and the source code (assemble with WinAsm99).

When running the demo, use the joystick to control the ship. Note that the map wraps around after a while.

I'm working on some (quite lengthy) notes that I can post if you're interested in how the algorithm works.


Absolutely fucking brilliant ! (pardon my language.)

The file runs perfect on a real console and the code converts to a little over 16K of memory image. Only problem I see is that it is not a complete game ;-).....

I assume this is compiled BASIC ? If so I am doubly impressed.

Good job RasmusM. I hope you continue on.

#22 InsaneMultitasker OFFLINE  

InsaneMultitasker

    River Patroller

  • 2,364 posts

Posted Wed May 15, 2013 10:24 PM

I have improved my scrolling algorithm, and it's now flawless on real TI-99/4A. Could someone let me know how it looks on a 9918A, please?


Wow. That is awesome! How do you keep the stars fixed in their position??

#23 Asmusr ONLINE  

Asmusr

    River Patroller

  • Topic Starter
  • 3,036 posts
  • Location:Denmark

Posted Wed May 15, 2013 10:36 PM

The file runs perfect on a real console and the code converts to a little over 16K of memory image. Only problem I see is that it is not a complete game ;-).....

I assume this is compiled BASIC ? If so I am doubly impressed.


It's 100% assembly language. I can't imagine how this would be possible compiled basic!

I'm thinking about turning it into a game, of course, but there are some problems: 1. Apparently you can only rely on 8 sprites working in this mode because of a weird bug, but I could choose to ignore that. 2. I think a have almost run out of clock cycles. To make this a game I would probably have to limit the scrolling to every second frame, but that might not be so bad. 3. Time... I have 3 small children.

How do you keep the stars fixed in their position??

I use the undocumented backdrop plane :-) No really, I just add them to the name table after scrolling if the positions are unoccupied. A simple trick with a nice result.

#24 RobertLM78 OFFLINE  

RobertLM78

    Stargunner

  • 1,055 posts

Posted Wed May 15, 2013 11:22 PM

Awesome demos RasmusM :cool: . Impressive what these machines can be made to do.

#25 Mobsie OFFLINE  

Mobsie

    Space Invader

  • 32 posts

Posted Thu May 16, 2013 1:42 AM

WOW, thank you for the nice tech. text.





Also tagged with one or more of these keywords: Scrolling, Assembler

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users