Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Applying filters on tiles. (https://forums.graalonline.com/forums/showthread.php?t=82649)

Rufus 11-04-2008 09:59 PM

Applying filters on tiles.
 
Is there any way to apply filters to tiles? Similar to backpals, but in a way that doesn't lag like hell. If you're not sure what I mean by filter, here's a level from Graal Classic and a "filter" from Zelda: Four Swords Adventures:

http://i284.photobucket.com/albums/l...ter-before.png

http://i284.photobucket.com/albums/l...er-applied.png

http://i284.photobucket.com/albums/l...lter-after.png

DustyPorViva 11-04-2008 10:03 PM

A layer with its transparency set would be able to replicate this. You know the deal with that, though.

cbk1994 11-04-2008 11:15 PM

Quote:

Originally Posted by DustyPorViva (Post 1439051)
A layer with its transparency set would be able to replicate this. You know the deal with that, though.

It might be possible to have a weapon script that edits the tilelayers on clientside, and sets the transparency. I might try that later.

Inverness 11-04-2008 11:41 PM

Quote:

Originally Posted by cbk1994 (Post 1439069)
It might be possible to have a weapon script that edits the tilelayers on clientside, and sets the transparency. I might try that later.

Of course it is, but Rufus said in a way that doesn't lag like hell, meaning a hard-coded method would be preferred over anything scripted. A filter is easily done by script.

Ideally you would specify a layer as a filter layer and provide an image to do it, then you would specify which tiles the filter would be drawn over, like grass tiles and such. Then Graal would apply the filter only over tiles that are in the allowed list, that way doesn't cover things like houses and paths and you wouldn't have to treat the filter as if it was another tile layer by manually placing them over the grass and such.

Better layering support could really allow for some awesome effects.

Rufus 11-05-2008 05:53 PM

Quote:

Originally Posted by Inverness (Post 1439074)
Ideally you would specify a layer as a filter layer and provide an image to do it, then you would specify which tiles the filter would be drawn over, like grass tiles and such. Then Graal would apply the filter only over tiles that are in the allowed list, that way doesn't cover things like houses and paths and you wouldn't have to treat the filter as if it was another tile layer by manually placing them over the grass and such.

Better layering support could really allow for some awesome effects.

You're correct and I must admit I didn't really think about it before I asked. There are tiles that are semi-grass semi-cliff, etc so applying a filter to tiles is not exactly suitable.

Inverness 11-05-2008 07:14 PM

Quote:

Originally Posted by Rufus (Post 1439446)
You're correct and I must admit I didn't really think about it before I asked. There are tiles that are semi-grass semi-cliff, etc so applying a filter to tiles is not exactly suitable.

Well in that case there would need to be a filter mask the same size as the tileset.

LordOfPi13 08-25-2010 04:28 AM

Amazing! For the record, are you publicly sharing this for use on servers? Or just for us to play around with =P

WhiteDragon 08-25-2010 04:41 AM

Quote:

Originally Posted by LordOfPi13 (Post 1596487)
Amazing! For the record, are you publicly sharing this for use on servers? Or just for us to play around with =P

I'm not sure what you're asking since there isn't anything shared at all except a Photoshop'd image.

adam 08-25-2010 06:04 AM

I'm so confused.

WhiteDragon 08-25-2010 06:19 AM

Wondering now though, if grass were laid on a separate layer from all your other tiles, and you used the transparent-edge cliff tiles and such on the higher levels, I don't think it would be too difficult to pull off an effect like this with something like a simple image overlay.

12171217 08-25-2010 06:24 AM

Sounds like a job for the stencil buffer!

..oh.. wait..

(Be forewarned that I typed this on my phone whilst very sleepy, I won't be home for a while, so if I'm rambling, please, ignore it.)

Yeah, with a stencil buffer you could take pics1 and make an overlay of sorts where black pixels are non-filtered and white pixels are filtered, then for the problem tiles that are half grass half non-grass, draw over them with the stencil buffer to crop out that specific area.

In current, non-stencil buffer Graal, you could draw it as a big overlay, then draw non-grass tiles from a separate pics1 with teansparency where the grass should show up on tip of that image. This would probably lag on older machines, though. Perhaps the best solution is to do the previously mentioned for only "problem tiles" that are half grass half non grass and separate the rest into tile layers, although I'm unsure how tile layers work exactly and if you can draw under them while still maintaining that the player be drawn above them.

Furthermore, I'm sure you can come up with something remotely satisfactory if you were to "bake" it into the level by automating the entire process via a third party scrypt you can write in Python or whatnot to redraw the level based on tile indexes that you send over, use a special pics1 with white being grass and black being non grass, parse out the grass parts via the black or white pixel color, I guess, make a 1024x1024 overlay for the entire level that is only on the grass portions, and send it back to the server to be downloaded and drawn by the client via a system NPC, all of which is perfectly doable in PHP with the GD library, or Python, or whatever you so choose to interface with on the server. And it would only have to be calculated once per level, forever and ever. That's what I did for my lightmapping system and it worked fabulously, with extremely zero lag since it's simply a 1024x1024 graphic being drawn over the screen at the level's top left corner.

Orrrrrr you can try and tinker with TDrawingPanels, but I wish you luck in getting those to work without freezing the client for a good two or three minutes while you redraw the level to a GUIControl, parse out the grass sections, and draw your detail texture to the grass areas to overlay.

Your best bet? The second to last method I described. Hooray for anything that looks good in Graal being a huge ****in' hack.

Fulg0reSama 08-25-2010 04:48 PM

Downsider... Too much text

12171217 08-25-2010 07:17 PM

It's very difficult to track how much you're writing when you're on an iPhone and your fingers are just flowing over the touchscreen. The only truely helpful things said were in the third to last paragraph. The rest are methods that will be unbearaly slow.

Fulg0reSama 08-25-2010 07:55 PM

Quote:

Originally Posted by 12171217 (Post 1596619)
It's very difficult to track how much you're writing when you're on an iPhone and your fingers are just flowing over the touchscreen.

I bet. My dad has one.


All times are GMT +2. The time now is 06:34 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.