So from the beginning:
1. Illumination critical for everything. So lack of it will slow down performing of any tasks, cause less quality goods production and dramatically rise risk of injury.
2. Level of illumination is different from tile to tile. So I will call total darkness as “0%light”, comfortable illumination as “100%light” and blinding flash as “200%light”
3. There are light sources of different power, from little candle to sun itself. This “power” is basic number which is determines level and area of illumination.
4. There are different types of objects. So any object in game must have number from 1 to 7 which is determines visibility (size) of object. This sizes can be micro, tiny, small, medium, large, colossal and mega. Every object has one particular size but when moving it’s counting as +1 size, when moving fast +2, but when hiding -1. Medium size is for dwarf, plate mail, barrel or throne. Kobold, goblin, dog, chain mail or shield is small. Elf, human, cow, horse, table or bed is large. Buckler, bucket, helm or cat are tiny, and rings, amulets, arrows and bolts is micro. Trees, catapults and other like this is colossal, and megabeasts are mega :) etc.
Take a candle for example: it has little power and illuminate about 3 tiles around (which is 7x7 area). It has no blinding effect and have only 40%light in center, 30% in first tiles, 20% in second and 10% in third. Something like this. More powerful souses will create illumination more bright and more wide.
5. Illumination percentage determines how good dwarfs (and anybody else) will see any items (or characters) on this particular tile. So they see anything on 100%light tile. They also see everything on 90% and 80%light tiles without any negative causes, so it’s best illumination for searching, work or anything else. 70%light tile will make micro objects hidden from distance more than 7 tiles. 60%light makes tiny objects hidden from distance more than 7 tiles, and micro hidden from 6. 50%light makes small objects hidden from distance more than 7 tiles, tiny hidden from 6 and micro from 5. And so on.
So if our candle illuminate a (small) dog sitting on next tile to it, this dog will be 30% illuminated and visible from 5 tiles and less. A candle is lesser of light sources, so lantern will illuminate dog for 40%, torch for 50%, gas lamp for 60% and light vent from surface for 90%. If dog will move, it makes him more visible and expand visibility range.
6. Combined light sources creates combined illumination areas. Amount of %light on each tile will be summary of all %light on this tile. So two candles can bring 80%light on center tile and 60%light on first tiles next to source. It will be nice challenge to combine different light sources for comfortable illumination and do not overflow fortress with blinding zones. Cause if we take two or three powerful light sources in one point they will create combined light source which will blind anyone within several tiles.
7. Blinding is similar to shading and 110%light is similar to 90% light. But there is difference between 0%light and 200%light. In first case creature (without night vision ability) will run to visible (10%light) place. So dwarf can travel from one VISIBLE lighted area to another thru darkness. But if he walks into 200%light area he will be absolutely blinded and will run in random direction in attempt of leaving blinding zone.
8. Candles, torches and all kind of lamps have finite lighting ability. Candles will burn totally and require full exchange, torches have 5-10 life periods with changing of burning material, lanterns, gas and lava lamps must be just refueled. (Another labor must be created special for this.) And only light vents (which will transfer sun light into dungeon) absolutely endless. This vents, build from surface, makes light sources on every level they run, but require digging, architecture, masonry and mirrors from glassmaker. Small and tiny creatures can make their way in fortress thru light vents, so grates highly recommended, but micro creatures can get in anyway. Also vents can split, so one surface exit will fill several vents but power of sources provided by this vents will be -20% for every split.
9. Quality of any light source objects can determine illumination radius. Maybe some artifact will illuminate entire dungeon.
10. Walls and doors will be barriers for light, and illumination areas can be designated similar to room designation, only without resizing.
11. Illumination on surface is 100%. Any exit is light source equivalent to light vent but it can't transfer light to another level or another place on current level.
I know I just raving here :) My system not ready for anything and not balanced at all, but has some potential, I think. So main question is what you think about it? Any comments…
[ April 18, 2008: Message edited by: gerkinzola ]
I think it would cover most cases and not slow down things too much. Make programming simpler too. Low light is enough for working but may cause bad toughts on light loving creatures, Bright light is uncomfortable to dark dwellers etc..
Your system sound like it would be overengineered for the need of dwarf fortress(imho of course). Still, nice read.
Cheers.
As for bit used to represent data, my guess is
0 Dark
1 Dim
2 Normal
3 Bright
or an 8 bit solution like water has.
quote:
Originally posted by gerkinzola:
<STRONG>if the engine has to handle anything like this it will cause a massive drop in FPS[ April 18, 2008: Message edited by: gerkinzola ]</STRONG>
Actually I don't quite understand why DF is SO demanding.
Maybe future optimization of code will solve this.
Anyway these kind of decision are for toady to make, i guess i just can't help commenting on it :D
quote:
Originally posted by Flying Mage:
<STRONG>Actually I don't quite understand why DF is SO demanding.
Maybe future optimization of code will solve this.</STRONG>
Because every moment it has to know where each dwarf, animal is and what its doing, and it also has to store the location of all the stuff. That's why the save files are so huge. Even if most data is saved on secondary storage, the whole S.S. -> Memory -> S.S. thing kills the CPU.
quote:
Originally posted by Derakon:
<STRONG>Water uses three bits, not eight.
000 = no water</STRONG>
Sorry, I meant 8 bit positions (8 levels, 2^3).
There's certainly a lot of data in the savefiles, but most of it isn't used on a regular basis (e.g. the status of the humans in a small village on the other side of the world) and thus doesn't affect performance except when saving and loading files.
I suppose giving water a light level would be a bit excessive, eh? Probably for the best, it'd just give the carp another way to ambush us...
quote:
Originally posted by Drakale:
<STRONG>A % based system need a minimum of 7 bits per tile for information while something with 4 states need 2.
</STRONG>
quote:
Originally posted by EOTistatron:
<STRONG>Well as long as it didn't take too much, a mirror system might be worth implementing. Obviously it would only work during the day, but it would lower maintenance costs for forts with fewer resources. That and it'd allow for overly complex integrations, which are always fun.
</STRONG>
quote:
Originally posted by Dae:
<STRONG>I don't know what to think about it actually.</STRONG>
What if you embark near a polar regoin? ;)
But this question stands: Would cave adapted dwarves get sick from artificial light? Likewise, would such light prevent cave adaptation?
Any outdoor tile would "bright" and causes problems for cave adapted dwarves. This implies a brightness of greater than 7/7.
the paths from outdoors to indoors are treated as a light source.
unlike a normal flow there is no random walk.
This means that light will form a "triangle"
7/7 6/7 5/7 4/7 3/7 2/7 1/7 0/7 ...
Dwarves are fine with anything from 7/7 to 1/7. At 0/7 or less the dwarves would be slowed in much the same way as they are without booze.
Allowing light flows to overlap and interact becomes a little trickier, and how to do it best may require some careful study.
X = wall
O = outdoors
# = amount of light
Example of a simple light source in a 1 wide hallway.
code:
XXXXXXXXXXXXXXXXXXXXX
O76543210000000000000
XXXXXXXXXXXXXXXXXXXXX
Example of a simple light source in a wide indoor area.
code:
X00000000
X11111110
X22222210
X33333210
X44443210
X55543210
X66543210
X76543210
O76543210
XXXX43210
X12333210
X12222210
X11111110
X00000000
Windows and glass block structures should allow light to pass through normally. And additional furniture could be devised to create or transport light for parts of the fortress farther from the surface. Torches, forges, candles, fires, etc would shed light in a similar but weaker manner.
A mirror could be placed that transmits light to a specific tile in line of sight (at -1 light level). Aim it at the wall at the end of a long hall to get a 6/7 light source (and light flowing outwards from there) from a mirror in 7/7 ilumination area. likewise, you could aim it at another mirror to bounce it around a corner.
One question that may arise is how light flowing from multiple light sources interact. If not at all, it would save a lot of CPU usage. If they stack, it wouldn't be to painful, but might lead to indoor areas with more than 7/7 light. and that would have to be addressed somehow.
One option would be to temporarily assign those tiles the same light sickness qualities as outdoor tiles and ignore everything over 7/7 light.
Another option would be that no matter how many sources, you can light sickness except outside as there are only so many light sources a dwarf can look at at the same time.
Yet another option might be that overlapping light zones "overflow" to create a footprint with a radius larger than the standard 7 tiles.
[ April 21, 2008: Message edited by: Nadaka ]
You're basically suggesting a BSP/portal-akin lightning engine. These are used in FPS games, and the data structures for real-time management of the lighting data is usually pre-computed and stored in the level information because It is EXTREMELY computationally expensive. DF, being essentially 2D, could manage this on the fly, but a likely estimate of a realistic and dynamic implementation would be at an expensive of 60-80% of the game's CPU cycles.
Infravision. :p
unless I'm missing something, light and lamps are on the dev page only as a subsection of adventure mode improvements. I very much doubt we'll see a comprehensive lighting system implemented for fortress mode.
FIRE AND LIGHTING ARC: The lighting in caves is artificial right now. It should be pitch black. This is also true of moonless cloudy nights. Once that's in, your adventurer will want fire. Fire can also come up in dwarf mode in various ways. Related to Core14, Core55, Req96 and PowerGoal150.
Req96, LIGHTING, (Future): Should be pitch black inside adventure caves and on cloudy moonless nights. Vision state should influence what you can see. Can try to make sunlight shine inside caves a bit by casting light lines on map-gen. Can track light with RGB filters so that things through red gem windows look red, etc. Things seen through glass statues could be distorted from their proper positions. Once fire is in, can do torches and other such light sources. Dwarves could place fires or gem lamps in dark places. Any magical take on alchemy could make extensive use of gems in this fashion, and the different colors of light can please certain nobles etc. Related to Core55.
Naturally, we will need to set up fortresses where secret messages are written in red over black walls, and surrounded only by green light, so that the message is only revealed when you bring in red light.
QuoteNaturally, we will need to set up fortresses where secret messages are written in red over black walls, and surrounded only by green light, so that the message is only revealed when you bring in red light.
By then it will be too late. Your torch will flicker its last flame and the sound and nashing of claws and teeth draw ever closer.....Spoiler (click to show/hide)
Overall I do agree that this would be a great way to add depth to finding ambushes and sneaking. Say a sneaking ambushers/adventures comes upon a torch wielding victim. Ambushers/adventures, depending on their observation/perception skill, will be able to see them more clearly due to being outside the light ring looking in while the torch bearer is restricted to whats in the light ring due to their eyes not being accommodated to the darkness beyond it. Furthermore it could lead to !!FUN!! if blinding light is added and could lead to some interesting traps.
unless I'm missing something, light and lamps are on the dev page only as a subsection of adventure mode improvements. I very much doubt we'll see a comprehensive lighting system implemented for fortress mode.
Have you tried looking at the full dev goals (http://www.bay12games.com/dwarves/dev_single.html)?
unless I'm missing something, light and lamps are on the dev page only as a subsection of adventure mode improvements. I very much doubt we'll see a comprehensive lighting system implemented for fortress mode.
Have you tried looking at the full dev goals (http://www.bay12games.com/dwarves/dev_single.html)?
Now how was I supposed to find that page?
Check our development pages. You can find everything in one place at this link (http://www.bay12games.com/dwarves/dev_single.html).
My take of dwarves and light:
Dwarves have a symbiotic bioluminescent fungus growing in their beards that feeds on their 'filth'. Taking care of the needs for sewage treatment and light sources at the same time.
null,null,null,null,
[1,4,6,7,7,7,3,0],
null,null,null,null,
null,null,null,null,
null,
null,null,null,null,
null,null,null,null,
null,
null,null,null,null,
null,null,null,
[0,0,0,2,2,2,0,0],null,null,
null,null,null,
null,null,null,
null,null,null,
null,null,null,
null,null,null,
null,null,null,
[0,1,2,2,0,0,0,0],null,null
[0,0,0,1,1,1,0,0],[0,0,0,1,1,1,0,0],[0,0,0,1,1,1,0,0],
[0,0,0,1,1,1,0,0],[0,0,0,1,1,1,0,0],[0,0,0,1,1,1,0,0],
[0,0,0,1,1,1,0,0],[0,0,0,1,1,1,0,0],[0,0,0,1,1,1,0,0],
null,null,null,
null,[0,0,0,0,0,3,0,0],null,
null,null,[0,0,0,0,0,1,0,0],null
null,null,null,
null,null,null,
null,null,null
The thing with lighting is that if it is done with rays instead of "light", it would be easily multi-threadable because each ray is independent of the others.
It's fairly simple to spawn a few extra threads at the beginning and have them process only light.The thing with lighting is that if it is done with rays instead of "light", it would be easily multi-threadable because each ray is independent of the others.
...only in an application that is already set up to be multithreaded.
It's fairly simple to spawn a few extra threads at the beginning and have them process only light.The thing with lighting is that if it is done with rays instead of "light", it would be easily multi-threadable because each ray is independent of the others.
...only in an application that is already set up to be multithreaded.
Have you ever wondered why the Minecraft character does not carry a torch in his hand that lights his way while he walks? Thats why.