Help - Search - Members - Calendar
Full Version: Adventus L3s Engine Lit Walls Workaround
Game Maker Community > Working with Game Maker > Advanced Users Only
DakaSha
Adventus (Pheonix 101) is the designer of the original engine. All credit goes to him

First off this is what I have managed so far:
Exe
GMK

This is the original Engine: Link

Press the right mouse button to shine the dynamic light. Example is meant to showcase the effect in a quickly constructed "dungeon/corridor" enviroment

So far this is just a work around to the Adventus L3S dynamic shadows engine "Z" problem. It isn't perfect but I'm actually fairly impressed by the effect. It still isnt good enough for use in a (quality) game but it is getting close.

Some things i want to mention:

1) I am not a great coder and have only used GML for about 8-9 months off and on. I also have next to no education in mathematics so I'm sure this isn't that great. It's also just a simple fix when it comes down to it. If it can be done better then let me know... Thats why I'm posting here:P
2) The engine is slow. It will be usable for my game if it is made just a little better but dont expect it to be super fast.
3) It only works with one light. In the project I have planned that will be the most important thing (The players light source) but being able to do this with multiple lights including the static lights that the room starts with would be great. I might be able to solve the latter but I'm still working on optimizing this first.
4) It still looks slightly glitchy.. *sigh* I don't know if this can be made much better given the limitations of the Z concept
5) I am aware that the example could be done better (the define_lit_wall script could use arguments for example. Prob some obvious optimization possibilities). I just threw the example together and it should be sufficient for now.
6) This workaround goes against some of the optimization techniques that would be standard when using L3S (such as using large shadow casters instead of many small ones). I do not think there is much that can be done against this (except doing this in a drastically different matter of course)
7) I'm posting this in advanced despite me being pretty newbish because I havn't received any help with the problem in the novice forum, I have example code and I think the act of extending/optimizing this is an advanced topic.
8) I emailed adventus about this just to make sure hes ok with a newb messing with his stuff. Will take this down if he isnt tongue.gif

Anyways I think making this look good and run fast would help alot of people who want to use this engine the way I have planned.

--edit--
uploaded a better example

--edit again--
much better example. It's actually looking quite good now. Still not 100% perfect but I'm very happy with it considering I havn't got this to work for a loooong time smile.gif
Still looking for ways to make it better.

Still:
I have some weird semi-random glitch when the dynamic light is moved in a certain way. if you play around with it youll see that now and then. All the walls go black (Z is obviously being set to above the light) I have no idea why this is. Something weird with my (strange) collision codes? If you change the lights sprite to the focus light and shine it on the right wall youll def see it. I really cannot find the reason behind this. Any help would be greaty appreciated.

After further testing it seems to depend very heavily on the type of light selected.. It's probably something pretty obvious but I've been playing with this so much and long that my head is about to explode tongue.gif
DakaSha
Sheesh this doesn't interest anybody lol.

Well its really important for my project so if anybody could just help me find the glitch id be very grateful ^^
nick360
Did you write this or what?

it looks pritty complex, if i knew what made it tick, i may be able to help.
DakaSha
The shadows engine was written by Adventus (Pheonix 101). Its a great engine but it has a problem:

Walls with a higher altitude then lights cast shadows on themselves. So if you set the rooms ambient light to pitch black and shine a light on a wall, then the whole space the wall is occupying is rendered black (or whatever the color you set the ambient light to). Basically the wall itself is never affected by light.

An analogy would be: You shine a light onto a book so you can read it. But although the book casts a shadow the pages remain black.

You can set the walls altitude to lower than the lights but then there are a billion other problems (the main one being that you light up walls behind the wall you are shining light on)

This is basically a bandaid fix for the problem.

To fix my problem you would prob have to understand how to use the original light engine. It really isnt difficult and the only thing i did was add a few objects and 2 scripts. I didn't go messing with the actual code of the original.

I'm going to link to the original engine btw. You can try to set up the same kind of test room i did and youll see the difference tongue.gif
jabelar
Hey, actually I really like this light engine. I haven't really tried to figure out how it works, but I think the result is very nice. I have been critical of other light engines and fog of war engines that don't respect walls, but this one does so nicely.
DakaSha
Like I said the respecting of walls can be a pain though too tongue.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.