Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3

Author Topic: Light...  (Read 3122 times)

Flying Mage

  • Bay Watcher
    • View Profile
Light...
« on: April 18, 2008, 11:03:00 am »

I was reading somewhere about this as planned feature, but now can’t remember where. Anyway, here is my suggestion about whole concept of light in the game. Maybe I will repeat something which is already present or planned. But maybe it will somehow useful. (I WILL be lost in translation for sure, but I kinda hope you will understand what I try to tell  :))

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…

Logged

gerkinzola

  • Bay Watcher
    • View Profile
Re: Light...
« Reply #1 on: April 18, 2008, 11:15:00 am »

if the engine has to handle anything like this it will cause a massive drop in FPS and i believe will be unbarable to have to handle all that micromanaging of light sources. im not canning it completely although has HUGE room for improvement.

[ April 18, 2008: Message edited by: gerkinzola ]

Logged

Drakale

  • Bay Watcher
  • I will get my revenge~
    • View Profile
Re: Light...
« Reply #2 on: April 18, 2008, 11:33:00 am »

Imo, it would be saner to use something like 0-NOLIGHT 1-LOWLIGHT 2-BRIGHTLIGHT

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.

Logged

Draco18s

  • Bay Watcher
    • View Profile
Re: Light...
« Reply #3 on: April 18, 2008, 01:01:00 pm »

See the Lighting Arc for details about Taody's plans.

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.

Logged

Derakon

  • Bay Watcher
    • View Profile
Re: Light...
« Reply #4 on: April 18, 2008, 01:07:00 pm »

Water uses three bits, not eight.
000 = no water
001 = 1/7
010 = 2/7
011 = 3/7
...
111 = 7/7
This has been your base-two nitpick of the day.
Logged
Jetblade - an open-source Metroid/Castlevania game with procedurally-generated levels

Flying Mage

  • Bay Watcher
    • View Profile
Re: Light...
« Reply #5 on: April 18, 2008, 02:20:00 pm »

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.

Logged

Drakale

  • Bay Watcher
  • I will get my revenge~
    • View Profile
Re: Light...
« Reply #6 on: April 18, 2008, 03:16:00 pm »

One way to optimize is to use more memory efficient algorithms, and that can be achieved by using smaller memory allocations for things like lighting etc.. A % based system need a minimum of 7 bits per tile for information while something with 4 states need 2. The impact on calculation/memory usage is huge in a game like DF that need to perform lots of checks in real time. It could certainly work with a % based system, but the question is is it really necessary, any processor time put on this might be used on something else.

Anyway these kind of decision are for toady to make, i guess i just can't help commenting on it   :D

Logged

Haedrian

  • Bay Watcher
    • View Profile
Re: Light...
« Reply #7 on: April 18, 2008, 03:20:00 pm »

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.

Logged
When life gives you kittens, make biscuits

Likes llamas for their long necks

Draco18s

  • Bay Watcher
    • View Profile
Re: Light...
« Reply #8 on: April 18, 2008, 03:29:00 pm »

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).

Logged

Derakon

  • Bay Watcher
    • View Profile
Re: Light...
« Reply #9 on: April 18, 2008, 03:34:00 pm »

Actually, it's pretty well known that most of the cost of DF is in the pathing algorithm, which makes absolutely no assumptions about the layout of your fortress. This keeps it flexible but means that pathing decisions take longer.

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.

Logged
Jetblade - an open-source Metroid/Castlevania game with procedurally-generated levels

EOTistatron

  • Bay Watcher
    • View Profile
Re: Light...
« Reply #10 on: April 18, 2008, 04:27:00 pm »

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.

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...

Logged

Flying Mage

  • Bay Watcher
    • View Profile
Re: Light...
« Reply #11 on: April 19, 2008, 01:59:00 am »

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>

It's not necessary % based system. I use % (and other numbers) just for example. Everething can be changed in any way and adapted for the game.

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>

I didn't know there is day/night change. I thought only years and seasons.
Logged

Dae

  • Bay Watcher
    • View Profile
Re: Light...
« Reply #12 on: April 19, 2008, 06:44:00 am »

Had we an indicator of whether it's night or day, it would only blink. Totally useless.
In fact, this system would make pathfinding heavier, but as long as light sources are static it wouldn't be so much of a problem.
Now, about carriable torches  :roll:
Logged

Belteshazzar

  • Bay Watcher
    • View Profile
Re: Light...
« Reply #13 on: April 19, 2008, 10:12:00 pm »

Perhaps Day and night could be somewhat abstracted by having only one or two cycle per a season in fortress mode. This way we could still have dawn, Noon, dusk, Night  phases. This would allow those nocturnal, diurnal, ect tags for creatures to have greater effect. It would also make it a bad idea to bust into a vampire crypt or daemon pit during the night if certain creatures were much easier to fight in the light.
Logged
In the year 570, Kjerdregus occurred.

Dae

  • Bay Watcher
    • View Profile
Re: Light...
« Reply #14 on: April 20, 2008, 11:32:00 am »

Time flies in dwarf mode. 24 hours in game may last, say, 4 seconds IRL. The idea of having a day/night cycle spread over months (as dwarven sleep cycle is) just seems weird... I don't know what to think about it actually.
Logged
Pages: [1] 2 3