Light casting : worth the work ?

Get help using Construct 2

Post » Fri Jul 12, 2013 1:03 pm

Hey !

I'm currently working on a dynamic light for a top down game. I want the light to stop when it hits a wall, with initialy shadows everywhere.
After some research on the forums, the examples I found were too CPU heavy to be used as they were. I turned to theory then and was told to take a look at this article. The technique described is somehow classic/logic, but is a lot of work to import into C2 (either write a plugin for it or a lot of events).
My question is, has someone tried to implement this method in C2 already ? If so, how much CPU was it taking ? Is it worth it ?


The technique in the article is :
- find all wall angles and store them with the links/segments between them (once)
- cast a "light ray" upon every corner and see where it intersects with the previously stored segments and draw the triangle (Player,lastIntersection,currentIntersection) (every tick)
B
17
S
8
G
4
Posts: 473
Reputation: 6,211

Post » Fri Jul 12, 2013 1:17 pm

I was just looking for something similar and found this example, hope it helps.

https://dl.dropboxusercontent.com/u/1685424/shadows.capx
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,699

Post » Fri Jul 12, 2013 3:10 pm

Thank you for your answer, but it wasn't what I was looking for. Shadow casting is nice but doesn't have the same use, and can't replace the light casting in this case. I know what I would do and how I would do it here, only problem is the complexity and the time it's going to take (witch I'm ok with), but I'm looking for people that tried it before, to know if they were able to handle the CPU charge this can generate.
B
17
S
8
G
4
Posts: 473
Reputation: 6,211

Post » Fri Jul 12, 2013 10:33 pm

@emoaeden

Wow, that helped me! Been interested in shadows for ages, but couldn't see a way to do it without 3rd party plugins. This would probably work on mobile devices!
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
81
S
13
G
7
Posts: 970
Reputation: 10,900

Post » Wed Oct 09, 2013 10:16 pm

Good examles. Need canvas plugin
http://c2community.ru/forum/download/file.php?id=1320
http://c2community.ru/forum/download/file.php?id=1319ShawnFTM2013-10-09 22:22:21
B
3
Posts: 2
Reputation: 204


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 13 guests