Jump to content


Photo

Easy Lighting V7.0.2 | Last Updated: 06/07/11


  • Please log in to reply
465 replies to this topic

#421 Hello Darren

Hello Darren

    Pirate

  • Banned Users
  • 275 posts
  • Version:Unknown

Posted 12 December 2011 - 07:52 PM

Thanks Scyler I've got it all working now and it looks great and is quite easy to play around with.

Edited by Hello Darren, 16 December 2011 - 02:44 PM.


#422 irjason

irjason

    GMC Member

  • GMC Member
  • 45 posts
  • Version:Unknown

Posted 13 December 2011 - 06:02 PM

Hey, Amazing extension just started using it my self for a game i am current developing and was wondering if a fov light using a sprite would be posible to help explain here is a picture.

Posted Image

And also i was wondering about more than 1 view that use's 2 different background image's for the lighting? since my view 1 is controlled by the player. and view 2 is controller by another controller is it possible to make them have the same lighting effect? i tried 0 and 1 in view shamefully didn't work. thanks again for this great and easy to use lighting engine ^^;
  • 0

#423 Hello Darren

Hello Darren

    Pirate

  • Banned Users
  • 275 posts
  • Version:Unknown

Posted 14 December 2011 - 12:22 PM

I seem to have a problem. I want it so one of the enemy types (obj_Wizard) has fire on his head but when I use the code below only some enemies have the fire lighting while others don't have it and which enemies have the fire lighting seems random.

This is what I have in the obj_Wizard Create event.

var = instance_create(x,y,obj_WizardLight);
var.vParent = id;

This is in the obj_WizardLight Create event.

vParent = 0 // initalise
vLight = lt_lightadd(spr_LightWizard, 1, vParent.x, vParent.y, 1, 1, 0, c_white, 1, 0);

This is in the obj_WizardLight Step event.

if instance_exists(vParent)
{
  lt_lightset(vLight, spr_LightWizard, 1, vParent.x, vParent.y, 1, 1, 0, c_white, 1, 0);
}
else
{
  lt_lightdelete(vLight);
  instance_destroy();
}


It looks like the above code also messes up one my other lights as well. A light that appears over the ninja when he casts a spell doesn't show up at all if the level has any obj_Wizard in it. Don't know why they would conflict. :(

Edited by Hello Darren, 14 December 2011 - 03:49 PM.


#424 Hello Darren

Hello Darren

    Pirate

  • Banned Users
  • 275 posts
  • Version:Unknown

Posted 19 December 2011 - 03:02 PM

I just upgraded to v7.0.2 and the same thing is happening. I'm not expecting an immediate proper fix for this bug but it would be nice to be given a clue as to what might be causing it so I can try and figure out a work-around.

#425 Scyler_27

Scyler_27

    -Insane Kid-

  • GMC Member
  • 2755 posts
  • Version:GM:Studio

Posted 19 December 2011 - 06:49 PM

@arjason, Adjust the light sprite so that it is as high as it is tall. It is fine if you just surround the light with more black space, but tell me if that works. I was informed of a problem with how the system detects the light size, so this might be your issue. If changing the light sprite as such works, then I may have a fix for you in the next version.

@Darren, hm... Are you sure the objects controlling the lights are always created? Are all the wizard objects' depths below the lighting system? Are you deleting the lights at any other time on accident?
  • 0

#426 Hello Darren

Hello Darren

    Pirate

  • Banned Users
  • 275 posts
  • Version:Unknown

Posted 20 December 2011 - 08:18 PM

@Darren, hm... Are you sure the objects controlling the lights are always created? Are all the wizard objects' depths below the lighting system? Are you deleting the lights at any other time on accident?

Yeah all of the obj_WizardLight objects are being created, I checked with an instance_number which it equals the amount of obj_Wizard. The obj_WizardLight are currently below the main light object that controls the lighting system (I did try changing the depth to above but it didn't seem to make any difference). The only time a light ever gets deleted is in the obj_WizardLight object.

Something I found quite interesting was that the ninja has a constant light of his own that's always on and doesn't get destroyed. When killing the obj_Wizard which in turn deletes it's light object the ninja's light only disappears if the Wizard's light was not working in the first place. If the Wizard's light was working and is killed then the ninja's light is unaffected. I've no idea why the two lights would be connected though since they have completely different names and objects.

I wonder if a problem is that all of the lights from the wizards have the same variable name. Would that cause issues somehow? I'm not sure how I would go about creating a unique variable for every wizard when it's created so I haven't tested it.

Oh and thanks for taking the time to help me out here, I really appreciate it. :thumbsup:

#427 Hello Darren

Hello Darren

    Pirate

  • Banned Users
  • 275 posts
  • Version:Unknown

Posted 21 December 2011 - 07:19 PM

Oh it looks like I unintentionally solved it. Before all the lighting for the ninja was done in the main lighting object but I moved it all into the ninja object itself and everything seems to be working fine now. :) I still don't know why that would cause problems but it seems to have solved it anyway.

#428 theALCH3MIST

theALCH3MIST

    GMC Member

  • New Member
  • 92 posts
  • Version:GM8

Posted 29 December 2011 - 08:40 AM

Exactly what I was looking for. I'm building a platformer - a small project - which doesn't rely on gorgeous sprites.
  • 0

#429 Redyoshi

Redyoshi

    GMC Member

  • New Member
  • 31 posts

Posted 31 January 2012 - 09:35 AM

This will be perfect for my RTS with fog-of-war and a day/night system. No link yet.
  • 0

#430 Reefpirate

Reefpirate

    GMC Member

  • GMC Member
  • 333 posts

Posted 03 April 2012 - 03:52 AM

Hello! I'm still using v6.02 with my game. I'm considering updating to your latest version, but I'm not sure yet. Is it going to be difficult? Have you changed many functions? Is it worth it? Any tips on how to do it with the least amount of hassle?

Thanks again for an awesome lighting system!
  • 0

#431 Scyler_27

Scyler_27

    -Insane Kid-

  • GMC Member
  • 2755 posts
  • Version:GM:Studio

Posted 03 April 2012 - 04:47 PM

Heya Reefpirate! Glad you are liking my lighting engine! Hm, been a while since I worked on 6.2... Is it difficult? There are some function changes, but I think it is manageable. This isn't everything, but here would be some things to look out for:

-light_refresh/redraw changed to lt_refresh/redraw
-Must now call lt_shadcreate() which returns ID
-ID must now be used for lt_shadbegin() (previously didn't take an argument)
-lt_shadobj() has more arguments and DOESN'T automatically make a mask for you
(This is fine though, you just use the same image as the sprite for the mask)
Taken out because it was slow and really buggy.
-lt_shadcircle() doesn't exist (I will likely add it in the future, however)
built-in images are gone for compatibility between versions. Images DO come included
in download.
-lt_sysset() some arguments are switched around


Is it worth it? Well, there aren't really any more features. Most of the changes were "under the hood." Certain things should be faster. Mostly complex objects, large rooms, stuff like that that you wouldn't immediately notice. Also there were a considerable amount of unchecked variables/limitations and things that were in 6.x that could lead to crashes or unexpected problems (usually after longer gameplay periods) that have been fixed.

So whether or not you should upgrade is up to you. I would say you may not really notice too huge of a difference right away, but what you will be working with will be a decent amount more stable and it gets the (very occasional) update for bug fixes and new features.

Edited by Scyler_27, 03 April 2012 - 04:53 PM.

  • 0

#432 Zanattax

Zanattax

    GMC Member

  • New Member
  • 5 posts
  • Version:GM8

Posted 13 April 2012 - 11:13 PM

Hello, i just started using this engine and I am hoping to use it in a game I am working on. However, is there a way to measure if a point is illuminated or the amount of light at a point?

Thanks in advance. :turned:
  • 0

#433 Scyler_27

Scyler_27

    -Insane Kid-

  • GMC Member
  • 2755 posts
  • Version:GM:Studio

Posted 14 April 2012 - 12:35 AM

Hey Zanattax, glad you are considering my engine! I am afraid there is no means to grab the values of a specific light at a point directly, not efficiently anyway. If you have circle lights, it should be easy enough to do yourself by using point_distance(). If you have unusually shaped lights, you could use a collision mask or something similar.
  • 0

#434 Hello Darren

Hello Darren

    Pirate

  • Banned Users
  • 275 posts
  • Version:Unknown

Posted 18 May 2012 - 06:22 PM

Is it possible to set the alpha of a light? At the moment I'm using the image_index part of the lt_lightset function to control the light brightness but you don't get the same degree of control as an image_alpha.

#435 Scyler_27

Scyler_27

    -Insane Kid-

  • GMC Member
  • 2755 posts
  • Version:GM:Studio

Posted 20 May 2012 - 07:56 PM

Hey Darren. Alpha is controlled by the color of the light itself. The more color that is in the light, the more visible it will be. So if you have RGB 255,255,255, the most light possible, then it should be very bright. However something like 200,128,200 should be more "see through" or not as strong. It acts similar to real light, where a white light is much more noticable and provides a much larger effect than, say, red light.
  • 1

#436 GS-games

GS-games

    Creative

  • GMC Member
  • 328 posts
  • Version:GM:Studio

Posted 22 May 2012 - 10:30 AM

Looks great! I will definitively use this in my arena top down game.
  • 0

#437 ClassyGoat

ClassyGoat

    Goatee Connoisseur

  • GMC Member
  • 410 posts
  • Version:GM:Studio

Posted 23 May 2012 - 01:27 AM

Any chance that this lighting system does or will ever be able to work with Game Maker: Studio?? In particular, the Android module?
  • 0

#438 hbryantlanier@gmail.com

hbryantlanier@gmail.com

    GMC Member

  • New Member
  • 18 posts
  • Version:GM8

Posted 26 May 2012 - 01:13 PM

@Krisando, That is extremely wierd. The lighting system isn't based around the view, it covers the entire level. It uses room_width and such so it is impossible for it to do that. Are you sure part of the view isn't going outside of the room? Since the lighting stops at the edge of the room, if you have the view go beyond it would give what you are seeing right now. I tried testing multiple things with views and room sizes just now and couldn't get the same problem as you. Mind making a quick example of how you got that problem and sending it to me? Would be greatly appreciated. :)

Ohh I figured why, the object I made create before the room started which had a room size of 640x480 to avoid an error.
Also I get this error in the latest which didn't appear in previous versions

___________________________________________
ERROR in
action number 2
of Step Event
for object o_bullet_1:

In extension function light_set_light:
Error in code at line 1:
var ID;ID=argument0;global.__lightx[ID]=argument1;glob
al.__lighty[ID]=argument2;global.__lightdiam[ID]=ar
gument3;global.__lighttype[ID]=argument4;var LIGHT;LIGHT=argument5;global.__lightangle[ID]=argu
ment6;if (LIGHT>=0&&LIGHT!=global.__lightshape_orig[ID]){

at position 235: Unknown variable __lightshape_orig or array index out of bounds


when i open it... a message pops up saying it cant find the extension lighting v.6.2... wut do i do... i copied the two things from the zip but now it doesnt work...
  • 0

#439 Gametester1000

Gametester1000

    GameTester1000

  • GMC Member
  • 144 posts
  • Version:GM:Studio

Posted 26 May 2012 - 03:07 PM


@Krisando, That is extremely wierd. The lighting system isn't based around the view, it covers the entire level. It uses room_width and such so it is impossible for it to do that. Are you sure part of the view isn't going outside of the room? Since the lighting stops at the edge of the room, if you have the view go beyond it would give what you are seeing right now. I tried testing multiple things with views and room sizes just now and couldn't get the same problem as you. Mind making a quick example of how you got that problem and sending it to me? Would be greatly appreciated. :)

Ohh I figured why, the object I made create before the room started which had a room size of 640x480 to avoid an error.
Also I get this error in the latest which didn't appear in previous versions

___________________________________________
ERROR in
action number 2
of Step Event
for object o_bullet_1:

In extension function light_set_light:
Error in code at line 1:
var ID;ID=argument0;global.__lightx[ID]=argument1;glob
al.__lighty[ID]=argument2;global.__lightdiam[ID]=ar
gument3;global.__lighttype[ID]=argument4;var LIGHT;LIGHT=argument5;global.__lightangle[ID]=argu
ment6;if (LIGHT>=0&&LIGHT!=global.__lightshape_orig[ID]){

at position 235: Unknown variable __lightshape_orig or array index out of bounds


when i open it... a message pops up saying it cant find the extension lighting v.6.2... wut do i do... i copied the two things from the zip but now it doesnt work...

extract the zip file then go into gamemaker and click on extension packages, then click instal and search for the *.gex you unzipped, then you have 2 ways of loading the extension,
  • close gamemaker and and open it again
  • select the extesion package you just installed and click the arrow

  • 0

#440 ToxicArtz

ToxicArtz

    GMC Member

  • GMC Member
  • 75 posts
  • Version:GM8

Posted 29 June 2012 - 03:55 PM

Easy Lighting v7.0.2!
Easy, yet effective.

Wow, up to version 7! When I started this .gex, it was a mere side-project thrown together to solve the issue of the lack of good lighting engines. Now-a-days that isn't much of a problem anymore, but I hope that through 7 full version, 3 rewrites, and many updates later you will be impressed and satisfied by what this .gex has become! This .gex is a full-fledged lighting engine with over 20 functions that provides a simple way to add impressive lighting and shadows to your games. I strive to provide a high-quality .gex that acts and performs as if it were part of GM itself. I am always open for suggestions, opinions, and ideas on how to improve my work and make it better for you. After close to 3 years of working on this .gex, I present to you Easy Lighting v7.0! Let me introduce you to some of the features:


-23 easy to use functions.
-Very flexible.
-Customizable ambient lighting for different moods and times of day.
-5 Included light shapes for quicker production.
-Supports varied light shapes with no extra slowdown!
-Supports animated lights for unique effects.
-Rotate and color your lights easily!
-Lights "interact" with objects and other lights, making moving lights look that much more stunning!
-View support, have the lights limited to a specified view for faster rendering on big levels!
-Option for control of light's update and drawing system. Static lighting? Ok, just draw it once!
-Delete unwanted lights for speed boost.
-Built-in shadow system for amazing results!
-Each shadow point can have a different z value.
-Shadows can be animated and morphed in-game.
-Stack multiple shadows on objects for a more 3D effect.
-Much, so much more.


If that isn't enough to get you interested, check out these screenshots taken from the provided example: (version 7.0)
Posted Image
-
Posted Image

Lights aren't just placed on top of objects, they interact with and brighten them! Though, of course, there is the option to remove additive lighting for a more simplistic look.
Here is a quick summary of the functions:

lt_sysset - Set's properties for the lighting system
lt_lightadd - Creates a new light and returns an id
lt_lightset - Adjusts settings for an existing light
lt_lightdelete- Delete's a light
lt_lightget_x - Get's x position of a light
lt_lightget_y - Get's y position of a light
lt_lightget_on - Returns if a light is on or off
lt_lightget_castsshadows - Returns if the light can cast shadows
lt_lightexists - Returns if a light exists
lt_lightcount - Returns the number of lights created
lt_lightset_x - Sets a light's x position
lt_lightset_y - Sets a light's y position
lt_lightset_on - Turns a light on/off
lt_lightset_castsshadows - Enables/Disables shadow casting for this light
lt_refresh - Manually updates lighting settings
lt_redraw - Manually draws lights onto screen
lt_shadcreate - Creates a new shadow shape
lt_shadbegin - Starts defining new shadow shape
lt_shadreset - Resets the points for a shadow so they can be re-defined
lt_shadpoint - Adds a point to the shadow
lt_shadend - Ends the shadow shape
lt_shadobj - Assigns an object with a specified shadow
lt_shadsetobj - Re-sets properties for an object and shadow

Lights can be turned on or off at will with lt_lightset/lt_lightset_on, along with the possibility to create flashing and blinking lights (among others) with ease!

So why are you still reading and not downloading? It is a small file-size and well worth the download!

FILE:
(v7.0.2) Download 1.2mb .zip <- .gex should now work with GM7 and GM4MAC, but not the example.

(v6.2 old) Download 800kb .zip <- Download, Made for GM8.0. (NOT COMPATIBLE WITH GM7 BECAUSE OF RESOURCE LOADING DIFFERENCES)

If you guys could leave feedback and tell me what you think, that would be very much appreciated. Thanks.

As always, with all of my .gex files, no credit is ever required (though appreciated) and you can use this .gex in both free and commercial projects.
Note: If you decide to credit me, please use the name Thagen Pinch

Extra Credit:
- With version 6.x+ I took a few ideas from the LS3 lighting engine by Adventus.



Changes In v7 Rewrite:

There are many internal changes and there may be some compatibility issues.
-You can now define multiple shadows at once. As a result, the process is slightly different.
-I removed the internal built-in lights for GM7 compatibility. I provided 5 shapes in the file, however, as a substitute.
-Much greater optimization for large areas, providing bigger speed boosts when objects/lights are out of view.
-Added many quick return functions for ease of use.
-Fixed many invisible internal remnants that could cause crashes/slowdown over long play times.
-Added returns to almost every function.
-Added a few more personal error messages, more to come, for when the user does something wrong (Rather than a confusing GM message).
-Completely re-wrote the example, making it easier to understand and more step-by-step.
-Wrote a quick function list (html file) that provides a brief rundown of every function.
-Fixed many minor bugs, such as black screen when no lights exist, among others.
-Made everything more efficient and easy to access so 1) Faster results for you, 2) Easier for me to modify.
-Source code is not provided with v7, nor will it ever be.

I'm not great at using game maker yet. I'm still learning. I'd like to be able to make some really good lighting effects for my game. I downloaded your file, but I get error messages when I try to run the example. Mind helping me out? Here are the error messages I got btw...
"___________________________________________
COMPILATION ERROR in Script: level_shadows_scr
Error in code at line 3:
shad_shape[0]=lt_shadcreate();
^
at position 16: Unknown function or script: lt_shadcreate"

Either that or "cannot find extension package easy lighting 7.0.2"
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users