Jump to content


Photo

3d Flashlight


  • Please log in to reply
35 replies to this topic

#1 Kajio

Kajio

    GMC Member

  • GMC Member
  • 2520 posts

Posted 08 April 2008 - 09:43 PM

Flashlight

Version 1.2 (Minor flash issue fixed)



Download Count : 522 (As of Jan 11th)


Explaination


Ever want to add a flashlight to a dark/scary game? I think a lot of people have, and I stumbled upon a good way to do it. It's not perfect like a real-time shadow system, but it's simple and easy it use and integrate into any 3D games that are dark with excellent speed and little code.

Is it simple and basic? Yes. Does it get the job done? More-so than anything else I have seen.

Downloads
GM7 Pro v1.2:
Download flashlight tut.gmk
GM6 Pro v1.1:
Download flashlight for GM6


How-to


The example is commented and easy to understand. Heck, I bet a novice user could figure it out.

As the game info explains, it doesn't fit into every game. Games that have large areas or have brightly colored textures (The ones in the example are kinda pushing it >.>) does look as good as they would with dark textures more hallway areas.

To fit this into your game, copy the obj_flashlight, spr_flash, and spr_dark into your game. The in-editable comments explain how you can change some of these to make the flashlight fit into your game more fluently.

Screen-shots of Examples
Click for full version
What's in the darkness?
Posted Image
The flashlight will show the way!
Posted Image


Give it a shot and tell me how I did! Please post with your comments and suggestions on possible improvements.

Crediting Information

Credit is not needed, although it is nice and appreciated. You are welcome to share this with others as long as you do not claim it as your own. Thank you.

Edited by Kajio, 12 January 2009 - 03:15 AM.

  • 0

#2 aaaaa3000

aaaaa3000

    GMC Member

  • GMC Member
  • 659 posts

Posted 11 April 2008 - 02:10 AM

thats a realy good example, but you should use a different sprite, like this one i just made
Posted Image

Edited by aaaaa3000, 11 April 2008 - 02:14 AM.

  • 0

#3 Kajio

Kajio

    GMC Member

  • GMC Member
  • 2520 posts

Posted 11 April 2008 - 10:41 AM

Well, It's easy to change what sprite you need, so I just made a really simple one for display purposes. You can technically use a batman or hello kitty shaped one(as I believe some cheat codes allowed you to do in Doom3), and color it with the other sprite.

In the game I'm using this in, I have a sprite that makes the flashlight seem old and dirty, due to some of the grays I put into the black area.

I'm glad you liked it, and thanks for the comments.

Edited by Kajio, 11 April 2008 - 10:42 AM.

  • 0

#4 ewic

ewic

    GMC Member

  • New Member
  • 252 posts

Posted 18 April 2008 - 09:06 PM

That's awesome, I could really see this being used in a dark game (like you said). It's probably just because the level you used was kind of claustrophobic, but just to let you know, it kind of strained my eyes, but it's hardly an issue at all.

Incredible work, simple beats complicated! :P
  • 0

#5 Joysurrender

Joysurrender

    GMC Member

  • GMC Member
  • 367 posts
  • Version:GM8

Posted 22 April 2008 - 04:06 PM

Wow! Great!
  • 0

#6 ga05as

ga05as

    GMC Member

  • GMC Member
  • 876 posts

Posted 25 May 2008 - 07:39 PM

its great but i think it looks better with this images as the torch Posted Image
  • 0

#7 xot

xot

    media multimixer

  • Global Moderators
  • 4648 posts
  • Version:GM:Studio

Posted 25 May 2008 - 10:40 PM

Working from a photo of a real flashlight/torch really raises the creepiness.

Posted Image

Edited by xot, 29 April 2012 - 03:37 AM.

  • 0

#8 sparkythecat101

sparkythecat101

    GMC Member

  • New Member
  • 50 posts

Posted 27 May 2008 - 04:39 AM

has anyone noticed that for a split second while turning off the torch, the screen is suddenly light?
  • 0

#9 Dragonos

Dragonos

    Multimedia Pro

  • New Member
  • 357 posts

Posted 28 May 2008 - 02:14 AM

Yes, I noticed too it is due to poor programing and is easily fixed.
7/10 for the idea, but needs ray-tracing. Then I'll be impressed.
Great for GM though Keep Expanding!
  • 0

#10 Kajio

Kajio

    GMC Member

  • GMC Member
  • 2520 posts

Posted 03 June 2008 - 10:18 PM

has anyone noticed that for a split second while turning off the torch, the screen is suddenly light?

It's been a while, but i think I remember that happening. I'll fix it if I get time. It has to do with the fog turning off before the picture is drawn, so it can be fixed in a second.

EDIT:Yeah, it was the that fog was in the draw event, and didn't take effect at the correct time, also having it switch on and off in the "F Press" event will actually save time as it won't be reset each step. I'll put up v1.2 up now.

Working from a photo of a real flashlight/torch really raises the creepiness.

Yeah. The image included was a really basic version. I tried yours and it's pretty nice.

Yes, I noticed too it is due to poor programing and is easily fixed.
7/10 for the idea, but needs ray-tracing. Then I'll be impressed.
Great for GM though Keep Expanding!

Right. :P The pros have problems with that.

That's for the comments everyone. I'm glad to hear you're enjoying this well enough.

Edited by Kajio, 03 June 2008 - 10:45 PM.

  • 0

#11 fasteddy_jones

fasteddy_jones

    Anarchist

  • GMC Member
  • 663 posts
  • Version:GM8

Posted 12 June 2008 - 08:42 PM

The example works well enough if you dont plan on using any other lights in the game. Due to the overlay it causes the other lights to become darker in the area not "lit" up by the overlay.
For what its worth, 5/10

fasteddy
  • 0

#12 Kajio

Kajio

    GMC Member

  • GMC Member
  • 2520 posts

Posted 13 June 2008 - 01:22 AM

The example works well enough if you dont plan on using any other lights in the game. Due to the overlay it causes the other lights to become darker in the area not "lit" up by the overlay.
For what its worth, 5/10

fasteddy


Okay. I didn't know how this would look with other lights, so I guess this answers my question.

Thanks for the comments.
  • 0

#13 weckar

weckar

    Helping Hand

  • New Member
  • 1946 posts

Posted 18 June 2008 - 08:49 PM

hmmm... practically, you could hardly sell this as a flashlight, not even for a FPS (in 3rd person this wouldn't work at all). The problem is that light beams stretch along surfaces if they hit them at an angle, which makes this one look really fake... sorry ::lmao::
  • 0

#14 Kajio

Kajio

    GMC Member

  • GMC Member
  • 2520 posts

Posted 19 June 2008 - 07:05 PM

hmmm... practically, you could hardly sell this as a flashlight, not even for a FPS (in 3rd person this wouldn't work at all). The problem is that light beams stretch along surfaces if they hit them at an angle, which makes this one look really fake... sorry :)

This is kinda based on you eyes being right at the flashlight so you wouldn't see that happening (which legitimately you wouldn't have unless you had a facelight...) but it's still better than anything else I've ever seen. :\ If you can show me an alternative that doesn't lag below 10fps... I'll eat my sandwich...
  • 0

#15 briantrlov

briantrlov

    GMC Member

  • GMC Member
  • 610 posts

Posted 14 October 2009 - 02:47 AM

simple, but i do want to add a: a flashlight would really boost the effect and a light trace from the flashlight to the circle besides that its creative and useful...

EDIT: ok since i thought it looked horrid as a light alone i added a picture of a quick 3d flashlight i created and put it in the game heres a screenshot if you want i can message you or just post the link to the game but i don't want to post it without your permission.
http://farm3.static...._271967554c.jpg

with your permission; here is the link to the game i implemented the flashlight in but hence the fact the light will get bright once the flashlight is turned on and idk how to make it always dark or light depending on preferences, anyways here it is: Download

Edited by briantrlov, 14 October 2009 - 11:10 PM.

  • 0

#16 antome

antome

    GMC Member

  • New Member
  • 305 posts

Posted 15 October 2009 - 07:57 AM

this is really, really cool!

Just wondering though, how easy would it be to allow colours to work for the flashlight? So that I can turn it into a visor :).
I don't mind if it has to stay black, but it'd just help in the long run..
  • 0

#17 kajnista

kajnista

    GMC Member

  • New Member
  • 15 posts

Posted 06 May 2010 - 09:24 PM

How can you integrate this flashlight example to this game maker project:

http://www.gmexample...ire_example.gm6
  • 0

#18 Endorel

Endorel

    GMC Member

  • Banned Users
  • 191 posts

Posted 06 May 2010 - 10:52 PM

Oh goodness, don't tell me you're just drawing a sprite over the screen.

Edited by Endorel, 06 May 2010 - 10:53 PM.


#19 Desert Dog

Desert Dog

    GMC Member

  • Global Moderators
  • 6409 posts
  • Version:Unknown

Posted 07 May 2010 - 05:24 AM

Oh goodness, don't tell me you're just drawing a sprite over the screen.

That's just what it does. Simple, but effective. :)

You could have checked it yourself, and you'd have seen..
  • 0

#20 kajnista

kajnista

    GMC Member

  • New Member
  • 15 posts

Posted 07 May 2010 - 07:20 AM

How can you integrate this flashlight example to this game maker project:

http://www.gmexample...ire_example.gm6
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users