Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by lazer

Does anyone have any experience with creating glowing objects or lighting in Impact? I don't mean just the appearance of glow in the sprite sheet, but having an entity cast off light that actually reveals other elements in the level when it comes near (I was thinking maybe even a foreground mask of some sort that's black with a transparent section that follows a particular item...or something similar?)

EDIT: This was originally asked in IRC and then Gnx_ and I discussed the transparency mask idea, which seems to work for now. I'll be experimenting with this first (it'll be tricky as I need different levels of lighting etc depending on other level attributes). If anyone has any other thoughts on this or lighting in general, please post!

1 decade ago by Chmood

Some folks debated a while ago about this topic on the channel. What I got from it :

"in fact you don't lighten, instead you avoid to darken."
You could do a glow mask (layered zones of light), but colors would be washed to white.

I think it all depends on which feature you want :

- just a halo of light around one entity => the "big black mask" technique is ok

- all other cases, including fog of war, or different entities emitting light => more tricky. You can have each tile of your map to maintain a "lightning" property (see example below).

Or in case of no map at all, have multiple masks (which need further work on overlapping or addition, performance affect..).

There also was a game here on the forum, showing tile bases (I guess) lighting map : http://impactjs.com/forums/games/little-miner-ijs-tryout-project

Good luck Lazer anyway !

1 decade ago by lazer

Chmood, having a lighting property on each tile sounds like it would look much better for the kind of thing I need, but I have no idea how to even start implementing this (I haven't done much work with tiles other than creating tilesheets and placing them into Weltmeister). Do you happen to know if there's a piece of documentation or existing forum post somewhere that might point me in the direction of starting to implement this? I'll dig around tonight when I get home from work.

1 decade ago by Chmood

Exception made of the wip game I mentionned before, I have no doc about it, sorry Lazer.

But I have hints on how you could do that :

- In WM, we have layers, with "distance" property. These layers are ig.backgroundMaps, that you can build by code (as in drop for instance, only an array to fill).

- You then would need a special tileset image, with alpha "shadow" black scale (empty tile equals no shadow (0.0 alpha), dark tile = full shadow (1.0 alpha), and all variations in the between if you need them).

- Then your shadow layer would be drawn in front of all map / entities (like atmospheric effect like rain). That's why I mentionned the "distance" setting (that can maybe be over-ridden). [edit] : the index of the backgroundMap seems to affect the rendering order, no need for distance parameter (not tested)...

- The layer must be updated, keeping its data reflecting the level of light anywhere on the map (computated against closer light source distance, for example, or any algo)

In short, you have one more top layer in your game, casting different levels of shadow (with the alpha spritesheet), updated by code accessing to its raw datas.
Note also that with this technique you can easily cast light instead of shadow.

Maybe somebody will find a better way to do, it's just my feeling on that specific feature.

1 decade ago by lazer

Thanks, Chmood. I think I understand what you're describing. The main problem I think will be the actual syntax of detecting this entity that's meant to emit this light and changing tiles on the shadow scale depending on their proximity to said entity. I'm sure I'll figure it out somehow, just need to get my head around it :)
Page 1 of 1
« first « previous next › last »