Floormapping optimization. - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html) +--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html) +--- Thread: Floormapping optimization. (/thread-629.html) |
Floormapping optimization. - Ninkazu - 04-13-2003 Hey, I decided to join this place after some nudging from Mofu, so... I guess I'll start out with a question. How can I optimize this floormapping code to be realllly reallllllly fast, like pasco's floormapper? Note: I tried to make this pure qb, but I wouldn't let me blit the buffer to the screen with PUT, so I had to use gslib's pcopy. ::EDIT:: Ok, I fixed it, code updated. ::EDIT 2:: Lithium gave me some advice on the MOD, so that's updated. Code: '$DYNAMIC You left a real slow line... - Jark - 04-18-2003 1920/4 = 480. I think this line is definitely slow ;-) My .0002 pence... I'm a lucky guy... - Jark - 04-18-2003 the graphics I handle take at least 30 minutes per view, the longuest times being the Buddhabot views that take several days for a 400x400 image... Check the Kofman's final QB project thread : I really wonder about ASM vs explicit languages and that speed issue. Re: You left a real slow line... - Ninkazu - 04-18-2003 Quote:1920/4 = 480. I think this line is definitely slow ;-) Um, that's just to make the view line up down the middle and is only run once upon initialization. this might not help at all, but... - Meg - 04-18-2003 ... the entirety of the "slowness" of this program lies in the loops, not in the commands. if you take out all the commands, and just leave in the loops, it hardly makes it run any faster. I'm sure you prolly knew that already, but if it helps, cool. *peace* Meg. thing #1 - Meg - 04-18-2003 Code: PlayerX = PlayerX + 10 * Cosine(PlayerAngle) You could take out the two multiplications inside the loop by creating arrays outside of the loop, Cosine10() and Sine10() *peace* Meg. Floormapping optimization. - Ninkazu - 04-18-2003 Thanks, it just sped it up a little though :/ after a few minutes... - Meg - 04-18-2003 I've been playing around a bit with your code, trying to speed it up. I've managed to just about double the speed. I'm sure there's got to be a way to make it go even faster, but I don't know anything about trig or using the POKE command. So, without changing those things, this is the best I could do: Code: '$DYNAMIC Hope that helps! *peace* Meg. oh - Meg - 04-18-2003 I think i might have removed a line underneath Code: xang = PlayerAngle - 159 that you'd want to put back in. By the way, if you could figure out some way of making these lines Code: vx = ABS(PlayerX + Raylength(y) * Cosine(xang)) run faster, you'd have your problem solved. Those operations are what's making it run so slowly. *peace* Meg. Floormapping optimization. - na_th_an - 04-18-2003 You can replace any "x MOD 64" for "x AND 63". |