Simple 2D Lighting - GameMaker Tutorial
Вставка
- Опубліковано 26 лип 2024
- "Hole punching" is an extremely popular trick to implement simple 2D lighting in GameMaker games. It only takes a few minutes to set up and all you need is a surface and some blend mode magic!
Example on Github:
github.com/DragoniteSpam-Game...
Surfaces:
• Introduction to Surfac...
The application surface:
• The Application Surfac...
Blend modes:
• Blend Modes - Simple V...
GameMaker Studio 2.3 playlist:
• GameMaker: New & Beta ...
GameMaker 3D playlist:
• 3D in Game Maker Studio 2
0:00 Introduction
0:44 Project setup
1:49 Preliminary knowledge
2:59 Setting up the surfaces
4:39 The different Draw Events
6:08 Filling the lighting surfaces
8:58 Punching holes with bm_subtract
14:40 Fine-tuning the lighting effects
22:17 A bit of subtractive blending math
23:50 That's all
#GameMaker
#GameMakerLighting
#GameMakerBlendModes
- - - - -
I've now made that Patreon:
/ wizardragon
That promised social media link spam.
/ dragonitespam
Transition / idle music is by my old friend Kamex:
/ greatgabite
Rate, comment, subscribe, watch more, enjoy! - Ігри
Great video. Easy to understand and practical without much filler.
Very helpfull tutorial, thanks!
Took some fiddling around myself to get it to fully work, but in the end it all came out great! 🙂
Great video on simple lighting, I like the chill pace. Keep up the good tutorials!
Thank you!
Tankyou so much!
FINALLY I FOUND IT
TOP!
Hola, funciona igual en gmk studio?
I know this is an older video now, but I want to say how helpful this is. The only thing is the light doesn't want to shrink or grow / bob despite me fiddling with the code to try to get it to. Any idea why ?
In my project i have the viewport X offset by -600 in the viewport properties so that it appears on the left side of the screen at all times. This is causing a black bar to appear on the right side of the screen. do you know what could be causing this?
great video once more. I wonder If it's possible to have the dark blue area in some sort of photoshop multiply effect over everything else.
you can: ua-cam.com/video/KqDe2JYxukA/v-deo.html
still undecided if i like the way multiply looks for this though
@@DragoniteSpam thanks for the super fast answer. how do you think do other games solve night time (for example stardew valley)? When I use photoshop I can get a kinda good night time color multiply but in game maker it's tough. Also because I still don't fully understand surfaces. Always when I think "this must work like this" it doesn't :D.
I have done this but my game has no camera. The screen works fine but it condenses the window and doesnt go fully to all edges
It worked but my game has levels and when I go to the next room the surface still there , how I can fix that ?
How is the global._part_system defined at the beginning of the video so I can launch the game without it crashing for this not being referenced? Tried doing this during the bit where you first test the opaque black surface
it's in the global code file called "particles"
How do I delete the lighting effect after applied. In my game I want this effect to work for 1 room but every room after that becomes pitch black even though I don't have the object
you need to add the clean up event to the lighting object and write this code in the cleanup event
if (surface_exists(light_surface)) {surface_free(light_surface);}
When I start up my game, the camera appears in the corner and doesn’t go full screen. A problem with viewports?
Probably
everything works fine but for some reason only instances in a certain layer can create "light"
My game has levels and for the next one the effect needs to be turned off anyway on how to do that
Same
Hi i cant seem to figure out why this doesnt work for me, ive got a camera obj that follows the player (just mentioning it incase its the cause, but i dont think it is)
I typed the code the exact same as you did, but the light is never centered on the torch, it seems to move based on the torch's position in the world, with the further left it is, the further left the light is. and when i make it follow the player too, the light is just fixed to the left of the head, rather than being centered.
My light cutouts origin is the center of the light, the torch's origin is the center of the flame, and the players origin is the center of the character
This is simple?
compared to most other lighting tricks, yeah
It is a great pity that it is GMS 2 and not GMS 1.4.
I gave up on GMS 2 because of the interface and the mess that reigns in the interface.
This works in all versions of GameMaker. You really shouldn't use a version that hasn't been supported in about 4 years though.
@@DragoniteSpam That's great. I really appreciate GM 1.4 for its simplicity and functionality. And it will stay that way ;) I have a nice day ;)