lighting system for platform game

Get help using Construct 2

Post » Sat Aug 01, 2015 10:04 pm

hey everyone!

need some opinions on how to better achieve a lighting system for a 2d platform game.
my references are these:

https://www.youtube.com/watch?v=PVmAP7LdR_g

https://www.youtube.com/watch?v=nIsLq11NxU8

https://www.youtube.com/watch?v=w7uOhFTrrq0

this is what i have right now:

Image

im using around 1000 black square sprites, that follow the camera, and change their color from black to white, depending on "light" conditions.
im using the lineofsight plugin to reproduce the shadowLight plugin. and using a simple distance thing to draw some light around the player.

main problems:
1 - well, its super mega uber not optimized, and runs really slow.
2a - since the tile map blocks the line of sight (just like with the shadowLight) the actual platform terrain is 100% black (unless when close to the player, when i force some light there) this is really bad obviously because how are you going to play a platform game when you dont actually see the actual platforms!?
2b - you could say, well, make the platform visual on top of the shadow. but then... its just going to look horrible! and defeats the purpose of even wanting to have this shadow going on.

*why not use the shadowLight? well, first of all, it renders perfect aliased shadows and i dont feel like that works visually with my game. and, it has the same problem from "2a/2b".

ideas??
Image
B
22
S
5
G
2
Posts: 65
Reputation: 1,724

Post » Mon Aug 03, 2015 5:37 pm

bump
Image
B
22
S
5
G
2
Posts: 65
Reputation: 1,724

Post » Mon Aug 03, 2015 6:07 pm

Another idea would be replacing your 1000 black square by a single tilemap. Each tick you check for LOS of each tile position and set (or erase) its tileID accordingly. You could even have multiple tile ID for multiple "lighting value".
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Mon Aug 03, 2015 8:40 pm

my first idea was actually to use a tilemap. but i have no idea how to access the individual tiles like you said!
Image
B
22
S
5
G
2
Posts: 65
Reputation: 1,724

Post » Mon Aug 03, 2015 8:53 pm

Then in that case, the manual is your friend! Check out the part on TileToPositionX/Y, this is certainly what you want. Ask away if there's still something you don't comprehend.
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Tue Aug 04, 2015 1:09 am

i managed to have 1 tile work!
basically im looking at the position of tile (3,3) and then setting it to a white or black tile depending if LOS can see it or not.

Image

BUT i have no idea how I would make the event looks at all tiles.

also, my layout is pretty big, at 600 tiles wide by 340 tiles tall. so i guess i would need an expression that only looks at tiles that are close enough to the player, or inside the camera/screen area?

also right now i have it be on/off as in sees/doesnt see. how could i measure the distance of each tile to the player? so i could actualy make the light be stronger/weaker with a gradient instead of just on/off
Image
B
22
S
5
G
2
Posts: 65
Reputation: 1,724

Post » Tue Aug 04, 2015 6:29 am

Heh, one tile is better than nothing ! :P

But what's even better is getting all tiles to behave correctly ! ;)
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Tue Aug 04, 2015 3:02 pm

ah magistross!! this is just beautifull!

I managed to get a loop running to check all tiles, but it was just sooo slow!

your result is amazing! ill study it here to understand what you did!
Image
B
22
S
5
G
2
Posts: 65
Reputation: 1,724

Post » Tue Aug 04, 2015 7:23 pm

@Magistross - I am getting a 404 error on the capx :(

can you post another link please ?
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,832

Post » Tue Aug 04, 2015 7:47 pm

Sorry @RamPackWobble, I had moved the file from my dropbox folder. Give it another go, it should work now.
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Next

Return to How do I....?

Who is online

Users browsing this forum: Lancifer, Yahoo [Bot] and 58 guests