Hello Guest

Author Topic: xonix style game  (Read 9991 times)

nbelkin

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
xonix style game
« on: November 22, 2012, 10:30:16 am »
Hello!
I want to make 2D xonix game using Unity.
I have a texture of an unexplored custom area (fog of war).
The player click on the map and set point that main hero should follow.
When hero finish his movement on the already explored area, i want to cut the part of fog.

So I have problems with cutting.

What is the best way to implement it?
And if I want to smooth cut edges?

Thanks for help and advices

mamamia

  • Guest
Re: xonix style game
« Reply #1 on: November 22, 2012, 10:48:20 am »
I see 3 options here:

1) Generate new geometry. You could have a big cuad and start teselating as you need every time you need to cut a zone. The smoothing can be achieved through adding a gradient where you cut.

2) Using a big quad with a black texture. This texture can be for example a fourth of the size of the quad. Then you can play with the apha channel of this texture to create the holes, etc... (Reading/Writing to a texture is really slow).

3) Tile all the zone you need with cuads. Choose the best size for each cuad. Everytime the player touches a cuad it becomes transaprent with a texture that smooths the the darness.

Sure there are more, this is what came to my mind.

nbelkin

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: xonix style game
« Reply #2 on: November 22, 2012, 11:06:35 am »
Thanks for answer.

The third options is hardly suitable in my situation, because player can move with different angles, so there will be "stairs effect".

So, I think the best way to look to the first option?
Because if i decide to support old devices with the second option, there will be great lags i suppose.

And are there any variants with shaders?

mamamia

  • Guest
Re: xonix style game
« Reply #3 on: November 22, 2012, 11:32:11 am »
Well, I think you still can use third option if you have some versi?ns of your texture. Don't really know how exact you need to be. I was thinking a bit more about things like fog of war in rts where the cut in the fog doesn't need to be perfect.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: xonix style game
« Reply #4 on: November 22, 2012, 01:53:30 pm »
#2 sounds far better to me. At least you get full control over it.

nbelkin

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: xonix style game
« Reply #5 on: November 22, 2012, 02:10:09 pm »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: xonix style game
« Reply #6 on: November 22, 2012, 02:15:53 pm »
Its a LOT more work to do it per polygon than per pixel.

nbelkin

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: xonix style game
« Reply #7 on: November 28, 2012, 11:00:03 am »
thank you for answers!
and the similar question, what about this situation?



what is the best way to implement polygon with right angles and stroke?
also with texture quads?

or triangulation is the best way here?
« Last Edit: November 28, 2012, 11:02:03 am by nbelkin »