Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Field of view

Author
Message
Max Tillberg
19
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 19th Jul 2021 13:54 Edited at: 19th Jul 2021 13:56
I am experimenting with a 2d game where the field of view around a centered sprite changes. One way to do this would be to cover the entire screen with a sprite that contains a transparent part but I wonder if there are a better and more flexible way? Preferable the effect would be animated with some flickering.
Sincerely,
Max Tillberg

Attachments

Login to view attachments
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 21st Jul 2021 19:19
That looks like the job of a full screen shader.
Not my realm of expertise I'm afraid.
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 24th Jul 2021 10:28
Is your game Tile based by anny chance that makes a fog of war effect much easier ?
Or do you just need a fancy(pixelated) vignette ?
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 24th Jul 2021 14:44
@Janbo, you ever get round to that 2D shader pack?

There has been a £20 note in my wallet marked '2D Shaders" for the last 2 years, if you build it, they will come
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 25th Jul 2021 12:25 Edited at: 25th Jul 2021 12:25
[Offtopic]
@PartTimeCoder:
Well yeah there is something like a 2D shader Pack in my Project folder, but there is one pice missing which is an SetSpriteShaderConstantByName command to individually set uniforms to sprite shaders.
Ofcourse there are tricks to work around it, but tried to somehow get the comand impelemnted into Tier 1 first, which doesn't seem to happen anymore
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 25th Jul 2021 15:32
OH, yeah I remember now, maybe we need to petition TGC for the function you need, after all its a DLC waiting to happen I don't understand the heel dragging.

[Back on Topic]
Fog of War, even on its own its a staple of every RTS ever made, we could certainly use a shader solution for that.
hendron
8
Years of Service
User Offline
Joined: 20th Dec 2015
Location:
Posted: 25th Jul 2021 15:42
Quote: "but there is one pice missing which is an SetSpriteShaderConstantByName command to individually set uniforms to sprite shaders."


SetShaderConstantByName works with sprite shaders doesn't it?
Max Tillberg
19
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 28th Jul 2021 11:33
The game is not tile based, that would help. I tried to use 5 sprites to create this effect but it requiers quite a lot of code and it does not scale very well. I want a pixel look and the pixel size is affected by the size of the view size. I also tried to use particles but that did not turn out well. I guess a shader would be the best solution but I have no idea how to do this.
Sincerely,
Max Tillberg
Max Tillberg
19
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 12th Jul 2024 12:05
After 3 years I am back to AppGameKit and wonder if any progress have been made to solve this? Any ideas would be helpful. I found a solution in Godot using shaders at https://www.youtube.com/watch?v=kM71HecDOvM but Godot was no fun to use.
Sincerely,
Max Tillberg
Yeshu777
4
Years of Service
User Offline
Joined: 26th Feb 2020
Location: Cardiff ( Caerdydd ), Wales ( Cymru ), UK
Posted: 2nd Aug 2024 09:19
HI,

Do you have a screen shot / example image of your implementation ?

Regards,

Yeshu777
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 7th Aug 2024 17:24
This should be very simple actually, create render image get size window x,y create screen sprite window size, draw nearblack box on render image, draw true black sprite for visible area, set image mask to black apply render image to sprite. 2 draws very small overhead and high compatibility vs a shader. Your render image will need to be scaled by the virtual resolution on creation so the pixel size will always match the game, so if the screen resolution on window size changes youll need to delete and recreate.

Login to post a reply

Server time is: 2024-11-21 09:28:13
Your offset time is: 2024-11-21 09:28:13