90's style 3D (Now for Rev.B with USB keyboard)

13»

Comments

  • Permadi's tutorial is pretty good, but I've made some notes to make the math more clear and made into pdf.

    I've attached it to the first post for anyone who may be trying to figure this out...
  • RaymanRayman Posts: 11,103
    edited 2018-12-16 - 19:47:50
    Not too hard to turn this into a cart racing game
    2016 x 1512 - 969K
    961 x 963 - 58K
  • Mode 7 FTW :smile:
  • Awesome, : ] That's rocking.

    Ultra Rayman-Kart. *lol*
  • One nice thing about cart racing games is that half the screen can be just a blue fade, not needing hardly any memory.

    https://tcrf.net/Proto:Wacky_Wheels/Wacky_Kart

    And, the background is only a few pixels tall. That's a big memory savings...

  • The trick of these games is that you just take a 2D image and scale the image based on scanline number. The upper scanlines get scaled less, which produces "distance" and the lower scanlines get scaled more, producing "foreground".

    Combine that with fast integer rotation and you've got faux 3d perspective.

    (note, everything I know about these modes I learned from a few YT videos)
  • RaymanRayman Posts: 11,103
    edited 2018-12-17 - 20:30:27
    I think 90's Wacky Wheels is slightly more advanced than that maybe.
    The floor is not one bitmap. It's actually a bunch of 32x32 pixel tiles.
    There is a byte array map that says what kind of tile goes where.
    I've copied this approach here...

    I do have a distance to floor array for each scanline though, so it's similar in that respect...
  • Just thinking about going from 320x200 to 640x400...

    If better coding and faster clock works as hopes, should be able to go to bufferless display, like Baggers did for Wolf on P1.

    Then, can also think about 5:6:5 encoded graphical elements. So, it's words instead of bytes, not too bad a penalty.
    I'm glad to find again two really useful instructions: RGBEXP and MULPIX.
    These should allow fast expand to 24 bits and then easy darkening.
    We could then work in 24-bit color mode and ditch the palette...
  • RaymanRayman Posts: 11,103
    edited 2019-01-02 - 22:20:20
    Frame rate up to 37 fps using one cog for rendering with P2 Eval at 250 MHz.
    Here's the code.
  • jmgjmg Posts: 14,417
    Rayman wrote: »
    Frame rate up to 37 fps using one cog for rendering with P2 Eval at 250 MHz.
    Here's the code.

    Did you notice any jitter effects on the display at this lower VGA resolution ?
    Besides the 2MHz PFD solution of /10 then *125, you can also get 250MHz with /2 then *25, for higher PFD of 10MHz & less jitter.
  • Ray, do you have the textures for the demo (or were there licensing issues with them? Would you be so kind as to provide us expected dimensions, other info for them to find alternatives if so)
    Thanks a lot for putting the code for this up!

    Cheers,
    Jesse
  • RaymanRayman Posts: 11,103
    edited 2019-01-02 - 22:18:44
    Textures are in zip file. I don't there are any license issues.
    The textures are more or less an 8bpp copy of the original.
    The only trick is that they all have the same 256-color palette...

    Oops. They are not in the zip file... I'll fix that...
  • Zip now has the bmp files.
    Should be able to compile now with Fastspin.

    Notte: For PNut, some labels are too long and have to be shortened...
  • RaymanRayman Posts: 11,103
    edited 2019-01-02 - 22:23:24
    jmg: It's actually signaled as 640x480, I'm just putting out the pixels 1/2 as fast and with two copies of each row... A trick to get 320x240 effective resolution.
  • roglohrogloh Posts: 2,471
    edited 2019-01-02 - 23:14:07
    Rayman wrote: »
    Frame rate up to 37 fps using one cog for rendering with P2 Eval at 250 MHz.
    Here's the code.

    Hi @Rayman, sounds great. Had a very brief look but when I get a chance I hope to dig though this code further and try to get my head around it. But just quickly, do you expect the rendering algorithm used is readily amenable to splitting over multiple cogs in order to hit over 60fps, and to also improve frame rate for any lower clocked systems?
  • Absolutely. Each vertical line is essentially independent. You can divide the screen up into vertical stripes among cogs and easily boost frame rate.

    Only downside is that the code will become harder to follow as improvements are made...
  • This one uses P2 EV header pins as input.
    P30=right
    P22=left
    P46=forward

    It's not perfect but if you touch the pin plus 5V and ground all with one hand, it sorta works...
  • the video sometimes has jitter... Need to play with clockfreq settings...
  • Ray, what are you using to assemble this? PNut_v32i is a no go. I fought through the length of variable names, cast several things as floats, but gave up once it was griping about COG IDs.
  • There is pnut v32j which has more label space. I cannot recall how pnut responded when it ran out of label space so it may possible be the same problem.
    Everyone should be using 32j.
  • RaymanRayman Posts: 11,103
    edited 2019-01-08 - 14:41:10
    I used FastSpin
    But did get it to work on p123 with pnut after fixing labels and floats...
  • Cluso, where does one get 32j? The latest version on the sticky thread is 32i

    Ray, time for me to take a look at fast spin :) Can't wait!

    --Terry
  • Here's a version that compiles with PNUT.
  • Here is PNut_v32j.exe - not sure where I found it.
    Just remove the ".txt"
  • This version is exactly the same size as v32i... Is it really different?
  • RaymanRayman Posts: 11,103
    edited 2019-09-22 - 23:50:27
    Finally was able to combine USB with this so can use USB keyboard's WASD keys to move around!

    This took some work... Thanks to ersmith for providing a version of fastspin that works for this (in the zip file).
    Moved from pure ASM to Spin + ASM, although the Spin mostly just starts the ASM...
    Each driver is in it's own Spin file now.

    This still isn't very optimized yet in terms of using more cogs to make it faster. That might be next...

    And, of course thanks to garryj for the USB code (and getting it into 1 cog)
  • Here's a version modified for P2 Rev.B
    VGA basepin set to P0, USB keyboard basepin set to P16.
  • https://propeller.parallax.com/ has the latest version of PNut plus a bunch of other stuff.
Sign In or Register to comment.