aliens

Author Topic: another idea - radar range on geoscape  (Read 109174 times)

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: another idea - radar range on geoscape
« Reply #90 on: July 16, 2012, 01:34:36 am »
line that you can see is leftover after my try to made borders a bit more smooth. It because I draw only first radar that have range there, right now this solution work more like Frog of War, every radar range is equal.

I only count 8 bases now, rest can be used for crafts :)

Good job, it looks nice. How's it done? Is it another "layer" or is it drawn "directly on the surface"? Would it be possible to mix the border color? This can be confusing - it can be mixed with the night shadow.
This is brutal force solution :D To lightning function I send position of radars in vector. then for every pixel I check if this pixel is in range with any of radars in list.
If is then I draw normal lighting divided by 2 in power, else I add 16 "shadow" value to made it darker. When I will be closer to release it I will tweak a bit this values to made it look better.
 

Offline Amunak

  • Colonel
  • ****
  • Posts: 101
    • View Profile
    • My homepage (czech only)
Re: another idea - radar range on geoscape
« Reply #91 on: July 16, 2012, 01:46:57 am »
This is brutal force solution :D To lightning function I send position of radars in vector. then for every pixel I check if this pixel is in range with any of radars in list.
If is then I draw normal lighting divided by 2 in power, else I add 16 "shadow" value to made it darker. When I will be closer to release it I will tweak a bit this values to made it look better.
Well that's awful :D there should definetly be something that can improve performance - even if it can't be seen, it's an expensive solution. Maybe add caching? You can save a "map" of all "radared" and "non-radared" pixels and use that to draw the radars; this map could then update only when you build/destroy a base. As for crafts, I think that their radar could be just a 1-pixel colored circle. I think that that would simplify it a lot.

Offline hsbckb

  • Colonel
  • ****
  • Posts: 275
  • Gill Man
    • View Profile
Re: another idea - radar range on geoscape
« Reply #92 on: July 16, 2012, 06:23:59 am »
Maybe add caching? You can save a "map" of all "radared" and "non-radared" pixels and use that to draw the radars; this map could then update only when you build/destroy a base. As for crafts, I think that their radar could be just a 1-pixel colored circle. I think that that would simplify it a lot.

Although this is a feasible solution but not perfect. You will not see the actual position of the flying UFO.

Volutar

  • Guest
Re: another idea - radar range on geoscape
« Reply #93 on: July 16, 2012, 08:56:15 am »
As for me - I'd better stick to 3d circles 1px thick instead of shading.

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: another idea - radar range on geoscape
« Reply #94 on: July 16, 2012, 08:35:20 pm »
As for me - I'd better stick to 3d circles 1px thick instead of shading.
I agree, shading looks fancy but I like the simple clean look of just 1px circles, keeps the globe clutter-free.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: another idea - radar range on geoscape
« Reply #95 on: July 17, 2012, 12:02:06 am »
Well that's awful :D there should definetly be something that can improve performance - even if it can't be seen, it's an expensive solution. Maybe add caching? You can save a "map" of all "radared" and "non-radared" pixels and use that to draw the radars; this map could then update only when you build/destroy a base. As for crafts, I think that their radar could be just a 1-pixel colored circle. I think that that would simplify it a lot.
Optimization is pointless :) with 400 test "radars" and rotating globe I get 30 FPS and 50% CPU (1 core). Without rotating I get 200 FPS and 30% CPU (2GHz x2).

After this test I think that possible is do directional shading in Battlescape :D

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: another idea - radar range on geoscape
« Reply #96 on: July 17, 2012, 12:11:50 am »
Optimization is pointless :) with 400 test "radars" and rotating globe I get 30 FPS and 50% CPU (1 core). Without rotating I get 200 FPS and 30% CPU (2GHz x2).

After this test I think that possible is do directional shading in Battlescape :D

well, you still have the "other platform" users... they will be thankful for optimization. I could imagine playing openxcom on my phone or a tablet, and they don't have fancy processors.

 :) optimization is never pointless  :)

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: another idea - radar range on geoscape
« Reply #97 on: July 17, 2012, 12:49:29 am »
I will fancy reduce numbers of radars to 40 ;P
And second, this will probably end as mod, not part of master branch :)

Behold disco earthscape (because of small bug, when you rotate earth, radars move they position)  :D

Volutar

  • Guest
Re: another idea - radar range on geoscape
« Reply #98 on: July 17, 2012, 04:40:37 am »
Please Yankes, get rid of those overlapping borders,

Offline luke83

  • Commander
  • *****
  • Posts: 1559
    • View Profile
    • openxcommods
Re: another idea - radar range on geoscape
« Reply #99 on: July 17, 2012, 10:14:39 am »
Looking good so far ;)


"After this test I think that possible is do directional shading in Battlescape :D" What?

Offline Daiky

  • Battlescape Programmer
  • Administrator
  • Commander
  • *****
  • Posts: 904
    • View Profile
Re: another idea - radar range on geoscape
« Reply #100 on: July 17, 2012, 01:00:07 pm »
I'm curious about "directional shading in battlescape" too... Directional shading is used in pencil-drawing, where you draw very thin lines, all in the same direction, very close together to create a certain shading effect.
« Last Edit: July 17, 2012, 01:02:04 pm by Daiky »

Offline Zharik1999

  • Colonel
  • ****
  • Posts: 133
    • View Profile
Re: another idea - radar range on geoscape
« Reply #101 on: July 17, 2012, 02:06:25 pm »
Sorry for maybe very silly question but are you sure that there is no way to make detection ranges be shown this way?

Volutar

  • Guest
Re: another idea - radar range on geoscape
« Reply #102 on: July 17, 2012, 02:09:34 pm »
Daiky, Yankes was joking... Directional shading will require "fire" tracing for each visible pixel, combined with voxels info. And I really doubt it possible even in 1fps mode.

Zharik1999, sure there is a way. Just nobody is really interested in. I've already made some tests in delphi with circle drawing (as lines with floating point coordinates). But concerning your screenshot - it's quite impossible currently, because currently it's 320x200 screen with hardware scale x2. Screenshot is made as some sort of overlay over it or 640x400 mode with all graphics scaled x2.
« Last Edit: July 17, 2012, 02:15:18 pm by Volutar »

Offline Zharik1999

  • Colonel
  • ****
  • Posts: 133
    • View Profile
Re: another idea - radar range on geoscape
« Reply #103 on: July 17, 2012, 02:19:02 pm »
So, are there any results?

Volutar

  • Guest
Re: another idea - radar range on geoscape
« Reply #104 on: July 17, 2012, 02:26:36 pm »
Please be more specific. I've already said - your screenshot is quite impossible, because there are TWO different resolutions used. Circle will be more "rough" (same resolution of 320x200).
My test results are fine:

But I never tried to draw them within openxcom.
PS: my draw function uses floating point, so some devices without fast FP arithmetics might become slow (though with Yankes' shading it will be waaaay slower).