English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 17 April 2021, 23:48   #1
mateusz_s
Registered User
 
Join Date: Jan 2020
Location: Poland
Posts: 181
[C, RTG] My raycaster funtime - sharing code and progress..

Source codes. Executables for Amiga and Windows.
https://github.com/mateusz83/msRay

--- UPDATE - 26.08.2022 ---

msDevPack v0.33 features:
- wall/floor/ceiling textures
- new, faster floor/ceiling render algorithm (based on screen projection and clipping)
- mipmaps (256x256 --> 32x32)
- baked lightmaps
- distance shading
- glowing pixels


video:
[ Show youtube player ]


--- UPDATE - 05.07.2022 ---

msDevPack v0.32 features:
- wall/floor.ceiling textures
- mipmaps (256x256 --> 4x4)
- baked lightmaps
- distance shading
- glowing pixels

Test video (includes V1200 test):
[ Show youtube player ]

Source code. Check out if you are interested in RTG coding,
Amiga framework, ReAction etc.:
https://github.com/mateusz83/msRay/t..._devpack_v0.32

Executables for testing:
http://mstanisz.website.pl/tmp/amiga/msRay-32.zip



--- UPDATE - 15.01.2022 ---

Hello again,
I send some time optimizing the engine and adding features.

Right now I have on V1200:
- 320x200x32 - average 50 fps, near the walls its 70-80 - generally its fast and smooth.
- 640x400x32 - average 16-18 fps (slowly but playable)

Check out demo level (this video is from WinUae)
[ Show youtube player ]

Also check out how its working on Emu68 in INSANE resolutions
[ Show youtube player ]

Checkout the exec yourself (needs RTG)
https://mstanisz.website.pl/tmp/amig...v0.31-exec.zip

The whole "devpack" with all sources (PC and Amiga, editor etc)
https://mstanisz.website.pl/tmp/amig...pack_v0.31.zip

The simplify "devpack" with Amiga sources only:
https://mstanisz.website.pl/tmp/amig...31--SIMPLE.zip



--- 17 April 2021, 23:48 ---


Hi,
Recently I spent some time to develop my Racycaster thinking mostly about Vampire accelerators. But the main point was to test the RTG possibilities and render something at 24 or 32 bits.

Right now, I get to this point (with 1:1 pixels)
- 320x240x32 - about 15-18 fps
- 640x480x32 - about 4-5 fps
on Vampires, the Warp 1260 at now is about 2-3x slower, but as far as I know the RTG is noy yest fully optimized

but please note that these are my coding limits not Vampire or Warp limits


VIDEO OF MY RECENT PROGRESS:
[ Show youtube player ]


I was coding in C, I don't know assembler so I don't think I can optimize the speed any further by now.
But the engine like this should problably works on Vampire like at least 40-50 fps in 320x240x32 and maybe at least 20 in 640x480x32..
it was my first RTG and System Amiga coding attempt, I am glad of the results so far. I hope I will back soon to this project
and optimize it much better.

The textured walls itselfs with shading was very fast even in 640x480x32, but adding floors and ceiling slow donwn everything. They can't be so much optimized as walls.

I also wrote a Launcher that scans thru available display modes (in fullscreen or window) that can be filtered and formated by user.


NOTE!
I would like to share my code to encourage users and coders to use more RTG modes and higher resolutions or color depths.
I would like also to hear your opinion and maybe ideas to optimize the performance
Probably the floor/ceiling is the major problem right now..


DOWNLOADS:
1. exec from the VIDEO: http://mstanisz.website.pl/tmp/amiga/ray8.zip
(works only on 32bit - fullscreen or window)

2. all C sources including Launcher application: http://mstanisz.website.pl/tmp/amiga/ray8-source.zip

3. C source with only main render loop to look up: http://mstanisz.website.pl/tmp/amiga...ender-loop.zip


KNOWLEDGE SOURCES
For people interested in Raycasting and graphisc programming I am sharing
some links:

1. probably the best Raycaster approach and tutorial: https://lodev.org/cgtutor/index.html

2. different Raycasting approach: https://permadi.com/1996/05/ray-cast...e-of-contents/

3. Watch 3 minutes of this clip first to get the idea: [ Show youtube player ]

4. wolf3d algorithm expalined: [ Show youtube player ]

5. javidx9 (aka One Lone Coder) - yout tube channel - lots of inspirations and knowledge: https://www.youtube.com/channel/UC-y...UJZvieEligKBkA

6. Graphic Gems book series (I-V) lots of graphics algorithms

7. Pikuma Raycasting course - trigonometric approach: https://courses.pikuma.com/courses/raycasting-c

8. another channel with cg aspects coding: [ Show youtube player ]

9. and another yt channel: https://www.youtube.com/user/Bisqwit

Last edited by mateusz_s; 19 April 2023 at 00:23.
mateusz_s is offline  
Old 21 April 2021, 19:40   #2
Photon
Moderator
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
In rendering, a Profiling method is gold for optimizing Fillrate. Some portions can get close to memory bus bandwidth (staring into a wall), per-pixel operations scale quadratically with resolution (big room with few walls).

I'm sure you know some culprits already, I'm stressing this because the more you know about the slowest rendering code, the more frame time you can remove. Measure frame times accurately, and improve low FPS outliers as first priority; ignore average FPS until you've addressed the major time sinks, removing as many per-pixel operations as you can.

Profiling gives insight into relative performance. Regarding absolute FPS expectations: A 486DX2-66 MHz "struggles a bit" [ Show youtube player ] (usually means ~30 FPS) @ ~256x140x8bpp (with enemies, shots, score, damage, etc). An 060 is faster per MHz if utilized properly. More information about the systems you run your code on is required to draw conclusions about code performance vs ideal (or close-to-ideal) hardware performance.
Photon is offline  
Old 22 April 2021, 13:55   #3
Pyromania
Moderator
 
Pyromania's Avatar
 
Join Date: Jan 2002
Location: Chicago, IL
Posts: 3,375
@mateusz_s

Thanx, looks like cool stuff and sounds like fun.
Pyromania is offline  
Old 22 April 2021, 14:44   #4
NovaCoder
Registered User
 
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
Very cool stuff like I said to you before, well done.....must have been a huge coding effort.

High color RTG graphics on a real classic Amiga will never be that fast I'm afraid to say, even discounting the fact the the CyberGFX API probably isn't very well optimized for high color the Zorro bus throughput is very limited so it will have trouble just drawing a screen quickly. Obviously FPGA computers like the Vampire won't have this limitation.

Profiling C (or even C++) would be very helpful for the classic Amiga but as far as I know this isn't possible using gcc?

Last edited by NovaCoder; 22 April 2021 at 14:55.
NovaCoder is offline  
Old 23 April 2021, 23:06   #5
mateusz_s
Registered User
 
Join Date: Jan 2020
Location: Poland
Posts: 181
Quote:
Originally Posted by NovaCoder View Post
Very cool stuff like I said to you before, well done.....must have been a huge coding effort.

High color RTG graphics on a real classic Amiga will never be that fast I'm afraid to say, even discounting the fact the the CyberGFX API probably isn't very well optimized for high color the Zorro bus throughput is very limited so it will have trouble just drawing a screen quickly. Obviously FPGA computers like the Vampire won't have this limitation.

Profiling C (or even C++) would be very helpful for the classic Amiga but as far as I know this isn't possible using gcc?

Hello NovaCoder, thanks you for reply..
Well yes, I am aiming for "modernish" accelerators like Vampires with combined RTG..
This because, there are a lots of 8 bit fps and other games, I just wanted to step level up,
and see the new possibilities.

This code can be much more optimised, and almost for sure could run 40-50 fps in 320x240x32.. which is more than enough. ~20fps in 640x400 could also be possible which is playable.

You can use profiler on GCC.. it generates the output file.. but in my case I couln'd find it much useful..

Another possibility is to use cycle counter and cache misses counter, but on Vampire only.

But 32 bit color is not only for 3d games that need lots of calculations. For example for a nice Tower Defense game we don't need 32bit, 8 would be enogh, but in higher resolution etc.

Anyway I am still trying to make more optimalisations, working in C, optimizing loops, trying different rendering algorithms etc.. no pressure just fun..
mateusz_s is offline  
Old 15 January 2022, 16:54   #6
mateusz_s
Registered User
 
Join Date: Jan 2020
Location: Poland
Posts: 181
(THE FIRST POST HAS BEEN UPDATED)


Hello again,
I spend some time optimizing the engine and adding features.

Right now I have on V1200:
- 320x200x32 - average 50 fps, near the walls its 70-80 - generally its fast and smooth.
- 640x400x32 - average 16-18 fps (slowly but playable)

Check out demo level (this video is from WinUae)
[ Show youtube player ]

Also check out how its working on Emu68 in INSANE resolutions
[ Show youtube player ]

Checkout the exec yourself (needs RTG)
https://mstanisz.website.pl/tmp/amig...v0.31-exec.zip

The whole "devpack" with all sources (PC and Amiga, editor etc)
https://mstanisz.website.pl/tmp/amig...pack_v0.31.zip

The simplify "devpack" with Amiga sources only:
https://mstanisz.website.pl/tmp/amig...31--SIMPLE.zip

Last edited by mateusz_s; 15 January 2022 at 23:46.
mateusz_s is offline  
Old 15 January 2022, 21:38   #7
Aardvark
Registered User
 
Join Date: Jan 2019
Location: Finland
Posts: 634
Tested this on TF1260 100mhz+Radeon [ Show youtube player ] No idea whats up with the colors.
Aardvark is offline  
Old 15 January 2022, 21:48   #8
kriz
Junior Member
 
kriz's Avatar
 
Join Date: Sep 2001
Location: No(R)Way
Age: 41
Posts: 3,185
Really impressing speed!!
kriz is offline  
Old 15 January 2022, 23:18   #9
mateusz_s
Registered User
 
Join Date: Jan 2020
Location: Poland
Posts: 181
Quote:
Originally Posted by Aardvark View Post
Tested this on TF1260 100mhz+Radeon [ Show youtube player ] No idea whats up with the colors.
Hi thanks for testing.. nice speed and interesting config. I am glad its fast on TF1260. I don't know right know why some colors are wrong, I run on BGR mode on winuae but it was ok..
mateusz_s is offline  
Old 02 February 2022, 18:54   #10
mateusz_s
Registered User
 
Join Date: Jan 2020
Location: Poland
Posts: 181
All shading variants, with lightmaps:

[ Show youtube player ]
mateusz_s is offline  
Old 05 July 2022, 22:10   #11
mateusz_s
Registered User
 
Join Date: Jan 2020
Location: Poland
Posts: 181
Hello, check out the latest update..

--- UPDATE - 05.07.2022 ---

msDevPack 3.2 features:
- wall/floor.ceiling textures
- mipmaps (256x256 --> 4x4)
- baked lightmaps
- distance shading
- glowing pixels

Test video (includes V1200 test):
[ Show youtube player ]

Source code. Check out if you are interested in RTG coding,
Amiga framework, ReAction etc.:
https://github.com/mateusz83/msRay/t..._devpack_v0.32

Executables for testing:
http://mstanisz.website.pl/tmp/amiga/msRay-32.zip
mateusz_s is offline  
Old 26 August 2022, 22:40   #12
mateusz_s
Registered User
 
Join Date: Jan 2020
Location: Poland
Posts: 181
--- UPDATE - 26.08.2022 ---

msDevPack v0.33 features:
- wall/floor/ceiling textures
- new, faster floor/ceiling render algorithm (based on screen projection and clipping)
- mipmaps (256x256 --> 32x32)
- baked lightmaps
- distance shading
- glowing pixels

Source codes. Executables for Amiga and Windows.
https://github.com/mateusz83/msRay

video:
[ Show youtube player ]

This is probalby the fastest results I have ever made.
- on V1200 35-45 fps
- on Warp1260 19-21 fps

switching off the lightmaps would gain the performance much more
mateusz_s is offline  
Old 27 August 2022, 14:29   #13
Dunny
Registered User
 
Dunny's Avatar
 
Join Date: Aug 2006
Location: Scunthorpe/United Kingdom
Posts: 1,976
oh cool! I did something like that in BASIC!

[ Show youtube player ]

Excuse poor recording software, it was some years ago now.
Dunny is offline  
Old 28 August 2022, 11:26   #14
modrobert
old bearded fool
 
modrobert's Avatar
 
Join Date: Jan 2010
Location: Bangkok
Age: 56
Posts: 775
Quote:
Originally Posted by Dunny View Post
oh cool! I did something like that in BASIC!

[ Show youtube player ]

Excuse poor recording software, it was some years ago now.

What BASIC is that and what hardware is it running on? Looks pretty fast.

Last edited by modrobert; 28 August 2022 at 11:34. Reason: Extended question.
modrobert is offline  
Old 19 April 2023, 00:19   #15
mateusz_s
Registered User
 
Join Date: Jan 2020
Location: Poland
Posts: 181
--- Probably the last update ---

msRay 036 features:
- regular / non regular walls, oblique / different height
- doors - regular, non regular, oblique, open up or to sides.
- wall/door collisions
- status bar (autoscaled to width)
- lightmaps
- glowing pixels (not affected by shadows)
- RTG or HAM8 modes

min config: 040/060 AGA
recommend config: fast 060 RTG

source codes avaialb on git hub:
https://github.com/mateusz83/msRay

Link to EXE:
http://mstanisz.website.pl/tmp/amiga/msRay_036.zip


[ Show youtube player ]

[ Show youtube player ]

[ Show youtube player ]

[ Show youtube player ]
mateusz_s is offline  
Old 19 April 2023, 10:35   #16
Karlos
Alien Bleed
 
Karlos's Avatar
 
Join Date: Aug 2022
Location: UK
Posts: 4,119
That's a good looking raycaster.

I was going to ask if the lightmaps get prebaked, then I saw the door open while the apparent lightmap remained in the same place (as you would expect for an object moving through a shadow volume). Excellent stuff.
Karlos is online now  
Old 19 April 2023, 12:00   #17
pixie
Registered User
 
pixie's Avatar
 
Join Date: May 2020
Location: Figueira da Foz
Posts: 340
I could see Alien Breed on this engine! ^^
pixie is online now  
Old 19 April 2023, 12:06   #18
Karlos
Alien Bleed
 
Karlos's Avatar
 
Join Date: Aug 2022
Location: UK
Posts: 4,119
I'm not sure. Raycasting comes with some limitations that restrict level design.
Karlos is online now  
Old 19 April 2023, 12:11   #19
Reynolds
Alien Breeder
 
Reynolds's Avatar
 
Join Date: Dec 2007
Location: Szigetszentmiklos / Hungary
Age: 46
Posts: 1,096
This is cool. Keep up the great work!
Reynolds is offline  
Old 19 April 2023, 12:19   #20
pixie
Registered User
 
pixie's Avatar
 
Join Date: May 2020
Location: Figueira da Foz
Posts: 340
Quote:
Originally Posted by Karlos View Post
I'm not sure. Raycasting comes with some limitations that restrict level design.
I guess... but there was something about the lighting that made me feel like home
pixie is online now  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Blitz Raycaster Demo Master484 Coders. Blitz Basic 3 16 February 2018 14:47
Sharing files over ntwork AliasXZ support.Other 7 03 May 2008 22:54
Sharing software? Yesideez Amiga scene 11 25 March 2007 19:52
Sharing CD32 Djay Amiga scene 12 01 April 2002 00:51
Sharing ADF's P-J Amiga scene 3 03 December 2001 10:08

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 17:08.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.14896 seconds with 13 queries