Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1397290 Posts in 67456 Topics- by 60676 Members - Latest Member: czoks

December 06, 2021, 12:00:46 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsRTG - The Ray-Traced Game (Puzzle / Platformer)
Pages: 1 2 [3] 4 5 ... 10
Print
Author Topic: RTG - The Ray-Traced Game (Puzzle / Platformer)  (Read 12170 times)
marcgfx
Level 7
**


if you don't comment, who will?


View Profile WWW
« Reply #40 on: November 08, 2020, 08:03:29 AM »

Raytracing! Ah yes, I've given that a go myself but never made a game from it. It was all javascript and only allowed rendering perfect spheres (and not rotated boxes) no polygons, but thanks to that it was pretty simple and I could add reflections and other cool stuff.

I feel like you could do a lot by adding texture (something simple & volumetric, e.g. 3d checkerboard, gradients) + using perspective instead of the frontal view, or maybe some kind of parallax background. Oh and distance based reflections could also be quite simple and fast, I think it's quite a neat effect.

You can see I am getting overly excited, I always wanted to make a raytraced game but never got round to doing it. The javascript raytracer was a bit too slow at the time and so it went nowhere.

edit: No where near the 60fps required, no idea how much better it would run with a C language.
« Last Edit: November 08, 2020, 08:20:32 AM by marcgfx » Logged

vdapps
Level 3
***


Head against wall since 2013


View Profile WWW
« Reply #41 on: November 08, 2020, 01:01:56 PM »

Hi marcgfx, thanks for remarks! Gentleman Your scene looks neat! In fact, I also started with checkerboard scene. Smiley

You touched it already, in SW algorithm, speed is only limiting factor. Because I want 60fps, I guess scenes will consists mainly from axis aligned boxes, probably just hundreds of polygons in scene. Resolution will be close to 320x180 on most potato computers (e.g. 15W laptops), maxing maybe somewhere near 640x360 for desktops.

I have 2D editor/engine so making it full 3D can prolong development a lot. With semi-2D (side view) I can use a lot from what I have already for game logic, scripting, serialization, etc..

But yes I can use parallax (put some objects deeper into scene, or in front of main view). Regarding textures, I have support for textures, only I use them on few objects now.

"Distance based reflections" - I admit, I don't know what it is, I guess objects further from camera reflects less? But reflections themselves, naturally are part of algorithm so definitely will be there. I think also in simple refractions. It comes almost for free (same impact on perf as reflections).

Keeping 60fps is must for me, otherwise, it will harm gameplay. Maybe different genre from platformer will allow lower fps, but I'm already on the train for puzzle / platformer. Gomez
Logged

marcgfx
Level 7
**


if you don't comment, who will?


View Profile WWW
« Reply #42 on: November 09, 2020, 01:25:57 AM »

I might have just made up that term "distance based reflection". The idea is that the further away an object is the less it gets reflected. This simulates a bit of diffusion (I think that's the right term) and makes it easier to tell it's a reflection. Could be nice on your floor.

I should have guessed that the perspective helps a lot in optimizing calculation, had not considered that. Will be interesting to see where this anyway.

Oh and I've started using webp as well, thanks to JobLeonard telling me about your devblog Smiley
Logged

vdapps
Level 3
***


Head against wall since 2013


View Profile WWW
« Reply #43 on: November 09, 2020, 08:50:07 AM »

So I thank to JobLeonard as well. Smiley He's doing good job keeping community together. Gentleman

Regarding WEBP, it's cool stuff, those WEBP animations, super quality (comparing to GIF) and low-size (comparing to APNG).

Only one note (I already noted it before). I see you do HTML5 games, so you're platform agnostic. WEBP does not work on OS X (only starting from OS X Big Sur there will be support for that), so maybe it's for you to consider. On every other major platform or browser it should work.

Me, I don't care about Apple as I plan only Windows games (either Microsoft Store or Steam), but if someone wants to be as compatible as possible, OS X including, there's still just GIF or APNG. (Thanks Apple Lips Sealed)
Logged

vdapps
Level 3
***


Head against wall since 2013


View Profile WWW
« Reply #44 on: November 11, 2020, 03:40:06 PM »

-= Devlog #9 =-

Fixes in lighting model

Hi All!

In this bunch of work on RTG I focused mainly on color computation fixes, as I had there some bugs (e.g. diffuse part was incorrectly computed, but I didn't notice before because I almost always used white lights) plus some important things were completely missing (e.g. light attenuation, which I didn't used before in my original algorithm, as it was used only on some small test scenes). I also enhanced engine support for per-level scripting, so this test level is scripted 'nicer' comparing to previous ones.

Here follows test level overview:

Room 1: reflection, diffuse, specular test
A bit of reflection and lot of specular on floor, specular on left wall, diffuse only for right wall and stairs.

Room 2: color mixing test
Lot of specular on floor, only diffuse on side walls. Colors are correctly mixed where met. Also note iris like player's shadow near those floating lights. Shadow has color depending on which color or combination of colors is met in every particular part of player's shadow. What is out of shadow is white as all 3 colors are met there (except locally on floor under every light where closest light intensity locally over-brights other lights intensities).

Room 3: reflections plus stronger attenuation test for local lights
Mirrooooors and mirror in mirror. Plus lights in this room have strong attenuation. Good to use for local lighties which we don't want to shine through whole level. And also saves some performance as strongly attenuated lights are not taken into account already in closer distances comparing to less attenuated lights.

Room 4: just exit Smiley

Lighting model test level:
« Last Edit: November 11, 2020, 04:39:22 PM by vdapps » Logged

Ishi
Pixelhead
Level 10
******


coffee&coding


View Profile WWW
« Reply #45 on: November 11, 2020, 09:37:34 PM »

This is a really nice showcase for a lot of different effects! I love the double mirror, something that would be really hard to do in traditional rendering but suited perfectly to raytracing. Great work Coffee
Logged

JobLeonard
Level 10
*****



View Profile
« Reply #46 on: November 12, 2020, 12:25:02 AM »

Quote
Shadow has color depending on which color or combination of colors is met in every particular part of player's shadow.

Oh that looks soooo good

I know you plan to keep things minimal, but even then you could do a lot with those colors and some nice art direction. May I suggest checking out Mario Bava's work? Wink



Logged
marcgfx
Level 7
**


if you don't comment, who will?


View Profile WWW
« Reply #47 on: November 12, 2020, 01:27:27 AM »

Oh really nice update! Now the raytracing is much more apparent Toast Right
Keeping things darker made me think you had increased resolution, as there are not so many hard edges.
Logged

Prinsessa
Level 10
*****



View Profile
« Reply #48 on: November 12, 2020, 01:36:23 AM »

Nice! Really letting the RT show through now. Kiss What are you using for scripting?
Logged

vdapps
Level 3
***


Head against wall since 2013


View Profile WWW
« Reply #49 on: November 12, 2020, 08:08:36 AM »

Thank you all! I'm glad you like it. Kiss

@Ishi, @marcgfx:

You touched it. I think, it's way to go. Darker scenes and let lights, shadows and reflections be something which will be driving visual look of game. Because of extra low-poly nature of levels (algorithm limits without GPU acceleration), I must focus on this as this can be something which can make it look good. Just for curiosity: this whole level has 300 faces, in GPU rasterized titles only player's nose has more faces. Grin I guess in final game there will be maybe up to 2k faces per level, depending on how I'll be able to optimize.

@JobLeonard:

Thanks for reference! Nice examples of color palette uses. Applies the same as in previous paragraph, so yes, also through colors (as I can play with them really nicely with ray-tracing), I can give the game some specific 'art direction'. Gentleman

@Princessa:

In short: C# plus my own script language. Just recently, I adapted C# scripting through C# Reflection to look it more high-level to allow better per-level scripting (to this I was referring in my previous post).

In long: before I was mostly using mainly my own script language, which was not fastest, but suited for events which happen from time to time. Here's an example:

Code:
@MMWhatsNewClicked
#PageWhatsNew._FadeIn=$0.3
@

On event MMWhatsNewClicked, to object named PageWhatsNew set property _FadeIn to 0.3 (it will run fadein FX which will last for 0.3 seconds).

Language is very brief, but it's not optimal to script objects with it, which needs to run every frame, as it always results in object search by name, property search, run-time checks for validity, etc.. If I want per-frame, I manipulate objects directly in C#.

And here it comes, my C# scripting was before awkward and almost non-existing. Just hard-coded checks, if I'm in specific level and then manipulate with right object, etc.. Very soon this can end-up in very messy code.

What I did now, I used C# Reflection to have nice per-level scripting. So for every-level, right piece of C# is invoked or for every event right C# function is invoked (if it's defined) with correct context. Example from this level:

Code:
    public void L007Init()
    {
        mL007Light01 = GetElement<RTLight>("L007Light01");
        mL007LightBox01 = GetElement<RTLightBox>("LightBox01");
        mL007LightBox01 = GetElement<RTLightBox>("LightBox01");
        mL007LightBox02R = GetElement<RTLightBox>("LightBox02R");
        mL007LightBox02G = GetElement<RTLightBox>("LightBox02G");
        mL007LightBox02B = GetElement<RTLightBox>("LightBox02B");
        mL007LightBox03R = GetElement<RTLightBox>("LightBox03R");
        mL007LightBox03B = GetElement<RTLightBox>("LightBox03B");
        mL007LightBox04 = GetElement<RTLightBox>("LightBox04");
    }

    public void L007Frame()
    {
        float Sin(float coef) { return 0.5f * (1.0f + (float)Math.Sin(coef * SystemTime.Time)); }
        mL007LightBox01.PosX = 20.0f + (920.0f * Sin(1.17f));
        mL007LightBox01.PosY = 450.0f - (150.0f * Sin(1.37f));
        mL007LightBox01.Intensity = 0.2f + (1.5f * Sin(1.0f));
        mL007LightBox02R.PosY = 450.0f - (30.0f * Sin(3.6f));
        mL007LightBox02G.PosY = 450.0f - (30.0f * Sin(4.0f));
        mL007LightBox02B.PosY = 450.0f - (30.0f * Sin(4.4f));
        mL007LightBox03R.PosY = 430.0f - (300.0f * Sin(1.17f));
        mL007LightBox03B.PosX = 1870.0f - (450.0f * Sin(1.17f));
        mL007LightBox04.Intensity = 0.8f + Sin(4.0f);
    }

As you can guess, every Init or Frame function is invoked at right-time in correct context. When level is restarted or you change level, context is changed (so no leaks, or retaining of no more valid objects). I can have now separate C# file for every level with something like that, so scripts can be nicely ordered in Visual Studio. Gomez
Logged

Prinsessa
Level 10
*****



View Profile
« Reply #50 on: November 13, 2020, 04:39:38 AM »

Cool, thanks for sharing! Grin
Logged

vdapps
Level 3
***


Head against wall since 2013


View Profile WWW
« Reply #51 on: November 27, 2020, 11:07:11 AM »

Hello,

After Universe Quest update, it's now turn for RTG.

Before doing implementations for the next update, I wanted to promote the game in more places, so I have created GameJolt page for RTG.

==> vdapps.gamejolt.io/rtg <==

Do you have some experience with GameJolt? To me, it looks inferior comparing to itch.io.

What I don't like, seems that posting new devlogs on GJ is not displayed in any news there (so you just have to rely on new followers coming from external sources, rather than from GJ platform itself). Anyway, I'll give it a shot.

Can't wait to post next update from development itself. Smiley
Logged

Prinsessa
Level 10
*****



View Profile
« Reply #52 on: November 27, 2020, 11:28:33 AM »

Didn't realise you're working on two things at the same time. Both look cool; I'm not sure that kind of gameplay is my thing, but space exploration is of course very interesting in general. Grin I don't know anything about GJ, so can't answer that, but good luck with it! Coffee
Logged

vdapps
Level 3
***


Head against wall since 2013


View Profile WWW
« Reply #53 on: November 27, 2020, 03:21:28 PM »

Thanks Prinsessa! Gentleman

Yep, Universe Quest is scaled to be long-term project in continuous development, with no particular deadlines and available to download from the earliest stages. So I don't need to rush with it. RTG has more "conventional" development cycle as most of games here.
Logged

Smerik
Level 1
*



View Profile
« Reply #54 on: November 28, 2020, 10:12:40 PM »

Posting here to follow this game! Yes very cool! Building your own rendering engine is so much fun! Are you working with SDFs? I've seen very simple but robust collision detection with those, e.g.: https://www.shadertoy.com/view/tdfXRN (<--- awesome website btw). (more sdf stuff here: https://www.shadertoy.com/results?query=sdf)

It would be great if you could utilize the fact that your building the engine yourself for a mechanic in the game, e.g. the portal gun in portal, or something like this:

, you can really create a one in a kind experience like that.

Additionally would you consider using emscripten to port to web?
Logged

vdapps
Level 3
***


Head against wall since 2013


View Profile WWW
« Reply #55 on: November 29, 2020, 03:33:20 PM »

Thanks Smerik and thanks for the tip. This Shadertoy looks really powerful. Worth to check it to gain inspiration and learn new stuff. Especially in physics, I not made lot of my own code. In this Shadertoy it looks nicely ordered, self-explanatory. Hmm, and I don't know what is SDF.

Regarding porting to web, I don't think so, it's hard to monetize, I'm not sure about learning curve (RTG is C#/C++ project with DirectX and XAudio for gfx/sound output). I'm aspiring with RTG for fully fledged indie title with Steam as main target.

Logged

JobLeonard
Level 10
*****



View Profile
« Reply #56 on: November 29, 2020, 11:53:05 PM »

Oh speaking of Shadertoy, Morgan McGuire of graphics codex fame recently tweeted these raytracing examples in Shadertoy:

https://twitter.com/CasualEffects/status/1333064550200078336

https://www.shadertoy.com/view/Ms2SWw

https://www.shadertoy.com/view/XdsGWS
Logged
vdapps
Level 3
***


Head against wall since 2013


View Profile WWW
« Reply #57 on: November 30, 2020, 07:35:49 AM »

This 'Shadertoy' is impressive. Great reference. I checked main page and this I can imagine used in 'Universe Quest' later in development.

https://www.shadertoy.com/view/XsyGWV
Logged

marcgfx
Level 7
**


if you don't comment, who will?


View Profile WWW
« Reply #58 on: November 30, 2020, 08:37:04 AM »

Oh I've seen that one too, a really cool shader. So how would you use it? Render the background with a shader on the gpu and the foreground with raytracing on the CPU?
Logged

vdapps
Level 3
***


Head against wall since 2013


View Profile WWW
« Reply #59 on: November 30, 2020, 10:10:56 AM »

Yikes, seems that you are confused that I work on 2 projects. Smiley But my mistake to post to this thread something related to my other project.

- for RTG aka Ray-Traced Game (this thread), I'll just use pure SW ray-tracing, nothing related with last ShaderToy link I posted (which is some nice planet landscape). For RTG, I can be inspired by some collision detections which was posted by Smerik sooner in this thread (as I need some 2D collisions and simple physics for RTG), or by some RT stuff posted by JobLeonard (if I want to enhance my RT routines).

- for Universe Quest (other thread), I can be inspired by last ShaderToy link I posted. As later in Universe Quest development, I want planets and possibly also landscapes. But this is really long way before me to get there. Universe Quest will be rendered by traditional rasterizing approach on GPU, nothing with SW ray-tracing (at least I can't find meaningful use to incorporate SW based ray-tracing in Universe Quest project).

One way or another, ShaderToy seems like quite powerful page for programmers, to get inspiration.
Logged

Pages: 1 2 [3] 4 5 ... 10
Print
Jump to:  

Theme orange-lt created by panic