Lune world map framerate/bug issue help

AllyJamy

Veteran
Veteran
Joined
Sep 24, 2015
Messages
65
Reaction score
36
First Language
English
Primarily Uses
RMVXA
I've been trying to implement Lune world map into my game. ( https://centrorpg.com/index.php?topic=1129.0 )

Using the script by itself results in a lot of lag in this specific project. Though, when using it in a similar project, that also uses a larger resolution, there is no lag. So I asked on Discord for help and TheoAllen made a scriptlet that was able to render the map at 60 fps, instead of the usual 5 fps I was getting. (Theo's fix below)
Ruby:
class Scene_Lune_Map
 
  def update
    super
    if @category_index != @category_window.index
      unless $lune_map_info == []
        @item_window.refresh(@category_window.index)
        @help_window.refresh(@category_window.index)
      end
      @category_index = @category_window.index
    end
  end
 
end
However, this resulted in some odd behaviour when moving around the map.

See video linked for what that odd behaviour looks like.


Does anyone know how I can get this to render at 60 fps without the broken map movement?

Thanks
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,351
Reaction score
8,532
First Language
English
Primarily Uses
RMMV

I've moved this thread to Script Support. Please be sure to post your threads in the correct forum next time. Thank you.

 

Raizen

Veteran
Veteran
Joined
Oct 24, 2012
Messages
381
Reaction score
660
First Language
Portuguese
Primarily Uses
RMMV
Hey its me that created the script X)... I'll tell you the truth, the reason of the lag was because of bad BAD HORRIBLE coding haha... Sorry about that, it was when I was still learning to code. I am clearing and recreating the images which is why the issues are happening, about it working for bigger pictures, it shouldn't work betther haha, I think maybe it's some script together with this that is lagging.

Anyway I tried to make some adjustments, try this out if you can. You can try to replace Theo's fix, just to test it out. (Sorry Theo for my bad code :()
Ruby:
class Window_ShowMap < Window_Base
  #--------------------------------------------------------------------------
  # * Renovação
  #--------------------------------------------------------------------------
  def refresh(index)
    @x += 10 if @x <= $lune_map_info[index]['Position'][0] - window_width/2
    @x -= 10 if @x >= $lune_map_info[index]['Position'][0] - window_width/2
    @y += 10 if @y <= $lune_map_info[index]['Position'][1] - window_height/2
    @y -= 10 if @y >= $lune_map_info[index]['Position'][1] - window_height/2
    @cursor.x = @x + 126 + Cursor_X - @nx + window_width/2
    @cursor.y = @y + fitting_height(2) + 24 + Cursor_Y - @ny + window_height/2
    unless @index == index
      @index = index
      @icon.bitmap.dispose unless @icon.bitmap
      @icon.bitmap = Cache.world_map($lune_map_info[index]['Icon'])
    end
      @icon.x = $lune_map_info[index]['Position'][0] + 160 - @nx
      @icon.y = $lune_map_info[index]['Position'][1] + 80 - @ny
    if @x > @bitmap.width + 24 - window_width
      @nx = @bitmap.width + 24 - window_width
    elsif @x < 0
      @nx = 0
    else
      @nx = @x
    end
    if @y > @bitmap.height + 24 - window_height
      @ny = @bitmap.height + 24 - window_height
    elsif @y < 0
      @ny = 0
    else
      @ny = @y
    end
  end
end
 

AllyJamy

Veteran
Veteran
Joined
Sep 24, 2015
Messages
65
Reaction score
36
First Language
English
Primarily Uses
RMVXA
Hey its me that created the script X)... I'll tell you the truth, the reason of the lag was because of bad BAD HORRIBLE coding haha... Sorry about that, it was when I was still learning to code. I am clearing and recreating the images which is why the issues are happening, about it working for bigger pictures, it shouldn't work betther haha, I think maybe it's some script together with this that is lagging.

Anyway I tried to make some adjustments, try this out if you can. You can try to replace Theo's fix, just to test it out. (Sorry Theo for my bad code :()
Ruby:
class Window_ShowMap < Window_Base
  #--------------------------------------------------------------------------
  # * Renovação
  #--------------------------------------------------------------------------
  def refresh(index)
    @x += 10 if @x <= $lune_map_info[index]['Position'][0] - window_width/2
    @x -= 10 if @x >= $lune_map_info[index]['Position'][0] - window_width/2
    @y += 10 if @y <= $lune_map_info[index]['Position'][1] - window_height/2
    @y -= 10 if @y >= $lune_map_info[index]['Position'][1] - window_height/2
    @cursor.x = @x + 126 + Cursor_X - @nx + window_width/2
    @cursor.y = @y + fitting_height(2) + 24 + Cursor_Y - @ny + window_height/2
    unless @index == index
      @index = index
      @icon.bitmap.dispose unless @icon.bitmap
      @icon.bitmap = Cache.world_map($lune_map_info[index]['Icon'])
    end
      @icon.x = $lune_map_info[index]['Position'][0] + 160 - @nx
      @icon.y = $lune_map_info[index]['Position'][1] + 80 - @ny
    if @x > @bitmap.width + 24 - window_width
      @nx = @bitmap.width + 24 - window_width
    elsif @x < 0
      @nx = 0
    else
      @nx = @x
    end
    if @y > @bitmap.height + 24 - window_height
      @ny = @bitmap.height + 24 - window_height
    elsif @y < 0
      @ny = 0
    else
      @ny = @y
    end
  end
end

Hey Raizen. Thanks for replying! I tried this fix, at first I got this error message1586271350847.png

So I added a "def dispose" into the script. Which kinda works and lets you open the map once, once you go out of the map the cursor and icon stay off the map for a second and then disappear too.

1586271449730.png

Then when trying to go back into the map again after exiting once, I got the same error I had at first.

Hmmm
 

Raizen

Veteran
Veteran
Joined
Oct 24, 2012
Messages
381
Reaction score
660
First Language
Portuguese
Primarily Uses
RMMV
Oops sorry, I put it the opposite way. If it still doesn't work, later today I will be able to test it out and I'll help you, just let me know!

Ruby:
class Window_ShowMap < Window_Base
  #--------------------------------------------------------------------------
  # * Renovação
  #--------------------------------------------------------------------------
  def refresh(index)
    @x += 10 if @x <= $lune_map_info[index]['Position'][0] - window_width/2
    @x -= 10 if @x >= $lune_map_info[index]['Position'][0] - window_width/2
    @y += 10 if @y <= $lune_map_info[index]['Position'][1] - window_height/2
    @y -= 10 if @y >= $lune_map_info[index]['Position'][1] - window_height/2
    @cursor.x = @x + 126 + Cursor_X - @nx + window_width/2
    @cursor.y = @y + fitting_height(2) + 24 + Cursor_Y - @ny + window_height/2
    unless @index == index
      @index = index
      @icon.bitmap.dispose if @icon.bitmap
      @icon.bitmap = Cache.world_map($lune_map_info[index]['Icon'])
    end
      @icon.x = $lune_map_info[index]['Position'][0] + 160 - @nx
      @icon.y = $lune_map_info[index]['Position'][1] + 80 - @ny
    if @x > @bitmap.width + 24 - window_width
      @nx = @bitmap.width + 24 - window_width
    elsif @x < 0
      @nx = 0
    else
      @nx = @x
    end
    if @y > @bitmap.height + 24 - window_height
      @ny = @bitmap.height + 24 - window_height
    elsif @y < 0
      @ny = 0
    else
      @ny = @y
    end
  end
end
 

AllyJamy

Veteran
Veteran
Joined
Sep 24, 2015
Messages
65
Reaction score
36
First Language
English
Primarily Uses
RMVXA
Oops sorry, I put it the opposite way. If it still doesn't work, later today I will be able to test it out and I'll help you, just let me know!

Ruby:
class Window_ShowMap < Window_Base
  #--------------------------------------------------------------------------
  # * Renovação
  #--------------------------------------------------------------------------
  def refresh(index)
    @x += 10 if @x <= $lune_map_info[index]['Position'][0] - window_width/2
    @x -= 10 if @x >= $lune_map_info[index]['Position'][0] - window_width/2
    @y += 10 if @y <= $lune_map_info[index]['Position'][1] - window_height/2
    @y -= 10 if @y >= $lune_map_info[index]['Position'][1] - window_height/2
    @cursor.x = @x + 126 + Cursor_X - @nx + window_width/2
    @cursor.y = @y + fitting_height(2) + 24 + Cursor_Y - @ny + window_height/2
    unless @index == index
      @index = index
      @icon.bitmap.dispose if @icon.bitmap
      @icon.bitmap = Cache.world_map($lune_map_info[index]['Icon'])
    end
      @icon.x = $lune_map_info[index]['Position'][0] + 160 - @nx
      @icon.y = $lune_map_info[index]['Position'][1] + 80 - @ny
    if @x > @bitmap.width + 24 - window_width
      @nx = @bitmap.width + 24 - window_width
    elsif @x < 0
      @nx = 0
    else
      @nx = @x
    end
    if @y > @bitmap.height + 24 - window_height
      @ny = @bitmap.height + 24 - window_height
    elsif @y < 0
      @ny = 0
    else
      @ny = @y
    end
  end
end
I tried this code, and it does fix the issue of the icon and cursor appearing and the dispose crash. but the map doesn't render now, and it still lags without Theos fix, and Theos fix will bug out the cursor moving. :rswt

1586273322036.png
Alright, sounds good! If you have discord you can reach me at: AllyJamy#6268
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top