Duke4.net Forums: Flashlight addon for polymost! - Duke4.net Forums

Jump to content

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Flashlight addon for polymost!  "it's not a real flashlight but it works like one."

User is offline   Bruno 

#31

Oh ok. So, you probably never try this one from Marcos? And thank you for the fast answer Mark about the one from Mblackwell.
0

User is offline   Mark 

#32

I never tried it. Its possible the Mblackwell project used it.
0

User is online   Danukem 

  • Duke Plus Developer

#33

The approach Marcos described doesn't sound very useful. It depends on the user using specific graphics settings (which you as the modder *cannot control*) and even then it doesn't really give you the ability to see anything. It just puts a white transparent circle in front of stuff, which might look alright in some contexts but it doesn't serve the actual function of a flashlight.

I guess if I had to make a polymost flashlight I would spawn the circle onto the actual surface (can't tell from the description whether Marcos was just putting it on the hud), could take advantage of sloped sprites and additive blending nowadays, too. But then I would also change the visibility in the sector it spawns in and the player's sector so it actually, you know, allows you to see better. But keep in mind you have to use it in maps that show it off to good effect. Since visibility is sector based, big and oddly shaped sectors will result in bad, unrealistic lighting. Even then its still going to be shitty compared with a polymer light because the improved visibility will be just as good in the area outside the light circle as inside (because sector based).
1

User is offline   Mark 

#34

I was going to post a short vid of Mblackwell's version but I'd have to clear it with him first. Its clever but certainly not on par with Polymer which is why I talked him into going that way.
0

User is offline   zykov eddy 

#35

I've tried making a working flashlight in polymost and software two times:

A.Dream Trilogy (second map, underground maze, uses lots and lots of sectors to simulate realistic light);

Slender's Woods (a similar solution to the one described in the first post, but a bit more complicated)

This post has been edited by zykov eddy: 14 May 2025 - 01:24 PM

1

User is offline   Mark 

#36

Hmm... I thought Slender's Woods was Polymer.
0

User is offline   Bruno 

#37

View PostDanukem, on 14 May 2025 - 12:19 PM, said:

The approach Marcos described doesn't sound very useful. It depends on the user using specific graphics settings (which you as the modder *cannot control*) and even then it doesn't really give you the ability to see anything. It just puts a white transparent circle in front of stuff, which might look alright in some contexts but it doesn't serve the actual function of a flashlight.

I guess if I had to make a polymost flashlight I would spawn the circle onto the actual surface (can't tell from the description whether Marcos was just putting it on the hud), could take advantage of sloped sprites and additive blending nowadays, too. But then I would also change the visibility in the sector it spawns in and the player's sector so it actually, you know, allows you to see better. But keep in mind you have to use it in maps that show it off to good effect. Since visibility is sector based, big and oddly shaped sectors will result in bad, unrealistic lighting. Even then its still going to be shitty compared with a polymer light because the improved visibility will be just as good in the area outside the light circle as inside (because sector based).

Thank you for your answer. It helps me a lot to understand how it could or could not be achieved. The issue with Polymer : I don't want to release my TC in the future with the obligation for players to use POLYMER rendering just because I add a flashlight function, useful only in a few room of the main campaign and the last part of the secret level. I already check you flare script in dukeplus. And it needs Polymer too. Maybe I could use a flare tile floor-aligned and transparent "stick to the player". Except if there's a way to include a polymer-like dynamic light (I doubt) in polymost as this is two different renders.

This post has been edited by Bruno: 17 May 2025 - 05:12 AM

0

User is offline   Bruno 

#38

View Postzykov eddy, on 14 May 2025 - 01:19 PM, said:

I've tried making a working flashlight in polymost and software two times:

A.Dream Trilogy (second map, underground maze, uses lots and lots of sectors to simulate realistic light);

Slender's Woods (a similar solution to the one described in the first post, but a bit more complicated)

Thank you, I'm gonna check those cool mods.
0

User is offline   Bruno 

#39

So, first I managed to make it work the "very old way". Not the best way, so far, but as a prototype it is very encouraging to get something far better (for exemple, I could add blendtable by using another sprite, as MBlackwell, Marcos and MC84 told me on Duke4 Discords) :
1) in my DEF file to replace the tile by for a 32bits HD texture :
texture 10070 { pal 0 { file "TILES/Tiles039/FLASHHD.PNG" nodownsize nocompress } }

2) define for keyboard configuration :
definegamefuncname 13 FLASHLIGHT_ON
definegamefuncname 14 FLASHLIGHT_OFF


3) define visibility value and gamevar
gamevar flashlighton 0 0
gamevar flinputcounter 0 1
define DEFAULTVISIBILITY 512
define FLASHLIGHTVISIBILITY 288 //test. It needs to be adjusted.


4) set gamevar values in EVENT
onevent EVENT_LOOKLEFT
ifvare menutoggle 0
{
ifvare flashlighton 0
{
ifvare flinputcounter 0
{
soundonce USEFLASHLIGHT
quote 382
setvar flashlighton 1
setvar flinputcounter 16
}
}
}
setvar RETURN -1
endevent

onevent EVENT_LOOKRIGHT
ifvare menutoggle 0
{
ifvare flashlighton 1
{
ifvare flinputcounter 0
{
soundonce USEFLASHLIGHT
quote 383
setvar flashlighton 0
setvar flinputcounter 16
}
}
}
setvar RETURN -1
endevent


5) onevent EVENT_DISPLAYREST
ifvare flashlighton 1
rotatespritea 150 100 65534 0 10070 -127 0 1067 1 0 0 xdim ydim
endevent


6) In game.con, in aplayer block
//FLASHLIGHT
ifvare flashlighton 1
setplayer[].visibility FLASHLIGHTVISIBILITY
ifvare flashlighton 0
setplayer[].visibility DEFAULTVISIBILITY

ifvarg flinputcounter 0
subvar flinputcounter 1


This post has been edited by Bruno: 17 May 2025 - 06:50 AM

2

User is offline   Bruno 

#40

Ok I updated my polymost flashlight code.
I find that using in APLAYER code the structure member "userdef[].const_visibility" works far better than "player[].visibility".

I choose to draw some layers on screen with rotatesprite too and add a few things in some events. For exemple, if the player is changing weapon by using a weapon key or the mouse wheel, it desactivates flashlight ; or if the player put the flashlight off with the dedicated key, the previous weapon used returns in hand, as I want the player to navigate between flashlight or weapon like in doom3 (the use of flashlight will occured only in little slow pace part of regular level with just a few enemis, or in the secret level which one doesn't have real enemis). I just need to reworked a little the flashlight hud tile.
0

User is offline   VGames 

  • Extra Crispy

#41

U can use just one button to turn the flashlight on and off. I don’t know if youve updated your code with that in mind. I was just going by the code u posted above. But the on and off code can be done in just one of the lookleft or look rightbuttons. U don’t need one button for on and one button for off.
0

User is offline   Bruno 

#42

Yep, I tried that before making this way. But I encountered some issues with the tic counter between each key press. The key press works to quickly resulting in weird glitch. It doesn't work the way I wanted to, with others keys : With lookleft and look right, I also encountered some weird bug whereas I set Return -1... So I change the event I used.
I also use others keys for new things (so the choice starts to be short!) like my netricsa menu for exemple.

This post has been edited by Bruno: 22 May 2025 - 01:21 PM

0

Share this topic:


  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options