Sporadic Posted September 1, 2015 Share Posted September 1, 2015 (edited) Hi all, I've ported this engine to Android before and it went well. ahhhhh modern tech where you don't have to care..... I thought for a laugh I would port it to rb+. Cause I hate myself like that lmao Managed to get it from 0.25 FPS up to a full 1 FPS before giving up. The main gain was switching from real time COS/SIN functions to lookup tables to store the values the engine needs. Still not enough though. If anyone fancies the challenge, see if you can make this faster lololololol Perhaps removing all the floats might be a good start? who knows... I already reduced the 320x240 res down to 80x240 (using 4px wide sprites) so it looks nice and blocky. It's based off the widely available java source out on the interwebz - but i've included it in the project for completeness. DPad to Move like some kind of swamp thing..... I've not even bothered testing on a real Jag for obvious reasons. Maybe I should put my bank holidays to better use in the future (didn't take long though i'm happy to say) EDIT: Although I have also ported this one before (non-textured version) to another platform too and the code looks like it might be more efficient. Damn, that's my next holiday gone..... 1fps Low Rez RayCaster.zip Edited September 1, 2015 by Sporadic 4 Quote Link to comment Share on other sites More sharing options...
ggn Posted September 1, 2015 Share Posted September 1, 2015 (edited) If you could only see the smirk in my face right now . Now, make a 0.5fps doom 3 port and you'll win the internets . (will add to the ever growing rb+ examples if it's ok with you) [EDIT] Changing the sine/cosine tables to 16.16 fixed point doesn't seem too impossible either - just needs a bit of time and motivation! Edited September 1, 2015 by ggn 2 Quote Link to comment Share on other sites More sharing options...
Sporadic Posted September 1, 2015 Author Share Posted September 1, 2015 If you could only see the smirk in my face right now . Now, make a 0.5fps doom 3 port and you'll win the internets . (will add to the ever growing rb+ examples if it's ok with you) Hahaha do what you will with it. Not sure its of much use to anyone except an example of what not to do Would be great to get something like that moving well. The other one I linked to was actually better code so I may try porting that one day..... 1 Quote Link to comment Share on other sites More sharing options...
Sporadic Posted September 1, 2015 Author Share Posted September 1, 2015 (edited) Still not sure how much it will help the speed because to draw the screen it loops 80 times (for each ray) and for each of those it steps forward until a wall is found. That stepping loop may be quicker on the other code I linked to as it only steps on the joins of the array grid. That looping and stepping is a killer Edited September 1, 2015 by Sporadic Quote Link to comment Share on other sites More sharing options...
sh3-rg Posted September 1, 2015 Share Posted September 1, 2015 I'm away for a few days with only my lappy and VJ for company. Will deffo check this out, thanks again for sharing! 1 Quote Link to comment Share on other sites More sharing options...
Sporadic Posted September 1, 2015 Author Share Posted September 1, 2015 I'm away for a few days with only my lappy and VJ for company. Will deffo check this out, thanks again for sharing! Excellent 1 Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted September 1, 2015 Share Posted September 1, 2015 Get rid of the floating point and it'll fly! 2 Quote Link to comment Share on other sites More sharing options...
Sporadic Posted September 1, 2015 Author Share Posted September 1, 2015 If I port the other method, I'll definately post that too. Perhaps I need to get fluent in fixed point math. Not had an excuse to bother in the past 2 Quote Link to comment Share on other sites More sharing options...
ggn Posted September 1, 2015 Share Posted September 1, 2015 If I port the other method, I'll definately post that too. Perhaps I need to get fluent in fixed point math. Not had an excuse to bother in the past Fixed point arithmetic is the spawn of Satan! ...but you learn to live with it . 1 Quote Link to comment Share on other sites More sharing options...
Sporadic Posted September 2, 2015 Author Share Posted September 2, 2015 Here is the second RayCaster example I said i'd do. This is based off Lode's tutorial found here. To me this looks faster overall (more stable with whatever is on screen) - doesn't slow down when long corridors appear. It's still slow but it might sometimes reach a whole 2fps lol. I haven't bothered removing the floats yet and changing things to fixed point. To start with I just wanted to get it working and remove any functions for quick wins. Hence the precomputed COS and SIN value variables. Unfortunately the function that's left is a SQRT function, which are slow as shit, plus its a float version. I tried a couple of other implementations but they didn't look right so left as is for now. Anyway, this one looks a bit better, it has different coloured walls depending on the face/side of the wall. DPAD to move like swamp things slightly younger brother... Still not bothered testing on real hardware. I don't have a fire extinguisher handy. 1-2 fps Low Rez RayCaster v2.zip 3 Quote Link to comment Share on other sites More sharing options...
ggn Posted September 2, 2015 Share Posted September 2, 2015 MOAR 2 Quote Link to comment Share on other sites More sharing options...
Sporadic Posted September 2, 2015 Author Share Posted September 2, 2015 As long as the framerate keeps doubling, we're golden 4 Quote Link to comment Share on other sites More sharing options...
Shamus Posted September 2, 2015 Share Posted September 2, 2015 Good luck with that. 1 Quote Link to comment Share on other sites More sharing options...
Zerosquare Posted September 2, 2015 Share Posted September 2, 2015 I'm sure he'll just use VJ and buy faster hardware until it runs at 60 fps Quote Link to comment Share on other sites More sharing options...
Sporadic Posted September 3, 2015 Author Share Posted September 3, 2015 As a learning exercise, the fixed point conversion has started (using the second project). I don't expect it to make much difference but it's a good example to learn with. 1 Quote Link to comment Share on other sites More sharing options...
ggn Posted September 4, 2015 Share Posted September 4, 2015 Well it'll be interesting if the framerate can be bumped up to 2fps 1 Quote Link to comment Share on other sites More sharing options...
TXG/MNX Posted September 5, 2015 Share Posted September 5, 2015 When the float math would be replaced by fixed point and maybe pre-calculated tables it could reach 2fps or more... Sent from UMI hammer with Tapatalk Quote Link to comment Share on other sites More sharing options...
Sporadic Posted November 3, 2016 Author Share Posted November 3, 2016 Been wanting to try this for a while and had time today - made for a good side project distraction. Changes; - Have changed all math to fixed point and added more precalcs. - (Offline) randomly generated maze. - Shaded Walls - A or C to Strafe - 0 to disable floor The upshot of the fixed point math? I think the FPS is now in double figures! Not bad for BASIC There's other things i'd like to try with this, but i'd best get back to finishing other stuff first. Binary attached for your consumption.... Sporadic FP Raycaster 031116.abs 9 Quote Link to comment Share on other sites More sharing options...
+CyranoJ Posted November 3, 2016 Share Posted November 3, 2016 Nice work! And a binary as well 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.