Jump to content
IGNORED

Raycaster


Asmusr

Recommended Posts

3 hours ago, Asmusr said:

All I can say is that at the moment I'm interested in developing this project further. But there's currently not much to make a game from, and I don't have any specific idea for a game.

 

I think you first need sprites implemented. According to the frame rate achieved, you will be able to design a game idea that fits the constrains

Link to comment
Share on other sites

9 hours ago, jrhodes said:

"Hunt the wumpus 3D"

Yes, that is a great idea! But there are some challenges with "seeing" stuff. Or maybe signs? Could replace the overview?

But a simple shoot em up is also a start! Slow speed and speeding it up. One bady and adding on badys for next level.

Or a shoot em up that is a maze that you have to get to the end to get to the next maze. Dead ends and some of them has more amo, first aid kit and so on.

Link to comment
Share on other sites

17 hours ago, artrag said:

I think you first need sprites implemented. According to the frame rate achieved, you will be able to design a game idea that fits the constrains

Exactly. Without anything other than walls very little interaction is possible. But adding big zooming sprites using a limited number of character tiles is quite challenging.  

Link to comment
Share on other sites

I was wondering to myself how a raycaster could work in 9918A multicolor 64x48 pixel mode, if it would even be possible with its unusual screen and pattern table layout.  There would need to be a way to quickly render columns of pixels, but each character pattern contains two pixels side by side.  Suppose we process two columns at once and combine the pixels into each byte written to the pattern table.  If every other column data is pre-shifted by 4 bits, we could then bitwise-OR the two column bytes together, which should be pretty fast.  The screen table is initialized with columns of 0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5 adding 6 to every byte when moving to the next column.  Now to draw the screen, the pattern table can be written sequentially, each byte drawing two side-by side pixels, moving downward.  I coded up a screen drawing function that runs from scratchpad RAM to see how fast it goes, and I get 83190 cycles (~28ms) per screen update.  May I copy your raycasting code to test my multicolor screen drawing function?

  • Like 1
Link to comment
Share on other sites

9 hours ago, PeteE said:

I was wondering to myself how a raycaster could work in 9918A multicolor 64x48 pixel mode, if it would even be possible with its unusual screen and pattern table layout.  There would need to be a way to quickly render columns of pixels, but each character pattern contains two pixels side by side.  Suppose we process two columns at once and combine the pixels into each byte written to the pattern table.  If every other column data is pre-shifted by 4 bits, we could then bitwise-OR the two column bytes together, which should be pretty fast.  The screen table is initialized with columns of 0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5 adding 6 to every byte when moving to the next column.  Now to draw the screen, the pattern table can be written sequentially, each byte drawing two side-by side pixels, moving downward.  I coded up a screen drawing function that runs from scratchpad RAM to see how fast it goes, and I get 83190 cycles (~28ms) per screen update.  May I copy your raycasting code to test my multicolor screen drawing function?

I did that myself (a multicolor renderer without a raycaster) a while back, and I am indeed considering if that's the way to go with this project. You're welcome to try your own renderer with my code, of course.

 

 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Here's the routine I used to draw two columns given top, height and color.

 

Spoiler

********************************************************************************
*
* Display two vertical multicolor strips
*
* R3: Strip 1 structure (top, height, color)
* R4: Strip 2 structure (top, height, color)
* R14: VDPWD
* VDP write address must already be set up
*
* On return R3 and R4 are incremented by 6.
* R0-R12 are modified.
*
STRIP  MOV  R11,*R15+        * Push return address onto the stack
      MOV *R3+,R5             * Get top 1
      MOV *R4+,R6             * Get top 2
      MOV *R3+,R7             * Get bottom 1
      MOV *R4+,R8             * Get bottom 2
      MOV *R3+,R9             * Get color 1
      MOV *R4+,R10         * Get color 2
*     Two sky pixels
      C   R5,R6           * Compare top 1 and top 2
      JGT STRIP1
      MOV R5,R2           * Get number of sky rows to display from strip 1
      JMP STRIP2
STRIP1 MOV R6,R2           * Get number of sky rows to display from strip 2
STRIP2 JEQ STRIP4          * Move on if zero
      MOVB    @SKY,R1             * Get sky pixel colors
STRIP3 BL  @VDPCPY
*     One sky pixel, one strip pixel 
STRIP4 MOV R6,R2           * Get top 2
      S   R5,R2           * Top 2 - top 1
      JEQ STRI19          * If zero this section can be skipped
      JLT STRIP5          * Jump if strip 1 starts after strip 2
      MOV R9,R1            * Get color of strip 1
      SLA R1,4            * Move to 1st nybble
      SOCB    @SKY2,R1         * Combine with sky pixel colors
      MOV R6,R12          * Save top 2 as the start of next section
      JMP STRIP6
STRIP5 NEG R2             * Make counter positive
      MOV R10,R1          * Get color of strip 2
      SOCB    @SKY1,R1         * Combine with sky pixel colors
      MOV R5,R12          * Save top 1 as the start of next section
STRIP6 BL  @VDPCPY
      JMP STRIP7
STRI19 MOV R6,R12          * Save top 2 as the start of next section     
*     Two strip pixels
STRIP7 C   R7,R8           * Compare bottom 1 and bottom 2
      JGT STRIP8
      MOV R7,R2           * Get bottom 1
      S   R12,R2          * Subtract end of previous section
      JEQ STRI17          * If zero this section can be skipped
      MOV R7,R12          * Save bottom 1 as the start of next section
      JMP STRIP9
STRIP8 MOV R8,R2           * Get bottom 2
      S   R12,R2          * Subtract end of previous section
      JEQ STRI17          * If zero this section can be skipped
      MOV R8,R12          * Save bottom 2 as the start of next section
STRIP9 MOV R9,R1           * Get color of strip 1
      SLA R1,4            * Move to 1st nybble
      SOC     R10,R1          * Combine with color of strip 2
STRI10 BL  @VDPCPY
      JMP STRI11
STRI17 MOV R7,R12          * Save bottom 1 as the start of next section
*     One floor pixel, one strip pixel
STRI11 MOV R8,R2           * Get bottom 2
      S   R7,R2           * Subtract bottom 1
      JEQ STRI18          * If zero this section can be skipped
      JLT STRI12          * Jump if strip 1 ends after strip 2
      MOV R10,R1           * Get color of strip 2
      SOCB    @FLOOR1,R1       * Combine with sky pixel colors
      MOV R8,R12          * Save bottom 2 as the start of next section
      JMP STRI13
STRI12 NEG R2             * Make counter positive
      MOV R9,R1            * Get color of strip 1
      SLA R1,4            * Move to 1st nybble
      SOCB    @FLOOR2,R1       * Combine with sky pixel colors
      MOV R7,R12          * Save bottom1 as the start of next section
STRI13 BL  @VDPCPY
      JMP STRI14
STRI18 MOV R8,R12          * Save bottom 2 as the start of next section      
*     Two floor pixels
STRI14 LI  R2,48
      S   R12,R2
      JEQ STRI16
      MOVB    @FLOOR,R1
STRI15 BL  @VDPCPY
*     Return
STRI16 DECT R15                * Pop return address off the stack
      MOV  *R15,R11
       B   *R11

SKY       BYTE    >77
SKY1   BYTE    >70
SKY2   BYTE    >07
FLOOR  BYTE    >EE
FLOOR1 BYTE    >E0
FLOOR2 BYTE    >0E

*// STRIP

*********************************************************************
*
* Fast VDP copy
*
* R1: Byte to copy (in MSB)
* R2: Number of bytes to copy
* R14: VDPWD address
*
VDPCP  MOV R2,R0
      SRL R0,3            * Number of groups of 8
      JEQ VDPC2
VDPC1  MOVB    R1,*R14
      MOVB    R1,*R14
      MOVB    R1,*R14
      MOVB    R1,*R14
      MOVB    R1,*R14
      MOVB    R1,*R14
      MOVB    R1,*R14
      MOVB    R1,*R14
      DEC R0
      JNE VDPC1
      ANDI    R2,>0007         * Isolate number of remaining bytes
      JEQ VDPC3
VDPC2  MOVB    R1,*R14
      DEC R2
      JNE VDPC2
VDPC3  B   *R11
VDPCPE
*// VDPCP

 

Link to comment
Share on other sites

Here's the latest version. I don't have time to write about it now, but it's progressing really well. I fixed an issue with the height calculation which means that the walls are no longer rounded.

 

 

Your challenge for today: find the two multi color striped areas. 

raycaster.rpk raycaster8.bin

Edited by Asmusr
  • Like 11
Link to comment
Share on other sites

This really a cool project, thanks asmusr for working on this and congrats of making it work!

 

Incidentally it also is a pretty much perfect test platform my new project, the StrangeCart cartridge for the TI-99/4A. This is something I wanted to try out for ages, but got around of implementing it only now.

Here I have my TI-99/4A running your raycaster from the StrangeCart cartridge. 32k RAM expansion is provided by ET-PEB. The USB cables are used for debugging the cartridge and not needed to run.

large.IMG_1123-1.jpg.cf567a7ef1a79674b02ea3a8ddcb96c5.jpg

Edited by speccery
  • Like 4
Link to comment
Share on other sites

2 hours ago, Asmusr said:

Here's the latest version. I don't have time to write about it now, but it's progressing really well. I fixed an issue with the height calculation which means that the walls are no longer rounded.

 

 

The challenge for today: find the two multi color striped areas. 

raycaster.rpk 7.34 kB · 2 downloads raycaster8.bin 32 kB · 3 downloads

Spear of DesTI99y ;-)

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

4 hours ago, Asmusr said:

Here's the latest version. I don't have time to write about it now, but it's progressing really well. I fixed an issue with the height calculation which means that the walls are no longer rounded.

That's pretty great.. just a few years ago we still weren't sure this was even feasible, and there it is, better than we could have hoped! ;)

  • Like 7
Link to comment
Share on other sites

It's interesting that this doesn't really require 32K RAM. As my code is now it does, but I think it could run almost as fine from a ROM cart. The only updated data in 32K are the positions of the enemies, and those could be moved to VDP RAM.

  • Like 4
Link to comment
Share on other sites

  • 2 weeks later...

I'm experimenting with various things. One is the floor pattern, as you will see.

 

You can also shoot the baddies now, but the baddies can't shoot you. 

 

Spoiler

And for fun you can also shoot the walls. That means you can break out of the map. I'm displaying your current memory address at the top right corner. You can walk out of lower RAM and into DSR space at >4000. When you reach the cartridge area at >6000 you may experience "black ice" in the shape of immutable memory. Maybe you can find you way into the busy >8300 region, and travel on to the >A000 region and kill the evil program?

 

 

raycaster.rpk raycaster8.bin raycaster.dsk

  • Like 5
Link to comment
Share on other sites

On 5/16/2020 at 7:29 PM, Elia Spallanzani fdt said:

Fantastic. Just one thing: the weapon shouldn't jump when you're stationary.

 

On 5/16/2020 at 7:35 PM, Asmusr said:

I use the weapon to see the frame rate.

Ok. The weapon should move up and down more slowly as you walk. And the weapon should be still, when you stand still or turn (without walking). ;)

 

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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