Need Help Implementing @RamPackWobble 's Lighting System

Discussion and feedback on Construct 2

Post » Fri Apr 04, 2014 1:57 pm

Message: nchima is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
Hello Construct community. I'm new to construct and game dev in general, so please pardon if I violate some construct forum norms. I recently came across @RamPackWobble 's Land of Light and Shadows tutorial: .The first 2 parts aren't necessary to my game, but the 3rd is. If you haven't read the tutorial please do, it's amazing. So here's my problem; I tired incoperating the lighting system into my platformer stealth type of game. The idea is the layout (think of it as a building) is divided into various segments (rooms) which have to sneak though. All the segments (rooms) in the layout are dark, unless, a light is on, in which case the room is lit. The light stays in that segment (room) only, obstructed by doors, walls, and solid ground. Some light may sip into the next room if the door between those two rooms is open (ie solid disabled). A well placed obstacle can also create shadow. I tried 3 methods listed in the his tutorials, (1) the line of sight full grid method, (2) line of sight full cone method, and (3) the cast light arc method. The line of sight cone method was my least favourite since its possible for light from one room to move into another room, therefore you'd have cones overlapping each other, and remember the whole layout is dark meaning a cone would have to be created for each light. In the end (in my case) im better of using the less complex method and using the line of sight full grid system, covering the whole layout in a grid of lights which are activated when an on light has a line of sight to them (which I also tired. I'll get back to that in a moment). I tired the cast light method, which seemed promising, except for a couple of things; (1) the walls and ground which the rays of light collide into, are long, and there origin is in the center. This affects the distance() functions which is used to calculates the distance between the light from which the ray sprite is drawn, and the obstacle (wall, ground) inorder to adjust the width of the ray of light to not go beyond the obstacle. Because the distance() function uses the centre of the obstacle to calculate distance between my light and my obstacle (a long wall). So while one ray will have an accurate width setting, the light rays won't, which creates a very ugly mess. this could be solved if I construct had a collision-point parameter which I would use in the distance() function. It would seem that the best method of me to use is the line of site full grid method you devised earlier, it's actually quite good, my only gripe with it is that, having that full grid in my game with everything else that I have in my layout seriously degrades the performance, especially on slower machines (which is odd for a 2D game, with barely anything really taxing in it). If this method was less memory intensive (or processor, or whatever it is, I'm not an expert) I'd use it (if the more skilled programmers in this community could find a way to optimize this method). Is there anyone reading this, following my chain of thought, and capable of helping? Mr @RamPackWobble, can you help? I'm so close to success... Sorry but due to the device I'm using, I can't upload screenshots or a capx file, I would really have loved to see if you could help. I just hope there's some amongst you capable of helping, even without. I know I've broken some forums posting norms/rules, again, sorry.
B
5
S
1
Posts: 24
Reputation: 443

Post » Fri Apr 04, 2014 3:59 pm

First of all, thanks for the nice comments about the tutorials. (and now with 75% off* - please look in the tutorial section. )

Easiest answer is, "Could you break your walls up into smaller sections - this would allow the distance (of the light beams) to be calculated with more precision ?"

Fixed lights (ie room lights) could be faked with a pre-made light overlay ...

This might have been better in the "How do I" forum ?

Paragraphs are fun :P

* The 75% off is for a limited time only :)
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Fri Apr 04, 2014 7:35 pm

1) Okay I must be getting old, I don't get the 75% off joke. (2) I can't break up the walls, considering the number of "rays", I'd have to have very tiny walls to have a accurate distance() calculation. (3) I considered the pre-made overlay, like you did, but the rooms are next to each over so the pre made over lays would just be next to each other, which is pretty much the same as just having a full grid, but with more work. (4) I considered sticking it in the how do I forum, but it didn't seem 100% percent accurate. Like I said, sorry for breaking forum posting rules. If any moderator is reading this, please move it to the appropriate forum. (5) with reference to the paragraphs bit, please don't mock my dumb phone, I can't work with the scirra forums' fancy text editor :(... I still don't get the 75% off bit.
B
5
S
1
Posts: 24
Reputation: 443

Post » Fri Apr 04, 2014 8:58 pm

I realise that maybe my original lengthy text post wasn't cleat enough. So I've uploaded a capx project file (r139) of my project. Maybe that'll be more clear and someone (looking at you @RamPackWobble) can have a look at it and have luck figuring out how to incoperate one of @RamPackWobble 's lighting methods with fare accuracy and without a heavy strain on memory, cause I'm clearly stuck. it would b very much appreciated.
You do not have the required permissions to view the files attached to this post.
B
5
S
1
Posts: 24
Reputation: 443

Post » Sat Apr 05, 2014 7:07 am

I will have a look but it will probably be Monday as "She who must be Obeyed" has plans for this weekend ....

You are typing on a phone - that would take me hours and be 50% spelling errors (I'm not that good on a full sized keyboard) , so your lack of paragraphs will be overlooked for now. (Me mock ? Never ! :) )

You "don't get the 75% off bit" - perhaps you viewed them before the sale ? :)

Which reminds me - the 75% off sale ends soon, get the tutorials while they are cheap ... :)
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Sat Apr 05, 2014 9:05 am

You "don't get the 75% off bit" - perhaps you viewed them before the sale ? :)


LOL i dont think that will help :)
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Sat Apr 05, 2014 10:34 am

@spongehammer
B
5
S
1
Posts: 24
Reputation: 443

Post » Sat Apr 05, 2014 10:35 am

@spongehammer -_-
B
5
S
1
Posts: 24
Reputation: 443

Post » Sun Apr 06, 2014 5:50 pm

Here you go - needs work but it is showing promise ...
You do not have the required permissions to view the files attached to this post.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Sun Apr 06, 2014 10:21 pm

It's Sunday. was expecting Monday. There I was counting the minutes.
B
5
S
1
Posts: 24
Reputation: 443

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 7 guests