Author Topic: YAAR (Yet Another Assembly/Axe Raycaster)  (Read 38007 times)

0 Members and 3 Guests are viewing this topic.

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: YAAR (Yet Another Axe Raycaster)
« Reply #45 on: December 14, 2010, 06:53:08 pm »
It's still pretty slow at 6MHz, it runs at about 6 FPS.

Would anyone be interested in me making an optimized hand-coded assembly version so I can make this as fast as possible? Although Axe is great and I love it, I think that it has just about reached its limits regarding speed here. I want people to be able to make really great games with this, so I want them to have the best engine possible. I would keep developing the Axe version too, and add the same features to both of them. Although the assembly one would be somewhat smaller and faster, the other would have the glory of being pure Axe. ;)
« Last Edit: December 14, 2010, 06:56:17 pm by Runer112 »

Ashbad

  • Guest
Re: YAAR (Yet Another Axe Raycaster)
« Reply #46 on: December 14, 2010, 07:24:49 pm »
I would, if I knew the math behind it :P

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: YAAR (Yet Another Axe Raycaster)
« Reply #47 on: December 15, 2010, 04:51:20 am »
Wow great! I think there should be both an Axe and assembly version. Maybe the later could be an Axiom? As for the Axe version there should be some doc on what to modify in the engine maybe.

As for parameters I think you should allow the user to

-define the camera height and if you add the later, angle
-rotation angle (obviously but I forgot how it's called :P)
-X/Y position (of course)
-quality (high or doubled pixels)
-Screen height/width
-Screen X/Y start (top/left corner)

I'm not sure if I forgot anything.

Nonetheless this is impressive. :) You should release it on ticalc.org when it's done (and maybe Omni dl section). :)
« Last Edit: December 15, 2010, 04:51:55 am by DJ Omnimaga »

Offline Ikkerens

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 378
  • Rating: +28/-9
  • JavaScript Magician
    • View Profile
    • Walotech
Re: YAAR (Yet Another Axe Raycaster)
« Reply #48 on: December 15, 2010, 06:23:34 am »
Wow great! I think there should be both an Axe and assembly version. Maybe the later could be an Axiom? As for the Axe version there should be some doc on what to modify in the engine maybe.

Seconded, future axiom? :w00t:
If you do, il love you forever (or until I forget you, or you cheat on me... xD)

Splut for Android [----------]
Paused/halted indefinitely, might be abandoned, our graphic designer quit and the rest of us simply doesn't have the time to work on it...

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: YAAR (Yet Another Axe Raycaster)
« Reply #49 on: December 15, 2010, 09:15:10 am »
This looks AWESOME, its the only word. Too bad that it already runs at full speed, i hope you can update this soon so that there more features can be added. keep up the nice job!
I'm not a nerd but I pretend:

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: YAAR (Yet Another Assembly/Axe Raycaster)
« Reply #50 on: December 16, 2010, 12:53:34 am »
Well I ported the whole thing to assembly, optimizing things as I could along the way. The hand-coded assembly engine is about 600 bytes smaller than the Axe engine, so about 2/3 of the Axe engine's size. It will undoubtedly be faster too, but I will not be able to tell how much faster until I figure out where in the approximately 750 lines of assembly code I messed it up. :-\

I'll debug it tomorrow. I worked on this for literally about 12 hours straight, so I'm exhausted.
« Last Edit: December 16, 2010, 12:56:33 am by Runer112 »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: YAAR (Yet Another Axe Raycaster)
« Reply #51 on: December 16, 2010, 01:24:38 am »
Wow 12 hours in a row? O.O I never worked that much in BASIC and BASIC was much easier to read. I can't imagine how it must be with ASM. O.O

I hope you can manage to solve the issues you're having.

Offline Mohammad

  • LV3 Member (Next: 100)
  • ***
  • Posts: 95
  • Rating: +23/-8
    • View Profile
Re: YAAR (Yet Another Axe Raycaster)
« Reply #52 on: December 16, 2010, 01:30:28 am »
can anyone tell me what a raycaster does? looks to me like 3d!!!!
whooooooaaaaaa.....blackops...racing games...3d stuff omg! can you make those?
what is the most practical 3d thing you can make with resolution this bad lol!
« Last Edit: December 16, 2010, 01:35:28 am by Mohammad »

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: YAAR (Yet Another Axe Raycaster)
« Reply #53 on: December 16, 2010, 01:51:39 am »
can anyone tell me what a raycaster does? looks to me like 3d!!!!
It does look like 3D, but is a bit more limited. If I recall correctly, moving up/down isn't possible in a raycaster.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: YAAR (Yet Another Axe Raycaster)
« Reply #54 on: December 16, 2010, 02:19:54 am »
Moving up and down is possible (there is some jumping/crouching in these screenshots too :P) but looking up and down can only be cheated

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: YAAR (Yet Another Axe Raycaster)
« Reply #55 on: December 16, 2010, 04:38:24 am »
This page might explain a bit about raycasting: http://en.wikipedia.org/wiki/Raycasting

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: YAAR (Yet Another Assembly/Axe Raycaster)
« Reply #56 on: December 17, 2010, 06:17:15 pm »
An update:

The assembly version mostly works now! I say mostly because the raycasting engine works just like the Axe engine, but sometimes it crashes, which I need to look into before releasing it.

In the assembly version, I made a lot of optimizations, especially in areas where the full 16-bit spectrum is not needed. The assembly version is about 500 bytes smaller than the Axe version, so it is about 70% of the size of the Axe engine. And by my quick test, it appears that the assembly engine runs about 30% faster than the Axe engine. Unfortunately, by my math, SLOW * 1.3 = STILL SLOW. At 6MHz, I would need about a 100% speed increase for this to run at a decent framerate. And that's with fairly low standards for "decent framerate."

I'll be constantly looking into optimizations.

(How ever did you do it Peter Bucher...)



Just for speed comparison, here are two GIFs of the two engines rendering the same 32 frames at 6MHz with no pixel doubling. As you can see, closer (and thus taller) walls have a habit of killing the FPS.

YAAXER
YAASMR
~3.1 FPS
~4.0 FPS
~3.8 FPS
~5.0 FPS
« Last Edit: December 17, 2010, 06:30:52 pm by Runer112 »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: YAAR (Yet Another Assembly/Axe Raycaster)
« Reply #57 on: December 17, 2010, 06:22:21 pm »
Awesome! Also don't worry too much about the slow speed. I don't think this should be scrapped just because it doesn't run fast enough in 6 MHz. Some SNES games ran at 4-8 FPS, after all, and some Nintendo 64 games ran at like 10-12 FPS when you didn't use the memory expansion pack. I hope you can find some optimizations, though, to make it faster, so 6 MHz users aren't limited to just RPG raycasters. :D

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: YAAR (Yet Another Assembly/Axe Raycaster)
« Reply #58 on: December 17, 2010, 06:41:05 pm »
That's interesting, my raycaster's speed always goes up when you're closer to a wall since then the rays have a shorter distance to travel. Maybe the textures have something to do with it though
« Last Edit: December 17, 2010, 06:41:18 pm by squidgetx »

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: YAAR (Yet Another Assembly/Axe Raycaster)
« Reply #59 on: December 17, 2010, 06:53:45 pm »
Yes, the textures have a lot to do with it. Even if you don't know assembly, you can probably guess that drawing an untextured wall slice:
Code: [Select]
ld de,12
DrawWallSliceLoop:
ld a,c
or (hl)
ld (hl),a
add hl,de
djnz DrawWallSliceLoop

Will run a bit faster than drawing a textured wall slice:
Code: [Select]
DrawWallSliceLoop:
ld de,(var_N)
ld bc,(var_R)
WallSpriteShiftLoop:
ld a,d
or a
jr nz,WallSpriteShiftEnd
ld hl,var_S
ld a,(hl)
or a
jr z,WallSpriteShiftEnd
dec (hl)
ld hl,(var_T)
add hl,hl
ld (var_T),hl
ex de,hl
add hl,bc
ex de,hl
jr WallSpriteShiftLoop
WallSpriteShiftEnd:
dec d
ld (var_N),de
DrawFirstWallPixel:
ld hl,(var_P)
push hl
ld bc,-plotSScreen
add hl,bc
pop hl
jr nc,DrawWallPixelSkip
ld a,(var_T+1)
rla
jr nc,DrawWallPixelSkip
ld a,(var_M)
or (hl)
ld (hl),a
DrawWallPixelSkip:
ld de,12
add hl,de
ld (var_P),hl
ld hl,(var_U)
dec hl
ld (var_U),hl
ld a,h
or l
jr nz,DrawWallSliceLoop


Because of this, my primary optimization goal is to try to do something about this.

EDIT: I already have some ideas about how to try to normalize the time drawing a wall slice takes.
« Last Edit: December 17, 2010, 07:02:37 pm by Runer112 »