Shadow Generator

by Kidpaddle45
A little system that generates shadows for selected objects in your game.
ID:1856881
 

V1.0


This little library will allow you to generate shadows for all the elements in your game. Works with all icons (Big and small)



Whats next in V2.0
-Water reflection



Credits:
Ganite (for the art)



Do you like my creations? Donate, it motivates me! =D










I noticed in the demo the rock under the tree casts a shadow even though its in shade.
What would be nice is smooth transitioning between the shadow directions.
To anyone that gets the "undefined var: SR.appearance" error, insert the following code at the beginning of the 'Shadow system.dm' file:

atom/var/appearance
Noticed an issue. Whenever you save the game with the shadow currently on a mob (not sure with turfs), and you reload into the world, the shadow system duplicates your player icon and shadow.
In response to Marcus55
Marcus55 wrote:
Noticed an issue. Whenever you save the game with the shadow currently on a mob (not sure with turfs), and you reload into the world, the shadow system duplicates your player icon and shadow.

You probably shouldn't be saving the player's icon then. Never do that.
First off, nice library, excellent way to go about making shadows, and from what I can tell, its a good implementation. There are a few things I changed with how I'm using it: I set the appearance, color, and alpha vars of the shadow in it's New() proc, passed the atom through to it. Also, instead of having 3 variants of shadow I'm going to be linking it to the day cycle of my game to update the shadow every in game hour, so I'll be doing some math based on that to calculate the position of the shadow.

Second, for those of you trying to use this, if you want to call it in atom/movable/New or obj/New.. do a sanity check to make sure you're not also calling it for /shadow types, as they inherit obj's (and by extension /atom/movable's) behavior. It was infinitely generating shadows for shadows and it lagged hardcore for me, I was thinking I wouldnt be able to use this but thankfully my debugging skills showed me the problem.

tl;dr make sure you don't generate shadows for shadows
if u try to host a game with your shadows codes, the game in dream daemon isn't that smooth like it is in single player, do u know why? it happens with all games, but the real question is , when u host your game in daemon, your character looses shadow, and everything else has it, but if u play single player the character have shadow
I Did Try This In A Game, But It Doesn't Quite Work For Objects Of Massive Scale That Don't Have A Flat Bottom. Like, Completely Straight Throughout The Icon.