RMMV Community Lighting MV & MZ

ImaginaryVillain

One With The Particle
Veteran
Joined
Jun 22, 2019
Messages
780
Reaction score
4,379
First Language
Absurdism
Primarily Uses
RMMV
Before I add to this the Github, please test it. You'll see a new setting, "Lights Active Radius" which represents grid spaces radiating out of the player's position.
community_lighting_lights_active_radius.jpg
Any lights outside of this distance will shut off, any lights within it will turn on. If you set it just beyond the screen's size, it will look like the lights are as normal. I defaulted it to 20 which I think will be perfect for most people's games (unless you're a crazy person who does 1920x1080 in which case 30 is better). For added fun set it to be too small (like 10) and watch your lights turn on and off in real time.

I haven't made these changes for MZ yet for a few reasons. One because I don't own it, two I want to see how it operates for people, and three because there are so many features that I want to see if breaks anything.

I have however made a UMC version of it for added speed. :LZSwink:
 

Attachments

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
331
Reaction score
481
First Language
German
Primarily Uses
RMMV
I've tested it for a bit and didn't really run into any problems so far.
This feature supposedly improves performance, right? Especially on bigger maps I guess.
 

ImaginaryVillain

One With The Particle
Veteran
Joined
Jun 22, 2019
Messages
780
Reaction score
4,379
First Language
Absurdism
Primarily Uses
RMMV
The theory behind it is a distance calculation being less intensive than a rectangular gradient with a circle gradient cut out of it.... That being said I made just a test game with 500 lights (300 radius, 6 different colors) randomly placed on a 250x250 map and couldn't see a huge FPS difference between the two versions. They both still waffle between 53-61FPS. At 1,000 lights both hit 2-4 FPS.

But see if I let my world creator script run it... It can do 3,000 lights at 60FPS. And can do 30,000 lights before hitting the same 2-4FPS. So the possibility is there... But obviously I'm not going to just start handing around my world creator script, not that it would be that useful for a normal game anyway.

I honestly think the problem is MV/MZ sucks at handling so many events. The secret may be to simply tie the lights to objects like Galv did with his Map Projectiles script. That script manages to have so many projectiles on the screen it's incredible, all without suffering the crippling lag of too many events.

Anyway I'll go back to the drawing board and see if there's a better method.
 

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
331
Reaction score
481
First Language
German
Primarily Uses
RMMV
Oh well, atleast its funny to see lights turn on and off as you pass them so the endeavor was not entirely pointless.
 

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
331
Reaction score
481
First Language
German
Primarily Uses
RMMV
One thing that kind of bothers me is the fact that for whatever reason, lights on events don't get updated properly when you issue move routes to them. I am not sure if this is a "bug" of the plugin or some kind of plugin incompatibility.

As you can see in the provided video, the light source stays in place and only after a little time moves to the event again. Does this happen to anyone else?

 

ImaginaryVillain

One With The Particle
Veteran
Joined
Jun 22, 2019
Messages
780
Reaction score
4,379
First Language
Absurdism
Primarily Uses
RMMV
At first I thought it was caused by the setup I tossed in to make it only update every other frame (basically adds a huge speed increase due to being half the workload), but I guess someone edited that out. Anyway I tested it in my game with my boss WIP and it updates immediately. So there's got to be some other cause. How is the event setup? And what sorts of plugins are you using? Maybe try disabling extra plugins and enable them one at a time.
 

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
331
Reaction score
481
First Language
German
Primarily Uses
RMMV
Here is the event in question; its really basic so I doubt that is the problem here:

event.png

And here is my plugin List:

PluginList.png

Let me know if you can spot anything that might be related to the bug I am getting.
Until then I'll just trial and error until I find something.

EDIT: I tried putting the community Lighting plugin at the top of my plugin list and it seems to have improved the condition slightly, but the lights still lag behind sometimes.
 

ImaginaryVillain

One With The Particle
Veteran
Joined
Jun 22, 2019
Messages
780
Reaction score
4,379
First Language
Absurdism
Primarily Uses
RMMV
Er.. wow... With that many plugins I'd say your best bet is the disable huge groups of them and try the scene again. Then enable them in groups of ten till you find the culprit. Other than that, maybe focus on stuff that affects the camera, text messages or move routes since those are the things involved in that scene.
 

Riazey

Master of None
Veteran
Joined
Feb 27, 2014
Messages
147
Reaction score
174
First Language
English
Primarily Uses
RMMV
At first I thought it was caused by the setup I tossed in to make it only update every other frame (basically adds a huge speed increase due to being half the workload), but I guess someone edited that out.
Edit it back in. :^)
 

BrentBAM

Veteran
Veteran
Joined
Jul 22, 2020
Messages
68
Reaction score
30
First Language
English
Primarily Uses
RMVXA
Hello!

Hey when I tried the demo the game wouldn't load. It said "retry" and there were no graphics either. Here is a picture of it:

1601344012747.png
 

ImaginaryVillain

One With The Particle
Veteran
Joined
Jun 22, 2019
Messages
780
Reaction score
4,379
First Language
Absurdism
Primarily Uses
RMMV
Create a new project and copy the demo over it, it's that way because GitHub only allows up to 25mb files.

@Riazey Nah, it probably messed with the date/time system. I usually forget that exists because I've never once used it.
 

BrentBAM

Veteran
Veteran
Joined
Jul 22, 2020
Messages
68
Reaction score
30
First Language
English
Primarily Uses
RMVXA
Create a new project and copy the demo over it, it's that way because GitHub only allows up to 25mb files.

@Riazey Nah, it probably messed with the date/time system. I usually forget that exists because I've never once used it.
Oh that fixed it! Thanks for responding so fast too!
 

DarkSearinox92

Veteran
Veteran
Joined
Jan 8, 2013
Messages
401
Reaction score
60
First Language
Italian
Primarily Uses
Before I add to this the Github, please test it. You'll see a new setting, "Lights Active Radius" which represents grid spaces radiating out of the player's position.
View attachment 161869
Any lights outside of this distance will shut off, any lights within it will turn on. If you set it just beyond the screen's size, it will look like the lights are as normal. I defaulted it to 20 which I think will be perfect for most people's games (unless you're a crazy person who does 1920x1080 in which case 30 is better). For added fun set it to be too small (like 10) and watch your lights turn on and off in real time.

I haven't made these changes for MZ yet for a few reasons. One because I don't own it, two I want to see how it operates for people, and three because there are so many features that I want to see if breaks anything.

I have however made a UMC version of it for added speed. :LZSwink:
Incredible, great! I'll try to test it tonight. Let's say that this improvement will be useful especially on mobile devices, but in any case it is still a great improvement! True, the game often lags for the amount of events on the map. So perhaps you should delete certain events created just to set up lights and use the command to create light on a specific x and y. In this way, perhaps, the amount of events created just to set up a light source is reduced.

In any case, a staff member, if I'm not mistaken, told me that the engine itself enables and disables events if they are away from the player. That way, why should the game slow down anyway, if events only trigger as you get close? (Kind of like the upgrade you just created for the lights ...)
 

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
331
Reaction score
481
First Language
German
Primarily Uses
RMMV
@ImaginaryVillain
Hey I am back with a report on my situation and its highly peculiar.

#1 I turned off ALL of my plugins except Community Lighting, and it STILL lags behind

#2 However, the lighting NEVER lags behind on player lights AND "Autonomous Movement" on events (e.g. approach player or random movement)

#3 Sometimes, when I perform the same move route command twice in quick succession, the first one will lag and the second one does not at all
#3.1 However, after waiting some time the same move route command will lag again


Now, here is the big dealbreaker though;
I tried creating an entirely new project with ONLY the community Lighting and guess what?
IT ALSO FREAKING LAGS, like what the hell is this? I am completely dumbfounded by this, considering that I am apparantly the only one who experiences this problem.
 

ImaginaryVillain

One With The Particle
Veteran
Joined
Jun 22, 2019
Messages
780
Reaction score
4,379
First Language
Absurdism
Primarily Uses
RMMV
I was able to duplicate the bug as well. It only seems to occur when the action button initiates movement. I admit since all I use is parallel movement.. I hadn't even noticed. It's present in both versions though. I'll have to see what causes it.

@DarkSearinox92 MV/MZ doesn't actually stop processing events at all (to test make a huge map like a 100x100, place a lag causing parallel event on a side, then put your character on the other side. See if you still get lag. :LZSwink:

What it really does is disable autonomous movement. That's it. Which is why MV/MZ has a cap on the number of events that one can have on a map at the same time. It's not a hard cap, more of a Javascript is a single thread language, and will overwhelm whatever core is running it causing lag... sort of cap.

I've managed to deal with the problem in my own game by simply removing events that are too far away and adding them back in when the player gets close. Thus allowing for more total effective events on a map... But that still doesn't deal with the single thread issue, so even in my setup I can only physically have the same number of events as anybody else existing at once.

If we can tie the lights to points instead of events though... Hmm... I'll have to think about that. It would vastly increase speed though.
 

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
331
Reaction score
481
First Language
German
Primarily Uses
RMMV
It only seems to occur when the action button initiates movement
That's partly true.
Just to clarify, that same "bug" happened to me on "Player Touch" events aswell,
e.g. a cutscene that triggers when the player steps over a certain event.
Any Move route command in said cutscene also suffers from this problem.

It also happens occasionally on Autorun/Parallel events
 
Last edited:

DarkSearinox92

Veteran
Veteran
Joined
Jan 8, 2013
Messages
401
Reaction score
60
First Language
Italian
Primarily Uses
I was able to duplicate the bug as well. It only seems to occur when the action button initiates movement. I admit since all I use is parallel movement.. I hadn't even noticed. It's present in both versions though. I'll have to see what causes it.

@DarkSearinox92 MV/MZ doesn't actually stop processing events at all (to test make a huge map like a 100x100, place a lag causing parallel event on a side, then put your character on the other side. See if you still get lag. :LZSwink:

What it really does is disable autonomous movement. That's it. Which is why MV/MZ has a cap on the number of events that one can have on a map at the same time. It's not a hard cap, more of a Javascript is a single thread language, and will overwhelm whatever core is running it causing lag... sort of cap.

I've managed to deal with the problem in my own game by simply removing events that are too far away and adding them back in when the player gets close. Thus allowing for more total effective events on a map... But that still doesn't deal with the single thread issue, so even in my setup I can only physically have the same number of events as anybody else existing at once.

If we can tie the lights to points instead of events though... Hmm... I'll have to think about that. It would vastly increase speed though.
So, for parallel events, I understand the fact that rpg maker can't disable them. Those are important. But the "press to start" events, they told me the core disables them. So I don't really understand. Are you sure they are not disabled?
 

ImaginaryVillain

One With The Particle
Veteran
Joined
Jun 22, 2019
Messages
780
Reaction score
4,379
First Language
Absurdism
Primarily Uses
RMMV
Yep, it turns out you can literally just put enough blank (action button trigger) events on the map to lag MV/MZ. I want to say it was a couple hundred... but it might have been more than that. Been a long time since I did the blank event test. But yeah give it a shot, just put hundreds of blank events and see what happens. I don't even think you need that many, and it's far less if they have graphics. Oh and don't forget to put them on the other side of an overly large map too, just so nobody can say you're too close to them. :LZSwink:
 

ImaginaryVillain

One With The Particle
Veteran
Joined
Jun 22, 2019
Messages
780
Reaction score
4,379
First Language
Absurdism
Primarily Uses
RMMV
@ScorchedGround It turns out that error is present all the way back in the original plugin, though it eventually starts updating the position. So I did some serious reworking of the MV UMC version of the plugin. It now fixes the error, but I need some testers. :LZSwink:

MV UMC v1.4
- Completely reworked coordinate system.
- 20.8% less lines of code (down to 486 from 613)
- Now only applies a tint besides black if you actually tell it, instead of always applying it like the normal script does.
- No longer requires a command to turn on, if you'd liked to disable it just set the screen tint to #ffffff since lights won't show up in a white tint.
- Now waits for the next available animation frame before updating to reduce lag, instead of skipping every other frame.
- Fixes the error of a light not following an event that shows a dialogue box, and then tries to move.

edit:
@KaYsEr Actually in testing, this may have fixed the UltraMode7 error. Probably due to it completely reworking the coordinate system it uses. This is especially interesting as I didn't include the original UltraMode7 fix in the UMC version. Let me know if you end up testing it, so I can see about pushing it to the main plugin if it's actually useful.
 

Attachments

Last edited:

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
331
Reaction score
481
First Language
German
Primarily Uses
RMMV
@ImaginaryVillain

That's great! But I still use the standard version of the plugin and not the ultra fast one.
The bug is present there aswell. Any chance for a quick fix? :kaoswt:
 

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Latest Threads

Latest Posts

Latest Profile Posts



So I figured out how to put words and pictures in the screen transition. It even wipes away from both the top and bottom. The possibilities are endless! :LZSexcite: I'm going to devise secret messages now for them because I'm a terrible wonderful person like that. :kaopride:
December has arrived and with that, an ¡update for Aletoir Feast! a game made it for the One Map Challenge. I will use some of the remaining switches, variables, and events from the challenge limit to add more content but keep it within the requirements. ¡Have a nice day Everybody!
What I worked on today. :LZSjoy:

No stream today, make a game in MZ is continuing next week!
It seems MOG Weather only has a "clear" function to instantly erase a given weather effect. Probably works well if weather only changes at map transfer, etc, but looks very abrupt if weather effects are continuously changing. So my next challenge: script a "fade" function to gradually fade the sprites and wait to "clear" the current weather until the opacity of all its sprites hits zero... or something like that! XD

Forum statistics

Threads
105,754
Messages
1,016,159
Members
137,437
Latest member
mephet
Top