Lemma Soft Forums

Supporting creators of visual novels and story-based games since 2003.


Visit our new games list, blog aggregator, IRC, and wiki.
Activation problem? Email [email protected]
It is currently Tue May 21, 2013 1:02 pm

All times are UTC - 5 hours [ DST ]


Forum rules


Ask questions about one topic per thread, and use a descriptive subject. "NotImplemented error in script.rpy" is a good subject, "Tom's problems" is not. Remember to include all of traceback.txt or error.txt when reporting a problem, as well as the relevant lines of script. Use the [code] tag to format scripts.



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri May 13, 2011 1:25 pm 
Newbie

Joined: Sat Apr 23, 2011 2:28 pm
Posts: 4
Greetings,

Okay, continuing where I left off. I'm still trying to create a good-looking main window for a cyberpunk-styled fiction piece of mine, which in my understanding involves placing both text and graphics inside a stylised computer monitor. I thought about using a fixed background, which is that of said monitor (monitor.jpg) on a layer of its own (monitor), and to display all game graphics (Characters, Background, etc.) atop of it, and realized it with code like that:

Code:
init python:
        config.layers.insert(0, 'monitor') # Creating a layer for underlying image of a computer monitor
        config.layer_clipping['master'] = (100, 100, 600, 400) # Defining area for master graphics area
init:
    image monitor = "monitor.jpg" # Defining the Displayable for image of a computer monitor
label start:
    scene monitor onlayer terminal # Displaying the background of a computer monitor

    <Rest of game code here>

    return

And it worked. But then I remembered that them old monitors used line scan, due to which anything displayed on it looked as if striped. I can give an example, which is the Fallout 3 hacking screen - if you look closely, you will notice them scanlines. So I decided to implement that effect somehow in my project; I remembered that in another Ren'Py game, "Digital: A Love Story", I saw that effect implemented nicely, so I though about analysing its code, but since it is such a complicated game my brain bled too much and I gave up. So, my first question would be whether anyone smarter than me could create a nice Ren'Py cookbook entry about making a TV scanlines effect ^_^

But, being a bit stubborn, I tried to tinker with Ren'Py and find a solution of my own. I devised an algorythm (which didn't work as I expected, though), which involves creating another layer (scanlines), on which a transparent image with scanlines would be displayed (scanlines.png), overlaying all underlying layers. The code is as follows:

Code:
init python:
        config.layers.insert(0, 'monitor') # Creating a layer for underlying image of a computer monitor
        config.layer_clipping['master'] = (100, 100, 600, 400) # Defining area for master graphics area

        config.layers.insert(1, 'scanlines') # Creating a layer for overlaying image of TV scanlines
        config.layer_clipping['scanlines'] = (100, 100, 600, 400) # Defining the area to overlay with the image of TV scanlines

        config.layers = ['monitor', 'master', 'transient', 'screens', 'overlay', 'scanlines'] # Putting the scanlines to the most overlaying layer
init:
    image monitor = "monitor.jpg" # Defining the Displayable for image of a computer monitor
    image scanlines = "scanlines.png" # Defining the Displayable for image of TV scanlines
label start:
    scene monitor onlayer terminal # Displaying the background of a computer monitor
    scene scanlines onlayer scanlines # Displaying the overlaying scanlines

    <Rest of game code here>

    return

And it worked, kind of. Scanlines overlayed the graphics and text nicely, making it look as if both game graphics and text are printed on my stylized "computer monitor". But then I suddenly found out that scanlines overlayed not only the graphics area, but all game menus - pause, save, load, preferences, etc., - rendering them useless. So I tried to locate on which layer the menus were rendered, and identified it as 'screens'; so by changing the code from

Code:
config.layers = ['monitor', 'master', 'transient', 'screens', 'overlay', 'scanlines'] # Putting the scanlines to the most overlaying layer

to

Code:
config.layers = ['monitor', 'master', 'transient', 'scanlines', 'screens', 'overlay'] # Putting the scanlines atop the graphics but below the menus

I managed to get scanlines off the menus;
but the drawback was that it disappeared from over the text, too, which means that text is rendered on 'screens' layer too! I wanted the scanlines to overlay the text but stay off the menus, so I tried to create a new layer ('textarea') for the text and put it below the 'scanlines' layer, while 'screens' layer remained atop, by editing the screens.rpy. But there I did'n find any statement which states on which layer the ADV-style text should be rendered! I tried to add the 'onlayer textarea' statement here and there, like:

Code:
screen say:

    <Smart config stuff here>

    # Decide if we want to use the one-window or two-window varaint.
    if not two_window:

        # The one window variant.       
        window:
            id "window"

            has vbox:
                style "say_vbox"

            if who:
                text who id "who" onlayer textarea

            text what id "what" onlayer textarea

    else:

    <More smart config stuff here>

but it always resulted in an error:

Code:
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


On line 27 of D:\Games\DR Test Project/game/screens.rpy: u'onlayer' is not a keyword argument or valid child for the text statement.
text who id "who" onlayer textarea
                         ^

Ren'Py Version: Ren'Py 6.12.0e

So if nobody could write a cookbook article for TV scanlines effect, then my second question is as following: could I re-define on which layer the ADV-style text frames should be rendered while leaving menu screens on their pre-defined 'screens' layer?

Thanks for you effort and my sicnerest apologies for writing such a long and brain-exhausting post,
--
S.


Top
 Profile Send private message  
 
PostPosted: Fri May 13, 2011 1:42 pm 
Ren'Py Creator
User avatar

Joined: Mon Feb 02, 2004 10:58 am
Posts: 10774
Location: Kings Park, NY
Completed: Moonlight Walks
Projects: Ren'Py
Your best bet would be to add the code:

Code:
init python:
    config.menu_clear_layers.append('scanlines')


To your game. This will cause the scanlines layer to be cleared when you enter the out-of-game menus, which I think would give you what you want. An alternative approach might also be to show the scanlines on a screen with zorder -1, so that it shows on the screens layer, but below everything else on that layer.

_________________
Another Old-Fashioned Bishoujo Gamer
Supporting creators since 2004; Code > Drama
(When was the last time you backed up your game?)
"It is not the critic who counts; not the man who points out how the strong man stumbles, or where the doer of deeds could have done them better. The credit belongs to the man who is actually in the arena, whose face in marred by dust and sweat and blood; who strives valiantly; who errs, who comes short again and again, because there is no effort without error and shortcoming" - Theodore Roosevelt


Top
 Profile Send private message  
 
PostPosted: Fri May 13, 2011 2:05 pm 
Newbie

Joined: Sat Apr 23, 2011 2:28 pm
Posts: 4
Thanks; it worked, this, I mean:

Code:
init python:
    config.menu_clear_layers.append('scanlines')

Would appreciate a cookbook entry on TV scanlines effect, though ^_^


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Protected by Anti-Spam ACP
Powered by phpBB® Forum Software © phpBB Group