Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-03-2008, 08:14 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Overlapping polygons

So I started a lantern script. This works by drawing a circle with polygons around the player. Great! Problem is, I want to introduce multiple lightsources. When polygons overlap each other, it inverses the overlapping polygons. This means I simply can't just add each lightsource. Here's a screencap that shows what's going on:

How can I fix this? I know it's going to involved a bit of math... and I'm not that great at it, so go easy on me, please!
Reply With Quote
  #2  
Old 01-03-2008, 08:23 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
What are the layers of the Polygons?
__________________
Deep into the Darkness peering...
Reply With Quote
  #3  
Old 01-03-2008, 08:28 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
It's all one polygon.
Reply With Quote
  #4  
Old 01-03-2008, 08:48 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
well when ever you cross a polygon they do that intersect punch out as obviously stated before. Maybe just make another polygon?
__________________
Deep into the Darkness peering...
Reply With Quote
  #5  
Old 01-03-2008, 08:52 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Different polygons overlapping does not invert the polygon, so that would mean I'd have to add it to the polygon array... and it would involve calculating the precise coordinates to overlap it with to show it right. I don't think it needs to get that complicated.
Reply With Quote
  #6  
Old 01-05-2008, 06:26 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Eh, polygons are kinda *****y, really. It's gotta be just right. How exactly are you doing this right now? I imagine it'd have to work drastically different for multiple light sources.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #7  
Old 01-05-2008, 06:38 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Actually it works quite great, with different light sources of different sizes. It's just the inverting that's causing problems.
Reply With Quote
  #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
  #9  
Old 01-19-2008, 02:25 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Wow, someone finally responded! I'm not home right now, but I'll have to try it out when I do get home. Thanks!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:21 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.