
Displaying Sprites
Ok, here is my problem.
My friend and I are in the process of making a C++/DirectX Hexagon-based Isometric Engine. It works fine so far. We can make it tile the hexes perfectly. Except when a sprites'' base hex is not on the visible screen.
For instance, the main character is visible on the screen, but a tree is covering him. This tree is huge and the base of the tree is way off below the charatcer and not visible on the screen.
Without having to blit everything in every direction hoping to get the base of the tree, how can this be done? So the tree is displayed over the charcter?
Hope this is easy to understand
Thanks in advance

Heres an idea for you:
each cube has a "dependecy" to other squares, meaning
that in order to draw the hero''s square, you have to
draw the tree that blocks him too, even if its not
on the shown map, with me so far?
so, for each cube, you have a list of cubes that contains
terrain that affect this cube, so that u know what cubes to draw.
ex.
x x x x
x x x x
x x x x
x x x x
lets say that the visible area is 3x3, and the hero
is at 3x3, but the tree on 3x4 is blocking him, so
when you load the map, u see exactly what terrain blocks each
cube, and u put in 3x3 cube data, dependency for cube 3x4
is that what you looked for?
Gil
each cube has a "dependecy" to other squares, meaning
that in order to draw the hero''s square, you have to
draw the tree that blocks him too, even if its not
on the shown map, with me so far?
so, for each cube, you have a list of cubes that contains
terrain that affect this cube, so that u know what cubes to draw.
ex.
x x x x
x x x x
x x x x
x x x x
lets say that the visible area is 3x3, and the hero
is at 3x3, but the tree on 3x4 is blocking him, so
when you load the map, u see exactly what terrain blocks each
cube, and u put in 3x3 cube data, dependency for cube 3x4
is that what you looked for?
Gil
[email=gil@gilzu.com]Gil Zussman[/email]Check out Goose Chase, Coming this fall!http://www.gilzu.com
I think I understand what you mean. (But where did cubes come into it
)
So I will basically have to number each hexagon with a number of the sprite that covers it? Correct? If it is then that will be very hard to do, especially for very large maps...
Is that what you meant?

So I will basically have to number each hexagon with a number of the sprite that covers it? Correct? If it is then that will be very hard to do, especially for very large maps...
Is that what you meant?

lol... sorry, i''m still stuck with rectangles.
yup, thats what i meant.
hard to do?
not really, and u have to easy tech to do that.
imagine your current situation where you have 2
layers: background and hero+NPC(call it units if you wish)
here w/me?
now add a third layer which we call it the block layer
since what you have on this layer, is things that will
always be topmost and always block the other two layers.
now save that layer as if each hexagon (see? i''m concentrating)
saves its own sprite, so that you wont have to look for the whole screen what-blocks-what.
now is it better?
Gil
yup, thats what i meant.
hard to do?
not really, and u have to easy tech to do that.
imagine your current situation where you have 2
layers: background and hero+NPC(call it units if you wish)
here w/me?
now add a third layer which we call it the block layer
since what you have on this layer, is things that will
always be topmost and always block the other two layers.
now save that layer as if each hexagon (see? i''m concentrating)
saves its own sprite, so that you wont have to look for the whole screen what-blocks-what.
now is it better?
Gil
[email=gil@gilzu.com]Gil Zussman[/email]Check out Goose Chase, Coming this fall!http://www.gilzu.com
OK, lets see if I''ve got you so far.
I have three layers (which I have) a background (the ground), the people layer and the foreground (trees and such). I have to break the foreground layer into individual hexes right?
But what if a character is behind a tree? It will draw the hex on top. But what if the character is in front of the tree? How do I know to draw the tree behind the character?
I have three layers (which I have) a background (the ground), the people layer and the foreground (trees and such). I have to break the foreground layer into individual hexes right?
But what if a character is behind a tree? It will draw the hex on top. But what if the character is in front of the tree? How do I know to draw the tree behind the character?
since its ISOMETRIC, i.e.
x y
z
the thing that is closest to you, will always be shown.
meaning?
if you have 3x3 matrix, you first show the distant from you row
then closer and then closer and so on, if you do it right,
youll never "step" over smting you dont want to
Gil
x y
z
the thing that is closest to you, will always be shown.
meaning?
if you have 3x3 matrix, you first show the distant from you row
then closer and then closer and so on, if you do it right,
youll never "step" over smting you dont want to
Gil
[email=gil@gilzu.com]Gil Zussman[/email]Check out Goose Chase, Coming this fall!http://www.gilzu.com
July 22, 2001 12:19 AM
Yep, thats what we have so far. It draws each hex from the top row, goes down to the next row, draws that one and keeps going, keeping track of where the people are and drawing them at the right place. So we have the whole, ''3D'' look to the engine.
Maybe we are doing it completely wrong though. As I said, we have 3 surfaces, background, people, and foreground.
With the foreground it is broken up into individual sprites, ie a tree is an entire sprite (covering multiple hexes) with a ''base hex'' (so we know where to put it) Is this the right way to have the foreground?
So we have these sprites with the base hex being at the bottom of the sprite. Now we have scrolling implemented and it is working well, but if we have one of these foreground sprites going off the screen, if the base hex cannot be seen, then the entire sprite is not drawn. The only way we could get the hex to draw is if we ''scan'' ahead in the map to see if there is a sprite that we can see. But this takes a lot of time and I am wondering if there is a different way of doing it???
Thank you
Maybe we are doing it completely wrong though. As I said, we have 3 surfaces, background, people, and foreground.
With the foreground it is broken up into individual sprites, ie a tree is an entire sprite (covering multiple hexes) with a ''base hex'' (so we know where to put it) Is this the right way to have the foreground?
So we have these sprites with the base hex being at the bottom of the sprite. Now we have scrolling implemented and it is working well, but if we have one of these foreground sprites going off the screen, if the base hex cannot be seen, then the entire sprite is not drawn. The only way we could get the hex to draw is if we ''scan'' ahead in the map to see if there is a sprite that we can see. But this takes a lot of time and I am wondering if there is a different way of doing it???
Thank you

well, you have two ways:
a. pre-scan for what disturbs what
b. (better) use a clipper object. u draw 3-4 hexagons outside
the map, and the clipper object will let only the map part
to be drawn. after all, thats his purpuse.
Gil
----------------------
microsoft beta test:
does the splash screen works? SHIP IT!!!
a. pre-scan for what disturbs what
b. (better) use a clipper object. u draw 3-4 hexagons outside
the map, and the clipper object will let only the map part
to be drawn. after all, thats his purpuse.
Gil
----------------------
microsoft beta test:
does the splash screen works? SHIP IT!!!
[email=gil@gilzu.com]Gil Zussman[/email]Check out Goose Chase, Coming this fall!http://www.gilzu.com
Ahhhh, but we are trying to have sprites the size of entire buildings, not just a few hexes big...
Can you understand our problem?
PS Thanks for helping me (no-one else is... *sniff*)
Can you understand our problem?
PS Thanks for helping me (no-one else is... *sniff*)

ummm... nope, lost u this time.
p.s.
itll b nice if you could answer my prob:
http://www.gamedev.net/community/forums/topic.asp?topic_id=55225
p.s.
itll b nice if you could answer my prob:
http://www.gamedev.net/community/forums/topic.asp?topic_id=55225
[email=gil@gilzu.com]Gil Zussman[/email]Check out Goose Chase, Coming this fall!http://www.gilzu.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement