+Andrew Davie Posted November 23, 2021 Share Posted November 23, 2021 (edited) Here's a demo drawing a Rubik's cube. I only have 2 cubes defined here, and randomly chaging between them. But, since I have 8 colours (including black) to play with, it looks like a complete implementation of Rubik's cube using this system would look good. The "internals" (would be one of the dark colours). Then black for the BG, and that leaves 6 other colours - enough for the 6 face colours. cubixCDFJ20211123.bin Edited November 30, 2021 by Andrew Davie 18 Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted November 23, 2021 Author Share Posted November 23, 2021 This looks much nicer... https://atariage.com/screenshot_page.php?SoftwareLabelID=2375 1 Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted November 23, 2021 Author Share Posted November 23, 2021 (edited) I'm now handling all the possible colours. This binary just randomly switches face colour for each cube. The draw is also handled a bit more "efficiently". Not sure what that blinking thing at the top is caused by Not sure... might leave it at this stage. cubicks20211124.bin Edited November 23, 2021 by Andrew Davie 13 Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted November 27, 2021 Author Share Posted November 27, 2021 I've started the rotations/animations. This shows the 45° frame; it will only be seen very briefly during a move, so it doesn't have to be perfect. The binary shows this "animating" back and forth. I plan to do a 22.5° frame either side of that. Then there's the three axes, so there are 4 frames for each -- 12 animation groupings total. That will allow each "layer" (top/bottom/mid) on each of the 3 axes to rotate. That will give me full movement - I'll be able to rotate either the whole cube in any axis, or any layer in any axis. It's complex to work on - particularly the alignment of colours to the "real" cube. I'm getting there... This version has improved timing, and should run OK on Gopher, too. cubiks20211127.bin 5 Quote Link to comment Share on other sites More sharing options...
JetSetIlly Posted November 27, 2021 Share Posted November 27, 2021 5 hours ago, Andrew Davie said: This version has improved timing, and should run OK on Gopher, too. Excellent. In the latest binary, you're not using much ARM time at all compared to previous versions, so you have lots of room for more processing. Incidentally, all versions work OK on Gopher2600 but cycle counting is on by default, so for earlier versions of your binary you need to turn it off, or the scanline count is unstable. In the latest version of Stella, it is the other way around - cycle counting is off by default and on in developer mode. Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted November 27, 2021 Author Share Posted November 27, 2021 (edited) I've put in one "inbetween" rotation. The resolution makes it difficult to get the spacing right. However, these "inbetween" rotation shapes are going to be very brief anyway, so I think this will do nicely. Because it seems Stella (by default, I guess - I'm probably running an old less-capable version - 6.5) does not cycle count ARM code in normal mode, I am constantly switching between code that "looks good in stella" and code that "looks good in Gopher (and presumably hardware)". It's to do with where I call ARM code -- in default config, Stella runs all this at super-speed, so the rotation speed is insane. I will include a binary (superfast) to show this. Compare running the same binary on Gopher and Stella to see the difference. I think Stella might be better with cycle counting on by default so this sort of thing doesn't happen. Of course I could be misunderstanding what's going on... but the differences between running "superfast" in the two is quite telling. Edit: Forgot to mention... not that it is very useful right now, but holding down fire button will rotate the whole cube instead of the top layer. cubiks20211127b.bin CubiksSuperfast.bin Edited November 27, 2021 by Andrew Davie 3 Quote Link to comment Share on other sites More sharing options...
JetSetIlly Posted November 27, 2021 Share Posted November 27, 2021 (edited) 1 hour ago, Andrew Davie said: Because it seems Stella (by default, I guess - I'm probably running an old less-capable version - 6.5) does not cycle count ARM code in normal mode, I am constantly switching between code that "looks good in stella" and code that "looks good in Gopher (and presumably hardware)". It's to do with where I call ARM code -- in default config, Stella runs all this at super-speed, so the rotation speed is insane. I will include a binary (superfast) to show this. Compare running the same binary on Gopher and Stella to see the difference. I think Stella might be better with cycle counting on by default so this sort of thing doesn't happen. Of course I could be misunderstanding what's going on... but the differences between running "superfast" in the two is quite telling. I've not dug into it too much but a quick look at what's happening to the memory in the ARM, it looks like there's a value in RAM that's not being updated when cycle counting is off. It looks to be a value that's copied to address 0x82 of the VCS RAM (or maybe the other way around). That might be a clue as to what is happening. demo_video.mp4 Edited November 27, 2021 by JetSetIlly Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted November 27, 2021 Author Share Posted November 27, 2021 2 minutes ago, JetSetIlly said: demo_video.mp4 7.31 MB · 1 download Interesting, and thanks for looking. But I'm pretty sure I know what's happening... sorry I wasn't clear. I have a "code stuffer" wait loop in the 6507 display overscan/vblank, which once the regular code finishes its stuff... this "stuffer" looks at INTIM and if there's enough time left (say, 10 timer units) it calls "idle" in the C-code. In the "idle" C-code, I draw one of the sub-cubes. If the emulator does not count ARM cycles, then this "code stuffer" calls the sub-cube-draw many times, as it thinks there's plenty of unused cycles. If the emulator does count ARM cycles, then the "code stuffer" runs much slower, because it has an accurate idea of how much time is really left to do idle stuff. So, for the "superspeed" version to work properly, the ARM cycles MUST be counted. Otherwise the idle calls a gazillion sub-cube draws. For Stella versions, I disable the "code stuffer" and put the sub-cube-draw inside the overscan or vblank, and only call once or twice each frame. Quote Link to comment Share on other sites More sharing options...
+Nathan Strum Posted November 28, 2021 Share Posted November 28, 2021 Very impressive! I used to be able to solve the first two layers of a Rubik's cube, but couldn't wrap my head around the third without looking up the moves. 1 Quote Link to comment Share on other sites More sharing options...
hizzy Posted November 28, 2021 Share Posted November 28, 2021 Stunning!!!! Quote Link to comment Share on other sites More sharing options...
Jinroh Posted November 29, 2021 Share Posted November 29, 2021 Really great! My son is all about solving the cubes. He will love seeing this. Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted November 29, 2021 Author Share Posted November 29, 2021 (edited) It's a bit rickety, but! This is the first binary which has a full-rotation of a face with all colours correct. It's a bit hardwired (the colours) and I spent way too many hours on hardwiring instead of doing it properly and indexing the colour into an array. I just wanted to see it quick-n-dirty, but it turned out to be slow-n-dirty. About 6 hours all-up. Oh well. The rickety nature is partly due to the chunky pixel resolution, but also due to the hand-drawing/alignment. One day I may do it from a 3D-rendered source (or even photograph) of a cube in the various rotation positions. That should make it look smoother/cleaner. Come to think of it, would need to be an isometric (no perspective) rendering, as I use the same sub-shapes for similar surfaces. Anyway, fairly sure I can improve on this. Here's the first version, and it looks OK, I think.... don't forget, hold trigger to rotate all layers at the same time. Edit: Just noticed a face-colour error on the corner piece with green top. One of the sides changes colour. That's because... hardwire hackity hack hack error. I'll fix that up soonish. cubiks20211130.bin Edited November 29, 2021 by Andrew Davie 6 Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted November 29, 2021 Author Share Posted November 29, 2021 A short demo of all layers animating... cubiks20211129b.bin 6 Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted November 29, 2021 Author Share Posted November 29, 2021 (edited) Final version for today. This has a real cube-like feel to it. Each layer rotating independently randomly, different speeds and directions. cubiks20211129c.bin Edit: If you are running Stella you must turn on developer settings (and restart the emulator) to get the correct run-speed. It's to do with timing calculations and how the screen is drawn. On Gopher, no settings are required. Edited November 29, 2021 by Andrew Davie 5 Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted November 30, 2021 Author Share Posted November 30, 2021 (edited) Now under joystick control... UP/DOWN will highlight the layer you are controlling. LEFT/RIGHT will rotate it. If you hold the fire button and LEFT/RIGHT, that will spin the whole cube. Next up I will probably have to do the rotation animations for the other two axes. Not sure how they will look... pixel aspect ratio is tricky. After that's done then I'll have to get some sort of sensible control system going, get the colours correctly indexing into a "cube" variable, get the rotations working on that variable, add some basic reset/select functionality... and I guess it will be close to done. I guess I could add a 2x2x2 cube and even a 4x4x4 cube, too. cubiks20211130f.bin Edited November 30, 2021 by Andrew Davie 4 Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted December 1, 2021 Author Share Posted December 1, 2021 (edited) I fixed up all the pixel mis-positioning, and refined the graphics... so now the rotation looks pretty smooth. cubiks20211201.bin Edited December 1, 2021 by Andrew Davie 3 Quote Link to comment Share on other sites More sharing options...
Bomberman94 Posted December 1, 2021 Share Posted December 1, 2021 Wow - very cool what you‘ve done! Any chance for a release (demo or something) for the „real machine“? ? Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted December 1, 2021 Author Share Posted December 1, 2021 (edited) 11 minutes ago, Bomberman94 said: Wow - very cool what you‘ve done! Any chance for a release (demo or something) for the „real machine“? ? The binary should work on hardware.... put it on a Harmony Cart, for example. Edited December 1, 2021 by Andrew Davie 1 Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted December 1, 2021 Author Share Posted December 1, 2021 I've increased the screen to 276 scanlines (from 262). This reduces the frame rate from 60Hz to about 57Hz -- barely noticeable. But it dramatically increases the game speed.... ironically! Because I draw the little cubes piecemeal, when there's spare time, it takes a number of frames to draw the whole thing. Now, with 262 scanlines there's only enough time to draw 1 ... maybe 2... pieces in each of the Vertical Blank, and the Overscan. But when I increase to 276 scanlines, those two areas have way more "space" in them, and there's enough time to draw 2... maybe 3... pieces. So the game gains a doubling of speed of the draw (4 pieces per frame rather than 2). At least. And it shows in this binary... nice and zippy. Don't forget: Stella to developer mode Hold button and left/right to turn entire cube. UP/DOWN to select layer LEFT/RIGHT to rotate cubiks20211202.bin 6 Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted December 1, 2021 Author Share Posted December 1, 2021 Concept for indicating selected layer. I'm not liking it so much, but keeping a record of it for posterity Quote Link to comment Share on other sites More sharing options...
+littaum Posted December 1, 2021 Share Posted December 1, 2021 I think that arrow looks rather nice - the flashing and the arrow make it easy to tell what layer you are on (assuming the arrow could also be repurposed for vertical rotations if that is planned? ). 1 Quote Link to comment Share on other sites More sharing options...
Melvin Missile Posted December 2, 2021 Share Posted December 2, 2021 This is so cool! I wish you'd been the one coding Q*bert's Qubes! Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted December 2, 2021 Author Share Posted December 2, 2021 24 minutes ago, Melvin Missile said: This is so cool! I wish you'd been the one coding Q*bert's Qubes! Isn't someone already doing a version/update? I wouldn't want to tread on toes. Quote Link to comment Share on other sites More sharing options...
+Nathan Strum Posted December 2, 2021 Share Posted December 2, 2021 2 minutes ago, Andrew Davie said: Isn't someone already doing a version/update? I wouldn't want to tread on toes. Q*bert is being remade, but I don't think Q*bert's Qubes is being worked on. 1 1 Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted December 2, 2021 Author Share Posted December 2, 2021 Here's a version just in case @ZeroPage Homebrew put this in the news/previews section today. Show day is a lot of pressure for us poor programmers! I've smoothed out the animation a bit (more particularly, now symmetrical), and increased the speed as much as I can. cubiks20211203.bin 1 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.