Jump to content

Recommended Posts

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!!

  • Like 1

Share this post


Link to post
Share on other sites

 

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/forums/topic/222529-smooth-scrolling-in-c/?do=findComment&comment=2937655

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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! ;)

  • Like 1

Share this post


Link to post
Share on other sites

 

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

 

Too late! :P

 

...lee

  • Like 1

Share this post


Link to post
Share on other sites

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. ;-)

post-35226-0-28144000-1444237663_thumb.png

  • Like 4

Share this post


Link to post
Share on other sites

 

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 ;).

  • Like 2

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

 

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).

Share this post


Link to post
Share on other sites

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.

  • Like 1

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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
  • Like 1

Share this post


Link to post
Share on other sites

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!

  • Like 8

Share this post


Link to post
Share on other sites

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)

 

post-33891-0-08295600-1461184048_thumb.png

  • Like 4

Share this post


Link to post
Share on other sites

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)
  • Like 7

Share this post


Link to post
Share on other sites

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

  • Like 2

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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. . .

  • Like 3

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...