![]() |
Forum Index : Microcontroller and PC projects : CMM2 demo teaser
Page 1 of 2 ![]() ![]() |
|||||
Author | Message | ||||
berighteous Senior Member ![]() Joined: 18/07/2020 Location: United StatesPosts: 110 |
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 StatesPosts: 110 |
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: AustraliaPosts: 55 |
Nice work! Also solid background music. |
||||
berighteous Senior Member ![]() Joined: 18/07/2020 Location: United StatesPosts: 110 |
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: AustraliaPosts: 55 |
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 StatesPosts: 110 |
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 KingdomPosts: 267 |
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 ZealandPosts: 9610 |
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 StatesPosts: 110 |
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 StatesPosts: 110 |
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: AustraliaPosts: 55 |
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 StatesPosts: 110 |
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: CanadaPosts: 1132 |
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 StatesPosts: 110 |
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 StatesPosts: 110 |
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 StatesPosts: 110 |
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: AustraliaPosts: 341 |
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 KingdomPosts: 10310 |
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 StatesPosts: 110 |
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 KingdomPosts: 10310 |
What colour depth are you using: mode 3,? |
||||
Page 1 of 2 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |