Asmusr Posted April 10, 2017 Share Posted April 10, 2017 I have been looking into how to implement a raycaster for the F18A GPU since Omega suggested this again the other day. It's definitely something the F18A has the power to do, but as far as I can tell the problem is precision. My starting point was this tutorial, but I find it difficult to fit the calculations into 16 bit. I have implemented the algorithm in Java, and it's working fine with floating point numbers, but when try to change the calculations to use fixed point 16-bit numbers (with 32-bit support for mul and div) I'm getting overflows all the time. I also have the source code for the Wolfie3D raycaster that The Mole made in c. This is working with angles instead of vectors which might be better when you don't have so many bits available. But even though the code is commented I'm not sure how the code is working. Is it something you made yourself is it based on some other work that might have a tutorial? I also tried to make my own algorithm, but, of course, I'm running into all the issues that other people have solved before. So, do you have good references to 8/16-bit code for raycasting? Thanks, Rasmus Quote Link to comment Share on other sites More sharing options...
Asmusr Posted April 11, 2017 Author Share Posted April 11, 2017 This looks interesting: http://retro-system.com/raycast2.htm 1 Quote Link to comment Share on other sites More sharing options...
TheMole Posted April 11, 2017 Share Posted April 11, 2017 (edited) Wolfie still has a bunch of rounding errors, most noticeable when the occasional gap between wall segments is visible (on corners), and I never really got around to fixing those. One avenue I went down for both speed an accuracy is precalculating look-up tables for all of the trig math. I'm having a hard time remembering exactly, but I believe I mainly relied on two tutorials while developing wolfie. One of them definitely was Lode's raycasting tutorial (the one you linked to in the original post), the other was the almost equally ubiquitous permadi tutorial: http://permadi.com/1996/05/ray-casting-tutorial-table-of-contents/ Your second example definitely seems to have the same heritage as wolfie: the algorithm is, at it's core, identical in structure. Edited April 11, 2017 by TheMole Quote Link to comment Share on other sites More sharing options...
artrag Posted April 11, 2017 Share Posted April 11, 2017 (edited) My z80 and c sources are here: https://sites.google.com/site/testmsx/msx2-doom Take the rar from February 2012 but I've started porting to fix point math Lode's Tutorial This is a video of the result on an msx turbo r Edited April 11, 2017 by artrag 5 Quote Link to comment Share on other sites More sharing options...
Asmusr Posted April 11, 2017 Author Share Posted April 11, 2017 My z80 and c sources are here: https://sites.google.com/site/testmsx/msx2-doom Take the rar from February 2012 but I've started porting to fix point math Lode's Tutorial That's pretty cool. Quote Link to comment Share on other sites More sharing options...
Omega-TI Posted April 11, 2017 Share Posted April 11, 2017 Looks like the old DOS game for the PC called Blake Stone: Alien of Gold https://www.youtube.com/watch?v=HsM-2Kgp_oY 1 Quote Link to comment Share on other sites More sharing options...
artrag Posted April 12, 2017 Share Posted April 12, 2017 (edited) Blake stone does not have lateral and back views for sprites. My robots have 8 directions of view with multiple frames of animation for walk and standing. But I ripped and adapted them from another dos game Edited April 12, 2017 by artrag 2 Quote Link to comment Share on other sites More sharing options...
Asmusr Posted April 15, 2017 Author Share Posted April 15, 2017 I started by converting Lode's raycaster from c to Java, which I know better. I then wrote a fixed-point library for Java, and made the code run with that. I then went through a lot of pain to make the fixed point calculation work with 16 bits without overflowing too often. I finally converted the Java code to TMS9900/GPU assembly language. It took a lot of debugging, but now I can present this first screen: I only include the code because you cannot move yet, and it's horribly slow - even on the GPU. But I haven't tried to optimize the drawing loop yet. Which is currently done by a call to a procedure using the F18A PIX instruction. I imagine this could be much faster inline. I also want to switch from 256x192 in 4 colors to 128x192 in 16 colors before I try to add textures to the walls. raycaster.a99 8 Quote Link to comment Share on other sites More sharing options...
LASooner Posted April 16, 2017 Share Posted April 16, 2017 Quote Link to comment Share on other sites More sharing options...
artrag Posted April 16, 2017 Share Posted April 16, 2017 Great work! Quote Link to comment Share on other sites More sharing options...
gfreige Posted April 17, 2017 Share Posted April 17, 2017 Nice! But... but... if you didn't use raycasting in megademo's Doom part, which witchcraft was invoked? 1 Quote Link to comment Share on other sites More sharing options...
+mizapf Posted April 17, 2017 Share Posted April 17, 2017 Blake Stone - I've got it still on an archive CD-ROM; I remember those Apogee games you could buy at the supermarket for little money, just a one-level version. And I remember Blake Stone for getting me really motion sick. Suffered a whole afternoon from it. I don't know why it was so bad with this game, but I get that feeling again when I watch your video. OTOH, I can play Skyrim for hours without any problems. 2 Quote Link to comment Share on other sites More sharing options...
Omega-TI Posted April 17, 2017 Share Posted April 17, 2017 Blake Stone - I've got it still on an archive CD-ROM; I remember those Apogee games you could buy at the supermarket for little money, just a one-level version. You know, I'm up for a little Blake Stone nostalgia. I would not mind a bit if you sent a copy of that via a PM my way... in fact I'd be quite appreciative! I'm thinking it should run under DOSBOX. Quote Link to comment Share on other sites More sharing options...
RickyDean Posted April 17, 2017 Share Posted April 17, 2017 Blake Stone - I've got it still on an archive CD-ROM; I remember those Apogee games you could buy at the supermarket for little money, just a one-level version. And I remember Blake Stone for getting me really motion sick. Suffered a whole afternoon from it. I don't know why it was so bad with this game, but I get that feeling again when I watch your video. OTOH, I can play Skyrim for hours without any problems. And Duke Nukem, got dizzy a lot. Quote Link to comment Share on other sites More sharing options...
Asmusr Posted April 17, 2017 Author Share Posted April 17, 2017 Nice! But... but... if you didn't use raycasting in megademo's Doom part, which witchcraft was invoked? Raycheating 1 Quote Link to comment Share on other sites More sharing options...
Asmusr Posted April 17, 2017 Author Share Posted April 17, 2017 You know, I'm up for a little Blake Stone nostalgia. I would not mind a bit if you sent a copy of that via a PM my way... in fact I'd be quite appreciative! I'm thinking it should run under DOSBOX. There are lots of abandonware sites where you can download old dos games. Quote Link to comment Share on other sites More sharing options...
Asmusr Posted April 20, 2017 Author Share Posted April 20, 2017 This is beginning to take shape. It runs more smoothly on real iron than in the video. It seems to run at 60Hz, but only just. I'm using double buffering for the bitmap, and this takes 12 KiB video RAM for half a screen. The 4 bitmaps in 32x32 16 colors take another 2 KiB, so there's only 4 KiB left for the program, the map, and everything else. I don't know if this would be enough for a game. raycaster80.dsk F18A Raycaster src.zip 7 Quote Link to comment Share on other sites More sharing options...
Omega-TI Posted April 20, 2017 Share Posted April 20, 2017 This is beginning to take shape. It runs more smoothly on real iron than in the video. It seems to run at 60Hz, but only just. I'm using double buffering for the bitmap, and this takes 12 KiB video RAM for half a screen. The 4 bitmaps in 32x32 16 colors take another 2 KiB, so there's only 4 KiB left for the program, the map, and everything else. I don't know if this would be enough for a game. Even a PARTIAL Castle Wolfenstein would be a major mind-blower on the TI!!! Only 4K left for the program eh? If it's not possible, would you have any objections to SAMS use? 1 Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted April 20, 2017 Share Posted April 20, 2017 As usual, you never cease to amaze me Rasmus! 1 Quote Link to comment Share on other sites More sharing options...
Asmusr Posted April 20, 2017 Author Share Posted April 20, 2017 Only 4K left for the program eh? If it's not possible, would you have any objections to SAMS & F18A use? SAMS is of no use here, it's video memory I need. 1 Quote Link to comment Share on other sites More sharing options...
ti99iuc Posted April 20, 2017 Share Posted April 20, 2017 OH MY GOD RASMUS ! Incredible to see it on the TI99 for real ! Quote Link to comment Share on other sites More sharing options...
matthew180 Posted April 20, 2017 Share Posted April 20, 2017 Well, we can always make the GPU faster... 2 Quote Link to comment Share on other sites More sharing options...
Retrospect Posted April 20, 2017 Share Posted April 20, 2017 (edited) This is just nuts. Things are being done here I didn't think were possible. Well done Rasmus. Edited April 20, 2017 by Retrospect 2 Quote Link to comment Share on other sites More sharing options...
Willsy Posted April 20, 2017 Share Posted April 20, 2017 I didn't think this was possible. Holy sh*t! 2 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted April 21, 2017 Share Posted April 21, 2017 SAMS is of no use here, it's video memory I need. Could the SAMS be used to store code sections that could be dynamically loaded into VDP RAM kind of like overlays? 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.