[XP] RMXPAce -- Using the VX Ace engine in your XP games

Started by KK20, February 17, 2013, 04:38:51 pm

Previous topic - Next topic

KK20

*looks around*

...are you talking to me? I didn't sign up for this! YOU CAN'T JUST MAKE ME DO THINGS I'M NOT OBLIGATED TO DO!

Sounds cool :U

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!

PhoenixFire

*points at shoutbox*


Quote from: KK20 in shoutbox
June 30, 2014, 08:50:45 PM KK20: *ragequits life* @Phoenix: Yeah sure, that'd be sweet :)


YOU AGREED SIR!!!!

Also, I know it will keep you occupied when you want to be, you're not actually obligated (none of us really are), and you will most certainly be given due credit (yanno, being damn close to co-owning the site and all). Anyways, site is started, but it's really hard to work on the site without the domain name being active yet. I have SMF installed so far with ezPortal. Nothing is configured yet though haha... Time for bed I think...
Quote from: Subsonic_Noise on July 01, 2011, 02:42:19 amNext off, how to create a first person shooter using microsoft excel.

Quote from: Zeriab on September 09, 2011, 02:58:58 pm<Remember when computers had turbo buttons?

KK20

Quote from: PhoenixFire in ShoutboxOh, and @KK20 to add to wjhat I said a little earlier, once you're done with your rewrite, I would like to use it as the 'official' rewrite for XPAce, assuming it's okay with you.

Don't take my post out of context >:U

Coolio. I'll be sure to do my best rediscovering all the fixes I've done before :P

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!

PhoenixFire

Quote from: KK20 on June 30, 2014, 11:37:54 pm
Don't take my post out of context >:U


You stand corrected :V: I had asked you to help with the site after that.. You didn't specify what you were answering =p (also, not being serious.. you totally do not have to help if you don't want to.. You're under literally zero obligation)


Quote from: PhoenixFire in shoutbox
June 30, 2014, 07:12:10 PM PhoenixFire: Anyways, what I was trying to send before to Zexion and KK20 was about the site Terv had up. I sent a message and got no response, but I'm going to most likely host a support forum/site for XPAce, and if you two could/would be willing to help, it could turn out great.


muahahhahaaa!!!!! I win!
Quote from: Subsonic_Noise on July 01, 2011, 02:42:19 amNext off, how to create a first person shooter using microsoft excel.

Quote from: Zeriab on September 09, 2011, 02:58:58 pm<Remember when computers had turbo buttons?

Zexion


PhoenixFire

Quote from: Zexion on June 30, 2014, 11:51:29 pm
Either way im in xD


yay!

Oh. Did you mention at one point that you got this working with a bunch of custom scripts you had? If so, you should totally post up the scripts that were working, and we can have a small list of "good and bad" scripts to have a start on? I just skimmed through the past 2 pages of replies and can't find a single mention, so I guess it's possible I dreamed it... Though that would be weird that I'm dreaming about the forums here O.o
Quote from: Subsonic_Noise on July 01, 2011, 02:42:19 amNext off, how to create a first person shooter using microsoft excel.

Quote from: Zeriab on September 09, 2011, 02:58:58 pm<Remember when computers had turbo buttons?

G_G

Sounds like a great idea. Just don't let it turn into another laptopsandtea.

Spaceman McConaughey

Quote from: gameus on July 01, 2014, 06:44:44 am
Sounds like a great idea. Just don't let it turn into another laptopsandtea.


Yeah, seriously.

PhoenixFire

Yeah, I thought of that issue happening. I really do hope that doesn't happen. I think if enough interest is generated, and not just by a group of 4 people, on a free server, that this could be decent. Next comes the painstaking task of finding everywhere Terv posted about this (or someone else for that matter), and informing the inhabitants of that board that there's a new site for it =p Looks like it's time to re-read the whole topic to see how many references to other sites I can find  hahaha


EDIT: The site is live. Nothing interesting or noteworthy set up yet or anything, but it's open for registration and whatnot.
Quote from: Subsonic_Noise on July 01, 2011, 02:42:19 amNext off, how to create a first person shooter using microsoft excel.

Quote from: Zeriab on September 09, 2011, 02:58:58 pm<Remember when computers had turbo buttons?

ArcaneAlchemy

Well, since Phoenix is still setting up the site, I figure that I'll pose my idea here for now. So, from what I'm sure everyone has noticed, RMXPACE is much smoother due to the higher frame rate. The downside is also this: Since RMXP uses the framerate as its "clock", most things inside the game move faster relative to the higher framerate.

So, I look at it like this:
Let's say that at about 40fps(normal rmxp rate) the character sprite moves at about walking pace(roughly about 4 tiles or so per second or "4 TPS"). If you hike up the fps to the max(120) then the character sprite, among other things, moves at about triple that(12 TPS). Even though the FPS is drawing more times per second, the speed of the sprites and everything else is exactly relative to the FPS therefore defeating the purpose of the extra times the graphics are drawn to the screen.

From what I'm assuming(and I haven't investigated this yet), the speed of the sprite movements, map scrolling, and such are based on a division of the FPS. So if we can slow down the movement, but set the FPS to be at its highest, then you will get the most smoothness without the crazy speed increase.

So instead of 4TPS/40FPS you get 4TPS/120FPS or in other words instead of 1TPS:4FPS you get 1TPS:30FPS.

Does this make sense, or am I rambling?
"Wait? Do I look like a waiter?" -Kefka

PhoenixFire

That actually makes alot of sense, yes. Well, the concept at least. I haven't delved far enough enough into the code to know if that's a feasible idea or not, but I do like the thought behind it.
Quote from: Subsonic_Noise on July 01, 2011, 02:42:19 amNext off, how to create a first person shooter using microsoft excel.

Quote from: Zeriab on September 09, 2011, 02:58:58 pm<Remember when computers had turbo buttons?

ArcaneAlchemy

Yeah, I don't know why this wasn't addressed at the very beginning. I am already tinkering with the update_move method of the Game_Character class. (in Game_Character2 section). This seems to be effective for the movement. As far as the animation frequency, I'm looking into that now and I will either rotate the animation sequences less often, or require multiplying them. If option 1 works and looks right, this is obviously optimal.

Unfortunately, the battle processing speed is also effected by the fps rate. I'm sure that the animations are as well. I looked for some kind of global setting, but seeing as there are deviations I've come across so far(fog speed different from flash speed, ect), the frame to speed ratios are independent and all have to be modified.

The end result is absolutely worth the means. Otherwise, there is literally no improvement in the quality by applying this patch in terms of visual smoothness whatsoever.

UPDATE: Check this Phoenix, make an event to set your FPS to 120:
Graphics.frame_rate = 120

Make a map that has like a width of 40 or so. Put some trees down to watch the scrolling.

First, try walking and see how insanely fast you are and also watch the scrolling.

Next, put in this script just above main and now watch the magic.  :D
Spoiler: ShowHide
WALK_SPEED = 6
WALK_FREQUENCY = 0.5

class Game_Character

 def update_move
   # Convert map coordinates from map move speed into move distance
   #distance = 2 ** @move_speed
   distance = WALK_SPEED
   # If logical coordinates are further down than real coordinates
   if @y * 128 > @real_y
     # Move down
     @real_y = [@real_y + distance, @y * 128].min
   end
   # If logical coordinates are more to the left than real coordinates
   if @x * 128 < @real_x
     # Move left
     @real_x = [@real_x - distance, @x * 128].max
   end
   # If logical coordinates are more to the right than real coordinates
   if @x * 128 > @real_x
     # Move right
     @real_x = [@real_x + distance, @x * 128].min
   end
   # If logical coordinates are further up than real coordinates
   if @y * 128 < @real_y
     # Move up
     @real_y = [@real_y - distance, @y * 128].max
   end
   # If move animation is ON
   if @walk_anime
     # Increase animation count by 1.5
     #@anime_count += 1.5
     @anime_count += WALK_FREQUENCY
   # If move animation is OFF, and stop animation is ON
   elsif @step_anime
     # Increase animation count by 1
     #@anime_count += 1
     @anime_count += WALK_FREQUENCY
   end
 end
end#end Game_Character class

P.S.
I couldn't alias this method successfully for some reason  :???: I had to just rewrite it for this example.
"Wait? Do I look like a waiter?" -Kefka

Zexion

I tried the above and it actually looked less smooth than I already had it xD
Using my custom animations script + pixel movement + F0/KK20 custom resolution 0.96

ArcaneAlchemy

Well jeez, I wish I knew about that script already!

Is KK20 letting people use this? If so, do you have a link?

But either way, it's an improvement and a closer step to a better ratio. I'll continue looking at it and see if I can't make an "out of the box" improvement anyway.

Oh, and also Zexion.. What method of solution did you come up with for this custom script of yours? Are you using more animation tiles, or are you modifying the time:fps, or what? That is, if you don't mind sharing.
"Wait? Do I look like a waiter?" -Kefka

Zexion

Turns out I'm actually using 0.97e which is by littledrago + f0 + kk20
Scripts:
Custom Resolution v0.97E
Animation & Movement
Don't have a link to pixel movement but it was some random thing from google.

The resolution script lags at high screen sizes, but not at normal or slightly bigger ones. It also recommends not to make huge maps bigger than 20x15, but I have a 60x40 and no lag. I guess it depends on events and stuff. I think this one includes anti-event lag though!

Edit: For my method I didn't modify anything other than the speed of the character graphics. For my game, the faster movement speed is actually a + and at 60fps it is hardly a bother! In fact, moving back to 40fps feels sluggish and ugly. I'm not sure what all is affected in the game other than graphics update methods because the time display seems to be fine, and I personally like the speed because it gives more room to work with in script

Animation Script: ShowHide
My animation script doesn't require any graphics, contrary to popular belief. Just pop it in and you can mess with the default animation speed. It does make this default speed regardless of movement speed though, so changing movement speed won't change animation speed anymore. It's messy because it was like my 3rd script release haha. I'm going to clean it up soon. For default rmxp experience with my script I set this up:
module ANIM_DATA
                 SPEED = 8                # Default animation speed
                 EIGHT_DIR = false        # Does not require certain number
                 
                 
                 ISO_TAG = "iso"           # Tag for 8 pose charset.
                                           # of frames, or custom charset.
                 STND_TAG = "stn"          # This uses the first pose as
                                           # a standing pose. Useful for
                                           # larger animation sheets.
end

#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#
# This section by:
# Dirtie & Zexion
# 16th December 2006
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#
class Game_Actor < Game_Battler
 #--------------------------------------------------------------------------
 # * Get Number of Frames for Character Graphic
 #--------------------------------------------------------------------------
 def character_frames
   @character_name.gsub(/cs\_(\d+)/) do
     if $1 != @character_name
       return $1.to_i
     end
   end
   return 4
 end
 #--------------------------------------------------------------------------
 # * Get Number of Rows for Character Graphic (allows for 1 row charsets.
 #--------------------------------------------------------------------------
 def character_rows
   @character_name.gsub(/vs\_(\d+)/) do
     if $1 != @character_name
       return $1.to_i
     end
   end
   return 4
 end
 #--------------------------------------------------------------------------
 # * Control the speed of an animation (is no longer affected by move_speed
 #--------------------------------------------------------------------------
 def animation_speed
   @character_name.gsub(/a\_(\d+)/) do
     if $1 != @character_name
       return $1.to_i
     end
   end
   return ANIM_DATA::SPEED
 end
end
class Sprite_Character < RPG::Sprite
 #--------------------------------------------------------------------------
 # * Get Number of Frames for Character Graphic
 #--------------------------------------------------------------------------
 def character_frames
   @character_name.gsub(/cs\_(\d+)/) do
     if $1 != @character_name
       return $1.to_i
     end
   end
   return 4
 end
 #--------------------------------------------------------------------------
 # * Get Number of Rows for Character Graphic (allows for 1 row charsets.
 #--------------------------------------------------------------------------
 def character_rows
   @character_name.gsub(/vs\_(\d+)/) do
     if $1 != @character_name
       return $1.to_i
     end
   end
   return 4
 end
 #--------------------------------------------------------------------------
 # * Control the speed of an animation (is no longer affected by move_speed
 #--------------------------------------------------------------------------
 def animation_speed
   @character_name.gsub(/a\_(\d+)/) do
     if $1 != @character_name
       return $1.to_i
     end
   end
   return ANIM_DATA::SPEED
 end
end
class Game_Character
 #--------------------------------------------------------------------------
 # * Get Number of Frames for Character Graphic
 #--------------------------------------------------------------------------
 def character_frames
   @character_name.gsub(/cs\_(\d+)/) do
     if $1 != @character_name
       return $1.to_i
     end
   end
   return 4
 end
 #--------------------------------------------------------------------------
 # * Get Number of Rows for Character Graphic (allows for 1 row charsets.
 #--------------------------------------------------------------------------
 def character_rows
   @character_name.gsub(/vs\_(\d+)/) do
     if $1 != @character_name
       return $1.to_i
     end
   end
   return 4
 end
 #--------------------------------------------------------------------------
 # * Control the speed of an animation (is no longer affected by move_speed
 #--------------------------------------------------------------------------
 def animation_speed
   @character_name.gsub(/a\_(\d+)/) do
     if $1 != @character_name
       return $1.to_i
     end
   end
   return ANIM_DATA::SPEED
 end
 #--------------------------------------------------------------------------
 # * Get Vertical Adjustment for Character Graphic
 #--------------------------------------------------------------------------
 def character_adjust_y
   @character_name.gsub(/v\_(\d+)/) do
     if $1 != @character_name
       return $1.to_i
     end
   end
   return 0
 end
 #--------------------------------------------------------------------------
 # * Get Horizontal Adjustment for Character Graphic
 #--------------------------------------------------------------------------
 def character_adjust_x
   @character_name.gsub(/h\_(\d+)/) do
     if $1 != @character_name
       return $1.to_i
     end
   end
   return 0
 end
end

class Window_Base < Window
 #--------------------------------------------------------------------------
 # * Get Vertical Adjustment for Character Graphic
 #--------------------------------------------------------------------------
 def character_adjust_y(actor)
   actor.character_name.gsub(/v\_(\d+)/) do
     if $1 != @character_name
       return $1.to_i
     end
   end
   return 0
 end
 #--------------------------------------------------------------------------
 # * Get Horizontal Adjustment for Character Graphic
 #--------------------------------------------------------------------------
 def character_adjust_x(actor)
   actor.character_name.gsub(/h\_(\d+)/) do
     if $1 != @character_name
       return $1.to_i
     end
   end
   return 0
 end
 #--------------------------------------------------------------------------
 # * Draw Graphic
 #     actor : actor
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate
 #--------------------------------------------------------------------------
 def draw_actor_graphic(actor, x, y)
   yalign = character_adjust_y(actor)
   xalign = character_adjust_x(actor)
   bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
   cw = bitmap.width / actor.character_frames
   if actor.character_name.include?(ANIM_DATA::ISO_TAG)
     ch = bitmap.height / 8
   else
     ch = bitmap.height / 4
   end
   src_rect = Rect.new(0, ch * 2, cw, ch)
   self.contents.blt(x - cw / 2 + xalign, y - ch + yalign, bitmap, src_rect)
 end
end
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#
# End of section by: Dirtie & Zexion
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#

#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#
# This section by:
# DerVVulfman
# Zexion
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#
class Game_Character  
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader   :step_anime               # Holds a sprite's step flag
 attr_reader   :walk_anime               # Holds an event's movement flag
 attr_reader   :stop_count               # The number of steps left to count
 attr_reader   :jump_count               # The number of steps in a jump
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # Branch with jumping, moving, and stopping
   if jumping?
     update_jump
   elsif moving?
     update_move
   else
     update_stop
   end
   if @anime_count > 18 - (self.animation_speed)
     # If stop animation is OFF when stopping
     if not @step_anime and @stop_count > 0
       # Return to original pattern
       @pattern = @original_pattern
     # If stop animation is ON when moving
     else
       # Update pattern
       @pattern = (@pattern + 1) % self.character_frames
     end
     # Clear animation count
     @anime_count = 0
   end
   # If waiting
   if @wait_count > 0
     # Reduce wait count
     @wait_count -= 1
     return
   end
   # If move route is forced
   if @move_route_forcing
     # Custom move
     move_type_custom
     return
   end
   # When waiting for event execution or locked
   if @starting or lock?
     # Not moving by self
     return
   end
   # If stop count exceeds a certain value (computed from move frequency)
   if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
     # Branch by move type
     case @move_type
     when 1  # Random
       move_type_random
     when 2  # Approach
       move_type_toward_player
     when 3  # Custom
       move_type_custom
     end
   end
 end
 
 #--------------------------------------------------------------------------
 # * Move Lower Left
 #--------------------------------------------------------------------------
 def move_lower_left
   # If no direction fix
   unless @direction_fix
     turn_down_left
   end
   # When a down to left or a left to down course is passable
   if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
      (passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
     # Update coordinates
     @x -= 1
     @y += 1
     # Increase steps
     increase_steps
   end
 end
 #--------------------------------------------------------------------------
 # * Move Lower Right
 #--------------------------------------------------------------------------
 def move_lower_right
   # If no direction fix
   unless @direction_fix
     turn_down_right
   end
   # When a down to right or a right to down course is passable
   if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
      (passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
     # Update coordinates
     @x += 1
     @y += 1
     # Increase steps
     increase_steps
   end
 end
 #--------------------------------------------------------------------------
 # * Move Upper Left
 #--------------------------------------------------------------------------
 def move_upper_left
   # If no direction fix
   unless @direction_fix
     turn_up_left
   end
   # When an up to left or a left to up course is passable
   if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
      (passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
     # Update coordinates
     @x -= 1
     @y -= 1
     # Increase steps
     increase_steps
   end
 end
 #--------------------------------------------------------------------------
 # * Move Upper Right
 #--------------------------------------------------------------------------
 def move_upper_right
   # If no direction fix
   unless @direction_fix
     turn_up_right
   end
   # When an up to right or a right to up course is passable
   if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
      (passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
     # Update coordinates
     @x += 1
     @y -= 1
     # Increase steps
     increase_steps
   end
 end
 #--------------------------------------------------------------------------
 # * Turn Up Left (Added for diagonal animation)
 #--------------------------------------------------------------------------  
 def turn_up_left
   unless @direction_fix
     if @character_name.include?(ANIM_DATA::ISO_TAG)
       @direction = 7
     else
       # Face left if facing right, and face up if facing down
     @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
     end      
   end
 end
 #--------------------------------------------------------------------------
 # * Turn Up Right (Added for diagonal animation)
 #--------------------------------------------------------------------------  
 def turn_up_right
   unless @direction_fix
     if @character_name.include?(ANIM_DATA::ISO_TAG)
       @direction = 9
     else
       # Face right if facing left, and face up if facing down
     @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Turn Down Left (Added for diagonal animation)
 #--------------------------------------------------------------------------  
 def turn_down_left
   unless @direction_fix
     if @character_name.include?(ANIM_DATA::ISO_TAG)
       # Face down-left
       @direction = 1
     else
       # Face down is facing right or up
     @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)      
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Turn Down Right (Added for diagonal animation)
 #--------------------------------------------------------------------------  
 def turn_down_right
   unless @direction_fix
     if @character_name.include?(ANIM_DATA::ISO_TAG)
       @direction = 3
     else
       # Face right if facing left, and face down if facing up
     @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
     end
   end
 end

 #------------------------------------------------------------------------
# * Move Random
#------------------------------------------------------------------------
 def move_random
   case rand(8)
     when 0 ; move_down(false)
     when 1 ; move_left(false)
     when 2 ; move_right(false)
     when 3 ; move_up(false)
     when 4 ; move_lower_left
     when 5 ; move_lower_right
     when 6 ; move_upper_left
     when 7 ; move_upper_right  
   end
 end
#------------------------------------------------------------------------
# * Move Toward Player
#------------------------------------------------------------------------
 def move_toward_player
   sx = @x - $game_player.x
   sy = @y - $game_player.y
   return if sx == 0 and sy == 0
   abs_sx = sx.abs
   abs_sy = sy.abs
   if abs_sx == abs_sy
     rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
   end
   if abs_sx
     move_upper_right  if sx < 0 and sy > 0
     move_upper_left   if sx > 0 and sy > 0
     move_lower_left   if sx > 0 and sy < 0
     move_lower_right  if sx < 0 and sy < 0
     move_right        if sx < 0
     move_left         if sx > 0
     move_up           if sy > 0
     move_down         if sy < 0
   end
 end
 
 #------------------------------------------------------------------------
# * Move Away from Player
#------------------------------------------------------------------------
 def move_away_from_player
   sx = @x - $game_player.x
   sy = @y - $game_player.y
   return if sx == 0 and sy == 0
   abs_sx = sx.abs
   abs_sy = sy.abs
   if abs_sx == abs_sy
     rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
   end
   if abs_sx
     move_lower_left   if sx < 0 and sy > 0
     move_lower_right  if sx > 0 and sy > 0
     move_upper_right  if sx > 0 and sy < 0
     move_upper_left   if sx < 0 and sy < 0
     move_left         if sx < 0
     move_right        if sx > 0
     move_down         if sy > 0    
     move_up           if sy < 0
   end
 end
 
 #--------------------------------------------------------------------------
 # * Set Custom Animation
 #--------------------------------------------------------------------------
 def set_custom_anim
   return if @animating
   @frame_count    = self.character_frames
   @animating      = true
   @anim_wait      = 40
   @pattern        = 0
   @direction_fix  = true
 end  
end

#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display the character.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Character < RPG::Sprite
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :character                # character
 attr_accessor :pattern
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     viewport  : viewport
 #     character : character (Game_Character)
 #--------------------------------------------------------------------------
 def initialize(viewport, character = nil)
   super(viewport)
   @character = character
   update
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   super
   # If tile ID, file name, or hue are different from current ones
   if @tile_id != @character.tile_id or
      @character_name != @character.character_name or
      @character_hue != @character.character_hue
     # Remember tile ID, file name, and hue
     @tile_id = @character.tile_id
     @character_name = @character.character_name
     @character_hue = @character.character_hue
     # If tile ID value is valid
     if @tile_id >= 384
       self.bitmap = RPG::Cache.tile($game_map.tileset_name,
         @tile_id, @character.character_hue)
       self.src_rect.set(0, 0, 32, 32)
       self.ox = 16
       self.oy = 32
     # If tile ID value is invalid
     else
       self.bitmap = RPG::Cache.character(@character.character_name,
         @character.character_hue)
       if @character.character_name.include?(ANIM_DATA::STND_TAG)
           @cw = bitmap.width / (self.character_frames + 1)
       else
           @cw = bitmap.width / self.character_frames
       end
       if @character.character_name.include?(ANIM_DATA::ISO_TAG)
         @ch = bitmap.height / 8
       else
         @ch = bitmap.height / self.character_rows
       end
       if @character.character_adjust_x != nil
         self.ox = (@cw - @character.character_adjust_x) / 2
       else
         self.ox = @cw / 2
       end
       if @character.character_adjust_y != nil
         self.oy = @ch - @character.character_adjust_y
       else
         self.oy = @ch
       end
     end
   end
   # Set visible situation
   self.visible = (not @character.transparent)
   # If graphic is character
   if @tile_id == 0
       if not @character.step_anime and @character.stop_count > 0
         sx = (@character.pattern) * @cw
       else      
         # If event's Movement flag is checked (or player sprite)
         if @character.walk_anime                  
           # Set rectangular transfer
           if @character.character_name.include?(ANIM_DATA::STND_TAG)
               sx = (@character.pattern + 1) * @cw
           else
             sx = @character.pattern * @cw
           end
         else
           sx = @character.pattern * @cw
         end
       end
   # Basic direction value
     dir = @character.direction
     # If a custom character in use
     if @character.character_name.include?(ANIM_DATA::ISO_TAG)
         dec = (dir == 7 or dir== 9) ? 3 : 1   # directional movement.
         sy = (dir - dec) * @ch    
       else
         sy = (dir - 2) / 2 * @ch        
     end
     # Typical block transfer
     self.src_rect.set(sx, sy, @cw, @ch)
   end
   # Set sprite coordinates
   self.x = @character.screen_x
   self.y = @character.screen_y
   self.z = @character.screen_z(@ch)
   # Set opacity level, blend method, and bush depth
   self.opacity = @character.opacity
   self.blend_type = @character.blend_type
   self.bush_depth = @character.bush_depth
   # Animation
   if @character.animation_id != 0
     animation = $data_animations[@character.animation_id]
     animation(animation, true)
     @character.animation_id = 0
   end
 end
end

#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  This class handles the player. Its functions include event starting
#  determinants and map scrolling. Refer to "$game_player" for the one
#  instance of this class.
#==============================================================================

class Game_Player < Game_Character
@@poin1 = 0    
 @@poin2 = 0
 @@wait_time = 0
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :waiting
 attr_accessor :wait_time
#------------------------------------------------------------------------
# * Update Character Movement
#------------------------------------------------------------------------
def update
last_moving = moving?
   #----------------------------------------------------------------------
   #  * Movement Handling
   #----------------------------------------------------------------------
     unless moving? or $game_system.map_interpreter.running? or
     @move_route_forcing or $game_temp.message_window_showing  
       if ANIM_DATA::EIGHT_DIR == true
           case Input.dir8
             when 1 ; move_lower_left
             when 3 ; move_lower_right
             when 7 ; move_upper_left
             when 9 ; move_upper_right
             when 2 ; move_down
             when 4 ; move_left
             when 6 ; move_right
             when 8 ; move_up
           end
       else      
         case Input.dir4
           when 2 ; move_down
           when 4 ; move_left
           when 6 ; move_right
           when 8 ; move_up
         end
       end
     end
   #----------------------------------------------------------------------
   #  * Screen Positioning
   #----------------------------------------------------------------------
   last_real_x = @real_x
   last_real_y = @real_y
   super
   if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
     $game_map.scroll_down(@real_y - last_real_y)
   end
   if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
     $game_map.scroll_left(last_real_x - @real_x)
   end
   if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
     $game_map.scroll_right(@real_x - last_real_x)
   end
   if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
     $game_map.scroll_up(last_real_y - @real_y)
   end
   #----------------------------------------------------------------------
   #  * Encounter and Event Processing
   #----------------------------------------------------------------------
   unless moving?
     if last_moving
       result = check_event_trigger_here([1,2])
       if result == false
         unless $DEBUG and Input.press?(Input::CTRL)
           @encounter_count -= 1 if @encounter_count > 0
         end
       end
     end
     if Input.trigger?(Input::C)
       check_event_trigger_here([0])
       check_event_trigger_there([0,1,2])
     end
   end
end
 #------------------------------------------------------------------------
 #  * Encounter and Event Processing
 #------------------------------------------------------------------------  
 def idle_wait(duration, value)
   for i in 0...duration
     @@wait_time += 1 if value == false
     break if i >= duration / 2
   end
 end
end

ArcaneAlchemy

Awesome man, thanks!

Oh, real quick, is this code an updated version of the Movement & Animation Script in the link above, or something else?
"Wait? Do I look like a waiter?" -Kefka

Zexion

It should be the same but just configured for default rmxp play.
I'm not sure though. It might have extra stuff because I took it from my project and not the topic.

ArcaneAlchemy

"Wait? Do I look like a waiter?" -Kefka

KK20

Copied from: http://rmxpace.com/index.php?topic=7.0

As stated in the project package, I am attempting to write a Tilemap rewrite for XPA. The goal is to replace ForeverZer0's Custom Resolution by using a DLL, which would help address memory, graphics, and frame rate problems that are inevitable with Ruby. Custom Resolution was originally designed for XP and I intend to write it for such; the fact that it works with XPA as well is a great coincidence.

The most notable alternate Tilemap rewrites are listed below:

  • poccil: Works amazingly in XP and to an extent in XPA, where larger maps tend to suffer from stuttering. I'm not 100% sure how this tilemap rewrite works, but I believe it had something to do with drawing and disposing multiple sprites. It didn't support map data table changes on the fly though.

  • me(tm): Performance is good at any size in XP. I noticed graphical displays with it in XPA though, particularly with autotiles--some tiles were not animating and others were not on the correct frame as their neighbors.

  • ForeverZer0 v.93 & 94: At high resolutions, XPA does not suffer from any major FPS drop. This is probably due to the script's nature to not redraw the tilemap as often. Of course, lots of autotiles will cripple this script as well as your memory (200x200 map takes a GB from me). It also has graphical display bugs that really can't be addressed without changing the way how tiles are drawn...which brings me to

  • Custom Resolution v.96+: I (and LiTTleDRAgo later on) completely gutted the way the tilemap was drawn by using hundreds of 32x32 pixel sprites to represent each tile on each layer. The script runs very good in XP and addresses most, if not all, the graphical issues. I came to realize, however, that many sprites drop the frame rate. Large resolutions could have over a thousand sprites. XP and XPA suffered from a massive drop in FPS, so the idea had to be scrapped.

  • The King: This tilemap rewrite was intended for VXA. It draws bitmaps that are as wide as the map (a 200 width map means a 200x32 width bitmap) and 32 pixels high. The script draws all of these bitmaps before putting the player on the map, meaning large maps could take tens of seconds to load. It also meant a ton of memory consumption, so large maps were impossible without a ton of RAM. It maintained very smooth FPS because drawing tiles during runtime was not necessary. I do not tread the VXA community, but it seems like he has not been active nor is he working on this anymore.

  • WhiteFlute: If you're looking for a rewrite that will just get your game working without all the extra bells and whistles, this is your best choice. Intended for VXA, it uses a DLL as well to draw the tilemap. It turned VXA games into XP games, so your window was restricted to 640x480, no exceptions. It's extremely fast and performs all the required aspects of RMXP's tilemap...except for one little thing. When the screen is scrolling up/down, z-layers are completely wrong. This could probably be fixed by modifying the characters' z-values (like how ForeverZer0's does). Also, because it's a DLL, we don't have access to the code itself, meaning you "take it or leave it."




Disclaimer:
I would also like to add that VXA limits the user from making a resolution higher than 640x480. Any higher requires hacking the RGSS, which goes against the EULA. The current XPA package contains this hacked DLL. I'm not sure if XPA also abides the EULA, but I can guess that it does since we are not using the programs as intended.


Anyways, I am stuck deciding which route I want to take in making this script. I've narrowed down to these two options:

  • Custom Resolution way: Uses 6 bitmaps and sprites, all of which are as big as the screen itself. This will keep sprite count to a bare minimum and all work is done in the DLL. This will not follow RMXP's z-value standards though and will require an edit to the Game_Character#z= method. As such, it might cause compatibility errors with some scripts drawing graphics to the screen.

  • WhiteFlute + King hybrid: Creates (screen_height / 32) + 5 bitmaps and sprites that are of size screen_width x 160 pixels. This will overcome the z-value issue in the above method. It uses slightly more sprites, memory, and time to draw.


Current optimization includes using a series of memcpys to shift tiles (anything faster?) and drawing only when something updates--data table modification, new bitmap graphics, autotile, scrolling. The DLL code will be open-source for anyone to edit. I'll also create a tutorial as to what I specifically use to generate this DLL (I'm still fairly new at this xD).

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!

bigace

Quote from: bigace on June 22, 2014, 03:49:07 pm
Quote from: bigace on June 01, 2014, 01:58:58 am
I'm having trouble getting this to go straight to the Internet with this code:
Lambda {Thread.new {system ("start #{http://www.chaos-project.com}")}}

Instead of going to the address I put in there it just restarts the game as if I pressed F12. This code works in rmvxace fine and if you take away the Lambda {} in rmxp the code works fine as well.

But in RMXPACE if:

  • you remove the Lambda { } you get a error and;

  • adding it restarts the game as if you pressed F12



Quote from: bigace on June 01, 2014, 07:46:26 pm
Ya I already stated that it works fine in xp and vxace, if what I said was confusing to read I apologize, I was using phone to type. It just doesn't work in XPACE. I also try what you said and I get an error.


I guess no one has the fix to this? :(

So... I guess bump once again? :???:


Use Dropbox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account.