0

I'm a little out of my depth here. The community here seem very helpful so I'm hoping together we can figure out the issue I'm experiencing.

I'm developing a game for Windows PC and the language is Javascript. I'm using a plugin that updates a character dynamically.

Unfortunately the creator of this plugin abandoned the plugin so due to it being unfinished, I expected parts of it to be a little bit janky. But it actually works very well and successfully updates my character using a layered composite system, dynamically updating/layering their png spritesheet file with images e.g. hair, clothes, etc, in another one of my folders. So at least the hard part is out the way!

  1. The first issue I'm experiencing involves the graphic of my character briefly flickering (there is a missing frame or two) when they update and an extra layer is added to them in the game. This flicker doesn't happen all the time when a layer is added to them, but sometimes it does, and I'm not sure why.

  2. Another issue: When the graphic updates the character's spritesheet also flickers in the corner of the screen for a few frames, and then disappears. Fortunately the spritesheet flicker in the corner isn't visible if I'm playing the game at a lower resolution BUT it can be seen if the game is played on 1920x1080 or larger screens... I'd love to know why that is happening and if it is possible to hide it.

I'm looking through the code right now and I would like to share it with you if that would be more helpful in solving the issue, but I'm not exactly sure where to look. I would certainly be happy to post it all, but there are 2000 lines of code! I'm not sure if it's frowned upon to post that many lines of code on here so I would prefer to ask first. If that's too many, I can attempt to post what is relevant if we can narrow down the problem! Thank you in advance for reading! Really hoping I can sort this out as it would be a big weight off my shoulders!

Edit: From what you have said so far, some code will definitely help. But not 2000 lines that's for sure, which is understandable! Here is a small section that I believe might be most relevant with the issues I'm experiencing...

How the images are combined:

Echomap_Processor.prototype.combineImagesLayer = function(bmp,imgLayerA,imgLayerE) {
this.combiningStarted = true;
var imgLayer = new Array();
for (var i = 0, len = imgLayerA.length; i < len; i++) {
    imgLayer.push( imgLayerA[i] );
}
for (var i = 0, len = imgLayerE.length; i < len; i++) {
    imgLayer.push( imgLayerE[i] );
}
for (var i = 0, len = imgLayer.length; i < len; i++) {
    var hue = 0;
    var dpath;
    var imgLocal = imgLayer[i]; //Echomap_CCG_ImgObject'
    dpath = 'img/composite/' + imgLayer[i].filename();
    imgLocal.setDPath(dpath);
    hue = imgLocal.hue();
    var toneR = imgLocal.toneR();
    var toneG = imgLocal.toneG();
    var toneB = imgLocal.toneB();
    Echomap.Utils.log('combineImagesLayer', 'dpath', dpath, 4);

    var tLayer;
    tlayer = ImageManager.loadNormalBitmapEcho3b(imgLocal);//dpath, hue, toneR,toneG,toneB);
    if (tlayer.isError()) {
        this.composingImgX = false;
        throw new Error('Failed to load: ' + tlayer.url);
    }
    if (!tlayer.isReady()) {
        this.composingImgX = false;
        Echomap.Utils.log('combineImagesLayer', 'WARN: bitmap not ready! (WHY?)!!', tlayer.url);
        return; //done = false;
        //throw new Error('Failed to load: ' + tlayer.url);
    }
    if( toneR!=0 || toneG!=0 || toneB!=0 )
        tlayer.adjustTone(toneR,toneG,toneB);
    var w = tlayer.width;
    var h = tlayer.height;
    Echomap.Utils.log('combineImagesLayer', 'bitmap ready', tlayer.url);
    bmp.blt(tlayer, 0, 0, w, h, 0, 0);
    /*tLayer.addLoadListener(function () {
        //blt ( source , sx , sy , sw , sh , dx , dy , [dw=sw] , [dh=sh] )
        bmp.blt(tLayer, 0, 0, tLayer.width, tLayer.height, 0, 0);
    });*/
}
this.combiningLvlStarted = false;

};

How the images are loaded:

Echomap_Processor.prototype.loadImagesLayer = function(bmp,imgLayer) {
//Echomap.Utils.log('loadImagesLayer', 'Called');
//Array imgLayer
for (var i = 0, len = imgLayer.length; i < len; i++) {
    var hue = 0;
    var imageLocal = imgLayer[i];
    //var dpath = 'img/composite/' + imgLayer[i];
    var dpath = 'img/composite/' + imageLocal.filename();
    hue   = imageLocal.hue();
    imageLocal.setDPath(dpath);
    if(imageLocal) {
        Echomap.Utils.log('loadImagesLayer', 'dpath', dpath, 4 );
        //var tLayer = ImageManager.loadNormalBitmap(dpath, hue);
        var tLayer = ImageManager.loadNormalBitmapEcho3(imageLocal);
    }
    /*tLayer.addLoadListener(function () {
        //blt ( source , sx , sy , sw , sh , dx , dy , [dw=sw] , [dh=sh] )
        bmp.blt(tLayer, 0, 0, tLayer.width, tLayer.height, 0, 0);
    });
    */
}
//Echomap.Utils.log('loadImagesLayer', 'Done');

};

Source: https://github.com/echomap/rpgmvplugins (This is where the plugin is from)

Embr90
  • 11
  • 2
  • Any code to show? – GetSet Feb 01 '21 at 23:23
  • 1
    It is definitely frowned upon here. I don't think SO is the place for yor long-shot of a request. You are very detailed, but there's very little substance here. What plugin? What kind of code? What engine? You can't just drop this and hope we figure it out. (This is also not a 'I will post updated later' kind of place. If necessary, sure, but you started with the premise you will share later, which is strange.) – somethinghere Feb 01 '21 at 23:24
  • @GetSet I have just edited my post with some! :) – Embr90 Feb 01 '21 at 23:31
  • @somethinghere Thank you for your comment! I've just posted some code to the post that seems like the most relevant to my problem. Hopefully that will help! – Embr90 Feb 01 '21 at 23:31
  • This doesn't look like your code. This looks copied from somewhere. If you want real help show your code. If you need someone to debug someone else's code, then provide a link on where you got it. And then provide your code in how you use the other's code. – GetSet Feb 01 '21 at 23:33
  • @GetSet Sure! The plugin is from here: https://github.com/echomap/rpgmvplugins – Embr90 Feb 01 '21 at 23:34
  • I find this plugin incredibly confusingly written - like something written in 1995. But since I can't run any of this code with any of your examples, I won't find the reason, because this would require me to debug the entire library and understand it's ideas and how they are implemented. Sorry man. Best to use things that aren't deprecated, although you could still reach out to the creator of that pkugin to see if he/she knows? – somethinghere Feb 01 '21 at 23:43
  • In other words, might be a wrong turn on that plugin choice @Embr90. You can always choose another – GetSet Feb 01 '21 at 23:51
  • Sadly there isn't another composite plugin for this particular engine. It is unfortunate as it works successfully aside from these issues. I can drop an email to the creator though I'm not confident as it has been some years since it was worked on. If anyone comes across this and does know anything at all, even a small bit of guidance, I'd super appreciate it. I've added the engine name as a tag in hope that someone who the language may understand. – Embr90 Feb 02 '21 at 00:27

0 Answers0