help Parallax map camera behavior ???

hi, I try somehow to understand the inner workings of the map in the source code of rmmv but I have a lot of difficulty to understand everything.

there are specialists who could bring me some clarification?

My issue is the following.
The basic parallax system of rmmv is not necessary for me, however I want to add a picture in the background that will have the role of the map camera.

in logic this image will have the behavior of the parallax system, without the infinite painting.

I attacked for several days the code that affects map camera and parralaxe , but without real success.
How the hell this work ?


how i can replace parralaxe by a single sprite pixi texture without loop ??

PHP:
    Spriteset_Map.prototype.createParallax = function() {
        this._parallax = new TilingSprite();
        this._parallax.alpha = 0.5;
        this._parallax.move(0, 0, Graphics.width, Graphics.height);
        this._baseSprite.addChild(this._parallax);
        var layers = pixiSSA.get_layer_parallax();
        for(var i = 0, l = layers.length; i<l; i++){ this._baseSprite.addChild(layers[i]) }; // add layers parallax

        this._atestMap =  new PIXI.Sprite.fromImage('C:/Users/jonle/Documents/Games/A NEW FANTASTIQUE TIME TOME1/img/parallaxes/'+"!A-jcartoon2.png");
        this._atestMap.alpha = 0.8;
        this._baseSprite.addChild(this._atestMap);
    };


i made little video to help understand my target.
it's really because I do not understand anything despite all my efforts on how the basic paralaxe and camera work!.
thanks in advance for help.

i try many code changes, but i cannot understand how the camera and parallaxe work.


here the basic am try understand., Am not shure its the good way, but if you have more good idea or understand more than me the system thank to help.
PHP:
  // LAYER ASIGNATION TO MAP
    Spriteset_Map.prototype.createLowerLayer = function() {
        Spriteset_Base.prototype.createLowerLayer.call(this);
        this.createParallax(); // Create parralaxe and add parralaxe layers
        this.createTilemap();
        this.createCharacters();
        this.createShadow();
        this.createDestination();
        this.createWeather();
        //plugin
        this.addLayersEvents(); // add eventsLayers with .z (from rmmv)
        this.addLayersTop();
        console.log('thisSpriteset_Map ', this); // contien tous parralaxe, event layer, saufe top layer
    };
    Spriteset_Map.prototype.createParallax = function() {
        this._parallax = new TilingSprite();
        this._parallax.alpha = 0.5;
        this._parallax.move(0, 0, Graphics.width, Graphics.height);
        this._baseSprite.addChild(this._parallax);
        var layers = pixiSSA.get_layer_parallax();
        for(var i = 0, l = layers.length; i<l; i++){ this._baseSprite.addChild(layers[i]) }; // add layers parallax

        this._atestMap =  new PIXI.Sprite.fromImage('C:/Users/jonle/Documents/Games/A NEW FANTASTIQUE TIME TOME1/img/parallaxes/'+"!A-jcartoon2.png");
        this._atestMap.alpha = 0.8;
        this._baseSprite.addChild(this._atestMap);
    };

    Spriteset_Map.prototype.addLayersEvents = function() {
        var layers = pixiSSA.get_layer_events();
        for(var i = 0, l = layers.length; i<l; i++){ this._tilemap.addChild(layers[i]) }; // add layers events
    };
    Spriteset_Map.prototype.addLayersTop = function() {
        var layers = pixiSSA.get_layer_top();
        for(var i = 0, l = layers.length; i<l; i++){ this.addChild(layers[i]) };// add layers top
    };

    Game_Map.prototype.scrollDown = function(distance) { // remove limite Camera, free cam limite
        if (this.height() >= this.screenTileY()) {
            var lastY = this._displayY;
            this._displayY = Math.min(this._displayY + distance); //  ,this.height() - this.screenTileY()
            this._parallaxY += this._displayY - lastY;
        };
    };
 
    Game_Map.prototype.scrollLeft = function(distance) { // remove limite Camera, free cam limite
        if (this.isLoopHorizontal()) {
            this._displayX += $dataMap.width - distance;
            this._displayX %= $dataMap.width;
            if (this._parallaxLoopX) {
                this._parallaxX -= distance;
            }
        } else if (this.width() >= this.screenTileX()) {
            var lastX = this._displayX;
            this._displayX = Math.max(this._displayX - distance); // , 0
            this._parallaxX += this._displayX - lastX;
        }
    };
 
    Game_Map.prototype.scrollRight = function(distance) { // remove limite Camera, free cam limite
        if (this.isLoopHorizontal()) {
            this._displayX += distance;
            this._displayX %= $dataMap.width;
            if (this._parallaxLoopX) {
                this._parallaxX += distance;
            }
        } else if (this.width() >= this.screenTileX()) {
            var lastX = this._displayX;
            this._displayX = Math.min(this._displayX + distance); // ,this.width() - this.screenTileX()
            this._parallaxX += this._displayX - lastX;
        };
    };
 
    Game_Map.prototype.scrollUp = function(distance) { // remove limite Camera, free cam limite
        if (this.isLoopVertical()) {
            this._displayY += $dataMap.height - distance;
            this._displayY %= $dataMap.height;
            if (this._parallaxLoopY) {
                this._parallaxY -= distance;
            }
        } else if (this.height() >= this.screenTileY()) {
            var lastY = this._displayY;
            this._displayY = Math.max(this._displayY - distance); // , 0
            this._parallaxY += this._displayY - lastY;
        }
    };

    Spriteset_Map.prototype.updateParallax = function() {
        if (this._parallaxName !== $gameMap.parallaxName()) {
            this._parallaxName = $gameMap.parallaxName();
 
            if (this._parallax.bitmap && Graphics.isWebGL() != true) {
                this._canvasReAddParallax();
            } else {
                this._parallax.bitmap = ImageManager.loadParallax(this._parallaxName);
            }
        }
        if (this._parallax.bitmap) {
            this._parallax.origin.x = $gameMap.parallaxOx();
            this._parallax.origin.y = $gameMap.parallaxOy();
            this._atestMap.x = -$gameMap.parallaxOx();
            this._atestMap.y =  -$gameMap.parallaxOy();
        }
    };
One of your problems might come from a misunderstanding of the original purpose of the parallax, because that code is still the main focus and one reason why the parallax movement needs to be disabled when trying to use that picture as a map.
In MV you can disable parallax by starting the picture filename with a ! (see help file).

Parallax is background movement that is different from map/player movement. It has nothing to do with mapping itself.
Back in VXA people used scripts to disable the parallax movement to use the slot for the parallax background as an additional map layer. That was then named "parallax mapping" die to the name on map properties, despite having nothing to do with the original definition of "parallax" anymore.

In MV the ! Option to disable the parallax without script was added exactly because that form of mapping has becomes widely used, but you still have to disable the code for parallax movement if you want to use it for anything else.

I hope this background info helps a bit.
One of your problems might come from a misunderstanding of the original purpose of the parallax, because that code is still the main focus and one reason why the parallax movement needs to be disabled when trying to use that picture as a map.
In MV you can disable parallax by starting the picture filename with a ! (see help file).

Parallax is background movement that is different from map/player movement. It has nothing to do with mapping itself.
Back in VXA people used scripts to disable the parallax movement to use the slot for the parallax background as an additional map layer. That was then named "parallax mapping" die to the name on map properties, despite having nothing to do with the original definition of "parallax" anymore.

In MV the ! Option to disable the parallax without script was added exactly because that form of mapping has becomes widely used, but you still have to disable the code for parallax movement if you want to use it for anything else.

I hope this background info helps a bit.

hum i use a copy of parralaxe for only see what i am do in the rmmv sofware , but my target it replace parralaxe system to a simple sprite map update, so if i undestand, i will can delete all this at end, and maybe try to add single sprite map background in the _baseSprite ?
My target it have a singlet map with black backgroundwith a free camera ex: with a addchildAt('background',0); ..
thank for help , yes this help me


PHP:
Spriteset_Map.prototype.createTilemap = function() {
    if (Graphics.isWebGL()) {
        this._tilemap = new ShaderTilemap();
    } else {
        this._tilemap = new Tilemap();
    }
    this._tilemap.tileWidth = $gameMap.tileWidth();
    this._tilemap.tileHeight = $gameMap.tileHeight();
    this._tilemap.setData($gameMap.width(), $gameMap.height(), $gameMap.data());
    this._tilemap.horizontalWrap = $gameMap.isLoopHorizontal();
    this._tilemap.verticalWrap = $gameMap.isLoopVertical();
    this.loadTileset();
 // add sprite map before.. here
    this._baseSprite.addChild(this._tilemap);
};
ok I read again what you said thank you very much, that help me understand that in fact I i work with not the good layer!!!
I do not want to delete the parallax for the moment because these the only way to see an image of the background on the software for work on.
But at the end of the game dev, I want replace parallax image to be a simple sprite that scrolls the same way as events with a free camera.

I will try to look rather at the layer events rather than the parralaxe, knowing that the parralaxe is there to help the software side.
thank a lot @Andar for this basic background explain, i will come back if i need more help
ok i think it solved, for help other, if you want a map sprite, but without use parralaxe
PHP:
    Spriteset_Map.prototype.createTilemap = function() {
        if (Graphics.isWebGL()) {
            this._tilemap = new ShaderTilemap();
        } else {
            this._tilemap = new Tilemap();
        }
        this._tilemap.tileWidth = $gameMap.tileWidth();
        this._tilemap.tileHeight = $gameMap.tileHeight();
        this._tilemap.setData($gameMap.width(), $gameMap.height(), $gameMap.data());
        this._tilemap.horizontalWrap = $gameMap.isLoopHorizontal();
        this._tilemap.verticalWrap = $gameMap.isLoopVertical();
        this.loadTileset();
        this._baseSprite.addChild(this._tilemap);
        // create a sprite photoshop map background (work like paralaxe system)
        this._atestMap =  new PIXI.Sprite.fromImage('C:/Users/jonle/Documents/Games/A NEW FANTASTIQUE TIME TOME1/img/parallaxes/'+"!A-jcartoon2.png");
        this._atestMap.z = -2;
        this._atestMap.alpha = 0.8; // test for see what behind and if pixel shake! when update!
        this._tilemap.addChild(this._atestMap);
        console.log('this._tilemap: ', this._tilemap);
    };

    Spriteset_Map.prototype.updateTilemap = function() {
        this._tilemap.origin.x = $gameMap.displayX() * $gameMap.tileWidth();
        this._tilemap.origin.y = $gameMap.displayY() * $gameMap.tileHeight();
        this._atestMap.x = -this._tilemap.origin.x; // origin not exist in pixi! work also with .pivot or ~(valur)+1
        this._atestMap.y = -this._tilemap.origin.y;
 
    };

there is probably improvement or other possible modification, but from what I understand for the moment, it semm works, thanks to all and if you have better ideal, i take it..
the major problem i think are rmmv is based on these own variable of position and for the update, but it not update from pixi basic position.
ex why use .origin, if .pivot do same thing ?
so also this work too
PHP:
        this._tilemap.origin.x = $gameMap.displayX() * $gameMap.tileWidth();
        this._tilemap.origin.y = $gameMap.displayY() * $gameMap.tileHeight();
     
        this._atestMap.pivot.x = this._tilemap.origin.x;
        this._atestMap.pivot.y = this._tilemap.origin.y;
I hope to understand more this, in the next update! 1.6! if dev make some change!

image_3078_m.jpg
mix-alcohol-piracetam.jpg

Original thread: https://forums.rpgmakerweb.com/threads/help-parallax-map-camera-behavior.89454/