 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
Bagne ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA

Joined: 19 Feb 2003 Posts: 518 Location: Halifax
|
Posted: Sat Jan 09, 2010 8:31 am Post subject: Slice question |
|
|
Is it yet possible to specify slice layering in relation to map layers?
Like ... placing a slice between map layers x and y? _________________ Working on rain and cloud formation |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Sat Jan 09, 2010 3:45 pm Post subject: |
|
|
Yes indeed! Check out "set parent" and "lookup slice" in the plotscripting dictionary.
Basically, you can attach a slice to any map layer, and it will be drawn on top of that layer, but underneath any higher layers.
Remember that when you attach a slice to a map layer, the x,y pixel position becomes relative to the whole map, not just relative to the screen. If you want to attach something to a map layer but still position it relative to the screen, you can use the "set screen x" and "set screen y" commands. |
|
Back to top |
|
 |
Bagne ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA

Joined: 19 Feb 2003 Posts: 518 Location: Halifax
|
Posted: Sat Jan 09, 2010 5:43 pm Post subject: |
|
|
Hooray!
Clack! Clack! _________________ Working on rain and cloud formation |
|
Back to top |
|
 |
Bagne ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA

Joined: 19 Feb 2003 Posts: 518 Location: Halifax
|
Posted: Sun Jan 10, 2010 8:55 am Post subject: |
|
|
Oops, ok ... question. Or ... feature request ... or something.
Here's what I'm trying to do: I'm trying to get my wizard to summon a massive lightning - bolt that will descend from the top of the screen and strike him. Here's my problem: I wish to be able to summon this lightning *anywhere*, including maps that have graphics in upper layers (i.e. tree tops, etc).
I need to be able to differentiate between the trees I am currently behind, and those in which I am in front. That way, I can get the lightning bolt to pass behind some tree tops, and in front of others, by drawing different pieces of the bolt in different layers.
How do I do this? Well, I'm looking for ideas.
So far, I have been thinking that my script can check for tree tops, and follow the map tiles down to the tree base. I will then use the y - value of that tree base to do a makeshift "y-sort" and thus draw the lightning bolt within the proper layers.
This should work, but it's terribly clumsy.
A related question/suggestion:
Are bigger walkabouts being given serious consideration?
I've been reading the Plan for Bigger Walkabouts - and I think that my lightning bolt problem could also be encountered here - especially if we start using very tall walkabout sprites.
Imagine I draw a bush. It is one tile high, and I draw it in layer 2 so that the hero's feet pass behind it. But now, when a sufficiently tall hero walks in front of the bush, his head gets cut off.
My point is, real-time use of large sprites will make it difficult to use map layers to give the illusion of "in front" and "behind".
In order to reap the full benefit of large walkabouts, it would be a good idea to allow some sort of y-sorting with objects on the map.
Maybe this would involve constructing "map-sprites" out of maptiles (say you make a tree), you associate some kind of wall-mapping to the "map-sprite" (block the base of the trunk), and then paint the sprites onto the map. Game.exe would then automatically y-sort the sprites (like how it's done in battles). _________________ Working on rain and cloud formation |
|
Back to top |
|
 |
Baconlabs PURPLE IS MANLY

Joined: 15 Mar 2009 Posts: 335 Location: Tennessee
|
Posted: Sun Jan 10, 2010 3:46 pm Post subject: |
|
|
A lightning bolt attack? Odd, I did something just like that in SHiIDA, though it's not usable outside of one scenario for now.
I used Attack Graphic slices, I think. I can't remember if there were issues regarding map layers, but I think slices automatically have a higher priority than heroes, NPCs, and map tiles. |
|
Back to top |
|
 |
Bagne ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA

Joined: 19 Feb 2003 Posts: 518 Location: Halifax
|
Posted: Sun Jan 10, 2010 5:40 pm Post subject: |
|
|
Can you summon the lightning to strike in front of a tree (or wall), walk around it, and then summon it behind the tree (and everything will look normal)? _________________ Working on rain and cloud formation |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Mon Jan 11, 2010 3:38 am Post subject: |
|
|
It's funny how I only considered that while thinking about scripted games and not about built in larger walkabouts. Yes, you are right, we're screwed. The map layer system can't handle this, and we need to move to map objects.
By the way, you don't want y sort. Y-sort sorts based on the screen position (of the top of the slice). You need to sort by the y-position where each item stands (effectively, depth into the screen). Use setsortorder and sortchildren.
Are your trees different heights? Or can you assume that they are have one tile in a layer above the heroes? If so, you can get away with just splitting your bolt in two pieces. Otherwise, your options are to do what you described, or to draw your trees and slices and use z-sorting. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Bagne ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA

Joined: 19 Feb 2003 Posts: 518 Location: Halifax
|
Posted: Mon Jan 11, 2010 5:03 am Post subject: |
|
|
I wanted it so that the deeper into the forest you get, the larger the trees will grow. It should make a neat visual, while also assisting the player in landmarking themselves on the map.
So far my tree tiles look like this:
CC
BB
BB
and
CCC
BBB
BBB
B stands for "Base" - it's wallmapped off, and C is an upper-layer canopy tile.
So, yeah - if I drop my variable tree-size idea, I could just place the bottom-most bolt tile in below layer 2, and the rest above.
I was hoping to include trees later like this:
CCC
CCC
BBB
BBB
or even
CCCC
CCCC
CCCC
BB
BB
and
CCCCC
CCCCC
CCCCC
BBB
BBB
Actually, I can make them to an arbitrarily large size. That's the cool thing.
Okay, maybe y-sort wasn't the right word ... I basically meant to say that if I could associate a tree-top with a tree base tile that is at a higher y-value than my hero, I should place the bolt behind that tree top.
I don't know if I understand your last option.
Draw trees and slices and z-sort? Do you mean that I draw my trees as a slice sprite (along with the lightning)? Can you assign sprites a z-value?
What is z-sorting supposed to accomplish?
When I'm drawing a sprite, I only care about their proximity to the camera (y value). _________________ Working on rain and cloud formation |
|
Back to top |
|
 |
ShakeyAir
Joined: 27 Apr 2004 Posts: 93
|
Posted: Tue Jan 12, 2010 12:31 am Post subject: |
|
|
as crappy as the implementation would be, i think having several walkabout graphics that are the same as your overhead map tiles, and using a script to overlay them on the fly, and then draw the lightning bolt with fake y-sorting would be the easiest way to do it.
i mean:
suspend movement
get camera x/y
go through the overhead map layer(s) that show up in the camera position, reading what tile is there
load a walkabout sprite slice that looks the same onto each maptile
individually
set its sort number based on its y position
draw the lightning, set its sort number based on the position it is hitting on the ground
sort slices
..whatever else
resume movement
also, you would need some consideration for when the lighting is hitting below an overhead tile. probably the 'easiest' way to do this is:
check if lightning hits below overhead tile
if true:
check if the tile above the 'hit' tile is also overhead, if so, change its sort number to the same as the 'hit tile'
repeat for tile above that as long as you need to
the main thing that could complicate this even further is if two slices can not have the same sort number. then, you will need to use some value range that increases left to right, and compensate for that (a new Y row is 19 larger than the last (18?(two halfsies?) tiles on screen at a time, 1 for the lightning (which will be 1, i am assuming))
basically. yikes. no fun to code at all. though in practice, you would probably only check tiles that are around the lightning bolt (like the middle 3 columns, top 10 rows or something)
a better idea, probably? assuming you have a long game, wait until big walkabouts and some elegant solution is introduced. until then, just let the lightning show up over everything and dont worry too much.
EDIT: also, to TMC, concerning big walkabouts and z-sorting and all that..
keep in mind that some overhead tiles are truly overhead, and some are just in front. maybe handled with separate overhead settings? like "walk behind layer" and "overhead layer"? |
|
Back to top |
|
 |
Bagne ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA

Joined: 19 Feb 2003 Posts: 518 Location: Halifax
|
Posted: Tue Jan 12, 2010 5:56 am Post subject: |
|
|
Quote: | a better idea, probably? assuming you have a long game, wait until big walkabouts and some elegant solution is introduced. until then, just let the lightning show up over everything and dont worry too much. |
Yeah, this is probably what I'll end up doing.
Yeah geez - there's something else I want to do and I'm again in the same situation.
I want to make an explosion animation. I'll use an attack graphic sprite which covers ... what, 3x3 tiles? Also, I want to be able to animate this explosion pretty-much anywhere the hero can walk.
Anyways, say I put the sprite below layer 1. This will look weird: All of my bushes and rocks will overlay the explosion graphic.
However, if I put it above layer 1, I have another problem - the explosion appears to slice through the center of my trees which use tiles from multiple layers.
Hey - you know what might be a simpler solution than using map-sprites?
This would require two- things:
1) Sprites can represent either a flat or vertical surface. (a "vertical" sprite would have all of its pixels at a single y value, and the vertical positioning of pixels would instead vary in z-values)
2) Every map layer can be assigned a z-value
This way, every map pixel would have an x,y and z value. The only drawback is that very tall map-tile objects would need to use tiles from multiple layers in order to properly interact with very tall sprites.
Is this actually simpler?
Maybe not.
Hmm...
Actually, this idea doesn't preclude map-sprites. If both were implemented, you could actually start creating highly simplified 3D terrains! _________________ Working on rain and cloud formation |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|