Autotiles are way too slow

● ARCHIVED · READ-ONLY
Started by Mister-ABC 9 posts View original ↗
  1. The waterfall tiles moves more slow than my dead grandma and with 48x48 tiles it looks really atrocious. ...Because more frames don't seem to be possible is there any method to speed it up? ...except creating ten thousands events just for a waterfall...
  2. What Version is your projects core?

    There was a bug with the animated tiles in 1.0 and 1.1 or so that made the animation look bad, but that had been fixed in a Version that is already years old...
  3. I actually use the new one: version 1.6.1 .... but still:

    Sloooooooooow
    RF2OBBE.gif
  4. You can turn them into animated doodads if all else fails.
  5. Update rate is locked to 2 frames per second by default. I think it's because animated tile updates can cause lag on slower devices.

    Couldn't find a plugin that did this, so made something myself (attached). It seems to be working for me! ^_^ Full code in spoiler below.
    Spoiler
    Code:
    //=============================================================================
    // Cae_TileAnimRate.js
    //=============================================================================
    
    /*:
     * @plugindesc v1.0 - Lets you specify the rate at which animated map tiles cycle their animation.
     * @author Caethyril
     *
     * @help Plugin Commands:
     *   None.
     *
     * Compatibility:
     *   Aliases update method of the Tilemap class.
     *
     * Terms of use:
     *   Free to use and modify.
     *
     * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     * Update log:
     *   1.0: Initial release.
     *
     * @param Tile Animation Rate
     * @text Tile Animation Rate
     * @type number
     * @min 0
     * @max 60
     * @desc Tile animation rate in frames per second.
     * Default: 2
     * @default 2
     */
    
    var Imported = Imported || {};			// Import namespace, var can redefine
    Imported.Cae_TileAnimRate = 1.0;		// Import declaration
    
    var CAE = CAE || {};				// Author namespace, var can redefine
    CAE.TileAnimRate = CAE.TileAnimRate || {};	// Plugin namespace
    
    (function (_) {
    
    'use strict';
    
    	_.params = PluginManager.parameters('Cae_TileAnimRate');			// Process user parameters
    
    	_.rate = Number(_.params['Tile Animation Rate']) || 0;
    
    	// Adjust animationCount prior to the standard +1 per call
    	_.Tilemap_update = Tilemap.prototype.update;		// Alias
    	Tilemap.prototype.update = function() {
    		this.animationCount += (_.rate / 2) - 1;	// -1 to balance the +1 from default code
    		_.Tilemap_update.call(this);			// Callback
    	};
    
    })(CAE.TileAnimRate);
  6. caethyril said:
    Update rate is locked to 2 frames per second by default. I think it's because animated tile updates can cause lag on slower devices.

    Couldn't find a plugin that did this, so made something myself (attached). It seems to be working for me! ^_^ Full code in spoiler below.
    Spoiler
    undefined

    So much work for an old grumpy man? I looked into your code and didn't understood anything, have only a bit experience with C and C# -.- But yes, it works like a charm. Thanks!

    ...Thread close? Solution found?
  7. @caethyril do you think you could include either a switch or an option in the options menu to turn the effects your plugin on/off? that way, if someone's device they're playing it on is lagging with the faster frame rate of autotiles, they could turn that feature off. otherwise, nice plugin c:
  8. Prescott said:
    @caethyril do you think you could include either a switch or an option in the options menu to turn the effects your plugin on/off? that way, if someone's device they're playing it on is lagging with the faster frame rate of autotiles, they could turn that feature off. otherwise, nice plugin c:
    Good idea! That was also easier to do than I'd expected. Updated plugin attached, full code in spoiler like before. :kaojoy:
    Spoiler
    Code:
    //=============================================================================
    // Cae_TileAnimRate.js
    //=============================================================================
    
    /*:
     * @plugindesc v1.1 - Lets you specify the rate at which animated map tiles cycle their animation. Can also add an on/off switch to the in-game options.
     * @author Caethyril
     *
     * @help Plugin Commands:
     *   None.
     *
     * Compatibility:
     *   Aliases update method of the Tilemap class,
     *       and addGeneralOptions method of Window_Options.
     *   Defines new Boolean property tileAnimRate on the ConfigManager.
     *
     * Terms of use:
     *   Free to use and modify.
     *
     * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     * Update log:
     *   1.1: Added on/off switch to the in-game options.
     *   1.0: Initial release.
     *
     * @param Tile Animation Rate
     * @text Tile Animation Rate
     * @type number
     * @min 0
     * @max 60
     * @desc Tile animation rate in frames per second.
     * Default: 2
     * @default 2
     *
     * @param Options Label
     * @text Options Label
     * @type text
     * @desc Text shown for this setting in the in-game options.
     * Leave blank to not add the option.
     * @default
     */
    
    var Imported = Imported || {};			// Import namespace, var can redefine
    Imported.Cae_TileAnimRate = 1.1;		// Import declaration
    
    var CAE = CAE || {};				// Author namespace, var can redefine
    CAE.TileAnimRate = CAE.TileAnimRate || {};	// Plugin namespace
    
    (function (_) {
    
    'use strict';
    
    	_.params = PluginManager.parameters('Cae_TileAnimRate');			// Process user parameters
    
    	_.rate  = Number(_.params['Tile Animation Rate']) || 2;
    	_.label = String(_.params['Options Label']) || '';
    
    	_.active = true;		// Default option value
    
    	// Adjust animationCount prior to the standard +1 per call
    	_.Tilemap_update = Tilemap.prototype.update;			// Alias
    	Tilemap.prototype.update = function() {
    		if (_.active) this.animationCount += _.rate / 2;	// animationCount cuts off at 30 so divide by 2 here
    		this.animationCount -= 1;				// Cancel out +1 from default code
    		_.Tilemap_update.call(this);				// Callback
    	};
    
    	// Add option to ConfigManager
    	Object.defineProperty(ConfigManager, 'tileAnimRate', {
    		get: function() 	{ return _.active;  },
    		set: function(value) 	{ _.active = value; },
    	configurable: true });
    
    	// Adds option to Window_Options
    	_.Window_Options_addGeneralOptions = Window_Options.prototype.addGeneralOptions;
    	Window_Options.prototype.addGeneralOptions = function() {
    		_.Window_Options_addGeneralOptions.call(this);
    		if (_.label !== '') this.addCommand(_.label, 'tileAnimRate');
    	};
    
    })(CAE.TileAnimRate);

    (Edit: as suggested, this plugin now has its own thread https://forums.rpgmakerweb.com/index.php?threads/tile-animation-rate.98377/ )
  9. @caethyril Could I suggest you post this in Plugin Releases? If it just stays here it won't become widely used.