The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Pokémon Essentials
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.


Reply
Click here to go to the first staff post in this thread.  
Thread Tools
  #201    
Old 3 Weeks Ago, 04:02 AM
FL's Avatar
FL
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
1. Remove the 'if $INTERNAL' for the line 'pbPrintException($!)'. This may helps developers while testing new effects since there is no reason for won't letting the error message pops and several times some error occurs when the dev forget/won't expect this bug. So, the dev must waste time reproducing this error when the flag is off. Sometimes the players may find an error, but can't inform the error message because there is no error message, only the battle with the "buggy screen".

2. The official games now are faster when changing the box at pokémon storage, so let's double it in Essentials. At 'pbSwitchBoxToRight' and 'pbSwitchBoxToLeft' change the 16 to 32. Maybe you need to reflect this at the others numbers at these defs, since the sum must be divisible by 32.

3.
Code:
def pbCheckPokemonIconFiles(params,egg=false)
  species=params[0]
  if egg
    bitmapFileName=sprintf("Graphics/Icons/icon%segg",getConstantName(PBSpecies,species)) rescue nil
    bitmapFileName=sprintf("Graphics/Icons/icon%03degg",species) if !pbResolveBitmap(bitmapFileName)
    bitmapFileName=sprintf("Graphics/Icons/iconEgg") if !pbResolveBitmap(bitmapFileName)
    return pbResolveBitmap(bitmapFileName)
  else
    for i in 0...2**(params.length-1)
      tgender=(i%2==0) ? params[1] : false
      tshiny=((i/2)%2==0) ? params[2] : false
      tform=((i/4)%2==0) ? params[3].to_s : ""
      tshadow=((i/8)%2==0) ? params[4] : false
      bitmapFileName=sprintf("Graphics/Icons/icon%s%s%s%s%s",
         getConstantName(PBSpecies,species),
         tgender ? "f" : "",
         tshiny ? "s" : "",
         (tform!="" ? "_"+tform : ""),
         tshadow ? "_shadow" : "") rescue nil
      bitmapFileName=sprintf("Graphics/Icons/icon%03d%s%s%s%s",
         species,
         tgender ? "f" : "",
         tshiny ? "s" : "",
         (tform!="" ? "_"+tform : ""),
         tshadow ? "_shadow" : "") if !pbResolveBitmap(bitmapFileName)
      return pbResolveBitmap(bitmapFileName) if pbResolveBitmap(bitmapFileName)
    end
  end
  return nil
end
This method has a very, very bad performance. If you tried to load a box full of Shadow Pokémon without shadow sprites, the game tries to load each sprite (at pbResolveBitmap call) around 24 times. 30*24 = 720. Loading sprite consumes a good time, so in this case (and even with fewer calls) generally consumes too much time that trigger the message "The script is taking too long. The game will restart.".

For the developers, I suggest to comment one of the two "sprintf" fields for making this twice as faster.

For base essentials, I suggest to change this def to:

Code:
def pbCheckPokemonIconFiles(params,egg=false)
  species=params[0]
  if egg
    bitmapFileName=sprintf("Graphics/Icons/icon%segg",getConstantName(PBSpecies,species)) rescue nil
    bitmapFileName=sprintf("Graphics/Icons/icon%03degg",species) if !pbResolveBitmap(bitmapFileName)
    bitmapFileName=sprintf("Graphics/Icons/iconEgg") if !pbResolveBitmap(bitmapFileName)
    return pbResolveBitmap(bitmapFileName)
  else
    loadedSpritesNames=[]
    for i in 0...2**(params.length-1)
      tgender=(i%2==0) ? params[1] : false
      tshiny=((i/2)%2==0) ? params[2] : false
      tform=((i/4)%2==0) ? params[3].to_s : ""
      tshadow=((i/8)%2==0) ? params[4] : false
      bitmapFileName=sprintf("Graphics/Icons/icon%s%s%s%s%s",
         getConstantName(PBSpecies,species),
         tgender ? "f" : "",
         tshiny ? "s" : "",
         (tform!="" ? "_"+tform : ""),
         tshadow ? "_shadow" : "") rescue nil
      next if !bitmapFileName || loadedSpritesNames.include?(bitmapFileName)
      loadedSpritesNames.push(bitmapFileName)
      bitmap=pbResolveBitmap(bitmapFileName)
      if !bitmap	
        bitmapFileName=sprintf("Graphics/Icons/icon%03d%s%s%s%s",
            species,
            tgender ? "f" : "",
            tshiny ? "s" : "",
            (tform!="" ? "_"+tform : ""),
            tshadow ? "_shadow" : "") if !bitmap
          bitmap=pbResolveBitmap(bitmapFileName)
      end
      return bitmap if bitmap
    end
  end
  return nil
end
The line "next if !bitmapFileName || loadedSpritesNames.include?(bitmapFileName)" save some calls. For example: When the pokémon is shadow and isn't shiny, the expression 'tshiny=((i/2)%2==0) ? params[2] : false' params[2] is false, so the same string combination is called twice in the old way.

The same thing need to be done at pbCheckPokemonBitmapFiles.
__________________
Reply With Quote
  #202    
Old 2 Weeks Ago, 04:47 PM
mej71
 
Join Date: Mar 2014
Gender: Male
Here's a replacement as per your suggestion FL
Code:
def pbCheckPokemonBitmapFiles(params)
  species=params[0]
  back=params[1]
  loadedSpriteNames=[]
  for i in 0...2**(params.length-2)
    tgender=(i%2==0) ? params[2] : false
    tshiny=((i/2)%2==0) ? params[3] : false
    tform=((i/4)%2==0) ? params[4].to_s : ""
    tshadow=((i/8)%2==0) ? params[5] : false
    bitmapFileName=sprintf("Graphics/Battlers/%s%s%s%s%s%s",
       getConstantName(PBSpecies,species),
       tgender ? "f" : "",
       tshiny ? "s" : "",
       back ? "b" : "",
       (tform!="" ? "_"+tform : ""),
       tshadow ? "_shadow" : "") rescue nil
    next if !bitmapFileName || loadedSpriteNames.include?(bitmapFileName)
    loadedSpriteNames.push(bitmapFileName)
    bitmap=pbResolveBitmap(bitmapFileName)
    if !bitmap
      bitmapFileName=sprintf("Graphics/Battlers/%03d%s%s%s%s%s",
       species,
       tgender ? "f" : "",
       tshiny ? "s" : "",
       back ? "b" : "",
       (tform!="" ? "_"+tform : ""),
       tshadow ? "_shadow" : "") if !bitmap
    bitmap=pbResolveBitmap(bitmapFileName)
    end
  return bitmap if bitmap
  end
 return nil
end
Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 05:10 AM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.