aliens

Author Topic: unit shadows and all units at above levels are visible as outlines?  (Read 7694 times)

Offline kikimoristan

  • Commander
  • *****
  • Posts: 647
    • View Profile
Unit shadows:
Terrain or objects undearneath standing units becomes darkness level -1. Same effect as darkness for map but only for 1 specific tile. Shadow persists until the unit leaves the grid cell.
Shadows are cast by flyers as well.
Shadows count as darkness making human/civilians underneath that are standing in the shadow have a vision of -1 as if it's  (the map) darker by 1 unit.


Units above as outlines:
Clicking the button Multi Level View has 3 states
1. normal
2. all units that are at levels above the current one are displayed as outlines only.all units below current level have an outline that is always visible.
3. all levels (and units) are displayed
« Last Edit: February 14, 2015, 09:12:07 am by tollworkout »

Offline volutar

  • Colonel
  • ****
  • Posts: 351
  • Vanilla digger & Quality assistant
    • View Profile
Re: unit shadows and all units at above levels are visible as outlines?
« Reply #1 on: February 14, 2015, 10:03:43 am »
It was the idea of like 2+ years ago...
You can try to implement this, if you wish.

Offline kikimoristan

  • Commander
  • *****
  • Posts: 647
    • View Profile
Re: unit shadows and all units at above levels are visible as outlines?
« Reply #2 on: February 14, 2015, 11:46:33 am »
Cool

Is that image a mockup or real?  Looks good. I don't think round shadow is needed.

What do I need to do to  get git setup?

Offline volutar

  • Colonel
  • ****
  • Posts: 351
  • Vanilla digger & Quality assistant
    • View Profile
Re: unit shadows and all units at above levels are visible as outlines?
« Reply #3 on: February 14, 2015, 01:26:03 pm »
Sure it's a mockup. Of more than 2 years old.

Why not round?
Blob shadows is pretty common practice for oldschool "8bit" neat pixelart style.
In oldstyle games this blob shadow mostly was part of the sprite itself, but it won't work in our case.
Though it's totally feasible. I see only one problem. It's the shadow casting over the slopes.

Offline kikimoristan

  • Commander
  • *****
  • Posts: 647
    • View Profile
Re: unit shadows and all units at above levels are visible as outlines?
« Reply #4 on: February 14, 2015, 02:17:32 pm »
I'd rather shade the entire tile underneath.

Here are reasons as to why:
1. The shape of the shadow is constant independent of the unit shape.
2. There is no extra logic needed to figure out slopes or shadow orientation.
3. The sprite darkening methods are already implemented all we do is call them when an unit is "shadowing" a tile and or a unit immediately underneath.
4. Because the game is tile /grid based and nobody will find it strange. Would be more strange if only half a tile is being shadowed then you have to use loftemps to calculate which part of the unit is being shaded etc.
6. It fits with the rest of the game as map tiles over each other shade areas underneath.
7. Is simple.
8. Completely unrelated but I also like Minecraft and I prefer the shadow square :) Is just cooler. Fits with the retro game look.

I care more about the limited vision to units underneath for example your flying guy above will make the sniper below see less.  Now that's pretty cool!

Gotta say tho. The arrow shadows can easily be done using sprite image and some dissolve type oldschool transparency shadow. Or more like checkered holes in the black shadow area.

The hard proper way would be to have a shadow sprite placed directly underneath the unit sprite but I don't want that :)
« Last Edit: February 14, 2015, 02:22:04 pm by tollworkout »

Offline volutar

  • Colonel
  • ****
  • Posts: 351
  • Vanilla digger & Quality assistant
    • View Profile
Re: unit shadows and all units at above levels are visible as outlines?
« Reply #5 on: February 14, 2015, 02:29:16 pm »
4. Because the game is tile /grid based and nobody will find it strange.
I find it UGLY, not strange. Be careful with the word "nobody". Because it could turn out that your opinion happen to be minority.

Quote
I care more about the limited vision to units underneath for example your flying guy above will make the sniper below see less.  Now that's pretty cool!
It's pretty insane - putting people above people to make them darker.

Offline kikimoristan

  • Commander
  • *****
  • Posts: 647
    • View Profile
Re: unit shadows and all units at above levels are visible as outlines?
« Reply #6 on: February 14, 2015, 02:54:58 pm »
You're right about first part . By nobody I meant me.
I mean is more realistic but still fits the tiled XCom world. That's what I am excited about :)

Offline volutar

  • Colonel
  • ****
  • Posts: 351
  • Vanilla digger & Quality assistant
    • View Profile
Re: unit shadows and all units at above levels are visible as outlines?
« Reply #7 on: February 14, 2015, 03:04:12 pm »
Square shadow covering whole 1x1m tile under skinny unit excites you? Oh god. It gonna be awful I'll never support that. Blob shadow with comparable size could be ok. Perhaps even without slope variation. And this shadow should move along with unit during walk.
Tho it shouldn't affect gameplay, ie there shouldn't be any shadow under unrevealed units. Shadow casting for slope calculation shouldn't be too hard. I already made projectile shadow casted correctly to the loft. I don't think it would be too difficult for small unit. But for 2x2 units it could be tricky (not to cause any gaps).

Offline kikimoristan

  • Commander
  • *****
  • Posts: 647
    • View Profile
Re: unit shadows and all units at above levels are visible as outlines?
« Reply #8 on: February 14, 2015, 03:07:37 pm »
Ok. How would you make that blob shadow? It wouldn't be a sprite is has to be calculated darkness with the tile no?

Offline volutar

  • Colonel
  • ****
  • Posts: 351
  • Vanilla digger & Quality assistant
    • View Profile
Re: unit shadows and all units at above levels are visible as outlines?
« Reply #9 on: February 14, 2015, 03:43:55 pm »
The color modification mechanism is similar to globe shading and radar lines (over already drawn surfaces).
The shape is either fixed sprite, or number of sprites (considering slope), or calculated cached sprite(s) as a set of projected smaller sprites (like, 4x2 pixels).

The problem is the rendering code. Currently it's really weird hardcoded method, to present more/less correct draw order for moving objects. I believe it should be refactored first, and then, this "shadow sprite" could be integrated into that render queue, like some ground object.
« Last Edit: February 14, 2015, 03:51:27 pm by volutar »

Offline kikimoristan

  • Commander
  • *****
  • Posts: 647
    • View Profile
Re: unit shadows and all units at above levels are visible as outlines?
« Reply #10 on: February 14, 2015, 03:54:16 pm »
Wait how about create another tile that has a cylinder shaped loftemp 1 cell high (as big as a soldier) and only shading the pixels that are at the intersection of the two loftemps?   Or whatever is called. That way the shadow will follow the shape of anything.  This is just for size 1 units.

Or you could even use the unit's own loftemp intersected with the tile underneath.

Or you could simply make a sprite that is a circle and not care about slopes etc.

What do you think?

Offline volutar

  • Colonel
  • ****
  • Posts: 351
  • Vanilla digger & Quality assistant
    • View Profile
Re: unit shadows and all units at above levels are visible as outlines?
« Reply #11 on: February 14, 2015, 04:04:41 pm »
Or you could simply make a sprite that is a circle and not care about slopes etc.
That's essentially the first thing among listed. "Fixed sprite".
Quote
What do you think?
I think you simply don't really understand how engine works. There's no "intersection" concept whatsoever.

Why are you asking? Are you gonna implement this? Because, I'm afraid noone is going to.
« Last Edit: February 14, 2015, 04:06:36 pm by volutar »

Offline yrizoud

  • Commander
  • *****
  • Posts: 1014
    • View Profile
Re: unit shadows and all units at above levels are visible as outlines?
« Reply #12 on: February 14, 2015, 04:21:06 pm »
Once you have flying soldiers, such shadows would be helpful to locate them more accurately.
However, I don't see how to handle 2x2 units whose shadow is over non-flat terrain.

Offline kikimoristan

  • Commander
  • *****
  • Posts: 647
    • View Profile
Re: unit shadows and all units at above levels are visible as outlines?
« Reply #13 on: February 14, 2015, 04:30:33 pm »
I don't understand how the engine works but I am able to code. I can spend a bit of time and I m sure I can understand how it works.

I am asking because you already know more than me. It helps me point the right direction so I know if I wanna make this kinda where or how to get started and what to focus on. For example if I was gonna get started a moment ago i as gonna look into loft thing and how that works and waste a bit more time. etc

Yeah i know 2x2 units would be harder to implement.

I kinda still wanna try just shading the tile underneath would probably be easier to implement.
« Last Edit: February 14, 2015, 04:32:46 pm by tollworkout »

Offline volutar

  • Colonel
  • ****
  • Posts: 351
  • Vanilla digger & Quality assistant
    • View Profile
Re: unit shadows and all units at above levels are visible as outlines?
« Reply #14 on: February 14, 2015, 04:42:24 pm »
Surely it's the easiest way, and the ugliest by the results (from my point of view).
Voxels (lofts) are considered only for the fire/throw tracing, for unit<->unit "can see" estimation, and I added functionality for shaded particles of projectile coordinate estimation. There is no other usage of it.  And exactly this function theoretically could be used to find out all 4 sides, and the center of the "unit shadow", to estimate slope. Or we can project multiple "particles" down to the sprite, with smallest sprites, pre-render them into "shadow" sprite and cache it. And then use it not as ordinary sprite, but as special "darkening" sprite, perhaps using Yankes' shader function.
And as I already said, it 100% will cause visual glitches during the movement, because rendering with movement now is really tricky and fancy, and it would need to be refactored before anything new added.