OpenXcom Forum

OpenXcom => Suggestions => Topic started by: Daiky on August 26, 2011, 11:48:24 pm

Title: "grey" fog of war
Post by: Daiky on August 26, 2011, 11:48:24 pm
I was having fun with a custom blit function - it gives the opportunity to have very fast effects on the color per pixel - almost like a pixel shader.
Blitting certain tiles in a grey-scale color for example. See screenshot.
It could serve a purpose some time?
Title: Re: "grey" fog of war
Post by: michal on August 27, 2011, 05:17:17 am
Probably ;)

Also, what about bliting in green color? It could be used for example in night vision devices.
Title: Re: "grey" fog of war
Post by: Daiky on August 27, 2011, 12:17:21 pm
Yeah. Or a special treatment of a blue tint towards yellow and red tint, depending on the heat of the object/unit ;)
Title: Re: "grey" fog of war
Post by: Istrebitel on August 29, 2011, 11:45:27 am
It is insanely useful.

If you have an option to grey out the tiles your operative / squad has no vision of. Vision=can detect enemy in that tile.

It is awlays a PITA in such games to understand where you can and where you cannot see, since this often costs a life of your operative when one single tile is left unnoticed and enemy from that tile can counterattack when you are very close to him (most evil for me in JA2, where death of your merc is much more serious loss than that of X-Com operative, and sometimes its just insanely hard to understand wether you see every tile where enemy can possibly be or not)
By having a clear understanding which tile does an operative see and which he does not, playing this game will get lot less frustrating and allow you to focus more on thinking rather than calculating tiles by hand... multiple times... for multiple tiles and multiple operatives.

Also after researching certain alien X-COM operatives could incorporate that data to be able to see alien's sight range (like in JA2 1.13 you can see your "danger zone" which equals to enemy sight range, adjusted to your stealthiness, camo and land cover). This could help players study the way to play against aliens, study dead zones like those pesky corner ambushes, learn about how to generally approach aliens and make door ambushes and so on with in-combat on-demand help.

Also we could add a very stylish "Motion Scanner 3D view" or "Motion Detection Headgear" or something, where using the item would turn everything to dark gray and tiles where movement was detected would be transitioned to bright yellow, depending on the amount of movement done.

Maybe also make an additional research option unlocked after having researched several alien corpses and probably live aliens - Alien Lifesigns Scanner - which would again turn everything to dark gray and nearby tiles where aliens are would be tinted in a color which signifies a kind of an alien (machine, coldblooded, humanoid, etc) is there - possibly with a chance of a false positive or with a chance to show PREVIOUS alien position based on agent's reactions (meaning, imagining this all actually goes in real time, agent was a slowpoke and since the time he managed to scan the alien location, alien already moved itself). Or maybe it could show trace of alien movement, with more color = more recent position and less color = position further back in time, this would make reading the scanner's output harder and at the same time would not need to "break" it in any way by false readings to prevent it going too imbalanced good, on the other hand allowing players to study alien behavior from playing the game, not from reading WIKI articles on AI and looking at waypoint maps. Would make sense too, as often seen by special ops in movies (i suppose they take it from RL, not imagine) where they use thermal and other kind of scanners to check the movement patterns of the terrorists before making an attack, to minimise casualties.
Title: Re: "grey" fog of war
Post by: Daiky on August 29, 2011, 09:01:17 pm
Talking about motion scanner... I always found it a bit silly:
I quote ufopaedia:" This sophisticated device uses a variety of detectors..."
so I assume it has at least the very basic detectors like sonar and infrared, right?
And then: "Static units will not be detected."
I mean, what's the story behind it? Since when does either sonar or infrared not detect static objects? I would say the opposite: static objects are the easiest to detect :p

Ok, the device would become slightly overpowered, but you could compensate in more realistic ways for example : 100% TU use instead of 25%, a detection radius of only 4 tiles instead of 9...
Title: Re: "grey" fog of war
Post by: winterheart on August 29, 2011, 09:26:26 pm
Talking about motion scanner... I always found it a bit silly:
I quote ufopaedia:" This sophisticated device uses a variety of detectors..."
so I assume it has at least the very basic detectors like sonar and infrared, right?
And then: "Static units will not be detected."
I mean, what's the story behind it? Since when does either sonar or infrared not detect static objects? I would say the opposite: static objects are the easiest to detect :p

Maybe it based on Doppler effect. Or maybe this is reference to Alien movie. Who knows.
Title: Re: "grey" fog of war
Post by: SupSuper on August 29, 2011, 11:58:17 pm
It's probably for gameplay reasons, I'd be more worried about enemies moving around. :P
Title: Re: "grey" fog of war
Post by: Volutar on August 30, 2011, 10:37:18 am
100% it's the reference to Aliens movie. And I really don't know what kind of real or unreal physics lies beneth it. Doppler sounds a bit more realistic explanation than others, if any. :)
Title: Re: "grey" fog of war
Post by: Daiky on August 30, 2011, 11:04:56 am
Hmm, yes, it's indeed from the Aliens movie.
It might have been easier to do a motion detector in the movie technically or the kind of aliens did not show up on infrared, so it adds some more to the tension, also the blobs on the motion detector are not realtime, they have a low update frequency = also more tension.

Hudson: [reading a motion detector] I got signals. I got readings, in front and behind.
Frost: Where, man? I don't see shit.
Hicks: He's right. There's nothin' back here.
Hudson: Look, I'm telling ya, there's somethin' movin' and it ain't us! Tracker's off scale, man. They're all around us, man. Jesus!
Dietrich: [looking through an infra-red scope, walks right past an Alien] Maybe they don't show up on infra red at all.
[the Alien pounces on her and drags her up to the ceiling]
Title: Re: "grey" fog of war
Post by: Volutar on August 30, 2011, 11:56:20 am
https://www.worthpoint.com/worthopedia/aliens-1986-film-uscm-combat-motion-134391565
Quote
The modern motion tracker is a simple surveillance device originally designed for use by rescue and police services. Essentially, it is a high-powered ultra-sound scanner that Uses Doppler-shift discrimination to filter out moving objects from the stationary background.
Title: Re: "grey" fog of war
Post by: Daiky on August 30, 2011, 04:20:56 pm
Allright, thanks for the info  - I'm starting to like the x-com motion scanner now :)

So on topic: it makes no sense to have some kind of fancy motion scanner 3D view I guess.
Having a "greyed-out" fog of war to visualize your soldiers's current field of view, is probably the only realistic and useful application for this effect.

EDIT: a cool blip-blip-blip sound effect when the blobs light up would be nice though :)
Title: Re: "grey" fog of war
Post by: Yankes on August 30, 2011, 07:20:22 pm
heat-vision  - dont use normal LOS simply reduce power when pass objects, blinded by fire (its block LOS in that direction) , snakeman barely visible (every object will have temperature, more heat means more visible).
you cant see terrain when you using that. i think easer way to implemented is made it black&white when for every color:
Code: [Select]
dest = (src/32)+ ((src%16)/8) - heat;`-heat` because more white mean more hot.
night-vision - similar to normal vision except you cant see in bright light (this mean `shade` in current blit function can be negative). additional we could cast every color group to green.
Code: [Select]
dest = GREEN_GROUP + (src%16) + shade
Title: Re: "grey" fog of war
Post by: Yankes on September 06, 2011, 04:04:51 pm
i have new idea how to use custom blit function.
we can use it to change color of skin and hair in your solder.
fast check show that 2 different colors group are used for hair and skin and their arent used for any other thing in solder graphic.
this mean we can replace this group with another one to made different skin and hair color solder.
function should look like:
Code: [Select]
inline uint8 face_color(uint8 orgin, int shade, int skin_color, int hair_color)
{
int temp;
if(FACE_COLOR == orgin&COLOR_GROUP)
{
temp = (orgin & SHADE_VALUE) + shade;
if(temp>15)
return 15;
else
return skin_color | temp;
}
else if(HAIR_COLOR == orgin&COLOR_GROUP)
{
temp =  (orgin & SHADE_VALUE);
if(temp>15)
return 15;
else
return hair_color | temp;
}
else
{
temp =  (orgin & SHADE_VALUE);
if(temp>15)
return 15;
else
return (orgin&COLOR_GROUP) | temp;
}
}

to easy add different color function to blit function, it should be template function. this will allow us avoid function calling inside loop. 
Title: Re: "grey" fog of war
Post by: Daiky on September 06, 2011, 08:39:02 pm
hehe Yankes, that's great. It's a bit like how JA2 does it's different skin, hair and pants colors
Title: Re: "grey" fog of war
Post by: Yankes on September 06, 2011, 10:16:52 pm
it will be bit harder with first armor because hair and face belongs to the same color group. i think that every armor class could have separate blit function (alien could have this too, like red muton form intro)
Title: Re: "grey" fog of war
Post by: Yankes on September 08, 2011, 03:29:14 am
i create abomination!
Title: Re: "grey" fog of war
Post by: Daiky on September 08, 2011, 10:48:00 am
colorful  ;D
Too bad that you don't see any hair or skin in a flying suit.
So once you got flying suits, this way to differentiate your crew doesn't work anymore.


Once the battlefield is rendered in a higher resolution, say 1024x768, then you got the possibility to draw a soldiers' last name above his head, together with his rank (abbreviated).
That is maybe more interesting to see in one blink of an eye who is where.
Title: Re: "grey" fog of war
Post by: michal on September 08, 2011, 11:14:37 am
What about using that technique for creating new aliens? Green sectoids for example ;)
Title: Re: "grey" fog of war
Post by: Daiky on September 08, 2011, 03:05:26 pm
Or have the commander of a race in a slightly different color, so you see the difference and know which one you need to capture.
Title: Re: "grey" fog of war
Post by: Volutar on September 08, 2011, 03:22:10 pm
I really see only good use of these colors in classic xcom/alien race tree.
Different skin coloring of humans is silly.
Color coding of alien rank will be kind of a cheat...

Only human color coding of rank could be useful, BUT, these colors will be too far from original (how'd you like green  personal armor?), so also will be silly :)
Title: Re: "grey" fog of war
Post by: Yankes on September 08, 2011, 04:51:10 pm
What about using that technique for creating new aliens? Green sectoids for example ;)
without problems :)

right now only problem with this `tech` is that when soldier is killed (dying animation is not modified too) he create item that represent his corpse, and corpse don have that colors.


Too bad that you don't see any hair or skin in a flying suit.
So once you got flying suits, this way to differentiate your crew doesn't work anymore.
maybe add new color for flying suit e.g.  pink? :D

I really see only good use of these colors in classic xcom/alien race tree.
Different skin coloring of humans is silly.
Color coding of alien rank will be kind of a cheat...

Only human color coding of rank could be useful, BUT, these colors will be too far from original (how'd you like green  personal armor?), so also will be silly :)
how different colors of skin is silly? Xcom hire only white people? :>
whit this we can add:
new kind of aliens, or simply not every alien look that same (they can have blond people too :>)
new ethnic group to soldier and civilian, new hair color etc.
camouflage :> (your soldier are green in forest, black in night, white on arctic)
Title: Re: "grey" fog of war
Post by: Volutar on September 08, 2011, 05:02:41 pm
Yankes, xcom already have different races for soliers. No need of green or red or blue humans.
Coloring of aliens will make game not xcomish at all.
Same with camouflage. What for? To get players into pixel-hunting for own soldiers or what?
Title: Re: "grey" fog of war
Post by: Yankes on September 08, 2011, 05:27:01 pm
this colors are only proof of concept ;P i didnt made correct color for every `SoldierLook`.
and i dont want made pink aliens or something, simple add some variation: dark gray, normal, light gray Sectoid, blue zombis from solder with personal armor, different colors for Ethereal robes  etc.
Title: Re: "grey" fog of war
Post by: Volutar on September 08, 2011, 05:40:45 pm
I agree with clother color variations, with no dependance of rank or race or something, without impact on classic gameplay.
And I can expect such variations for alien skin colors with purpose of kind of "subrace", but only for some extended xcom. Though extended xcom should have totally another graphics, opengl, 3d and so on :).
Title: Re: "grey" fog of war
Post by: Daiky on September 08, 2011, 06:48:05 pm
There is no harm in experimenting of course.
But the thread kinda got bit off-topic: the suggestion was to have grey tiles to show your current view area, so the tiles you don't see are grey, and you are aware there could be aliens hiding out of your sight.
Title: Re: "grey" fog of war
Post by: Yankes on September 14, 2011, 03:24:11 am
now better version :)

[ps]
i have small problem with corpse item. its dont have any connection to owner of this body. if i could find it, it will be possible to colors corpse too.
Title: Re: "grey" fog of war
Post by: luke83 on September 14, 2011, 09:47:15 am
I like it, Can it change the suit colours also?
Title: Re: "grey" fog of war
Post by: Yankes on September 14, 2011, 02:27:25 pm
if you want change whole suit, yes. if you want color only part, no.
it simply replace one color group by another from palette:
https://www.ufopaedia.org/images/2/2b/5_BattleScapePal.Png
Title: Re: "grey" fog of war
Post by: SupSuper on September 14, 2011, 03:52:48 pm
now better version :)

[ps]
i have small problem with corpse item. its dont have any connection to owner of this body. if i could find it, it will be possible to colors corpse too.
Looks neat. :)
Corpses are just items so there is no connection to the original soldier, you'd probably need to modify the item structure for that. Although they might need a connection in case of stunned soldiers, dunno if/how Daiky has implemented that.
Title: Re: "grey" fog of war
Post by: Yankes on September 14, 2011, 05:09:45 pm
Looks neat. :)
Corpses are just items so there is no connection to the original soldier, you'd probably need to modify the item structure for that. Although they might need a connection in case of stunned soldiers, dunno if/how Daiky has implemented that.
or create new class `CorpseItem` that extends normal item class. his will allow me to even color corpses in inventory screen.
Title: Re: "grey" fog of war
Post by: Daiky on September 14, 2011, 05:39:32 pm
Proper implementation of unconscious units is planned for when the first stun items are implemented. But you normally should already get a the proper "corpse item" in the inventory screen of a dead unit.
(at least it works with xcom and sectoid corpses)

You need to make sure you've added the corpse to the bigobs.pck (and of course have created a RuleItem and used this to setCorpseItem when you defined the new RuleArmor )
Title: Re: "grey" fog of war
Post by: Yankes on September 14, 2011, 07:21:44 pm
my point of creating this "corpseitem" is for storing information whose is this body. adding this to normal items will only increasing complexity of this class and amount of useless data for rest of the items.
Title: Re: "grey" fog of war
Post by: kkmic on September 15, 2011, 11:08:17 am
Regarding the fog of war / line of sight:

How about coloring only the tiles that have been seen in that turn? Since aliens do not move on your turn, you can always see where you looked at in that turn. When the turn ends, everything turns gray again, except what is in the soldier's LOS at that moment.
Title: Re: "grey" fog of war
Post by: Daiky on September 15, 2011, 12:34:38 pm
That makes sense in a turnbased game I guess. Do you know an example of a turnbased game where it works like this? I'd like to try it out.
Title: Re: "grey" fog of war
Post by: kkmic on September 15, 2011, 02:19:34 pm
No, I have no example to give for that particular "feature" in a turn-based game.

The fog of war you find in most (every?) RTS games these days behaves pretty much in the manner I described - except it is in real-time.

Extending on my previous post, that would mean that you will have to have two battlescape "versions":

This would mean that a grenade going out on a previously discovered patch of terrain (but not currently in any soldier's LOS) won't have it's effects shown unless someone goes back and takes another look at that spot.

Hope my two cents make sense  ;D
Title: Re: "grey" fog of war
Post by: SupSuper on September 15, 2011, 03:14:19 pm
These kind of overlays can also be useful for quickly highlighting info for the user without cluttering the interface, like:
- The tiles the soldier can move to/fire from in that turn.
- The path a soldier would take to a certain point.
- Line of sight of units.
- Etc.
Title: Re: "grey" fog of war
Post by: Daiky on September 15, 2011, 04:40:28 pm
I like the highlighting of tiles on the path the soldier will walk.
You could highlight tiles in greenish where he can walk, in orange where he could walk when no time units are to be reserved, in red the tiles he will not be able to reach.
Title: Re: "grey" fog of war
Post by: SupSuper on September 16, 2011, 03:42:40 am
I think Ghost Recon 3DS has a feature like that: https://www.youtube.com/watch?v=NJxcD8t2CFY
Title: Re: "grey" fog of war
Post by: michal on September 16, 2011, 09:08:28 am
I think also xenowar has something similar:

(https://unflobtactical.googlecode.com/svn/wiki/images/xenowar_6.jpg)
Title: Re: "grey" fog of war
Post by: Volutar on September 16, 2011, 11:31:56 am
Ghost Recon 3DS? Correct me if I'm wrong, but is this the game developed by Julian Gollop?
Title: Re: "grey" fog of war
Post by: kkmic on September 16, 2011, 12:13:38 pm
I like the idea of highlighting paths too.

And indeed, various overlays are something that would be nice to have. How about having options for them and/or hotkeys to enable/disable (or maybe "this overlay is active when while X key is pressed" approach)

I believe this is a non-modifying gameplay alteration. After all, I want to see OpenXcom as faithful to the original as possible.
Title: Re: "grey" fog of war
Post by: Yankes on September 16, 2011, 12:21:42 pm
i have made next step into cloning X-Com soldier (did you remember blue skinned ones? :>). now they have chameleon genes!

and about highlighting paths, its can be say done by recoloring titles.
Title: Re: "grey" fog of war
Post by: SupSuper on September 16, 2011, 01:23:25 pm
Ghost Recon 3DS? Correct me if I'm wrong, but is this the game developed by Julian Gollop?
Yes, he even discusses the game in the video I linked. :)

i have made next step into cloning X-Com soldier (did you remember blue skinned ones? :>). now they have chameleon genes!

and about highlighting paths, its can be say done by recoloring titles.
More like ghost soldiers! :o
Title: Re: "grey" fog of war
Post by: luke83 on September 16, 2011, 01:36:13 pm
chameleon genes would be a awesome ABILITY for snake man.

Keep up the Good work Yanks , your making me very excited  ;)
Title: Re: "grey" fog of war
Post by: Daiky on September 16, 2011, 02:44:22 pm
nice work - alpha blitting !
It would be very nice to add this alpha blitting to the shadows of bullets.
What is the slowdown in fps of this?

anothe usage: to make objects transparent that are in front of a soldier.
Or to make the smoke particles transparent..
Title: Re: "grey" fog of war
Post by: Volutar on September 16, 2011, 03:29:37 pm
Intensive alpha blitting usage will slow fps dramaticaly. Shadows under bullets - probably will be fine, but smoke will require alot more CPU resources. Though same thing with OpenGL will be almost no-cost.
Title: Re: "grey" fog of war
Post by: Yankes on September 16, 2011, 04:55:26 pm
this ISNT alpha bliting :> i simply replace "shade" part from dest pixle by shade from src pixel. color group stay same
Code: [Select]
https://this function will be used for every pixel that is bited
static inline Uint8 func(const Uint8& dest, const Uint8& src, const int& shade, int, int)
{
if(src)
{
int t1 = (dest&ColorGroup) + (((src & ColorShade)+(dest & ColorShade)+ shade + 2)>>1) ;
int t2 = (dest&ColorGroup) | 15;
return (t2> t1)? t1 : 15;
}
else
return dest;
}
it have many limitations. it can be used for shadow, but probably different function could be used instead.
this is very fast function i dont see any big performance loose (i use it only for unit now).
i will soon update my fork of openXcom, if you are interested in my implementation of this :)
Title: Re: "grey" fog of war
Post by: Volutar on September 16, 2011, 06:52:28 pm
Alpha blitting is totally different. First of all it's a 24bit. Secondly it mixes every pixel from screen with applied, which is quite costy.
Title: Re: "grey" fog of war
Post by: SupSuper on September 16, 2011, 09:10:35 pm
nice work - alpha blitting !
It would be very nice to add this alpha blitting to the shadows of bullets.
What is the slowdown in fps of this?

anothe usage: to make objects transparent that are in front of a soldier.
Or to make the smoke particles transparent..

I presume it's not actual alpha, he's just using palette tricks so the soldier sprite colors get "added" onto the original tile colors instead, producing a transparent-looking sprite. Probably doesn't affect FPS but you're limited by how far the palette color gradients let you go.

Edit: Whoops didn't notice a page 4...
Title: Re: "grey" fog of war
Post by: Yankes on September 17, 2011, 01:10:04 am
on https://github.com/Yankes/OpenXcom i have my current version of SurfaceShader :D
now with soft shadows :)
Title: Re: "grey" fog of war
Post by: luke83 on October 02, 2011, 03:27:40 pm
Code: [Select]
i have made next step into cloning X-Com soldier (did you remember blue skinned ones? :>). now they have chameleon genes!

Yanks , is your " chameleon Genes" fully working? Do you know if it will be merged with the source code as im having some strange thoughts for its use and have been toying around with a new alien type between redrawing civilians . ;D



NOTE: On the alien there still my Civilian arms :P
Title: Re: "grey" fog of war
Post by: Yankes on October 02, 2011, 03:52:17 pm
yes and no, i can made every unit transparent by replacing normal blit function by my custom one. its cant be turn on/off on demand right now.
this will not be merged anytime soon because this is first mod of openxcom :D this code dont give anything useful or new for standard xcom.
if i could finish new version of globe i will be able to smuggle some code to main repo :D
Title: Re: "grey" fog of war
Post by: MKSheppard on October 02, 2011, 10:18:38 pm
What about using this to give X-COM different uniform colors?

I always found it hilarious you used the same color of jumpsuits/personal armor/power armor whether it was urban combat, desert combat, jungle combat or arctic combat.
Title: Re: "grey" fog of war
Post by: luke83 on July 01, 2012, 09:49:04 am
Yanks , i had a similar thought to RyanCrierie, but instead of changing the colours to suit the environent , could this be used in the equip craft screen to pick a soldiers  individual colour? 

Example - Billy Bob my love stepping out in a black jump suit but my Ms Piggy wants a pink suit.
Title: Re: "grey" fog of war
Post by: moriarty on July 01, 2012, 10:44:49 am
I can see this working with the personal armor and power/flying suit, but shifting palettes on the coveralls will probably result in weird skin colors :) I don't see a way around this, since the arms are only partly covered and the torso/head sprite also has uniform and skin parts.

of course, someone could go and subdivide the sprites from i.e. "left arm" into "upper left arm - uniform covered" and "lower left arm - skin", but that's a bit of work, and somebody else would need to write some code to re-combine them in the game (after palette shift has been applied...).
Title: Re: "grey" fog of war
Post by: luke83 on July 01, 2012, 10:54:17 am
from memory , Yanks specifies only the colours he want to replace , so if you tell to ignore the skin it would.

 Even if it was just a visual feedback for the player and that there not really wearing those colours in game, Just think i could make all my medics have red suits, my main snipers could be wearing black,  etc OR you could create colour teams , red team goes east blue team will serrp the UFO ... This would make it easier to see who is who when scrolling through a map, just activate this with a toggle button on or off.
Title: Re: "grey" fog of war
Post by: Yankes on July 01, 2012, 12:30:12 pm
yup, if armor have different color than skin I can change it independently.
moriarty you can look on my "skin color" example.