![]() |
|
Raycasting problems |
MiquelFire
Member #3,110
January 2003
![]() |
You forgot the image TF --- |
Thomas Fjellstrom
Member #476
June 2000
![]() |
sory and by green, almost teal, the two blocks, one at the top, and one at the bottom... -- |
23yrold3yrold
Member #1,134
March 2001
![]() |
Yikes O_o I see nothing like that when I'm playing ... just nice gray walls ... -- |
aybabtu
Member #2,891
November 2002
|
23 said: Sweet mother, aybabtu, why does your code run at 0 FPS?!? Um...did you run the binary or compile the code? The binary is a DOS binary (DJGPP, remember?), so if you have winXP or 2000 or something, it probly won't work.:P |
23yrold3yrold
Member #1,134
March 2001
![]() |
I ran the binary, and use Win98. -- |
Peter Hull
Member #1,136
March 2001
|
Chris, Can you explain what you're doing in DrawSlice? I can't figure it out (my fault void DrawSlice(BITMAP* buffer, BITMAP* texture, int xoff, int x, int y, int tall) { stretch_blit(texture, buffer, xoff, 0, 1, 64, x, y, 1,tall); } but I may not have compiled yours with the correct optimisation. Also it rotated the textures by 90 compared to yours. Pete
|
Trezker
Member #1,739
December 2001
![]() |
I compared your raycaster with mine. And my engine has quite a bit of usefull features you might want to have a closer look at. |
23yrold3yrold
Member #1,134
March 2001
![]() |
I get better fps my way over using stretch_blit() (about 50% better). The rotation is because I treat rows like columns in DrawSlice() due to Bob's suggestion. Otherwise I'm doing evil cache missing or something Anyway, DrawSlice is based off my Bresenham line drawing code to step through the column pixels and get the right texture pixel to draw. It's not too difficult to figure out, methinks. If it still confuses you, post in my "Math help, please" thread since this one's getting a little long Trezker: Yes, I should look at your code closer; thanks for reminding me -- |
Thomas Fjellstrom
Member #476
June 2000
![]() |
So, have you figured out whats up with the funky colors? Since you say its supposed to be shaded? -- |
23yrold3yrold
Member #1,134
March 2001
![]() |
I took the shading out of that code, TF. I don't see that for the life of me when I run it. Can't duplicate the error at all. Are you using my gray stone texture? -- |
Trezker
Member #1,739
December 2001
![]() |
Nice, the stretch_blit is tha main bottleneck in my code. That's why I don't let the player closer than 2 units, each block is 64, from the walls. If I use a better method, it'll do alot. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
what grey stone texture? -- |
23yrold3yrold
Member #1,134
March 2001
![]() |
The one in my last zip (at miran's request)? -- |
aybabtu
Member #2,891
November 2002
|
Quote: I compared your raycaster with mine. Hey...so am I! I know my casting method is far from the best, but 50-64 FPS is fine by me. Wow...400? You're useing the "right" method, huh? I'm gonna check out your source... 23 said: I ran the binary, and use Win98. Geez! That's crazy! It runs on both my old 586 (Win95) and my family's computer (Win98SE). Crazy... |
Steve Terry
Member #1,989
March 2002
![]() |
hey just tested it, looks great, but you may want to actually put a fps limiter on there to make it always run at 60fps or something, because when I'm moving around you don't go forward smoothly, for instance you go around a corner where the fps goes from 60 to 90, you run into it because a sudden change in velocity. Anyway nice little demo ___________________________________ |
aybabtu
Member #2,891
November 2002
|
Holy CRAP! A 30 frame jump! Wow...didn't think I'd see the day...well okay! If it's becomming a problem, I'll put a limit...! YAY! I think I've coaxed another frame per second out of it. In my raycasting while loop, I had it testing to see if the_x and the_y were hitting a tile, but, if they do, the inside of the loop catches it and breaks out of it. So, I eliminated 2 divisions (well, shifts), and a usless conditional...it runs a little bit faster...I think. EDIT: |
Ace
Member #1,781
December 2001
![]() |
Pfffft, PI.... round that thing down to 3 and call it a day. Seriously though, using a long PI will definately give you more precision, there's only show much precision that's going to show up. Ten decimals should be plenty, probably overkill. Edit: Dear lord... I'm going to have nightmares about pi tonight. In it, I'm going to be traveling through a raycasted dungeon and I'll run into various 2^1/2 enemies and when I finally get to the boss room, PI will be standing in the middle of it, carrying a missle launcher. Too bad I'm out of bullets and I'm done to 5% health. - Ace |
aybabtu
Member #2,891
November 2002
|
Quote: Pfffft, PI.... round that thing down to 3 and call it a day.
Heheheheh. EDIT: How long with Matthew let a thread go to...I see that Bruce Perry's "My avatar" thread is well over 200... EDIT2: Quote: Dear lord... I'm going to have nightmares about pi tonight. Yes! How dare you insult teh almighty PI!? Round down to 3...bah! |
23yrold3yrold
Member #1,134
March 2001
![]() |
Well, this thread is still on-topic -- |
Thomas Harte
Member #33
April 2000
![]() |
Quote: Anyway, DrawSlice is based off my Bresenham line drawing code Wolfenstein uses the broad equivalent of compiled sprites for every possible sized slice of every possible texture. But I'd dare imagine it uses some super-clever assumptions about run length stuff which Allegro does not with its compiled sprites - or else it couldn't possibly fit all that code into memory. How many different textures does the average Wolfenstein level have? And has this thread yet discussed the ways of inserting sprites and doors into the world? [My site] [Tetrominoes] |
23yrold3yrold
Member #1,134
March 2001
![]() |
Quote: And has this thread yet discussed the ways of inserting sprites and doors into the world? Unfortunately, no. -- |
Zaphos
Member #1,468
August 2001
|
Well, a very primative technique of drawing a baddie would be to: Of course, this technique is designed with same-height enemies in mind, and cannot have a taller enemy peeking over a wall or another baddie. But then, it's probably good enough for your average wolfenstein clone.
|
23yrold3yrold
Member #1,134
March 2001
![]() |
Actually, I would just draw the enemies back to front, since you can see one enemy behind another because of transparency. You're keeping an array of distances to walls anyway, just grab all the enemies in your line of sight, get distances, draw back-to-front slice by slice, and I guess you got it. -- |
Karel
Member #3,624
June 2003
|
I get around 70 fps with 1 frameskip and over 200 fps with 5 frameskips, with and without vync. 'Course, I'm on an Athlon 1800+ |
Zaphos
Member #1,468
August 2001
|
23: Oh, right. Heh, silly me and my rectangular enemies.
|
|
|