Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
21 May, 2013, 11:25:50 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1] 2 3 ... 9   Go Down
  Print  
Author Topic: Axe Raycaster -  (Read 7341 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
squidgetx
Food.
Coder Of Tomorrow
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: 28 April, 2013, 23:50:38
Date Registered: 30 May, 2010, 19:54:18
Location: eating somewhere
Posts: 1829


Topic starter
Total Post Ratings: +476

View Profile
« on: 03 December, 2010, 14:16:28 »
+7

*ahem* introducing a little side project I've been working on: a raycasting engine in Axe Cheesy
Runs faster on 15Mhz models (maybe a little too fast) and a bit slower on 6mhz models (almost too slow  Tongue)
It's very basic right now, and supports single color walls (no textures or sprites), but it does have collision testing and all the basic features of a raycasting engine Cheesy (rotation, moving, etc.) and can be used to make a (sort of) enterntaining maze game Wink It only uses the first 80 columns of the screen (for speed, and because I'm too lazy to change it. Also I'm sure this area could be used when making a real game for a user display or something)



use left/right to turn, up/down to go forward/backwards respectively. You can press Mode to view the map, and 2nd to quit the map. Press clear to exit the game.

Maps are currently 96x64, and the program will take the picture from OS Pic3 to be the map.

Source is in....RAYSRC, executable is in RAY (nostub) A sample map is included

Currently sits at under 1000 bytes Grin

Things I might add sometime are textures (or at least another color of wall), scaled sprites (not too sure how that will work), and fixing any bugs you guys find. The only bug I've found so far is that everything looks kind of distorted if you get too close to it Tongue

* RAY.8xp (1.02 KB - downloaded 78 times.)
* ARsamplemap.8xi (0.81 KB - downloaded 75 times.)
* RAYSRC.8xp (0.46 KB - downloaded 84 times.)
« Last Edit: 03 December, 2010, 14:17:43 by squidgetx » Logged

Read my webcomic! | My SoundCloud
Projects:

Check out the demo now!- Current progress: battle engine and stuff
Proud author of: Cuberunner | SpaceDash | The Psyche | XXEdit | AxeSynth | StickNinja | Gravity Guy | Embers:Phoenix | Zombie Gun
Axe: Need help optimizing?
User of Axe | zStart | TokenIDE | CalcGS | MirageOS
Happybobjr
James Oldiges
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 00:12:04
Date Registered: 01 June, 2010, 00:52:05
Location: IN, United States
Posts: 2273


Total Post Ratings: +100

View Profile
« Reply #1 on: 03 December, 2010, 14:45:11 »
0

cool good job.

downloading to wabbit at my school.
Logged

School: East Central High School

Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Non-Cas |||  OS: 1.1 |||  Build: Old  |||  84+ keypad.   Being lent out
____________________________________________________________
SirCmpwn
Guest
« Reply #2 on: 03 December, 2010, 15:41:10 »
0

Very nice!
Logged
Yeong
Eternally Young Scarlet Moon
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

Gender: Male
Last Login: Yesterday at 01:44:48
Date Registered: 15 October, 2010, 04:29:49
Location: Arden, NC
Posts: 3694


Total Post Ratings: +260

View Profile
« Reply #3 on: 03 December, 2010, 17:12:59 »
0

starts with nspire raycaster, and now the axe one...
*Yeong assumes that there will be FPS games for Axe later
Logged

Project Redemption....

My project progresses:HERE
My Pastebin stuffs:HERE
Check your rate: HERE
My Animations: HERE
Spoiler for Images :D:

ノ◕ヮ◕)ノ:・゚ PENGUIN WAVE!!:„ø¤º°¨ ¨°º¤KEEP THE PENGUIN GOING ¸„ø¤º°¨ ¨°º¤øº LETS GO PENGUIN !¤¤º°¨¨°º¤øº¤ø„¸¸ø¤º°¨„ ø¤º°¨¨°º
aeTIos
You got stair'd!
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

Gender: Male
Last Login: Today at 10:31:39
Date Registered: 15 September, 2010, 06:00:00
Location: Netherlands, Overijssel
Posts: 3111


Total Post Ratings: +120

View Profile
« Reply #4 on: 03 December, 2010, 17:16:50 »
0

starts with nspire raycaster, and now the axe one...
*Yeong assumes that there will be FPS games for Axe later
Of course they will be here!
Logged

If something above sounds rude, feel free to vote it down, it was not meant to be rude<<lolol
--Always stay relAXEd!--


Spoiler for Hidden:


[







Spoiler for Still Alive:
This was a triumph.
I'm making a note here: HUGE SUCCESS.
It's hard to overstate my satisfaction.

Aperture Science:
We do what we must because we can.
For the good of all of us
Except the ones who are dead.

But there's no sense crying over every mistake
You just keep on trying till you run out of cake
And the science gets done and you make a neat gun
For the people who are still alive.

I'm not even angry.
I'm being so sincere right now.
Even though you broke my heart and killed me.
And tore me to pieces.
And threw every piece into a fire.
As they burned it hurt because
I was so happy for you.

Now these points of data make a beautiful line
And we're out of beta we're releasing on time.
So I'm GLaD I got burned think of all the things we learned
For the people who are still alive.

Go ahead and leave me.
I think I prefer to stay inside.
Maybe you'll find someone else to help you.
Maybe Black Mesa -
THAT WAS A JOKE. HA HA, FAT CHANCE.
Anyway, this cake is great:
It's so delicious and moist.

Look at me still talking when there's science to do.
When I look out there it makes me GLaD I'm not you.
I've experiments to run there is research to be done
On the people who are still alive

And believe me I am still alive.
I'm doing science and I'm still alive.
I feel FANTASTIC and I'm still alive.
While you're dying I'll be still alive.
And when you're dead I will be still alive.

Still alive
Still alive
Yeong
Eternally Young Scarlet Moon
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

Gender: Male
Last Login: Yesterday at 01:44:48
Date Registered: 15 October, 2010, 04:29:49
Location: Arden, NC
Posts: 3694


Total Post Ratings: +260

View Profile
« Reply #5 on: 03 December, 2010, 17:19:29 »
0

CoD games....? O_o
Logged

Project Redemption....

My project progresses:HERE
My Pastebin stuffs:HERE
Check your rate: HERE
My Animations: HERE
Spoiler for Images :D:

ノ◕ヮ◕)ノ:・゚ PENGUIN WAVE!!:„ø¤º°¨ ¨°º¤KEEP THE PENGUIN GOING ¸„ø¤º°¨ ¨°º¤øº LETS GO PENGUIN !¤¤º°¨¨°º¤øº¤ø„¸¸ø¤º°¨„ ø¤º°¨¨°º
squidgetx
Food.
Coder Of Tomorrow
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: 28 April, 2013, 23:50:38
Date Registered: 30 May, 2010, 19:54:18
Location: eating somewhere
Posts: 1829


Topic starter
Total Post Ratings: +476

View Profile
« Reply #6 on: 04 December, 2010, 01:06:05 »
+1

Actually worked on this quite a bit today: I've added shading according to distance and lengthened your line of sight. I've also located the bug that may cause some of the distortion but I haven't managed to fix it yet Tongue


* axeraycaster2.gif (379.48 KB, 192x128 - viewed 678 times.)
* RAY15.8xp (1.11 KB - downloaded 61 times.)
Logged

Read my webcomic! | My SoundCloud
Projects:

Check out the demo now!- Current progress: battle engine and stuff
Proud author of: Cuberunner | SpaceDash | The Psyche | XXEdit | AxeSynth | StickNinja | Gravity Guy | Embers:Phoenix | Zombie Gun
Axe: Need help optimizing?
User of Axe | zStart | TokenIDE | CalcGS | MirageOS
Runer112
Anti-Riot Squad
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 07:41:21
Date Registered: 02 July, 2009, 06:38:05
Posts: 1679


Total Post Ratings: +492

View Profile
« Reply #7 on: 04 December, 2010, 01:08:04 »
+2

A while ago I was toying with the idea of a raycaster in Axe, but I couldn't get the math right. Looking at your source code now, it makes so much sense.

I figured the least I could do to help was to give it a bit more kick Wink I could hardly avoid from crashing into walls it was so fast.


* Raycaster Speed Boost.gif (514.02 KB, 192x128 - viewed 692 times.)
« Last Edit: 04 December, 2010, 01:10:15 by Runer112 » Logged
squidgetx
Food.
Coder Of Tomorrow
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: 28 April, 2013, 23:50:38
Date Registered: 30 May, 2010, 19:54:18
Location: eating somewhere
Posts: 1829


Topic starter
Total Post Ratings: +476

View Profile
« Reply #8 on: 04 December, 2010, 01:09:40 »
0

holy...... Shocked how did you do that?
« Last Edit: 04 December, 2010, 01:10:36 by squidgetx » Logged

Read my webcomic! | My SoundCloud
Projects:

Check out the demo now!- Current progress: battle engine and stuff
Proud author of: Cuberunner | SpaceDash | The Psyche | XXEdit | AxeSynth | StickNinja | Gravity Guy | Embers:Phoenix | Zombie Gun
Axe: Need help optimizing?
User of Axe | zStart | TokenIDE | CalcGS | MirageOS
ztrumpet
The Rarely Active One
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: 23 April, 2013, 16:09:52
Date Registered: 08 November, 2009, 21:10:12
Location: Michigan
Posts: 5687


Total Post Ratings: +360

View Profile
« Reply #9 on: 04 December, 2010, 01:10:40 »
0

That looks awesome!  Nice job squidgetx! Grin

Edit: Wow, Runer, that's quick! Afro
« Last Edit: 04 December, 2010, 01:11:14 by ztrumpet » Logged

Munchor
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: 07 May, 2013, 22:49:01
Date Registered: 16 October, 2010, 15:39:13
Location: Position
Posts: 6209


Total Post Ratings: +174

View Profile
« Reply #10 on: 04 December, 2010, 01:19:55 »
0

Hum... Axe Doom?Huh?

Very good job! Now, i have a doubt, is the map repeating a few times?


* maprepeat.gif (81.59 KB, 192x128 - viewed 649 times.)
Logged
Runer112
Anti-Riot Squad
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 07:41:21
Date Registered: 02 July, 2009, 06:38:05
Posts: 1679


Total Post Ratings: +492

View Profile
« Reply #11 on: 04 December, 2010, 01:25:36 »
+1

Well that's at 15MHz, so it runs really fast. But I did some rough testing and my modification makes it run about twice as fast at either 6MHz or 15MHz.

I figured that the slowest part of the engine was probably drawing the lines, so I decided to work on that. I did cheat a bit, though, because the speed boost was from a hand-written assembly routine. It took me a few hours, but I managed to make a special case vertical line drawing routine. For drawing vertical lines, it's on average probably 5-10x faster than the normal line drawing routine. I might submit it to Quigibo so he can add it as a built-in feature, although I don't know if it has enough circumstances in which it would be useful to warrant its addition into the standard command set. But then using it wouldn't be cheating any more. Wink

Anyways, I don't think Axioms are working right now so I had to sort of hack together a method to use it as a fake Axiom.

1
2
3
4
5
6
7
8
9
10
11
12
.X coordinate
Z-{L1}+40Asm(E5)
32/E→H
.Y1 coordinate
32-HAsm(E5)
.Y2 coordinate
H+32sub(VL)
... Later in the code, as a subroutine:
Lbl VL
Asm(D1C1EBE3C501A0FF093856E3AFCB7C2803676F3CCB7A2805B72046575FAF0EC00930033D676FEB093005B72034626A7B953003ED44EB3C012C8F545D29192929095FC13E0747A157A90F0F0F4F094204AF3F1F10FD4F43110C0079B6771910FAC9E1)
Return


EDIT: I just realized that you could draw rectangles of width 1, too. It's slower than this routine, but it's built-in, simpler to use, and still a good deal faster at drawing vertical lines than the line routine.
« Last Edit: 04 December, 2010, 02:10:17 by Runer112 » Logged
meishe91
Super Ninja
Members
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 02 May, 2013, 23:54:14
Date Registered: 05 March, 2010, 05:39:48
Posts: 2965


Total Post Ratings: +102

View Profile WWW
« Reply #12 on: 04 December, 2010, 02:24:47 »
0

Wow, that is really neat Smiley Great job on it Cheesy Keep up the good work. Can't wait to see what this leads too.
Logged





For the 51st time, that is not my card! (Magic Joke)
squidgetx
Food.
Coder Of Tomorrow
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: 28 April, 2013, 23:50:38
Date Registered: 30 May, 2010, 19:54:18
Location: eating somewhere
Posts: 1829


Topic starter
Total Post Ratings: +476

View Profile
« Reply #13 on: 04 December, 2010, 02:43:13 »
0

And I was thinking....If only there was a super-optimized vertical line command Wink

Now if I am understanding your code correctly, Runer, I put Asm(E5) after the X coordinate, put the height into H, put Asm(E5) after the first Y coordinate, then the massive Asm() block in VL after the 2nd Y coordinate, right? Thanks....I'll be sure to credit you if this ever goes anywhere.

Next, scaled sprites.....

Oh and if anyone could help me with this bug/flaw in the algorithm:

You may notice that the height of the lines drawn on the screen are based on E, or R in the updated version, which is the length of the terminated ray. However, this is inaccurate: it should be based on the straight distance of the triangle instead:

______
|    /
|   /
|Z /
| /
|/
player

So you'd think that I'd then multiply the E (or R) value by cos(Z)/128, but it doesn't seem to be working...is there anything wrong with my trig?

Oh and @Scout David, the map isn't repeating Tongue the beginning just has two parts that are the same Tongue
« Last Edit: 04 December, 2010, 03:10:45 by squidgetx » Logged

Read my webcomic! | My SoundCloud
Projects:

Check out the demo now!- Current progress: battle engine and stuff
Proud author of: Cuberunner | SpaceDash | The Psyche | XXEdit | AxeSynth | StickNinja | Gravity Guy | Embers:Phoenix | Zombie Gun
Axe: Need help optimizing?
User of Axe | zStart | TokenIDE | CalcGS | MirageOS
Runer112
Anti-Riot Squad
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 07:41:21
Date Registered: 02 July, 2009, 06:38:05
Posts: 1679


Total Post Ratings: +492

View Profile
« Reply #14 on: 04 December, 2010, 04:15:13 »
0

I noticed that bug/flaw too and tried to correct it, but it didn't work right for me.

I noticed another part of your code that could be improved upon, though. And this may actually be the cause of the above fix still not looking right. (Possibly not, though.) When you advance the ray, it doesn't always return a very accurate distance to the wall it collided with because of the relatively large, constant step system you use to advance the ray. You could reduce the step size, but then calculations would be much slower.

The method most commonly accepted as the quickest and most accurace raytracing method is to track where the ray hits cell boundaries. I'm not really sure how to explain it accurately without confusing both you and myself, so I made a picture instead.

The ideal method of tracing infinitely small steps is on the left. Your method of following a constant step size is in the middle. As you can see, the two illustrated rays will return the same length, although they clearly are not the same length. And the method that seems to be generally accepted as the best raytracing method is on the right. I've always had trouble wrapping my head around how to correctly implement that, but if you succeed, it should work quite well and speedily.


* Raycasting_Ray_Collision_Detection.png (1.08 KB, 375x152 - viewed 609 times.)
« Last Edit: 04 December, 2010, 14:26:17 by Runer112 » Logged
Pages: [1] 2 3 ... 9   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.302 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.