Jump to content

Photo

Alex Kidd Port

gcc smooth scrolling

197 replies to this topic

#176 Tursi OFFLINE  

Tursi

    Quadrunner

  • 5,638 posts
  • HarmlessLion
  • Location:BUR

Posted Tue Oct 6, 2015 7:32 PM

Scanline coloring is a great trick! It's cool to see it being used in MESS. Now I really need to catch up. ;)

 

30hz won't likely hurt the game appeal at all -- 60hz is a tough goal on a retro machine. That said, you are pretty close!! 



#177 Asmusr OFFLINE  

Asmusr

    River Patroller

  • 3,113 posts
  • Location:Denmark

Posted Tue Oct 6, 2015 11:00 PM

 

You're right, I got confused and used the roughly 12000 cycles we have during vblank as the total per frame but I'm double buffering (not very well, mind you, but that's another story) so I can draw to VRAM for the entire frame. That seems to imply I'm using way more cycles for scrolling (about 15000?) than I think I should be if I'm not mistaken about what the most efficient implementation would look like (that '3000' figure seems awfully far off now...). Back to the drawing board to figure out how much potential for optimization there is, hopefully I was completely wrong in a good way :).

 

15000 is also what you said here:

http://atariage.com/...c/#entry2937655



#178 TheMole OFFLINE  

TheMole

    Dragonstomper

  • Topic Starter
  • 819 posts
  • Location:Belgium

Posted Wed Oct 7, 2015 2:03 AM

 

15000 is also what you said here:

http://atariage.com/...c/#entry2937655

 

Clearly my memory is not what it used to be  :dunce: .



#179 TheMole OFFLINE  

TheMole

    Dragonstomper

  • Topic Starter
  • 819 posts
  • Location:Belgium

Posted Wed Oct 7, 2015 3:45 AM

Just as a test, I replaced the sound player with the 30hz version, and that alone brings me very close (it's actually fast enough when not picking up money or punching boxes). So I might just start by converting all audio to 30hz and try to optimize the rest enough to make it all fit in one frame.

 

I also realized I had to triple buffer my name table since when scrolling two pixels in one frame I ran the risk of writing in the first three rows of my active name table.



#180 Willsy OFFLINE  

Willsy

    River Patroller

  • 3,100 posts
  • Location:Uzbekistan (no, really!)

Posted Wed Oct 7, 2015 8:37 AM

I also realized I had to triple buffer my name table since when scrolling two pixels in one frame I ran the risk of writing in the first three rows of my active name table.

 

Yeah. I'm just gonna make out like I understood you perfectly and quietly drift away before anyone notices! ;)



#181 Lee Stewart ONLINE  

Lee Stewart

    River Patroller

  • 3,967 posts
  • Location:Silver Run, Maryland

Posted Wed Oct 7, 2015 9:23 AM

 

Yeah. I'm just gonna make out like I understood you perfectly and quietly drift away before anyone notices! ;)

 

Too late!  :P

 

...lee



#182 Asmusr OFFLINE  

Asmusr

    River Patroller

  • 3,113 posts
  • Location:Denmark

Posted Wed Oct 7, 2015 11:11 AM

I had to try timing Bouncy with background coloring. Starting from the bottom just after vertical refresh:

 

Black: Play music

Light green: Upload sprite attributes

Dark blue: Scrolling

Light blue: Update switched meta tiles (not happening for this screenshot)

Dark red: Ball - Map interaction

Cyan: Enemy collisions

Light red: Read joystick

Yellow: Move ball

Dark green: Move enemies

Magenta: Display 'sparkle' sprites (not happening for this screenshot)

Grey (not visible): Check quit key

White: Unused

 

Looks like I still have a nice chunk of the frame left for improvements.  ;-)

Attached Files



#183 Opry99er OFFLINE  

Opry99er

    Quadrunner

  • 10,734 posts
  • Location:Hustisford, WI

Posted Wed Oct 7, 2015 11:16 AM

That is fascinating... What a cool test! :)

#184 TheMole OFFLINE  

TheMole

    Dragonstomper

  • Topic Starter
  • 819 posts
  • Location:Belgium

Posted Wed Oct 7, 2015 11:27 AM

 

Yeah. I'm just gonna make out like I understood you perfectly and quietly drift away before anyone notices! ;)

I think it says more about my ability to explain things than about your ability to understand them ;).



#185 TheMole OFFLINE  

TheMole

    Dragonstomper

  • Topic Starter
  • 819 posts
  • Location:Belgium

Posted Wed Oct 7, 2015 11:45 AM

I had to try timing Bouncy with background coloring. Starting from the bottom just after vertical refresh:

 

Black: Play music

Light green: Upload sprite attributes

Dark blue: Scrolling

Light blue: Update switched meta tiles (not happening for this screenshot)

Dark red: Ball - Map interaction

Cyan: Enemy collisions

Light red: Read joystick

Yellow: Move ball

Dark green: Move enemies

Magenta: Display 'sparkle' sprites (not happening for this screenshot)

Grey (not visible): Check quit key

White: Unused

 

Looks like I still have a nice chunk of the frame left for improvements.  ;-)

 

Very cool!

 

I wonder why your soundplayer is taking so much less time than mine though, since we're both using Tursi's library. Are you using the sfx enabled version, and are you running at 60hz?



#186 Asmusr OFFLINE  

Asmusr

    River Patroller

  • 3,113 posts
  • Location:Denmark

Posted Wed Oct 7, 2015 12:15 PM

 

Very cool!

 

I wonder why your soundplayer is taking so much less time than mine though, since we're both using Tursi's library. Are you using the sfx enabled version, and are you running at 60hz?

 

I'm not using the sfx version, but I'm running at 60Hz. The timing varies, sometimes the green line at the bottom (signifying the end of sound playing) is visible and sometimes it's not. I guess it also depends on the music. If I measure it in Classic99 I get an average around 3000 cycles (range 1000 - 9000).



#187 Tursi OFFLINE  

Tursi

    Quadrunner

  • 5,638 posts
  • HarmlessLion
  • Location:BUR

Posted Wed Oct 7, 2015 6:42 PM

The sound player is VERY variable - it depends entirely on the music. In my comments at the top of the file where I list a range of cycles from 1000-10,000 cycles per frame - that's real world, not estimated (it IS rounded though ;) ). It depends on how many of the 12 streams need to be reloaded that frame (there are four for tone, four for volume, and four for timing). The SFX version needs to run twice, once for the song and once for the SFX (but most SFX are simpler and don't use all the channels, so are not as expensive as the music). Unfortunately there's really nothing I can think of that can be done to stagger that - when it needs a new note, it needs it now.

 

I've not been happy with the performance, so I've been taking notes for an optimization pass. I can at least remove some of the duplicated tests that happen on every single byte. Something that should be feasible in the meantime (since I can't promise my free time right now) is moving the "getbyte" function into scratchpad should get back a bit of CPU time - that's where the heaviest lifting happens. It's the first function in the code and runs to the "stinit" function. At a quick count, it looks like it's about 184 bytes, which is a lot to ask of scratchpad, I know. But it should help a lot as it's code heavy, relying a lot on indexed addressing and immediate values.



#188 TheMole OFFLINE  

TheMole

    Dragonstomper

  • Topic Starter
  • 819 posts
  • Location:Belgium

Posted Fri Oct 9, 2015 9:44 AM

By using the 30hz player (I will need to reconvert all my music files again, which is a bit impractical since my only machine with vmware fusion on it died, but otherwise no big deal), rewriting the scrolling function and putting it in scratchpad it seems I can make most of the logic fit within the 50k cycles we have. When scrolling and picking up items I still go over budget, so I will need to optimize my "item pickup" routine (moving sideways + scrolling + playing a sound effect + manipulating the map and VRAM add up quickly), but I'm sure there's room for improvement there.

 

I'm at the point where if I can't optimize it further I think I'll just release the demo as-is and get feedback from the community on how acceptable the occasional screen tearing is.

 

Hopefully more soon, when I've had a chance to setup a (virtual) windows machine.



#189 TheMole OFFLINE  

TheMole

    Dragonstomper

  • Topic Starter
  • 819 posts
  • Location:Belgium

Posted Fri Oct 9, 2015 9:47 AM

Something that should be feasible in the meantime (since I can't promise my free time right now) is moving the "getbyte" function into scratchpad should get back a bit of CPU time - that's where the heaviest lifting happens. It's the first function in the code and runs to the "stinit" function. At a quick count, it looks like it's about 184 bytes, which is a lot to ask of scratchpad, I know. But it should help a lot as it's code heavy, relying a lot on indexed addressing and immediate values.

 

I think the scrolling code needed the speed boost a bit more, but with the gcc workspace, soundplayer workspace and copy-scrolldata-to-vram code running from scratchpad, I have exactly 140 bytes left. If there's another easy target that would benefit in the player code (and fits within 140 bytes), let me know and I'll give it a try.


Edited by TheMole, Fri Oct 9, 2015 9:48 AM.


#190 TheMole OFFLINE  

TheMole

    Dragonstomper

  • Topic Starter
  • 819 posts
  • Location:Belgium

Posted Mon Jan 25, 2016 5:10 AM

Okay, life got in the way of this project for a while there (nothing bad, just work and renovations... I don't have a home office anymore currently). I'll be picking this up again and hopefully fixing the one remaining bug in the demo that I hadn't gotten to yet. Then I can start adding the last remaining parts of the game (shops, bosses, special items, more enemies, ...) and hopefully knock out some more interesting levels and flesh out the story a bit more.

Either way, I'm eager to get back to this, so hopefully I'll be sharing some real progress soon!

#191 TheMole OFFLINE  

TheMole

    Dragonstomper

  • Topic Starter
  • 819 posts
  • Location:Belgium

Posted Wed Apr 20, 2016 2:28 PM

Ok, so now that I've got a bit more time, I've dug up my old to-do list. First up, add the 'shop' functionality, so that all that money you pick up is actually worth something... This is my first try, what do you all think? (Note that I will have to redesign the items that are for sale somewhat, these are too colorful for the 9918a, consider these here placeholders)

 

Attached File  shop.png   3.29KB   4 downloads



#192 --- Ω --- OFFLINE  

--- Ω ---

    Hexacorerunner

  • 13,924 posts
  • Location:82.102.25.76

Posted Wed Apr 20, 2016 2:37 PM

Will you get to buy extra lives too?  For 'marginal' players like myself, that could be beneficial!



#193 TheMole OFFLINE  

TheMole

    Dragonstomper

  • Topic Starter
  • 819 posts
  • Location:Belgium

Posted Wed Apr 20, 2016 3:06 PM

Will you get to buy extra lives too?  For 'marginal' players like myself, that could be beneficial!

 

Yup, I'm currently thinking:

  • Extra life
  • Invincibility shield (get hit once without dying)
  • Invincibility potion (can't die for a short amount of time)
  • Flying fist (you 'shoot' your fist across the entire screen, destroying all destructible terrain and enemies on its way)
  • Wings (Gravity won't affect you, allowing you to fly over tricky parts)
  • Mystery item (one of the above for a discounted price, but you don't know which)


#194 Tursi OFFLINE  

Tursi

    Quadrunner

  • 5,638 posts
  • HarmlessLion
  • Location:BUR

Posted Wed Apr 20, 2016 7:55 PM

Just to make the mystery item a bit less attractive, one of the possible items should be a brick. (Or something else completely useless.) :)

#195 TheMole OFFLINE  

TheMole

    Dragonstomper

  • Topic Starter
  • 819 posts
  • Location:Belgium

Posted Thu Apr 21, 2016 4:23 AM

Just to make the mystery item a bit less attractive, one of the possible items should be a brick. (Or something else completely useless.) :)

Good idea!



#196 Ksarul OFFLINE  

Ksarul

    Quadrunner

  • 5,273 posts

Posted Thu Apr 21, 2016 4:43 AM

Of course, this being Alex Kidd, the nominally useless item could be a cookie. He'll enjoy eating it, but it doesn't actually do anything for him. . .



#197 The Usotsuki OFFLINE  

The Usotsuki

    River Patroller

  • 2,051 posts
  • Also called "Licca"

Posted Thu Apr 21, 2016 2:40 PM

Or a nigiri?



#198 RupanIII OFFLINE  

RupanIII

    Moonsweeper

  • 362 posts

Posted Sat Dec 17, 2016 2:09 AM

So, how is this going? 

 

Good idea!







Also tagged with one or more of these keywords: gcc, smooth scrolling

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users