View Single Post
  #8  
Old 01-19-2008, 02:20 AM
hotrian hotrian is offline
Who?
Join Date: May 2003
Location: Eatonville, Washington, 98328
Posts: 56
hotrian is on a distinguished road
Send a message via AIM to hotrian Send a message via MSN to hotrian
I know this isn't the best way to do it, but I thought I'd post my attempt anyway
It works, but if there are too many points it lags like crazy ( Granted, my computer is rather bad, but still) And even so, if you use too few points ( less than 360 / ( 36 / 4)) it will clip the shape too much, and glitch out.

Based on your last post, you have modifiable sizes, I'm sure that wouldn't be too hard for you too add to this system, though I'm using fixed light sizes.

this.lightSize modifies the size,
this.shapeIncrease modifies how many points are on the shape
this.shapeCheck modifies how far it checks in deviation to a point, before deciding it's clipping one too close already

this.lightSources is the array of objects, currently it's adding all players in the level as a light source... so don't try this in a populated level.. lol..

near the bottom you find an f for below it there's
PHP Code:
if ( && !temp.searchNextPoint
that check tells how close a point needs to be, before the script decides the next point it does locate, is actually from another source ( this makes it so diffrent light sources don't clip together unless they're close enough)

the incriments to the f for alter how fast it spreads outwards, in attempt to locate the next point.

The system first locates the closest light to the top left of the level, then it locates each point of that light, by determining which point is closest to the one it's at, without being the last. If a light point is too far from the last, it decides it's another light source and marks that to be a seamless return point, so that the polygon doesn't reclip itself when it returns.

All in all, I'm sure there's a much better way of going about this.


I was going to paste it under CODE or PHP tags, but apparently the server doesn't understand when I try to paste too much or something.. I'll just use attachments
Attached Files
File Type: txt weaponHotrian%047LightTest.txt (4.9 KB, 278 views)
__________________
Sometimes I wonder if I think too big.
Quote:
Originally Posted by Admins
I've moved the fox map to "levelstoobig/" because a terrain gmap of 1024x1024 levels is clearly too huge (the kingdoms main map is 40x40 and is already quite big). It was taking a lot of memory and was slowing down the computer.
Reply With Quote