Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:17 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2 demo teaser

     Page 1 of 2    
Author Message
berighteous
Senior Member

Joined: 18/07/2020
Location: United States
Posts: 110
Posted: 09:01pm 12 Aug 2020
Copy link to clipboard 
Print this post

Hey all!  Here's a teaser for a something I'm working on



I have 300 animated asteroids in various sizes with animated overlays. I'm not using sprites. I have control arrays for any number of objects and I'm blitting them to the framebuffer. I set the framebuffer to 50 pixels larger than the playfield size all the way around, so that as the asteroids move off the playfield I can neatly crop them out by blittting just the playfield region.  Every frame I restore the framebuffer and background then blit a bajillion asteroids, then blit the playfield area of the framebuffer to page 9 where I add the overlays and the feedback window to the screen before page copying to page 0.  

Here's a youtube video.  How many sprites can you move on the CMM2?  You can move ALL OF THEM!
 
berighteous
Senior Member

Joined: 18/07/2020
Location: United States
Posts: 110
Posted: 09:20pm 12 Aug 2020
Copy link to clipboard 
Print this post

If you can draw something to the screen, you can move it and draw it.  If you can move it and draw it, you can move it and animate it and draw it.  If you can move and animate and draw one thing to the screen, you can move and animate and draw lots of things to the screen.
 
HellbentHorse
Regular Member

Joined: 08/07/2020
Location: Australia
Posts: 55
Posted: 11:01pm 12 Aug 2020
Copy link to clipboard 
Print this post

Nice work!

Also solid background music.
 
berighteous
Senior Member

Joined: 18/07/2020
Location: United States
Posts: 110
Posted: 11:16pm 12 Aug 2020
Copy link to clipboard 
Print this post

Thanks!  That was me in my Metal days.  I actually won my Carvin DC-125 in a Metal Method beginner guitar contest.
 
HellbentHorse
Regular Member

Joined: 08/07/2020
Location: Australia
Posts: 55
Posted: 11:45pm 12 Aug 2020
Copy link to clipboard 
Print this post

Nice one!

I bet that Carvin is worth a bit with them no longer in production.
 
berighteous
Senior Member

Joined: 18/07/2020
Location: United States
Posts: 110
Posted: 11:52pm 12 Aug 2020
Copy link to clipboard 
Print this post

It's a neck-thru with a floyd-rose tremolo and maple fretboard.  It's sweet.

here's some of my game music
ozmusic.zip
 
Womble

Senior Member

Joined: 09/07/2020
Location: United Kingdom
Posts: 267
Posted: 12:29am 13 Aug 2020
Copy link to clipboard 
Print this post

  berighteous said  Here's a youtube video.  How many sprites can you move on the CMM2?  You can move ALL OF THEM!

You sir are a terrible tease

I look forward to playing this, looks and sounds great.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 12:45am 13 Aug 2020
Copy link to clipboard 
Print this post

  Quote  I have 300 animated asteroids in various sizes with animated overlays. I'm not using sprites. I have control arrays for any number of objects and I'm blitting them to the framebuffer. I set the framebuffer to 50 pixels larger than the playfield size all the way around, so that as the asteroids move off the playfield I can neatly crop them out by blittting just the playfield region.  Every frame I restore the framebuffer and background then blit a bajillion asteroids, then blit the playfield area of the framebuffer to page 9 where I add the overlays and the feedback window to the screen before page copying to page 0.


Wow.  

That is impressive, considering you are not using sprites.  THIS is a perfect example of how those complaining about the lack of sprites, simply need a rethink on how they do it.  Excellent work.  Can't wait to see the finished(or even not-quite finished!) version of this.  
Smoke makes things work. When the smoke gets out, it stops!
 
berighteous
Senior Member

Joined: 18/07/2020
Location: United States
Posts: 110
Posted: 02:00am 13 Aug 2020
Copy link to clipboard 
Print this post

It's easier for me to manage my own sprites. I can have as many as I want and I can animate them on the fly. Collisions are simple to do and I can control what I check collisions for and I can change the size of the collision bounding boxes.

Blit is such a powerful command and it will handle the masking.

I found a problem trying to use the image resize_fast with the framebuffer.  It garbled the images.  I ended up using it to rescale the big asteroids to another video page and then blited the smaller versions from that page to the framebuffer instead.
 
berighteous
Senior Member

Joined: 18/07/2020
Location: United States
Posts: 110
Posted: 02:03am 13 Aug 2020
Copy link to clipboard 
Print this post

More than 300 sprites it starts to slow down.  I had over 1000 things going last night, lol. The game will probably have maybe up to 20, but I wanted to see what it could do.
 
HellbentHorse
Regular Member

Joined: 08/07/2020
Location: Australia
Posts: 55
Posted: 02:44am 13 Aug 2020
Copy link to clipboard 
Print this post

As a new comer to all of this I would really love a peak at the source code at some stage in the future if it is ever on offer. Sounds like a really good example of getting some grunt from the hardware.
 
berighteous
Senior Member

Joined: 18/07/2020
Location: United States
Posts: 110
Posted: 03:36am 13 Aug 2020
Copy link to clipboard 
Print this post

It's super simple.  I load the art pixel by pixel from the data files and pixel them onto one or more of the off screen pages.  When I need to put something on screen, I blit a background onto the framebuffer then blit the thing from the page it's stored on to the frame buffer to create the finished image and then I use blit to copy that completed image to the visible screen on page 0.  In this case I tell it to do it 300 times with a for-next loop. The CMM2 is crazy fast doing this, so it makes me look like a super genius.
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1132
Posted: 05:07am 13 Aug 2020
Copy link to clipboard 
Print this post

Do you need to use the frame buffer at all? As far as I can tell, BLIT only copies pixels that end up within the page.

What video mode are you using? Keeping big BLITs working in fast processor RAM instead of slightly slower external RAM might squeeze out slightly more performance.
Visit Vegipete's *Mite Library for cool programs.
 
berighteous
Senior Member

Joined: 18/07/2020
Location: United States
Posts: 110
Posted: 05:47am 13 Aug 2020
Copy link to clipboard 
Print this post

I'm using the frame buffer for all the oids.  I'm in mode 3,8 with the frame buffer set at 333x292.  In the middle of the frame buffer at 50,50 I load the nebula playfield.  It's 233x192, so there's a buffer of 50 pixels all the way around.  I backup the frame buffer, so at the beginning of every frame I restore it to a clean nebula.  I blit a million moving asteroids to the frame buffer, and then blit the nebula area to page 8 at 0,8, cropping off the asteroids that are partially out of the playfield. On page 8 the feedback window meets it at 233,8 and then I blit on the overlays and then I page copy the completed page to page 0 so we see it.
 
berighteous
Senior Member

Joined: 18/07/2020
Location: United States
Posts: 110
Posted: 06:00am 13 Aug 2020
Copy link to clipboard 
Print this post

Where in memory does the framebuffer live anyway?

I'm using 9 pages of video memory to store all the art.  There's a lot of it.  I keep the oids and enemies in pages 1-3 so they're close to page 0.

I have my own font and text draw subs.  The font is 6x6, transparent and can be colored and blitted on top of any background .
 
berighteous
Senior Member

Joined: 18/07/2020
Location: United States
Posts: 110
Posted: 06:04am 13 Aug 2020
Copy link to clipboard 
Print this post

Blit will blit from anywhere to anywhere, This page to this page, this page to another page, this page to the framebuffer, another page to the framebuffer framebuffer to another page.  It's cool.  

Image resize_fast doesn't work right for me to and from the framebuffer, it's actually irratic and kinda crazy.  But I'm on the last release of the firmware and not on a beta.  they may have fixed it.

It works fine to and from regular pages.  I wanted to just scale what I needed on the fly - read the big oid from page 1 and scale it and put it on the framebuffer where it's needed, but I was getting garbled images.  So I ended up using it to prescale the big oids and other things into 2 smaller sizes and put them on page 10, and told my program to blit smaller things from page 10 to the framebuffer.
Edited 2020-08-13 16:08 by berighteous
 
capsikin
Guru

Joined: 30/06/2020
Location: Australia
Posts: 341
Posted: 06:51am 13 Aug 2020
Copy link to clipboard 
Print this post

  berighteous said  Blit will blit from anywhere to anywhere, This page to this page, this page to another page, this page to the framebuffer, another page to the framebuffer framebuffer to another page.  It's cool.  

Image resize_fast doesn't work right for me to and from the framebuffer, it's actually irratic and kinda crazy.  But I'm on the last release of the firmware and not on a beta.  they may have fixed it.

It works fine to and from regular pages.  I wanted to just scale what I needed on the fly - read the big oid from page 1 and scale it and put it on the framebuffer where it's needed, but I was getting garbled images.  So I ended up using it to prescale the big oids and other things into 2 smaller sizes and put them on page 10, and told my program to blit smaller things from page 10 to the framebuffer.


You may get more speed prescaling - I've tried doing a full screen Image resize_fast and it was much too slow to keep up with the frame rate.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 07:16am 13 Aug 2020
Copy link to clipboard 
Print this post

  Quote  I found a problem trying to use the image resize_fast with the framebuffer.  It garbled the images.  I ended up using it to rescale the big asteroids to another video page and then blited the smaller versions from that page to the framebuffer instead.


Sounds like a bug

Please can you code up a simple demo so I can find and fix
 
berighteous
Senior Member

Joined: 18/07/2020
Location: United States
Posts: 110
Posted: 09:14am 13 Aug 2020
Copy link to clipboard 
Print this post

Will do.  I had it write to a 320x200 frame buffer and blit back to Page 0 and the sprites were garbled, and when I changed it to write to page 2 and back they were fine.




Here's the code (phone camera sucks, sorry) blitting and image resize_fast to page two and blitting back to 0.


resizing works fine.  I'm using a custom palette, so regular image resize mangles the colors.  Image Resize_fast works fine with nearest neighbor scaling or whatever it's doing.



here's the code for using the framebuffer.  I opened a 320x200 frame buffer.  The onnly change in the code is page write framebuffer and blitting final image from framebuffer.  All the resized asteroids are cut in half and they "bounce" up and down and don't stay in the same place vertically onscreen



Here's a youtube link showing what it's doing
Edited 2020-08-13 19:16 by berighteous
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 09:24am 13 Aug 2020
Copy link to clipboard 
Print this post

What colour depth are you using: mode 3,?
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025