1. Serious Sam Classic: The First Encounter
  2. News
  3. Featured Mod - Serious Sam Ray Traced

Featured Mod - Serious Sam Ray Traced

Hi everyone! As many of you must have found out by now, one of the craziest members of our community recently released a brand-new Serious Sam: The First Encounter mod which updates our original Serious baby with state-of-the-art technology - Ray Tracing.

[previewyoutube][/previewyoutube]

I remember vividly seeing the mod in one of our community Discord servers a long time ago. Back then, Sultim was about halfway through, and very excited about the stuff he learned while making it. We were instantly impressed and could barely wait for the mod to finally drop, and here we are. Serious Sam: The First Encounter can be played with Ray Tracing. I bet you thought you’d say that out loud. Come on, do it. Say it out loud.

The mod is available for download on GitHub. For sure check it out:
https://github.com/sultim-t/Serious-Engine-RT/releases

Sultim has spent an insane amount of time on this project, and it definitely shows. That’s why we simply had to send our community master, the artist currently known as THE LAW, on another mission – to interview a superstar modder in the making. Make sure to check out that interview below.

Much love!
Danny

[hr][/hr]

BASEMENT CHATS WITH YASEN


Good day, dear readers! Today, I am joined by the guy everyone talks about, the master of Ray Tracing – Sultim! We chat about his latest mod, what motivated him to make it, and how it all came together.

⚪ Hi Sultim. Glad to have you here in the basement. Please introduce yourself to the audience. How long have you been a Serious Sam fan and when did you first start modding for it?

Hello, I'm Sultim and I've finished my bachelor's degree in Software Engineering this Summer. Not sure what to say more about myself, I think this is the most appropriate introduction currently.

I've been a Serious Sam player since 2013, I think, but back then I didn't understand what the game is even about. It was just another game. Over time, I was experimenting with game engines and tried to make my own, of course. And only after figuring out that games are really complex systems, I tried to find a game I could clone for fun. That's how I've returned to Serious Sam because on the surface level it seems like it's a simplistic game. However, after experimenting with trying to clone it, I've found a lot of obstacles. For example, the core gameplay of my clone wasn’t as engaging as the original.

After that, I've been more involved in graphics programming and, like other beginners, started with OpenGL. I was in my second year of university, and we were given a task for a semester to make a finished project with a requirements specification, planning, etc. So, I've chosen to make a very simple game engine. At the end of that semester, it had graphics in OpenGL, a very coarse physics engine that works on triangles and spheres... But anyway, it was finished in a way that it did have an example game (which was set in Egypt). And since then I started to look at Serious Engine 1 more closely as it’s been open-source since 2016.

In January 2020, when I had 2 weeks of holidays, I decided to make a Vulkan port for Serious Engine 1. At the time, I and my friend had a one-year project which was based on Vulkan API, so it was another chance to improve my limited knowledge of Vulkan back then.
After 2 weeks it was ready. Seeing this code now is devastating. But it just works. What I remember is that it was really hard to get it to work at the start, I had numerous issues because of my poor knowledge of Serious Engine 1 architecture, WinAPI, Vulkan, C++, etc. I couldn't see The Second Encounter anymore after that - I really tired from it throughout these 2 weeks.
The grand idea of that Vulkan port was making a ray tracing port, after seeing Quake 2 RTX. But I didn't have a ray-tracing GPU, nor a strong knowledge of APIs and SE1.

⚪ Ray tracing is a relatively new graphical development. How challenging was getting this technology to compile on a nearly twenty-year-old engine? Did you have to perform significant code rewrites for it?

The initial compilation was quite challenging. Introducing Vulkan API wasn't hard – it was already there. But the problems were related to the fact that ray-tracing extensions require the application to be 64-bit. SE1 was initially 32-bit. So, SE1 had to be ported to 64-bit. Fortunately, there was an open-sourced x64 Linux port of SE1! That was a great relief because SE1 has some places not prepared for x64, like some pointers, which are assumed to be 4 bytes long, but with x64 they can be 8 bytes.

The project itself has roots in September of 2020 when the 4th year of my education started. Since it's the final year, all the students must make another one-year project, namely "Graduation thesis". So, after much deliberation, I've finally chosen to make a library that should help to port games to path tracing and I've started to make a research of the subject, concepts of path tracing, light physics, what are the current hardware limitations, etc.

I really needed a ray-tracing GPU to test so I decided to buy an RTX3070 which was released at the end of October 2020. Buying one was a pain in the ass. At the release hour, I was sitting for 2 hours straight and reloading the online store page to get just anything. The first time I tried to order an available GPU, it just disappeared in front of me. But I got one eventually.

The development of the library started in November 2020 and I started to sort out the old graphics engine of Serious Engine 1. Of course, the old graphics engine was really optimized for rasterization. And it wasn't possible to make a few changes to it to make it work with ray–tracing primitives. More grand changes must've been introduced to the engine. Almost every day I was assembling piece by piece the library. And I got something working in Serious Engine 1 itself by the middle of January 2021.

After that it seemed to me that with enough passion I'll be able to release Serious Sam: Ray Traced in May 2021. But now we all know how that went.

Each component of Serious Engine 1 had to have been reworked; dynamic geometry, static geometry, static movable geometry, particles, water, light sources... The main problem is the lack of game resources and meta-information: like, what light sources are not "natural" (like torches), what geometry can't be visible (in Oasis, in Moon Mountains, and others there was overlapping geometry that should not be visible from one side, but visible from another), what are the water polygons, the lack of normal maps, roughness, metallicity, emission maps (SE1 uses up to 3 textures per polygon, and each of them should have additional 2 PBR textures, it increases the load on GPU to fetch that data), etc etc.

With all that, path tracing is limited with current generation GPUs -- only a very limited amount of rays can be cast per pixel, around 4-7. Offline path tracers are using thousands of rays per pixel! So because of maintaining the real-time-ness (very few rays per pixel), there's a lot of noise on raw ray-traced images. So there are denoising techniques that are designed specifically for such cases: they require only 1 sample per pixel, one of them is A-SVGF, which was used in my library and consequently, in Serious Sam: Ray Traced.

Another kind of problem is how to draw particles and other semi-transparent geometry, and since with ray tracing it would cost another few rays, I've decided to draw them with classic rasterization but using ray traced depth buffer, so semi-transparent geometry can be hidden by ray-traced geometry.

⚪ Where else have you spent time reworking engine aspects? Did you have to perform case-by-case fixes in certain levels or were your changes global?

There are a ton of such fixes on each level. Testers really helped with that - they've pointed out most such inconsistencies. Like no lights in cutscenes or Sewers which were too dark (so the flashlight angle is wider there), invisible Gnaars are hard to see, etc. The fresh point of view is very useful because after 10 months of development one gets too used to everything in a project. I would say the most time-consuming part is level tweaking.

⚪ Testers are always lifesavers! So now the most important question is, was your thesis graded and what grade did you receive?

I've finished my studies successfully and got an "Excellent" grade (which means 5 on the scale from 2 to 5 [it's the Russian academic grading system]) for my thesis and its defence. It was challenging to make this thesis, to create such a library, to make the ray tracing port of SE1, but it was enjoyable, in a way that it was genuinely exciting to develop it, and also interesting and funny to see the people's reactions, to read their comments.

⚪ Congratulations, you really deserve it. When you first told me about the mod I was absolutely sure it's one of those mods that would never see the light of day, but you proved me wrong and did a great job! What are your plans for the future now that you have graduated?

My current plans are to rest a bit from such intense work, because I was thinking and developing it almost every day, especially after graduation when there were almost no distractions.

For the future, I really don't know. There are several ways for me, and until November it's very uncertain. I don't know, maybe there'll be another port. We'll see.

⚪ Thank you for this interview Sultim, I really appreciate you taking the time to be here with us. As always, please take the stage to share whatever you wish with our Serious community! As for you my dear readers, I’ll see you soon in the next episode where we are going to interview one of the biggest Serious Sam fans in Russia “Samson”

Oh, god, never underestimate the power of open-sourced projects.