Dynamic Lights Test for XP (brand new script)...

Started by Heretic86, May 20, 2016, 07:53:27 pm

Previous topic - Next topic

Heretic86

May 20, 2016, 07:53:27 pm Last Edit: November 19, 2016, 03:18:50 pm by Heretic86




New script for XP that Im working on now...

All the Light Sources are FULLY DYNAMIC!

I've played with a couple of Dynamic Light Scripts, and they all seemed to have either a lot of trouble or serious shortcomings.  The one I am working on now, so far, is running at a very high framerate as opposed to a couple that I have played with, and should be very easy to use!  There is still quite a bit to do with it before I reach a Release Candidate status tho.

- I dont have any intent of building in a feature like "Fog of War" however, just so you know.

- I dont have any intent of putting in "Dynamic Shadows" where the corners of buildings cast shadows.  Not doing anything that fancy...

- I do have the intent of putting in some different graphics so the Player can have a "Flashlight" if you will

Are there any "features" that anyone would like to have built in to the script as I continue working on this?

-----

Edit - Full Version Released for download and Demo here:
http://forum.chaos-project.com/index.php/topic,13682.0.html

I should have edited this post a while ago for anyone who is interested in the full functionality of this script.  Sorry for the delay...
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

KK20

Might as well incorporate some day-night system with it. Not sure how feasible it would be to work with other day-night systems that lack any dynamic lighting.

How about giving a list of scripts you have used and evaluate them?

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Heretic86

Day and Night, will do...

Others I've looked at and evaluated:

http://www.hbgames.org/forums/viewtopic.php?f=11&t=74494&sid=93da246f8bbf96ed64e3e51b5e96e2ac
- Trouble here is you cant move the Lights around dynamically

http://forum.chaos-project.com/index.php/topic,14284.0.html
- Fast enough but relies too much on parallel events so hard for many people to use

Ive seen a couple modifications to scripts, and they are either too difficult for the average RPG Maker user to use or suffer terrible frame rates!  I know Blizz worked on one that cast shadows, I dont plan on doing that tho...

Know of any others I can take a look at?
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

KK20

Basically just check the script database. Also Moonpearl's, though I never tried it, probably not even dynamic either. Might help with the day/night.
http://moonpearl-gm.blogspot.fr/2013/12/daily-life-project-part-1-time-and.html

I mean, just google for it. It's a pretty common script people have done before.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Blizzard

Right, I once made a conversion from a VX script. I might be able to dig it out if you want.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Heretic86

Quote from: Blizzard on May 21, 2016, 12:24:21 am
Right, I once made a conversion from a VX script. I might be able to dig it out if you want.


I have a copy of it.  Conversion of Khas Awesome Lighting.  One cool thing was it had shadows.  Was that particularly difficult to do?

---

I've asked for assistance from ThallionDarkshine to create a dll that handles bitmap rotations since I cant use a sprite as a lightsource, and bitmaps only cache the original version.  Yes, Im still working on this, but it might take a week or two before I put out a demo...  Sad thing is that there are only like 5 things that need to be done to create a "dynamic shadowmap" and display it at a very high speed!
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

KK20

You still haven't figured out how to make a DLL yet? I thought you were learning some years ago :huh:

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Blizzard

I put the whole source code with a Visual Studio project in my XPA_Window implementation. You can check it out there.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Heretic86

Im getting a lot closer to being done.  Still have some work to do, and have to do ALL the script commenting explaining how to use it.  Per KK20's advice, I added a Day / Night system and there are smooth transitions between day and night.  Also has a setting for "Indoor Lighting" which is not affected by time of day.  I added some stuff so that lights could fade in and out depending on day or night and everything in between even if an "Indoor Light" is used.





And it is still running very fast!  I dont think I am going to do dynamic shadows however, its too much work for the users!

Other than all that, how does this look so far, appearance wise?
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

KK20


Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Heretic86

May 27, 2016, 05:56:29 pm #11 Last Edit: May 27, 2016, 05:59:00 pm by Heretic86
Quote from: KK20 on May 27, 2016, 12:49:09 pm
Should GIF it for ultimate dynamic-ness




Animated! (give it a moment to fully load)

I made a variable to control how long a day lasts and set that to a really low number to make a very fast transition from day to night.  Normally the transition from day to night would take quite a bit longer, depending on how a user configures the options in the script.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

KK20


Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Blizzard

... Excuse me, I'll just have to quickly go change my pants.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

schmoggi

May 28, 2016, 08:39:57 am #14 Last Edit: May 28, 2016, 08:44:35 am by schmoggi
Oh my, didn't see that coming! That looks very nice, Heretic.
I have used the Light Script called Fabien 3.0 in the past and i was fine with it. But this looks very promising.
Probably i'll stick with it when it is released, i like to have most as possible from one Hand :). I've got one Question though:

Is the Day & Night System linked with the functionality of the Light System or is it free to decide using only the Light System or both?

I ask because while i was looking out there in the Past for some Light Scripts, i've always found some with inbuild Day & Night System which bothered me, to be honest.
Many People, like myself, like to use their own (Evented) Day & Night System or have already build one and do not like to drop it.
And that is the reason i like the Fabien 3.0 one so much because it can be used without some inbuild Day & Night.

Thanks for the Answer.

greetz

Heretic86

A Time system has to be built in for less work for the end user.  There really isnt any way around it.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

KK20

That sounds extremely limiting. It's not hard to just make another method.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Heretic86

Quote from: KK20 on May 28, 2016, 07:56:26 pm
That sounds extremely limiting. It's not hard to just make another method.


I should explain better.

Matching a "Light" with the Day / Night / Indoor Light is a comment option for each event.  I used a game variable to know what time it is, and a game switch to go back and forth between indoor and outdoor lighting.  The time system isnt very robust, and isnt mandatory to be used.  Its a simple 24 hour clock, no days of the week, no solstices, no months, no calendar, etc.  In the end, Eventers have full control over everything, from script calls to comments. 

Im also taking a few days off for Memorial Day weekend seeing as I am a vet and all...
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Heretic86

*bump* (Like its even needed)

Im being held back from progress on this script due to my lack of l33t sk1llz with .dll files.

I need a .dll file that can handle Bitmap Rotations.  I asked Thallion to take a crack at it, but he may be a bit busy.  I am hoping it will not be too difficult.  It will need to be fast, so I suspect GPU Rotation may be necessary.  This can not be done from a Sprite Rotation because stretch_blt is needed to draw the Bitmap of the Lightsource into a Shadowmap, which doesnt take Sprites, just Bitmaps, and the Bitmaps in RPG::Cache are unrotated versions of the Image.

Basically:

# Rotate the Cached Unrotated Bitmap Image if needed
light_bmp = rotate_bitmap(light_bmp, @light.angle) if @light.angle != 0

Center of Rotation needs be Center of Image.  Image Rect can change in size as much as needed so it doesnt need to change size.

Flipping Horizontal and Vertical may also be quite useful.  No other effects are needed.

Does anyone think they can help out with this?
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Heretic86

July 01, 2016, 07:20:10 am #19 Last Edit: July 01, 2016, 07:34:43 am by Heretic86
Ok, finally got .dll file for Bitmap Rotations finished and working very stable.

@KK20, it was simply a matter of changing transx> width to transx>=width for the .dll crashes.  :facepalm:

Anyway, now that I can Rotate Lights, and you've seen the Spotlight Effect, Im also working on Pendulum Lights!



The gif has a bit of a stutter, it is much smoother in game!  I also made the shadows quite a bit darker than I would normally set them to in order to make the Pendulum Light much easier to see.  The movement is also accelerated as normally pendulums would not swing quite that fast.

Now, for Pendulums, which is another script (already available in the Database), I had to put together TWO types.  One is shown above.  It tracks the bottom position of the Pendulum.  That is a Vertical Pendulum.  The other will display over flat ground.  Movement wont curve like it does above and is only a left and right pattern.  But I've also added other options so the light will fade out as it approaches Right Angles as well as increases in size.  The animated gif above is intended to show off Bitmap Rotations!  Woot!

Yes, I am still working on this.  I got a bit busy earlier this week and hadnt had much time to code. 

Yay for Holiday Weekends, right?

Im a lot closer to releasing this.  I think I need to put in a feature for Lightning.  Other requests are already fulfilled.  Dawn and Dusk can be called manually.  Lots of shortcuts to do as there are a bazillion commands going on that need to be simplified for users.

Can anyone think of what else a Dynamic Lighting script might need?
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Blizzard

Are you using linear interpolation when you rotate the image? You should be able to get an even smoother movement that way.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

schmoggi

This looks absolutely amazing. I can't think of any additional Features at the moment, but i guess by releasing a first Demo people will see how it works and functions... and maybe have some Ideas for new things. I can't wait to try it out :).

greetz

Heretic86

Quote from: Blizzard on July 01, 2016, 07:46:09 am
Are you using linear interpolation when you rotate the image? You should be able to get an even smoother movement that way.


@Blizz - Im not, not yet.  I still have to take a look at your source code, just havent had time to yet.  Only got the bug that was crashing me a little bit ago.  How hard is it to implement Linear Interpolation?

@Schmoggi - I may put up a prototype demo around the time I get Lightning Effects implemented.  Im already up to about 3000 lines of code, which really isnt that much.  Most of it is trying to make things easy for users by not requiring every other event having goofy configurations, which is one of the things that drives me up the wall in other peoples scripts.

For example, the way they might make you create a light:

0
Light.png
255
[24, 24]
[32,96,96,32,76,1.0, 1.25]

Um, what?

Needs to be easier.

Put in a Comment: \light[]
Want to use a different source file?  Put in a Comment: \light[MyLight.png]

Want a Spotlight?
\light_spotlight[character_id]

Want to change the size of the Light?
\light_zoom_xy[2.0, 2.0]

Even when parameters are expected, for example, the Zoom one, zoom_xy immediately tells a person the first value is X Zoom and the second value is Y Zoom.

I will probably have something up in a couple of days.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Blizzard

LERP is easy. You just take the values of the pixels around the rotated pixel in a weighted manner and calculate an average rather than just taking the pixel value bluntly.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Heretic86

July 03, 2016, 05:53:52 pm #24 Last Edit: July 03, 2016, 05:55:12 pm by Heretic86
I havent gotten much done this weekend.  Holidays always mean "do loads of work around the house".

Anyway, I said I'd let everyone take a look at what is available so far, so here you go.

This is NOT a proper demo as a ton of the stuff is just junk that I use for testing purposes.

Heretic's Dynamic Lighting - Prototype Demo
http://downloads.chaos-project.com/heretic86/LightingPreRelease.exe

*** WARNING ***

Im not making this legal to distribute in games yet, although you can play with it to see what else it needs and how to improve it. 

It should be stable, but features may be changed around completely.  Not recommended for use in development with the advanced features.

With all that having been said, two very important things I need to work on are Lightning Flashes and LERP.  Although the code for Lightning is relatively easy, I would like to know what would be expected during a Lightning Strike / Flash.  Fade out the Shadowmap entirely or change its color?  I dont think every Lightsource will be expected to react to Lightning flashes, but some will be expected to, such as Windows.  I think I may have written myself into a corner the way that Dawn and Dusk are implemented...

@Blizz - You'll probably need to glance at the code, but Im using stretch_blt.  Should I use XPA_Window instead of stretch_blt for non rotated lightsources?  And for rotated lightsources, should I use your Linear Interpolation in KK20's DLL file?
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Blizzard

Yes, I would definitely recommend it. My LinearWrite() is faster than stretch_blt() and unlike stretch_blt(), it does bi-linear interpolation.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Heretic86

Okay, I believe I am finished with the script, so I need some folks to test it out.  I worked on putting it into the "Collection", and just need to make sure it runs.  There is one issue I am aware of and it will be fixed before release.

http://downloads.chaos-project.com/heretic86/LightCollectionBeta.zip

Anyone care to check it out?

I'm also working on a simplified Demo for this that doesnt include the whole Collection since it is quite large in size.  That will be out once I can confirm everything works for people.

Thoughts?
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

KK20


Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Heretic86

August 16, 2016, 06:06:47 am #28 Last Edit: August 21, 2016, 04:09:04 am by Heretic86
Okay, link removed on purpose.

FULL VERSION RELEASED
http://forum.chaos-project.com/index.php/topic,13682.0.html
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)