Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

$game_map.panorama_hue lag

I was wondering if there is a way to actively adjust the panorama hue, cycling through a couple of hues.

My current project has a cave type setting, with a crystal type panorama. (not the one included with RMXP). I would like the panorama to shift hue gently in the background, like a kind of warming and cooling effect. I have been able to script it in a parallel event using:

Code:
$game_map.panorama_hue = [n]
wait 20

repeating the above and increasing and decreasing [n] by 10 as needed. Doing it this way, I have a slight stutter each time the panorama is updated, is there a way to do this without the lag?

Sorry if this is elsewhere, I was to tired to search, well past my bedtime ;)
 

khmp

Sponsor

I tried to do it just through script. And it still lags. My guess is it's redrawing the whole panorama every time the hue changes. I'm probably wrong but it's a lot of lag.
Code:
class Game_Map
  alias_method :beek_panorama_hue_change_update, :update
  def update
    # If the flag to update the panorama has been set alter it!
    if @altering_hue
      # Update the timer.
      @timer_applied += 1
      # If the number of frames per second equals the amount of time passed.
      if @timer_applied == Graphics.frame_rate
        # Reset the timer.
        @timer_applied = 0
        # Update the panorama.
        @panorama_hue += @delta_hue
        # Turn off the flag if the we've reached the hue we want.
        @altering_hue = false if @panorama_hue == @ending_hue
      end
    end
    beek_panorama_hue_change_update
  end
  
  def alter_panorama_hue(ending_hue, delta_hue = 1, starting_hue = nil)
    return if @panorama_hue == ending_hue
    # Toggle the flag that states the panorama hue must change.
    @altering_hue = true
    @timer_applied = 0
    
    # Set the starting hue an ending hue.
    @panorama_hue = starting_hue if !starting_hue.nil?
    @ending_hue = ending_hue
    
    # Decide whether or not delta_hue should be changed.
    if (@panorama_hue > @ending_hue && delta_hue > 0) ||
       (@panorama_hue < @ending_hue && delta_hue < 0)
      delta_hue *= -1
    end
    
    # Set delta_hue.
    @delta_hue = delta_hue
  end
end
 
Khmp,  take a look at line 88 in Spriteset_Map.
Not only is it redrawing, but it's also re-caching the panorama.

I'm wondering if we created 2 extra panorama planes (Red, Green, Blue), then adjusted the opacity of the sprites if we could get something like what beekeep is asking for?

I'll give it a try if I have time

Be Well
 
Cheers for your work on this guys.
Any solution would be a great help, I think being able to alter the panorama hue live in game adds some depth, I am just having difficulty figuring it out. I am new to RMXP and very new to scripting, although I must say, I feel that I am getting the hang of it, the actual language used isn't too complicated, it just takes some getting used to.

I try my best to solve the problem before posting, but this one has me stumped.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top