Raised This Month: $12 Target: $400
 3% 

Flashlight in HLSDK


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 06-28-2014 , 13:41   Flashlight in HLSDK
Reply With Quote #1

Hello AlliedModders!
Maybe this is the wrong forum to post this into, but I couldn't find better place for this question(maybe in Off-Topic forum?).

Anyway, I can't seem to find how is flashlight handled in game. I guess it is purely done client-side, but I am still not sure.
I don't really think it is Dynamic Light (TE_DLIGHT tempentity) because when you create an DLight near the wall, it also lights other side of the wall, while that is not possible with the flashlight. I also tried with ELight, but it only lights entities up.
So after searching server-side stuff in HLSDK(dlls folder and few others) I began to search on client-side files(cl_dll). There is flashlight.cpp, but it is only for flashlight as a HUD element(in the upper right corner of the screen). So, is there a code in HLSDK that shows how flashlight works? I need it to create a flashlight but with a little bit more features, and with DLight you could update its position only once every 0.1 seconds, but real flashlight updates in real time, which makes me think it is handled client-side.
Thanks in advance.

Last edited by klippy; 06-28-2014 at 13:42.
klippy is offline
4dead
Member
Join Date: Jun 2012
Old 06-28-2014 , 20:58   Re: Flashlight in HLSDK
Reply With Quote #2

Check those 3 lines
Edit : This ?
__________________
Too old

Last edited by 4dead; 06-28-2014 at 21:00.
4dead is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 06-28-2014 , 22:26   Re: Flashlight in HLSDK
Reply With Quote #3

Quote:
Originally Posted by 4dead View Post
I've seen that already, but that code only adds EF_DIMLIGHT effect and updates HUD, but it doesn't create flashlight effect.
klippy is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 08-05-2014 , 07:07   Re: Flashlight in HLSDK
Reply With Quote #4

Bump, I still need it.
I am about entirely sure it is handled client-side, since when someone turns his flashlight on, only he could see it, and other players can only see EF_DIMLIGHT on him.

Last edited by klippy; 08-05-2014 at 07:08.
klippy is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 08-06-2014 , 01:42   Re: Flashlight in HLSDK
Reply With Quote #5

Every visual effect is handled client-side. It's the same as sending a temp entity message, but this is added in a big packet (which is handled by AddToFullPack, then engine does the work). The EF_DIMLIGHT has 2 effects on client, if it's the player who owns it, the flashlight will be turned on in his screen; if isn't, you'll see a little aura sphere. Anyway, if flashlight radius and color were able to be modified, you wouldn't be searching it.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 08-06-2014 , 06:44   Re: Flashlight in HLSDK
Reply With Quote #6

Yes, I knew that these network messages are all handled client-side, but still I didn't know that much about EF_DIMLIGHT. Thank you!
klippy is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode