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 02-03-2010, 06:57 AM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
Lightmapping/Shadows

My experiments with lightmapping that will hopefully be finished soon.

Right now the editor supports RGBA values for each light and a falloff value. I want to add support for multiple equations for falloff, such as inverse square, etc. There's more to be added later, such as proper anti-aliasing, support for custom resolution lightmaps (Right now it's half resolution of a Graal level, which is 512x512), but whatever!

Here's a video showing the editor and lightmap compiling.



Note: I clipped the compiling time. It took 19 seconds in that instance (The compiler's not optimized at all at the moment.) and the editing time was sped up by a factor of two. Also, the software I was using to record raped my video. It's 8-bit =(

When you click render, it does the proper calculations and bakes the lights into two PNG files; a colored light map, and a shadowmap, saved as levelName_lightmap.png and levelName_shadowmap.png. Lights blend correctly with one another as well.

Also, I can't release this until V6 is released, as I need to use the requesturlfromgamefile function for this to work 100% properly. That function isn't available in the V5 client.

umm to-do list:

1) More falloff equations.
2) Spotlights.
3) Custom resolution lightmaps.
4) Fake walls in the editor, and likewise ignoring walls.

Oh, if anyone wants this, PM me, I guess.

Last edited by 12171217; 02-03-2010 at 07:08 AM..
Reply With Quote
  #2  
Old 02-03-2010, 07:00 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
That's really, really cool. Excellent work.
__________________
Reply With Quote
  #3  
Old 02-03-2010, 07:05 AM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
Quote:
Originally Posted by cbk1994 View Post
That's really, really cool. Excellent work.
Thanks!
Reply With Quote
  #4  
Old 02-03-2010, 07:10 AM
maximus_asinus maximus_asinus is offline
RIP DarkCloud_PK
Join Date: Oct 2001
Location: Canada
Posts: 3,746
maximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond repute
That is awesome, pure awesome. Would rep you if I could.
__________________
Save Classic!
Reply With Quote
  #5  
Old 02-03-2010, 07:27 AM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
Thanks max

I'd like to see some servers start using solutions like this for indoor levels..
Reply With Quote
  #6  
Old 02-03-2010, 09:10 AM
Clockwork Clockwork is offline
ᶘ ᵒᴥᵒᶅ...ᶘ ಠᴥಠᶅ❤...ℳℴℯ
Clockwork's Avatar
Join Date: Feb 2007
Location: Pennsylvania
Posts: 2,071
Clockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant future
Very nice !
__________________
Reply With Quote
  #7  
Old 02-03-2010, 09:18 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
Perhaps you should add in your light-map editor the ability to select tiles and declare them as walls and use that in your lighting algorithm to add some more realism? Only walls facing down, of course, since those are the ones you can see...
__________________

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
  #8  
Old 02-03-2010, 01:04 PM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
Quote:
Originally Posted by coreys View Post
Perhaps you should add in your light-map editor the ability to select tiles and declare them as walls and use that in your lighting algorithm to add some more realism? Only walls facing down, of course, since those are the ones you can see...
What's extremely annoying is that you never seem to read my posts..
Reply With Quote
  #9  
Old 02-03-2010, 03:42 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Looks pretty impressive
Wondering for what you need requesturlfromgamefile(), is the lightmap generator running on a webserver?
Reply With Quote
  #10  
Old 02-03-2010, 06:42 PM
Immolate Immolate is offline
Indigo
Join Date: Dec 2009
Posts: 322
Immolate is on a distinguished road
Interesting. Really interesting.

Last edited by Immolate; 02-03-2010 at 08:43 PM..
Reply With Quote
  #11  
Old 02-03-2010, 08:27 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Stefan View Post
Looks pretty impressive
Wondering for what you need requesturlfromgamefile(), is the lightmap generator running on a webserver?
I suppose it is. I, personally, wouldn't want to code something that converts raw image data to PNG in GS2.
Reply With Quote
  #12  
Old 02-03-2010, 09:02 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Nice stuff Would like to see the code for this.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #13  
Old 02-03-2010, 09:28 PM
Immolate Immolate is offline
Indigo
Join Date: Dec 2009
Posts: 322
Immolate is on a distinguished road
Quote:
Originally Posted by Tigairius View Post
Nice stuff Would like to see the code for this.
I asked too but I realised it said PM him for it. It would be nice if there was a public release in the Code Gallery though.
Reply With Quote
  #14  
Old 02-03-2010, 10:03 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Stefan View Post
Looks pretty impressive
Wondering for what you need requesturlfromgamefile(), is the lightmap generator running on a webserver?
He said last night he's using PHP and GD to generate the image.
__________________
Reply With Quote
  #15  
Old 02-03-2010, 11:10 PM
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
Quote:
Originally Posted by 12171217 View Post
What's extremely annoying is that you never seem to read my posts..
Sorry, missed that.

Quote:
Originally Posted by cbk1994 View Post
He said last night he's using PHP and GD to generate the image.
I'm considering using some Python code on a webserver to do image generation remotely.
__________________

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
  #16  
Old 02-04-2010, 05:13 AM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
Quote:
Originally Posted by Stefan View Post
Looks pretty impressive
Wondering for what you need requesturlfromgamefile(), is the lightmap generator running on a webserver?
Yeah. The original implementation used pure GS2, but I wasn't happy with performance and didn't want the NPCServer to suffer.

Unfortunately, the light only collides with tiles because of this; I couldn't trust appending 512x512 bytes of GET data to get a half-res collision map, so I simply did 4096 bytes; the tile map. If you could enable POST on Testbed, though, instantly solved!

With a release, I'd like to host a central, PHP-powered hub for lightmap generation. Might as well go the extra mile; V6 isn't seeing a release soon and I need the requestfilefromblahblahblah function before release..

Also, is there a way to add more GUIControl elements to the scripted RC? Having access to this simply by opening scripted RC and having a simple weapon script that a server manager could install as a sort of "plugin" would be awesome.

Last edited by 12171217; 02-04-2010 at 05:45 AM..
Reply With Quote
  #17  
Old 02-04-2010, 05:59 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
Actually a really good idea to use a webserver to generate things like this. You should also release the PHP code so people can put it on their own webserver so you don't have all that stress on whatever server you're using.
__________________

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
  #18  
Old 02-04-2010, 06:03 AM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
Quote:
Originally Posted by coreys View Post
Actually a really good idea to use a webserver to generate things like this. You should also release the PHP code so people can put it on their own webserver so you don't have all that stress on whatever server you're using.
Of course. I'm pro-open source; for the most part.
Reply With Quote
  #19  
Old 02-04-2010, 06:14 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by 12171217 View Post
Yeah. The original implementation used pure GS2, but I wasn't happy with performance and didn't want the NPCServer to suffer.
Did it work client-side?

Also the plugin thing: http://forums.graalonline.com/forums...ad.php?t=87384
__________________
Quote:
Reply With Quote
  #20  
Old 02-04-2010, 06:19 AM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
Quote:
Originally Posted by fowlplay4 View Post
Did it work client-side?
Of course, but the speed wasn't even comprable to what I ended up doing with the PHP server, and the client would be essentially immobilized until the rendering was done.

Might've been because I was using those panel display things; I could always try just writing the PNG information directly from an array, but then the max loop limit still comes into play, and I feel the PHP server is the most elegant solution.
Reply With Quote
  #21  
Old 02-04-2010, 08:58 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
Quote:
Originally Posted by 12171217 View Post
Of course. I'm pro-open source; for the most part.
Good man
If you're still looking for some performance improvements, and you're familiar with Python, the Python Imaging Library should be much faster than GD (PIL is written in C). If not, I hear imagemagick is faster than GD.
__________________

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
  #22  
Old 02-06-2010, 05:51 PM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
Quote:
Originally Posted by coreys View Post
Good man
If you're still looking for some performance improvements, and you're familiar with Python, the Python Imaging Library should be much faster than GD (PIL is written in C). If not, I hear imagemagick is faster than GD.
I'll port it to Python when I get ungrounded :< I'm on my phone.
Reply With Quote
  #23  
Old 02-07-2010, 04:07 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
For increasing the loop limit there is obj.maxlooplimit, for using TSockets you need to contact me for enabling them on your server (need the host/ip and port range).
Reply With Quote
  #24  
Old 02-07-2010, 04:09 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Stefan View Post
For increasing the loop limit there is obj.maxlooplimit, for using TSockets you need to contact me for enabling them on your server (need the host/ip and port range).
I never understood how to change the loop limit, never worked for me. Post an example, maybe?
Reply With Quote
  #25  
Old 02-07-2010, 04:20 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Just set the variable in onCreated? this.maxlooplimit = 100000; or so, default is 10000
Reply With Quote
  #26  
Old 02-07-2010, 04:40 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Makes me think of this:

__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #27  
Old 02-07-2010, 04:56 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Stefan View Post
Just set the variable in onCreated? this.maxlooplimit = 100000; or so, default is 10000
Yea, I tried that before. That didn't seem to work, still got the error.
Reply With Quote
  #28  
Old 02-14-2010, 10:47 AM
calani calani is offline
Scriptess
calani's Avatar
Join Date: Aug 2003
Location: asmgarden.gmap
Posts: 606
calani is on a distinguished road
Send a message via AIM to calani
Incredible. Props!
__________________
Reply With Quote
  #29  
Old 02-14-2010, 11:06 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Crow View Post
Yea, I tried that before. That didn't seem to work, still got the error.
It works for me, but sometimes you have to let it "update". If you set it, then run the script again (or add a sleep after setting it) it tends to work.
__________________
Reply With Quote
  #30  
Old 02-14-2010, 11:30 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by cbk1994 View Post
It works for me, but sometimes you have to let it "update". If you set it, then run the script again (or add a sleep after setting it) it tends to work.
Thanks for that hint, I'll give it a try later.
Reply With Quote
  #31  
Old 02-20-2010, 02:53 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Nice work
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #32  
Old 01-09-2011, 01:41 AM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
I was thinking about rewriting this for Google's AppEngine in Python, but I'll definitely need socket support this time around. How do you go about enabling that on your own server? Or on Testbed? Can the server owner do it?
Reply With Quote
  #33  
Old 01-09-2011, 01:43 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by 12171217 View Post
I was thinking about rewriting this for Google's AppEngine in Python, but I'll definitely need socket support this time around. How do you go about enabling that on your own server? Or on Testbed? Can the server owner do it?
You have to PM Stefan, with the what and why.
__________________
Quote:
Reply With Quote
  #34  
Old 01-09-2011, 01:53 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by 12171217 View Post
I was thinking about rewriting this for Google's AppEngine in Python, but I'll definitely need socket support this time around. How do you go about enabling that on your own server? Or on Testbed? Can the server owner do it?
PM Stefan or send him an email ([email protected]) and tell him the server and the host and port you need enabled.
__________________
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:56 AM.


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