Open Surge Forum

A fun 2D retro platformer inspired by Sonic games and a game creation system

You are not logged in.

Announcement

Our community has moved to Discord! https://discord.gg/w8JqM7m

#1 2014-04-21 15:58:45

KZR
Member
Registered: 2010-07-14
Posts: 1,447
Website

[Suggestion] Background Object

I was browsing through the source code, and found a way to mess with the order in which things are rendered, but this seems out of my grasp:

would it be hard to make an object be rendered in between the background layers? maybe with a special "background_object" property, which would tell the engine that the object should be rendered in the same pass as the bg, and not the one where normally bricks and objects coexist.

before the question comes up, a zindex of 0 still renders the object over a bg layer.

usage scenario: dynamic clouds and weather, using alpha blended stuff on background, etc


SD_sml.pngSeD_sml.pngLTot_W_sml.png
https://discord.gg/w8JqM7m ---> Open Surge's Discord server

Offline

#2 2014-04-27 15:20:00

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: [Suggestion] Background Object

KZR wrote:

I was browsing through the source code, and found a way to mess with the order in which things are rendered, but this seems out of my grasp:

would it be hard to make an object be rendered in between the background layers? maybe with a special "background_object" property, which would tell the engine that the object should be rendered in the same pass as the bg, and not the one where normally bricks and objects coexist.

before the question comes up, a zindex of 0 still renders the object over a bg layer.

usage scenario: dynamic clouds and weather, using alpha blended stuff on background, etc

in your scenario, i think it's much easier to create objects that behave like dynamic clouds and so on... but let's examine the rendering system:

the pass is like this, in the code (see src/scenes/level.c):
1. render background => 2. render entities => 3. render water => 4. render foreground => 5. render hud
each bg entry having zindex <= 0.5 is rendered at first step
regular objects, with zindex <= 1 are rendered at second step
bg entries having zindex > 0.5 are rendered at step 4
objects width zindex > 1 are huds, being rendered at step 5

Offline

#3 2014-04-27 20:08:09

KZR
Member
Registered: 2010-07-14
Posts: 1,447
Website

Re: [Suggestion] Background Object

Alexandre wrote:

each bg entry having zindex <= 0.5 is rendered at first step
regular objects, with zindex <= 1 are rendered at second step

my question is, how to render an object, for example, between two background layers? like this:

bg layer Z=0.3
object Z=0.4
bg layer Z=0.5

as of now, it looks impossible without changing the source code.


SD_sml.pngSeD_sml.pngLTot_W_sml.png
https://discord.gg/w8JqM7m ---> Open Surge's Discord server

Offline

#4 2014-04-27 22:27:48

jobromedia
Member
From: Stockholm, Sweden
Registered: 2009-11-01
Posts: 1,072
Website

Re: [Suggestion] Background Object

The most logical thing would be to have a negative Z index to affect the bg. -0.1 - -1.

Offline

#5 2014-05-03 01:25:57

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: [Suggestion] Background Object

hmm, not really possible without changing the source

Offline

Board footer

Powered by FluxBB  hosted by tuxfamily.org