Regarding Overlays (Some Thoughts from Work)

Started by Plot, Mon 10/11/2008 19:23:11

Previous topic - Next topic

Plot

After doing a bit of research on overlays, I started to wonder if they could be the solution I'm looking for. The problem, which I probably should have explained first, is that I'm looking for a way to place a transparent texture over most of the rooms in my test game.

Essentially I'd like every room to look as if it were drawn on a piece of blue-lined notebook paper. It's not a terribly new idea, but it's appropriate for the art direction I've started. I was just pasting the texture directly onto the backgrounds in my graphics editor but the problems of doing this became apparent the moment a large object or sprite appeared on the screen--they'd all overlap the blue lines. This was fine with the playable character, but when it happens with puzzle objects it kind of kills the challenge.

Despite the actual game world being black and white, making the sprites transparent won't work because I'll end up with a mess of lines and possibly losing the character on certain backgrounds. So I thought about turning a piece of notebook paper into a massive object, say the size of the room, and placing it over the room with a transparency set for white. There doesn't appear to be a limit on the size of the object, and it won't be animated, but I fear it its girth might break my already fragile little game.

Overlay seems interesting, though I'm a little confused as to whether or not I have to turn it on and off with every room. I suppose if I use a handful of overlays throughout the game (ideally), I would. Overlays actually sound the most promising, as they, if I'm understanding this correctly, are positioned above everything the room but below the GUI.

Naturally, I'm thinking about all of this while I'm at work (shhhh) so I can't try any of it out. I've written down some script for both the object and overlay method to try when I get home, but I'm curious to know if the effect is even possible or if I should just figure out how to pull it off with my graphics editor (lining up objects just right...I've done it, but wow, what a pain).

I'm not looking for script, necessarily, but any constructive input anyone's willing to offer would be great. So...any thoughts?

GarageGothic

Yeah, an Overlay does sound like a good solution for your game (though you will need some extra scripting if you want the grid to move along with scrolling rooms). If I recall correctly, speech overlays always have priority, so you shouldn't experience problems with the grid covering in-game text either - as you would if you used a full-screen GUI instead.

And yes, as far as I can tell Overlays are destroyed on room change, so you will have to re-initialize it upon entering a new room.

Trent R

But what if you declared an Overlay pointer in the global script and initialized it in game_start?

~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

GarageGothic

I think it has to do with the Overlay being destroyed by the graphic transition to another room rather than the Overlay itself being local to that room. For the experiments I did (where it does disappear on room change), I declared it globally in a module and created it in that module's game_start script.

Trent R

In that case, shouldn't he use on_event(eEventEnterRoomBeforeFadein) and maybe eEventLeaveRoom to destroy it manually and re-initialize it. And then, he can even specify certain rooms where he doesn't want it.

~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

Plot

Well, I feel more than a little foolish. Some experimentation proved successful (more or less), however in my mind I must have been assuming the engine would have some sort of multiply filter because it didn't even dawn on me that the blue lines would overlap the black lines featured in the background.

This means that the paper texture, which I had in the foreground, would need to go behind the actual background which, in turn, would have to feature a transparent white. It might be possible, but I see the script getting ugly fast. Real fast.

For now I'll stick with the old method of assembling the sprites with the aligned texture in the graphics editor as my knowledge with scripting is still very, very basic. I appreciate the help, though!

GarageGothic

If you make the game 32-bit, you could use an alpha channel in the Overlay to make the blue lines semi-transparent. Or if not, use a GUI instead, then you could simply use GUI transparency at, say, 50%. I think it should look OK even over darker lines.

Trent R: Yeah, that's what I meant when I said "you will have to re-initialize it upon entering a new room".

Khris

Couldn't one use a semi-transparent character? One line in eEventBeforeFadein:
Code: ags
  cLines.ChangeRoom(player.Room);

SMF spam blocked by CleanTalk