Jump to content


Photo

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


  • Please log in to reply
466 replies to this topic

#1 Binsk

Binsk

    -Insane Kid-

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

Posted 06 November 2008 - 10:26 PM

NOTICE: THIS ENGINE IS NO LONGER SUPPORTED! I AM STARTING A NEW BRANCH COMPATIBLE WITH STUDIO, CHECK IT OUT HERE

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)
screenshot1xt.png
-
screenshot2pv.png

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:[/b]
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:
[b]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

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.


Edited by Scyler_27, 31 March 2013 - 04:17 AM.

  • 12

#2 Binsk

Binsk

    -Insane Kid-

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

Posted 11 November 2008 - 05:12 AM

Hi there! Why is no one leaving feedback? Makes me sad. :P You know, even if you DON'T like it, you can still leave feedback, thanks. :)

Anyway, I have updated the lighting engine to v2! I added colored lights, you don't HAVE to define their color, if you do not it is set to "no color" which, believe it or not, IS different than white. If you do define their color, you need to insert the color (or c_nocolor if you don't want a color) and the alpha. (I suggest 0.5) Also, you will need to place light_colorset_step() somewhere, but only if you are using colors. (And I suggest placing it AFTER light_set_step() )

Well, please leave feedback guys! It is always appreciated!
  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#3 kburkhart84

kburkhart84

    Firehammer Games

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

Posted 11 November 2008 - 05:34 AM

I looked at it. It looks like it does the job well. I could see this being used possibly in my Organic Metal(no link yet). Towards the last levels, I think you will be fighting the aliens on their homeworld, and it may be where you have a level where you are inside a tunnel going to the final boss, or something like that. I could see good use for it. In fact, it could be useful in some game where the lighting defines the gameplay. I could see that happening.
  • 0

My KBInput system is now on the marketplace here.  It wraps up nice and tight GMStudio's input system into a few function calls making a user configurable input system that works the same regardless of what inputs the player has chosen including keyboard, mouse buttons, and gamepad/joysticks using DInput/XInput.  The support forum topic for it is here.


#4 Binsk

Binsk

    -Insane Kid-

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

Posted 18 November 2008 - 05:35 PM

Thanks kburk, hope you choose to use it, and wish you luck. ;)

To all else, I am really open for ideas and feedback. If you have an idea feel free to suggest it! No guarantee I will add it, but I will mostly likely give it a shot. Even if it is a comment about something you DON'T like, POST IT so I can DO something about it!

Thanks. ;)
  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#5 flankattack

flankattack

    BETA Tester

  • New Member
  • 407 posts

Posted 21 November 2008 - 05:49 AM

This is cool. If you are making a topdown war game where one (or more) levels are at night; USE THIS.
  • 0
Spell my username as: flankattack
I specialize in ALPHA and BETA testing as well as game design. Currently testing 2 games. PM for more info.
Every time you use "Treat Uninitialized Variables As Value 0", The United States of America declares war.

#6 death-droid

death-droid

    GMC Member

  • GMC Member
  • 2600 posts

Posted 21 November 2008 - 10:50 AM

How about doing a basic day night system that supports lights....
  • 0

Posted Image


#7 BUD

BUD

    GMC Member

  • New Member
  • 163 posts

Posted 22 November 2008 - 05:32 PM

BUD

Hi. do you think you can add like a flashlight effect??
  • 0

#8 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 24 November 2008 - 03:37 AM

Scyler, I love this! It's great. So simple, yet so good. Thank you a ton.

BUD: Try making a sprite that looks similar to what a flashlight beam would look like and use it in place of sh_* when your creating your light. Look at his example where he uses a sprite to define how the light looks.

Edited by bocochoco, 25 November 2008 - 09:59 PM.

  • 0

#9 Binsk

Binsk

    -Insane Kid-

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

Posted 28 November 2008 - 04:35 AM

Thank you guys for the comments and feedback! It is greatly appreciated. :lol:

@death-droid: I might add that to the next big update, good idea. Thanks.

@BUD: As boko said, you can create your own light shapes with custom sprites like in the example.

I did find a problem with using custom images though, it causes big lag if using too many. I will be fixing that once I have access to the computer with the .ged.
  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#10 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 30 November 2008 - 10:38 PM

Wow it's really nice works great and is easy to customise lights.
Is it possible to rotate a light?

And heres my torch/spotlight which works quite well.
Posted Image

Edited by Krisando, 30 November 2008 - 10:41 PM.

  • 0

Posted Image


#11 Binsk

Binsk

    -Insane Kid-

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

Posted 30 November 2008 - 11:15 PM

I am glad you like my .gex. :)

As for rotation, I forgot to add that. O_o I can't believe it! Haha, I will add that to the next update! Thanks. (I might be able to update today, depending on how easy it is to fix a current lag issue with custom sprites)

EDIT: I have updated the .gex! Now v2.2, download same link!

Edited by Scyler_27, 01 December 2008 - 12:05 AM.

  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#12 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 01 December 2008 - 02:06 AM

Nice update Scyler. I love this engine =) Did you fix the lag issue with the custom sprite lights? I haven't had time to check yet.

Also, would it be possible to get a function to set the ambient light color and intensity? Instead of having it be pitch black wherever there isn't a light. Even a parameter on light_init() would be great.

Thanks a ton

<(^-^<) <(^-^)> (>^-^)>

edit: I just tested it out. With lots of custom sprite lights, it does lag =(. I had 12 of them and it lagged pretty bad. Also lags quite a bit with 4 of them. a flashlight that follows the mouse, and three rotating emergency lights.

Edited by bocochoco, 01 December 2008 - 02:56 AM.

  • 0

#13 Binsk

Binsk

    -Insane Kid-

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

Posted 01 December 2008 - 03:37 AM

Dang really? I thought I fixed it. (I put about 15 with 30 fps, though now I just tested and put around 25 and it went around 18-25 fps) Well I think I know what the problem could be, I will probably be able to upload a new version within an hour or two. As for the light color, that isn't too hard so I will see if I can add that while I am at it. :)

EDIT: Ok, I really DID fix the lag issue this time! I tested it with 30 custom lights all rotating towards the mouse and it was at 30fps the whole time. Also, I added the option to change the surrounding light to whatever color you want. Though I think it looks best black, white looks cool too. :D You set its properties in the light_init() function, and you can change it with the newly added light_main_set() function. In the example you can right click to change it.

EDIT2: @bocochoco, I forgot to say, I will try adding the option to change the darkness alpha sometime tomorrow if I get the time. It is going to be hard to figure out how to do with the colored lights.

Edited by Scyler_27, 01 December 2008 - 05:10 AM.

  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#14 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 01 December 2008 - 05:06 AM

Sweet. Looks great. I kinda feel like I didn't get my idea across properly though. I was thinking of something that would make objects in the room not completely black, but allow you to add a sort of ambient light across the entire room. So that rather than the entire room being dark, and only being able to see where there is a light, there can be a small amount of light throughout the entire room.

Also, thank you soo much for adding the rotating lights option. I did manage to get them to rotate though, by drawing the sprite rotated on a surface every step and making a sprite out of it to use for the light. That really lagged like holy hell.


Edit: Sorry if I'm being picky :) Just seems like something important for a lighting engine.
Edit again: no lag!!!! Freakin awesome

Edited by bocochoco, 01 December 2008 - 05:12 AM.

  • 0

#15 Binsk

Binsk

    -Insane Kid-

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

Posted 01 December 2008 - 05:15 AM

Sweet. Looks great. I kinda feel like I didn't get my idea across properly though. I was thinking of something that would make objects in the room not completely black, but allow you to add a sort of ambient light across the entire room. So that rather than the entire room being dark, and only being able to see where there is a light, there can be a small amount of light throughout the entire room.

You mean like being able to set how dark the "darkness" is? So you can see through it a little or make it look like dawn instead of night etc? If that is what you mean, I understood and will be trying to make it tomorrow. I just thought I would try making the color-change function tonight since it was pretty easy to implement. :)
  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#16 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 01 December 2008 - 05:17 AM

That is exactly what I mean. I would imagine that adding an alpha parameter would be able to handle that, but I've got no idea how you've coded this. I look forward to seeing what you come up with next.

Also, this might be tough to do as well, but perhaps adding a way for objects to block light?

Edited by bocochoco, 01 December 2008 - 05:18 AM.

  • 0

#17 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 01 December 2008 - 05:21 AM

I have a bug for you =]
My view & room is larger then 640x480, so I get a square 640x480 not filling whole view =]
[IMG Edited]

Also, this might be tough to do as well, but perhaps adding a way for objects to block light?

I would think thats related to shadows :)
I really would like the alpha darkness aswel =]

The latest version has given me errors, and all kidns of glitches hmm

Edited by Krisando, 02 December 2008 - 09:20 PM.

  • 0

Posted Image


#18 Binsk

Binsk

    -Insane Kid-

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

Posted 01 December 2008 - 07:05 AM

@bocochoco, yes that would be considered shadows. I am extremely iffy about shadows because they will be EXTREMELY hard to do.

@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. :)
  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#19 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 01 December 2008 - 07:22 AM

I suppose that would be shadows. Would be pretty awesome if you could figure out a way to do that.
  • 0

#20 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 01 December 2008 - 07:23 AM

@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


  • 0

Posted Image


#21 Binsk

Binsk

    -Insane Kid-

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

Posted 01 December 2008 - 07:59 AM

Ok guys, I updated it, you now have your customisable suround lighting! Tell me what you think!

@bocochoco, Heh well, I will see if I can get shading in later versions, but no guarantees. :)

@Krisando, Oh I see. At the end of that room you can place light_end(); then just start it up again at the beginning of the next room. That should re-set EVERYTHING. (Though I actually haven't tested the light_end() much so there might be a few bugs, tell me if you come across any.) As for the error, I am not getting it, but I will check into it to see what is going wrong. (Also, could you download the new version and tell me if you get the error?)

EDIT: Also @Krisando, I just remembered, if you use light_set_light before using light_add_light then it should give you that error. Make sure that you are creating the light first.

Edited by Scyler_27, 01 December 2008 - 08:06 AM.

  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#22 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 01 December 2008 - 08:05 AM

Ive made the code that makes light around your mouse instead shed light around multiple objects, ill try make an example of error.
Odd that it worked in previous versions

Error Example
=]

Edited by Krisando, 01 December 2008 - 08:09 AM.

  • 0

Posted Image


#23 Binsk

Binsk

    -Insane Kid-

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

Posted 01 December 2008 - 08:10 AM

Huh... Ok that would be great. What the error is saying, is that it is trying to check for the original image shape of a certain light, but that that light hasn't been created. So it is is giving an error. But this should only happen with custom lights, since you said you were using the exact code from the mouse (and that wasn't a custom light) that would be a big problem... Unless you ARE using a custom light?

EDIT: Huh, you are right... that is odd. Well, I DID upload a version with an error, but uploaded a fixed version about 1 minute later. You might just have happened to get the bad version. Download the newest version, it is v3.0 and has more features anyway. The example I uploaded with it works fine for me.

Edited by Scyler_27, 01 December 2008 - 08:14 AM.

  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#24 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 01 December 2008 - 08:22 AM

Keep with the constant updates =]

I noticed the 2 latest versions the x and possibly y coordinates have been noticibly changed position,
still get error. Ill just make it a custom light

Edited by Krisando, 01 December 2008 - 08:23 AM.

  • 0

Posted Image


#25 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 01 December 2008 - 08:24 AM

Excellent stuff scyler. Keep the updates coming

Edited by bocochoco, 01 December 2008 - 08:26 AM.

  • 0

#26 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 01 December 2008 - 08:26 AM

I've gotten that error too, after changing from 2.2 to 2.3. I checked treat uninitialized variables as zero and it went away. Though a fix for it would be preferable.

Thats for a workaround =]
  • 0

Posted Image


#27 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 01 December 2008 - 08:30 AM

Hey just noticed you uploaded 3.0... I like. But I get an error, goes away with the workaround

[codebox]
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]=a
r
gument3;global.__lighttype[ID]=argument4;var LIGHT;LIGHT=argument5;global.__lightangle[ID]=argu
ment6;if (LIGHT>=0&&LIGHT!=global.__lightshape_orig[ID])
{ sprite_delete(global.__lightshape[ID]) global.__lightshape[ID]=LIGHT; global.__lightshape_orig[ID]=sprite_duplicate(argu
ment5); sprite_set_alpha_from_sprite(global.__lightshape_o
rig[ID],global.__lightshape_orig[ID]); var TEMP; TEMP=global.__lightshape_orig[ID];
global.__lightshape_orig[ID]=global.__lightshape[I
D]; global.__lightshape[ID]=TEMP;}

at position 235: Unknown variable __lightshape_orig or array index out of bounds
[/codebox]

edit: fixed it so it didn't make the page expand. i hate that

Edited by bocochoco, 01 December 2008 - 09:14 AM.

  • 0

#28 Binsk

Binsk

    -Insane Kid-

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

Posted 01 December 2008 - 08:34 AM

Hm, so it is still giving the error... Thanks... So wierd, it isn't giving it to me at all. I don't want you to have to use a work-around for it to work right. :) I will devote 10 minutes to trying to find a fix, then I need to go to bed. (2am and school tomorow. >.< ) If I don't fix tonight, I will try tomorow.

EDIT: I don't know why the example wouldn't work, but I THINK I might have found the problem. I will upload a (hopefully) fix in a few min. If it isn't the fix you have to wait till tomorow.

Edited by Scyler_27, 01 December 2008 - 08:40 AM.

  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#29 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 01 December 2008 - 08:37 AM

I know the feeling bro, I've got class in about 5 hours (its actually 4am here) and I've yet to sleep =) No need to update tonight, though I wouldn't complain.

Edited by bocochoco, 01 December 2008 - 08:40 AM.

  • 0

#30 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 01 December 2008 - 08:37 AM

Hm, so it is still giving the error... Thanks... So wierd, it isn't giving it to me at all. I don't want you to have to use a work-around for it to work right. :) I will devote 10 minutes to trying to find a fix, then I need to go to bed. (2am and school tomorow. >.< ) If I don't fix tonight, I will try tomorow.

Wow your dedicated xD
Good to know your extension means more to you then school :D
  • 0

Posted Image


#31 Binsk

Binsk

    -Insane Kid-

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

Posted 01 December 2008 - 08:47 AM

Haha, yeah well my school is evil so... :)

I know the feeling bro, I've got class in about 5 hours (its actually 4am here) and I've yet to sleep =)

DANG! Good luck with classes tomorow. :D

Anyway, I think I have managed a fix, since I didn't get the error myself, I am not sure if it fixed it or not. (Though theoreticaly it should have) Hope it works for you guys. 'Night.

Edited by Scyler_27, 01 December 2008 - 08:48 AM.

  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#32 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 01 December 2008 - 09:01 AM

Oh boy =/
It made loads of objects have unitilised variables for some reason, made worse i think xD
  • 0

Posted Image


#33 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 01 December 2008 - 09:12 AM

Seems to have solved all the errors I was getting. Weird.

Time for me to get some sleep. nite folks

Edited by bocochoco, 01 December 2008 - 09:12 AM.

  • 0

#34 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 01 December 2008 - 09:24 AM

Hmm, with the coordinate change the positions are not precise heres a picture where each light is meant to have a lighting effect which somewhat varies it's position.

Also something I call bloopers, the lights which appear and don't go away :)

[IMG Edited]

Edited by Krisando, 02 December 2008 - 09:20 PM.

  • 0

Posted Image


#35 Binsk

Binsk

    -Insane Kid-

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

Posted 01 December 2008 - 03:59 PM

Krisando, your version of Game Maker is screwed. :lol:I dnow WHAT is going on with you, 1. I never changed coords or sprite origins. It loads the "built in" sprites externally which are 256x256, and puts the origin at 128x128. There is NO possible way for it to have changed unless you managed to do it yourself. I have loaded the example and messed with it on a DIFFERENT computer that I am NOT making the .gex with and it is still working fine, no errors. Could you tell me if the v3.0 example works properly?

EDIT: Hm.. I just noticed that it isn't changing the light shape if you change it under light_set_light(), I will have to look into that later, I am at school.

Edited by Scyler_27, 01 December 2008 - 04:05 PM.

  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#36 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 01 December 2008 - 09:15 PM

Kris, I had a similar problem before with moving objects and the lights lagging behind them. I figured out how to fix it. its actually quite easy. Code below for a flashlight following the player

[codebox]if keyboard_check_pressed(ord("W")) yspd-=10;
if keyboard_check_pressed(ord("S")) yspd+=10;
if keyboard_check_pressed(ord("A")) xspd-=10;
if keyboard_check_pressed(ord("D")) xspd+=10;
if keyboard_check_released(ord("W")) yspd+=10;
if keyboard_check_released(ord("S")) yspd-=10;
if keyboard_check_released(ord("A")) xspd+=10;
if keyboard_check_released(ord("D")) xspd-=10;

var pd,xx,yy;
pd = point_direction(x, y, mouse_x, mouse_y);
xx = x+lengthdir_x(0, pd) + xspd;
yy = y+lengthdir_y(0, pd) + yspd;

light_set_light(flashlight, xx, yy, 512, lt_normal, spr_flashlight, pd);
[/codebox]

Basicly it takes the movement speed into account when updating the location of the lights.
  • 0

#37 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 01 December 2008 - 09:27 PM

*Click* Thankyou =] that also helped with another bug.
  • 0

Posted Image


#38 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 01 December 2008 - 09:48 PM

Great, glad it helped out.
  • 0

#39 Binsk

Binsk

    -Insane Kid-

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

Posted 01 December 2008 - 11:06 PM

Ok guys, I hope I was able to fix some problems with this minor update! This is what I did:
1. Removed the light_set_light() and light_colorset_light() functions! It is done automatically for you now.
2. Speeded up the positional lighting, so lights SHOULDN'T lag behind objects anymore, or at least less than it did.
3. I hopefully removed the undefined error, and made it more efficient. Please tell me if you get the error, because I never got it so I can't really know if my "fix" worked.
4. I added another argument in light_main_set() so you can turn colored lights on or off manually! (If you don't ever call this function, the colored lights are automaticaly turned off)

That is about it, please say if the example works smoothly or not!

EDIT: Coming across more problems with the lights... I am going to have to look into this... AGAIN.

Edited by Scyler_27, 02 December 2008 - 12:33 AM.

  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#40 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 02 December 2008 - 12:07 AM

I will give you feedback once there is a working link. You'll fix it. You've fixed everything else so far.

edit: 100 posts!

Edited by bocochoco, 02 December 2008 - 12:07 AM.

  • 0

#41 Binsk

Binsk

    -Insane Kid-

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

Posted 02 December 2008 - 12:39 AM

Ok, I think I found the source of the some of the problems, and it is really odd and so far I can only find 1 work around! Ok, the object calling the light_init() event must be placed in the room FIRST! It would give an error if you didn't, I fixed it so it doesn't give an error, but now it just doesn't draw the lights unless THAT OBJECT says to create them. Changing depths and such didn't do anything at all, so it must be something else which I can't put my finger on...

Anyway, as long as you place the object calling light_init() in the room first (depth doesn't matter) then it should work fine. Also, I found out that what I did with the light_set_step() etc, it messed everything up so I added a new function light_update() in it's place. So basically instead of having light_set_step() and light_colorset_step() just put light_update!();

I hope this works for you guys until I find out why the lighting is acting up if not placed first.

P.S. Grats on your 100'th most mate. :whistle:

EDIT: Oh yeah, don't place the light_update() under the draw event, that WILL make the lights be drawn out of place including other random images.

Edited by Scyler_27, 02 December 2008 - 12:49 AM.

  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#42 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 02 December 2008 - 12:59 AM

Works fine. No errors that I could find. I'm not too sure why you would have to enable colorlights that way, but it works.
  • 0

#43 Binsk

Binsk

    -Insane Kid-

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

Posted 02 December 2008 - 01:07 AM

Well, I thought it would be nice to be able to turn colored lights on and off if you want, and plus, this way avoids unnecessary loops. So it should speed things up slightly when you have a large number of lights. :whistle:

Anyway, glad to hear that it works again.

Edited by Scyler_27, 02 December 2008 - 01:07 AM.

  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#44 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 02 December 2008 - 03:20 AM

My time to test :whistle:

Wow I like what you've added :GM122:

Hehe works better for me =]

Few odd glitches like random lights, and in my game a gfx mix up until i create a new light =P
Im getting all kinds of coordinate problems this is so odd

Edited by Krisando, 02 December 2008 - 07:17 AM.

  • 0

Posted Image


#45 bocochoco

bocochoco

    GMC Member

  • New Member
  • 140 posts

Posted 02 December 2008 - 07:13 AM

Feature request: flickering lights (think candles). Perhaps you could add multicolor lights? Like a light that fades from color1 to color2.

Kris: I have no idea what is going wrong for you, the lights aren't off center for me. I am using over 100 lights currently and every one of them is exactly where it should be.

Edited by bocochoco, 02 December 2008 - 07:14 AM.

  • 0

#46 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 02 December 2008 - 07:32 AM

[IMG Edited]
Fine in example though =/

For flickering I make the side get bigegr with random(); looks quite nice.

Im wondering if the change of room size or anything changed the lighting,
I think they ahve correct positions bit it is being placed incorrectly

Try this, it gives an error on game end. and a no lighting bug which may be causing incorrect coordinates
Download Error

Edited by Krisando, 02 December 2008 - 09:19 PM.

  • 0

Posted Image


#47 Binsk

Binsk

    -Insane Kid-

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

Posted 02 December 2008 - 06:01 PM

Wow... I think most of the problems came from your programing instead of the lighting engine. ;)

1. It started up and switched rooms before the other object could even initialize the lighting engine, this caused the error, AND the problem with drawing no lights.
2. You were calling light_update() in multiple objects per step which caused serious lag and problems with drawing the lights. You only need it called once per step, you don't need to update the lights more than that. ^^
3. The view you put was really weird, (Though I assume that you did that on purpose) which made things look strange, but no biggie.
4. The fact you placed light_init() in a different room adjusted the lighting settings to that room. This is ok if the rooms are the same sizes, but if not that causes problems.

So once I fixed these few things, everything worked smoothly again. Here are some things to remember:
1. Make sure that light_init() is always placed FIRST, before any other object creating lights or changing rooms etc. (It is best just to place it first in the room)
2. Never call light_update() more than once per step. Placing it in other objects in the same room can cause drawing problems and lag.
3. A good rule is to place light_init() at the beginning of each room you want lights, and light_end() at the end of each room. Though this isn't NECESSARY depending on room sizes, and such it could cause problems and lag because it sets the settings of the light for the room it is initialized on and it resets variables to avoid drawing (or attempting to draw) lights created from the previous level.

Hope that helps!

EDIT: For the flickering, instead of putting lt_normal you can put lt_flash. If you don't like that effect then under light_set_light() you can use a random() for the size/alpha or use light_set_on() and use choose(0,1,1) for on or off. I might update some effects later on, but right now I am just trying to make the lighting system work steadily. :)

EDIT2: @Krisando, I know it is a hassle having to put it at the beginning of each room. Especially if you have the room designed already. If that is the case, try this, open the room editor and find the object with the lowest id number. (If you don't know, the id of the object your mouse is over is displayed in the bottom bar of the room.) hold ctrl+right mouse a menu should appear. At the bottom of the menu there is "Creation Code" click that and inside place the light_init() and it should work. That is one way to avoid having to re-do the entire level.

Edited by Scyler_27, 02 December 2008 - 06:09 PM.

  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#48 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 02 December 2008 - 08:24 PM

Sorry for bothering you so much, the cause for all my problems was the room been to large oddly enough.
10100 in size xD
It works great now =]

This has got to be my favourite extension essential, Im happy with the results =]
Posted Image

Edited by Krisando, 02 December 2008 - 09:19 PM.

  • 0

Posted Image


#49 Binsk

Binsk

    -Insane Kid-

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

Posted 02 December 2008 - 09:50 PM

Ooh I see. Well I am glad it is working well for you now! :)

Your game looks really nice by the way, do you have a demo of it out yet? I would love to try it out!

P.S. I am still open for suggestions, so feel free to say if you want anything added! I am possibly planning on adding gradient surround light, or even textured. But that is iffy.

@bocochoco, about the multi-colored lights, I don't know a way to make it gradient (though I CAN make it possible to color certain portians of light, but that could cause lag) You could always make 2 lights of different colors and merge them together slightly. Since colors mix (if you put a red and blue light, the outcome will be purple) it should work quite nicely.
  • 0

NEWS FLASH! You can't get to heaven by your works. No chance. Hopeless. Give up now. No amount of works will get you anywhere, in fact all your efforts have been botched years ago because you already missed perfection the first time you lied, stole, or performed any of those other lovelies.

 

That said, do you want to go to heaven? Not the hellish picture given by cartoons. You know, the nightmarish one where you are renting a cloud and harp? I mean, holy crap, where did that come from? I am talking about a bonafide city, people, designed by God no less. Heck, read John's Revelation 21 if you want details. Getting to heaven is extremely simple, actually, the how and why is spelled out in Paul's letter to the Romans, summarized in Romans 10:9,10. God lived a perfect life and died in your place, covering every one of your mistakes and failures past and future. All you have to do is believe that He did what he said He did and accept the gift. Bam, you're saved. Done deal. Complicated, no? Questions? PM me.


#50 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 02 December 2008 - 09:59 PM

(Game had been released but will release soon ;P got alot of work to do though =] online part of game is complete though)
Suggestion.. well something which may be handy depending on how easy it'd be for you to implement.
Possibly a code light_object_visible(); checks to see if an object has been hidden by darkness/non visable due to lighting.
It'd probably be very hard for you so iuno up to you =P

Also maybe been able to add a fade to
light_set_on(my_light,ef_fade,false);
or something like that =].

Edited by Krisando, 02 December 2008 - 10:21 PM.

  • 0

Posted Image





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users