skymen's Forum Posts

  • ssllav I can try to but I won't have time to make a video at the moment. When I do, I will post it and notify you.

  • I did not include the sprite movement exemple with the exemple because it's a very simplistic implementation, and in most cases, it won't be a good implementation. if you want the code I used, here it is:

  • Hey, I've checked out your plugin, and it seems awesome. One thing I'd like to ask about, I would be interested in having this typewriter effect included in the plugin with a option to tweak the speed of the typewritting per word. For example: "hey there <x wave> stranger" and have something like <speed 10> to add before stranger to change the speed of the typewritting effect

    I don't know how hard that would be to add since i understand the typewritting effect isn't added to the plugin specifically. But I'd be interested if it would be possible, since it's the only thing that I see missing from something like this. If you do add it, I'd very much like to know

    Thanks!

    Hey by the way, the typewriter is now in the plugin and has many features in case you missed it!

  • Oh, thanks for reporting this! I will be fixing it in the next update, I think I know what's causing this. I will keep you informed of when the update will be live so you can get it.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Oh well you're getting a store key ofc, so you're having the updates as well.

    I'm doing this because I have a few unclaimed keys left from some giveaways and I don't wanna leave them rest there, so I can't sell these keys through the store, and also because the store doesn't allow for Pay what you want models.

  • Yep, exactly. Couldn't explain it better.

  • With me. Send me an email at skymen75019 at gmail dot com or go the the discord and drop me a DM

    discord.gg/AfpSQ8D

  • Hey. Two things.

    First, for a limited time, Spritefont Deluxe is Pay what you want.

    Secondly, for anyone that owns colludium's Twine plugin (https://colludium.itch.io/twine-plugin) and Spritefont Deluxe here's a free dialogue system:

    Download link:

    mega.nz

  • It's just an utilitary plugin. There isn't much to it. You can use it whenever you want to monitor a value but don't want to have to create a new variable to compare it to.

  • Yeah, hence the use of "Usually" xD.

    Well the ones that don't get abandonned are the ones made by crazy developers or that managed to gather enough attention and customers.

  • I wouldn't recommend this kind of engine, unless you want to make that exact type of game. Usually these engines get abandonned after a few years, are too limited to make anything and won't even teach you much in the end.

  • To be precise, basically they had the engine itself, not the editor that should have came with it.

    They were 3 or 4 working on it, and only one developer. They tried making games for private companies using the engine to fund the development, and that made them delay the editor more and more and they eventually just gave up when they all became too tired and burnt out to continue working on it.

  • Thanks for the info

  • Oh :o

    Nice, thanks. I'll look into this. I'll need to learn some proper webgl first. I didn't know you could get C2's gl by doing glw.gl xD.

    I guess I misread glwrap.js cause I never saw anywhere anything named this.gl, only gl.

    Oh interesting, I didn't know "multiply" was one of the options now. It didn't used to be. I'm not sure if that would cause compatibility issues on some browsers.

    Well it seems like most browsers support it. Every browser except Edge 11 and prior. Edge 12 supports it.

    According to MDN: developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation

    I hadn't thought of creating individual letters of different colors as needed and keeping them for later use. Probably works well when only using a limited amount of colors. If the user ended up trying to do gradual color transitions you may run out of video memory though.

    Yeah it works pretty well in most cases. But indeed it may become inefficient if a user uses too many colors for too many characters. However run out of video memory? How so? Maybe run out of RAM, but VRAM? I'm genuinely asking here. I create the texture on a virtual canvas, and then store it in a JS object. I never actually add the canvas to the document. Would that still use up some video memory?

    It's not bad to end a batch in c2's renderer. It does it all the time. All a batch does is it sends multiple quads using the same texture at the same time instead of separately. Besides you'd be doing your own batching of all the letters in your spritefont renderer. The only drawback is if multiple spritefont instances drawn right after each other then they could only be batched individually instead of together, but I say it doesn't matter too much.

    Yeah ok I kinda get it. I really need to learn webgl, because I didn't know most of that.

    Maybe that could be a useful example to use alongside a webgl tutorial.

    Yes thanks again. I'll look into it and maybe I can use that to make the code more optimized.

  • Hi, thanks R0J0hound for your super helfpul answer.

    Sadly I had already found a way to do this.

    Indeed what I do right now, is I draw the letter on a black canvas the size of the letter, multiply by my color, and draw the letter again in 'destination-in' mode to mask the canvas's content.

    Then to save performance, I cache the texture in an object and if I ever need to redraw that letter with that color, I don't need to redo the process. This is helpful given that in a game the colored parts of the text are often the same words.

    But indeed this is problematic on WebGL because changing an image to a webGL texture had some issues. So I decided to cache the texture as well. So I draw the image, convert it to a texture only once.

    However, this still has some overhead compared to the canvas reder mode.

    I'll need to see if recoding the same process in WebGL will save more perf compared to keeping what I have right now or not.

    Also I don't think breaking C2's batch is a good idea. I have little to no experience in WebGL so I'm probably wrong, but afaik this means that the rendering gets a lot more tedious the more I have letters since I need to create a new batch and break it for each letter. Also I wasn't able to create a new proper batch using the same params C2 uses because I can't access these values, but again, maybe it's due to my inexperience with WebGL

    		function getColoredTexture(inst, image, color, clip, scale, letter) {
    		if(!color || color === 'None') {
    			return image
    		}
    		if (inst.cachedImages !== undefined && inst.cachedImages[letter] !== undefined && inst.cachedImages[letter][color] !== undefined) {
    			return inst.cachedImages[letter][color];
    		}
    		// Create new canvas
    		var charCanvas = createCanvas(clip.w * scale, clip.h * scale)
    		var charContext = charCanvas.getContext("2d");
    		// Draw letter on it
    		charContext.fillStyle = 'black';
    		charContext.fillRect(0, 0, charCanvas.width, charCanvas.height);
    		charContext.drawImage(image,
    			clip.x, clip.y, clip.w, clip.h,
    			0, 0, clip.w * scale, clip.h * scale);
    		// Apply color
    		charContext.globalCompositeOperation = 'multiply';
    		charContext.fillStyle = color;
    		charContext.fillRect(0, 0, clip.w * scale, clip.h * scale);
    		// Restore the transparency
    		charContext.globalCompositeOperation = 'destination-in';
    		charContext.drawImage(image,
    			clip.x, clip.y, clip.w, clip.h,
    			0, 0, clip.w * scale, clip.h * scale);
    		// Restore composite operation
    		charContext.globalCompositeOperation = 'source-over';
    		if (inst.cachedImages === undefined) {
    			inst.cachedImages = {}
    		}
    		if (inst.cachedImages[letter] === undefined) {
    			inst.cachedImages[letter] = {}
    		}
    		inst.cachedImages[letter][color] = charCanvas
    		return charCanvas
    	}
    

    Here's the code and here's how it looks

    cdn.discordapp.com/attachments/183566321156358144/481403367705542659/2018-08-21_11-58-23.gif

    EDIT: Just realized I should probably not recreate a whole new canvas each time. I'll change that.