Not logged inOpenClonk Forum
Up Topic General / Feedback and Ideas / Strategie matter: Fog of War!
- - By ala [de] Date 2011-04-17 10:50 Edited 2014-11-18 11:49
Welcome, I'll introduce you to a  Fog of War concept which might improve strategy :)
Most of the concept evolved from mcGreen who bugged me with a concept for some CR knight melees.

1. Fire, explosions and bright objects (like the boom pack, stove/furnace while in use) will light up the map at their specific positions - even if a big material wall is between the player and the object position, all players can see them. Fire burns long, explosions are a lot brighter but only unveil the map a very short time (flickering). We also have to think of Volcano's and lightnings.

2. Clonks can use light as a tactical resource, specific items can be designed: I always liked the idea of introducing a rocket for discovering purposes (like a silvester rocket) - could be a cool item for spying on the enemy. Also lamps and torches, which add a few pixels to the wielders line of sight, a magical light scroll also could be used (like in nethack).
Worth mentioning: In the game Starbound - the player can only see around 5 pixels around his character without a light source. So light source are a very interesting gameplay element there (they - sadly have killed this element by making torches super-cheap, and basically you don't need any lamps or anything since you have several hundred torches with you).

3. Teamview: This means you can see all your allied clonks - regardless of light sources, at least with a few pixels of sight around their characters. We already had a great time with this strategic element in Clonk rage. As a team you could try a sneak attack, and with fire-arrows one could try to detect this, but would also reveal the current position to the enemies.

I build a minor implementation for Clonkrage into the recent 2011 knight tournament folder: Knight Turnierordner, and Newtons TheTemple from 2003 also uses a similar system, it still works with CR today :o
Parent - - By PeterW [de] Date 2011-04-17 13:24 Edited 2011-04-17 13:28
I am half-way committed to doing a shader-based FoW implementation, possibly linked with general lightning. Yes, loosely inspired by deferred lighting. I haven't tried it yet, but here's my brain-dump:
* Background texture that defines light map
* Each pixel in the texture with intensity and direction
* Specify objects as "blit to light map". Use shader in order to integrate data properly (rotate directions etc.)
* Have a diffusion shader which propagates light into its direction, fade out on material
* Specify materials as light-emitting? Shiny crystals! Note spooky lava light would be a bit harder, as I would have to reason about colored light. Not impossible, though.
* Also have general diffusion, so a few pixels over won't create hard-edged shadows

Problems I see:
* Don't really want to have light map for whole landscape. Would probably only do it for current viewport plus a bit of "border". Fast scrolls could be supported by forcing additional shader iterations on affected regions.
* Light would be slow, unless I want to iterate the diffusion many, many times each frame.

Maybe there's some grand unified design that answers the "how many iterations on what region?" question nicely. Needs a bit more thought. Might also be that the CPU is actually better at it (can do flood-fill!).
Parent - - By ala [de] Date 2011-04-17 13:50
Sounds awesome :).

So you suggest to link the FoW issues to light?

>Don't really want to have light map for whole landscape. Would probably only do it for current viewport plus a bit of "border"


I agree, most games these days also have to much light (and people hate them), so just a little bit of it, might be perfectly fine :).

>"Light would be slow"


How slow? Gameplay wise, just the little FoW changes without the light prooved strategically valuable already in CR, in a few scenarios fire arrows can be shot around to get a bigger line of sight ;). So if it is fast enough to do something as that, no problems will accur. (A really fast spaceship, or a lightning would be something else and could be adjusted with special treatment, which is not the norm - or simplified).

>Maybe there's some grand unified design that answers the "how many iterations on what region?" question nicely.


Well, there are. Textures and materials :o? Not sure, if I understood you correctly, though.
Parent - By PeterW [de] Date 2011-04-17 14:13
Well, with one iteration the "speed of light" would be 1px/frame. Which is most likely too slow for fire arrows. I could run the shader a bit more often in the vicinity of moving light sources... But I'm not sure how exactly that could work.

Hm, also there's the issue of two flashlights pointing in opposite directions. Ugly. Might have to go with a CPU-based solution after all :/
Parent - - By Günther [de] Date 2011-04-17 22:08
The Shader-using FoW currently in OC can work quite nicely. We might want to increase the resolution of the texture, and definitively need some antialiasing again, but computing the FoW with the GPU and uploading that every frame to a texture works.
Reply
Parent - - By PeterW [gb] Date 2011-04-19 12:29
Well, sure. Still - the more we can push into the GPU, the more crazy stuff we can do. Having it a whole-screen transformation would allow us to do it on a massive scale, like having an actual sun that puts shadows into the landscape.
Parent - - By Sven2 [de] Date 2011-04-19 12:33
Considering GPU temperature, I'd prefer to have a simulated sun rather than an actual one.
Parent - By PeterW [gb] Date 2011-04-19 15:53
An actual simulated sun, of course :P
Parent - - By Newton [gt] Date 2011-04-21 21:55
That would be awesome. I have had this idea since the start of the project. Remember the raytraced example videos I created?
Parent - - By PeterW [gb] Date 2011-04-21 22:15
Back here? Real raytracing is obviously very expensive - we have to use some kind of compromise. Maybe we could save the GPU lights idea by having multiple light layers (worst-case one per light). Calculating this stuff in the CPU scares me a bit - even after using some more or less obvious optimizations, you would probably still end up with thousands of path checks per tick.
Parent - - By Newton [gt] Date 2011-04-23 17:28
Yes. However, my point back then wasnt that we should use raytracing but my point was that it could look really cool if "real" lighting is used like you also plan to do (if i understand you right). Apart from the "Schlagschatten" seen in the videos, a similar effect can be achieved with "normal" methods IMO.
Parent - By PeterW [gb] Date 2011-04-23 18:03
How do you "use" "real" lighting? We have different methods of emulating it, some cheaper, some more costly. Raytracing is one of the more costly ones. We probably have to settle for one that's cheaper and also less realistic.
Parent - - By Newton [ni] Date 2011-04-18 01:56
With Peters Shaders, this might all be possible and at the same time look awesome.
Anyway, we, that is the former Hazard team, tried to create something like a FOW bound to light sources (which is basically what you propose) with the "Darkness" rule. This was based on a low global gamma value and many very large light sources as additive overlays. In my opinion, this worked really well. As said, with shaders in the game, the gamma+additiveoverlays technique could be replaced by "real" lighting.
Parent - - By Zapper [de] Date 2011-04-18 05:47

>In my opinion, this worked really well.


Except blitting huge additive graphics lagged a lot in CR :(

PS: Or, let's say "noticeable"
Parent - By Newton [ni] Date 2011-04-18 16:08
Yes, there was the performance problem. I doubt though that a shader-solution would not have a performance problem.
- By ala [de] Date 2014-11-18 11:43 Edited 2014-11-18 11:47
An epic thread reanimation!
I'm very hyped on the current improvements in the lights branch - and very interested in the following development. The basic ideas from this thread are still valid (well I removed some very much outdated CR influenced talk on base melee stuff and fantasy in the start post and on general terms updated the start posting).
Up Topic General / Feedback and Ideas / Strategie matter: Fog of War!

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill