[Mod] Light Tool [0.4] [light_tool]

Coder12
Member
Posts: 162
Joined: Sat Sep 30, 2017 00:15

Re: [Mod] Light Tool [0.4] [light_tool]

by Coder12 » Post

I tried it. This is a very good attempt at a flash light mod. Keep up the good work :)

User avatar
Melkor
Member
Posts: 378
Joined: Sat Sep 24, 2011 01:03
Location: Underground

Re: [Mod] Light Tool [0.4] [light_tool]

by Melkor » Post

Good mod, now we can make horror survive games :)

User avatar
Extex
Member
Posts: 245
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

Re: [Mod] Light Tool [0.4] [light_tool]

by Extex » Post

XD Yeah
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

Nipe
New member
Posts: 9
Joined: Thu Jan 23, 2020 20:56
In-game: Nipe and Merlok

Re: [Mod] Light Tool [0.4] [light_tool]

by Nipe » Post

Awesome so useful

doxygen_spammer
Member
Posts: 70
Joined: Wed Dec 16, 2020 16:52
GitHub: doxygen-spammer

Re: [Mod] Light Tool [0.4] [light_tool]

by doxygen_spammer » Post

Hi! I like this mod, because it theoretically makes it fun to explore huge caves.

I installed it and changed the light_tool:light_tool’s beam range from 20 to 200. Unfortunately the beam goes only about 64 nodes, or 80 nodes while using the binocular’s zoom.

I believe the code in this mod (light_tool.light_beam()) works correctly, and light sources are placed properly. By placing default:glass instead, I can easily verify that all light sources are placed at some time, they are just not visible directly. I assume that the server also properly calculates light levels immediately.

I think the server just does not send mapblock updates for blocks farther than 4 or 5 blocks. I tried to increase various range limits in the server/singleplayer configuration, but these have no effect. Adding calls to minetest.load_area() and such in the mod does not help either. (Why should it? The area is already loaded...)

player.send_mapblock() should theoretically do it, but I can’t call send_mapblock() because I don’t have any accepted parameters (“UserData expected”) for it. :(

Does someone know how to tell the server to perform proper updates for a specific area?
ShadMOrdre wrote:
Thu Aug 15, 2019 20:04
When standing next to any node, like with my side up against a cave wall, even when pointing into completely open space, the light beam goes dark.
I observed this problem too. It makes the screen flicker, which is uncomfortable to me in general.

A first mitigation might be always place a light source in the player, even if there are obstacles.

I think it can be fixed with not using position rounding, but precise eye offset and so on. Maybe do a raycast from the eye position to the farthest possible beam position, search the first obstacle, then place light sources between eye position and obstacle. I’m trying to make a patch for that.

doxygen_spammer
Member
Posts: 70
Joined: Wed Dec 16, 2020 16:52
GitHub: doxygen-spammer

Re: [Mod] Light Tool [0.4] [light_tool]

by doxygen_spammer » Post

I prepared a patch to fix the flashlight becoming dark when a wall is adjacent to the player: https://github.com/Extex101/light_tool/pull/5

The change is minimal, and simply uses floating point instead of integer. get_eye_offset() didn’t work, but adding (0, 1, 0), like you do it now, should be fine.

Dragonop
Member
Posts: 1233
Joined: Tue Oct 23, 2012 12:59
GitHub: Dragonop
IRC: Dragonop
In-game: Dragonop
Location: Argentina

Re: [Mod] Light Tool [0.4] [light_tool]

by Dragonop » Post

Really nice mod! really cool for exploring caves, mostly now they are as dark as ever

doxygen_spammer
Member
Posts: 70
Joined: Wed Dec 16, 2020 16:52
GitHub: doxygen-spammer

Re: [Mod] Light Tool [0.4] [light_tool]

by doxygen_spammer » Post

I learned how to use player:send_mapblock() properly, and it actually updates lightning to the player over long range. A 200 meter flashlight is now possible. But I would like to find a way to make it less performance demanding, sending all affected blocks every time causes heavy lags...

doxygen_spammer
Member
Posts: 70
Joined: Wed Dec 16, 2020 16:52
GitHub: doxygen-spammer

Re: [Mod] Light Tool [0.4] [light_tool]

by doxygen_spammer » Post

I made some experiments with player:send_mapblock() to allow long range flashlights. They didn’t have positive results.

My last PR changes the way temporary light nodes are removed. Instead of removing them in every step, they are now removed when a 200ms node timer expires, so this timer can be extended while the player is not moving. This reduces the network traffic when the player is moving slowly, because no map blocks change when no light nodes are removed.

A positive side effect is that light nodes now live long enough to trigger automatic map block updates by the server, even outside the 48 node range. This makes 200m flashlights working. There is still some delay, so the illuminated area makes funny trails. I tried to reduce this delay with some kind of block update scheduler, but that didn’t work.

Do you think it makes sense to add some long range flashlights by default? I am thinking of these:
  • Mini flashlight: 20 meters, craftable from only coal, copper, and tin (and surface materials).
  • Midi flashlight: 40 meters, requires iron.
  • Maxi flashlight: 70 meters, requires gold.
  • Super flashlight: 110 meters, not blocked by daylight, requires mese.
  • Ultra flashlight: 150 meters, not blocked by daylight, requires diamonds.
So, the deeper you mine, the better flashlights you can build. The current flashlight goes 20 meters.

doxygen_spammer
Member
Posts: 70
Joined: Wed Dec 16, 2020 16:52
GitHub: doxygen-spammer

Re: [Mod] Light Tool [0.4] [light_tool]

by doxygen_spammer » Post

I made some resamples of this mod’s light_tool_light_tool.png as textures for the mentioned five flashlights. I don’t claim they are good, I’m not experienced with textures or pixel art.

Image

What do you think?

Edit: The last picture is the original.
Attachments
tools.png
tools.png (10.45 KiB) Viewed 1003 times

Merak
Member
Posts: 116
Joined: Sat Nov 05, 2016 20:34

Re: [Mod] Light Tool [0.4] [light_tool]

by Merak » Post

Being mainly blue is better because it shows something modern. Brown staff with lighter head could be something else on a wooden staff. I run with HDX textures, so high res is better to me.

doxygen_spammer
Member
Posts: 70
Joined: Wed Dec 16, 2020 16:52
GitHub: doxygen-spammer

Re: [Mod] Light Tool [0.4] [light_tool]

by doxygen_spammer » Post

Here are the textures with blue handles. Do they look more modern now? I actually like the blue handles.

Image

More horrible pixmaps: these are some craft items for the different flashlights. It’s a bronce disk, which is coated with tin by putting it in a furnace, and then it is a tin reflector. For the next tier, you coat it with gold the same way.

Image

It’s just some gameplay to make it a bit more complicated to get these powerful tools. :)
Attachments
tools_blue.png
tools_blue.png (10.3 KiB) Viewed 1003 times
mirrors.png
mirrors.png (9.32 KiB) Viewed 1003 times

Merak
Member
Posts: 116
Joined: Sat Nov 05, 2016 20:34

Re: [Mod] Light Tool [0.4] [light_tool]

by Merak » Post

doxygen_spammer wrote:
Tue Dec 22, 2020 18:58
Do they look more modern now?
Yes. I like them better also.

Dragonop
Member
Posts: 1233
Joined: Tue Oct 23, 2012 12:59
GitHub: Dragonop
IRC: Dragonop
In-game: Dragonop
Location: Argentina

Re: [Mod] Light Tool [0.4] [light_tool]

by Dragonop » Post

doxygen_spammer wrote:
Tue Dec 22, 2020 18:58
Here are the textures with blue handles. Do they look more modern now? I actually like the blue handles.

...

More horrible pixmaps: these are some craft items for the different flashlights. It’s a bronce disk, which is coated with tin by putting it in a furnace, and then it is a tin reflector. For the next tier, you coat it with gold the same way.

...

It’s just some gameplay to make it a bit more complicated to get these powerful tools. :)
I really like your textures!
They are good, don't worry about it, you clearly have at least one artistic bone in your body haha
Looking forward to seeing the recipes, seems like you've done your research and the light tools will be interesting to craft
Keep it up! Love your mod

doxygen_spammer
Member
Posts: 70
Joined: Wed Dec 16, 2020 16:52
GitHub: doxygen-spammer

Re: [Mod] Light Tool [0.4] [light_tool]

by doxygen_spammer » Post

For now, there is a version at https://github.com/doxygen-spammer/ligh ... -tool-2000 for testing. It also contains a list of crafting recipes.
Love your mod
Note that this is Extex’s mod, I’m just expanding it. :)

Dragonop
Member
Posts: 1233
Joined: Tue Oct 23, 2012 12:59
GitHub: Dragonop
IRC: Dragonop
In-game: Dragonop
Location: Argentina

Re: [Mod] Light Tool [0.4] [light_tool]

by Dragonop » Post

doxygen_spammer wrote:
Wed Dec 23, 2020 21:36
For now, there is a version at https://github.com/doxygen-spammer/ligh ... -tool-2000 for testing. It also contains a list of crafting recipes.
Love your mod
Note that this is Extex’s mod, I’m just expanding it. :)
Haha true, still, love the original, and your expansion of it

User avatar
Extex
Member
Posts: 245
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

Re: [Mod] Light Tool [0.4] [light_tool]

by Extex » Post

doxygen_spammer wrote:
Tue Dec 22, 2020 18:58
More horrible pixmaps: these are some craft items for the different flashlights. It’s a bronce disk, which is coated with tin by putting it in a furnace, and then it is a tin reflector. For the next tier, you coat it with gold the same way.

Image

It’s just some gameplay to make it a bit more complicated to get these powerful tools. :)
Ooh, interesting idea, maybe something like getting the light levels at the players position and using that for the reflectors light beam, it'll need some changes to the api but it's an interesting idea
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

Post Reply

Who is online

Users browsing this forum: No registered users and 56 guests