TheRealDannyyy's Forum Posts

  • Do Construct 2 and Construct 3 Multiplayer still share the same Signaling Server despite the changed URL? Will the old URL eventually be deprecated and stop functioning for existing published projects?

    Ashley This is probably a question that only you could answer. Appreciate it if you find the time to, since I couldn't find info in regards to this.

  • While going through the included Construct 3 example projects for fun recently. I discovered a 3rd party example called "Keyboard Mapping". To get straight to the point. I think it should be reworked because it's not very accurate.

    Issues:

    • Doesn't take into account the side of a key (e.g. CTRL, ALT, SHIFT and META)
    • Doesn't store/return the correct typed key (e.g. "ä, ö, ü" or similar keys)

    Dealing with keyboard inputs is quite a challenge in general since there is no easy way to return the keycode from a typed key but there are ways these issues could be solved in an update. Here are suggestions on how I did it personally.

    Update suggestions:

    • Store keycodes and typed keys together (Example: "222;Ä")
    • Use typed key visually and keycode mechanically
    • Manually detect and store special key sides (Example: "L-17;Left Control")

    As a side note. Big thanks to Viridino Studios for providing these examples!

  • One of the reasons Construct's behavior's default controls use arrow keys is because they are consistent across keyboard layouts.

    How does Construct 3 manage to detect the correct keys on my German Keyboard (flipped y/z)? Is that part of the browser js api or did you guys implement a hack'y workaround for detecting keyboard layouts?

  • Curious! I wonder if AZERTY is a keyboard with its own region profile on a computer - as in, are the physical scancode values different comparing QWERTY and AZERTY, or, when you plug in an AZERTY keyboard, are you expected to change the keyboard region before it works correctly?

    It must technically already be possible since Construct 3 does detect the correct StringFromCharCode on my German keyboard with flipped Y/Z.

  • Let's say we make a simple key-binds menu and try to set absolute defaults for it. In this example "WASD" for basic movement. This is all fine on certain keyboard layouts but as soon as AZERTY comes into play, we got a mess on our hands since the appropriate keys for that would be "ZQSD".

    In theory working around this would require to fetch the current keyboard layout and set the defaults based on it on the 1st run of the game. However there don't seem to be any conditions or expressions to do this right now.

    So how do other devs deal with this problem? Do you just set absolute defaults and call it a day, forcing AZERTY users to just rebind themselves?

  • Hi!

    I work with the publisher Ratalaika Games and often help him with ports of games made on Construct 2/Construct 3.

    Creating the right Spritefont images was a big challenge, especially finding the right characters, so I made my own "mini program" on Construct3 that can get a list of characters from your text. This way I get the entire Character Set, which I then generate in the program that you specified earlier, and it works great for me.

    This tool is great and I appreciate sharing it with me but it also comes with the issue that the copied text is "absolute". Basically meaning that if your pasted text is missing unique characters of a selected language. They won't end up in the character-set.

    It should still work fine though. Pasting in all translation strings should do the trick. Thanks again!

  • Generally you don’t want all the characters in a selected font. A font can have anything from a few characters to the entire Unicode character set of around 4 billion.

    I guess it should be possible to parse a font file and find all the characters defined in it. All the different font formats are documented online.

    I understand that but I think a detection algorithm for unique glyphs within a font would solve the issue of 4 billion characters. I'm also aware that your tool is limited by the web and might not be able to support such a feature but I found a paid tool which does what I mentioned today. I did manage to only export a comma-separated character-set and used your tool to do the sprite-sheeting work.

    Thanks a lot for creating and providing your tools for free by the way!

  • You won't be able to create spritefonts for languages like Chinese, because they have tens of thousands characters. Japanese is possible, but only for the hiragana and katakana.

    If you need a universal object that supports lots of languages including Chinese, you will have to use Text object.

    Figured that would be the case, which is a shame really.

    I usually just google the alphabet for a particular language, copy/paste it into Word, use Find/Replace to remove all unnecessary characters like spaces. Shift+F3 to change case. And that's it.

    That's what I've been doing so far. Do you have any specific sites to make this easier on a per-language basis? Maybe sites that have the character-set as comma-separated values or in a different list format.

  • The Basics:

    So I've been getting into using Spritefonts recently. While the Spritefont tools by R0J0hound and blackhornet do a great job with modifying and generating them. I noticed one big flaw in both tools and would be interested if anyone knows an easy solution for this.

    (Software Downloads: R0J0hound Software | Blackhornet Software)

    The Issue with Unique Characters:

    Imagine you have a font which supports unique characters. The problem is that both tools use an absolute value for their character-set. Meaning instead of fetching a list of all available characters from the selected font. They only go by a limited set of characters that you have to expand by yourself.

    This basically means that you are pretty much required to Google together an entire list of unique characters by yourself and this can get very difficult for languages like Japanese, Chinese or Arabic.

    The search for Automation Tools:

    After searching the web for a typography tool to get the full character-set of a selected font. I couldn't find anything useful besides the ancient "Character Map" tool, that comes bundled with Windows since the dawn of time but that doesn't have a multi-select option.

    My call for Help:

    So how did other developers using Spritefonts deal with this issue? Did you guys just ditch Spritefonts in favor of Construct 3's native font object?

  • After some further experimenting around. I could unfortunately still not find any workarounds for these issues. I'll provide the most stable working older release below, for people who need it.

    NWJS Release Version: v0.72.0 download (e.g. "nwjs-sdk-v0.72.0-win-x64.zip")

    • No support for MacOSX ARM
    • Supports --disable-windows10-custom-titlebar for the old working titlebar
    • Requires --disable-features=Vulkan for Linux to work (see issue)
    • Isn't affected by the titlebar missing icon bug (see issue)
    • Requires custom prebuilds for Steamworks 1.58a to work (download here)
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah, yes this is a traditional canvas. I assume this function will be used multiple times, so I would also suggest creating a single canvas outside of the function and pass it to the function to be reused (so you are not creating a canvas per function call.)

    I guess the best way to do this would be to just check if the canvas element exists and running the 3rd line if required. Thanks again for laying the groundwork for me.

    As a side note. I had to ditch the async function because for some reason it didn't work as expected inside the browser execute action. Most likely an issue caused by my lack of experience with async/await in Javascript. I still lack the experience but the years of feature workarounds, I had to implement in C2/C3 over the years taught me a little bit I suppose.

  • I can give the basics, but I don't use c2 anymore. Here's generally how I would do it (untested):

    > async function GetFriendAvatar(e) {
    return new Promise((resolve, reject) => {
    const requestResult = this._greenworks["requestUserInformation"](e["steam-id"], false);
    console.log('*** INFO *** domSide.js _OnGetFriendAvatar requestResult', requestResult);
    console.log('*** INFO *** domSide.js _OnGetFriendAvatar', e);
    var handle = this._greenworks["getSmallFriendAvatar"](e["steam-id"]);
    console.log('*** INFO *** domSide.js _OnGetFriendAvatar handle', handle);
    var data = this._greenworks["getImageRGBA"](handle);
    console.log('*** INFO *** domSide.js _OnGetFriendAvatar data', data);
    var size = this._greenworks["getImageSize"](handle);
    console.log('*** INFO *** domSide.js _OnGetFriendAvatar size', size);
    const result = {size, data};
    resolve(JSON.stringify(result));
    });

    > 	const e = {"steam-id": "483094812098"}
    	const result = await GetFriendAvatar(e);
    

    > function createImageDataUrl(pixelArray, width, height) {
    // Create a canvas element
    const canvas = document.createElement('canvas');
    canvas.width = width;
    canvas.height = height;
    
    // Get the 2D context of the canvas
    const ctx = canvas.getContext('2d');
    
    // Create a new ImageData object
    let imageData = ctx.createImageData(width, height);
    
    // Set the pixel values
    for (let i = 0; i < pixelArray.length; i++) {
    imageData.data[i] = pixelArray[i];
    }
    
    // Put the image data onto the canvas
    ctx.putImageData(imageData, 0, 0);
    
    // Convert the canvas to a data URL and return it
    return canvas.toDataURL();
    }
    
    const imageData = result
    const height = imageData.size.height
    const width = imageData.size.width
    const pixelArray = imageData.data.data
    
    const dataURL = createImageDataUrl(pixelArray, width, height)
    
    console.log('dataURL', dataURL)
    

    replace this._greenworks with your pointer to greenworks

    I can help debug, if you try and it is not working for you. Just post the code.

    Thanks a lot again! I'll try to figure things out. I initially thought the canvas stuff was a reference to the C3 canvas plugin, so I thought it would require a C2 specific workaround.

  • This seems to be a roadblock that cannot be worked around. Webview2 could become a solution in the future when it's ready for multi-platform distribution but the NWjs side of things looks pretty bad.

    It would either require Valve to add very specific support for "fake" Chromium window titlebars or Chromium to offer a version of their custom titlebar that integrates with the native Windows DWM.

    Their recently added Windows 11 mica titlebar support doesn't seem to fix this issue either and it would be useless on Windows 10 anyway. NWjs will probably never support Mica to be begin with but it was worth a shot I suppose.

    TL;DR:

    • Valve: Doesn't care enough to implement specific workaround.
    • Google/Chromium: Doesn't care about issues for 3rd party projects that use their browser engine.

    The Steam overlay is usually not picked up by streaming software anyway. So it's only a slight inconvenience for players who prefer playing in windowed mode for the time being.

  • Ok, got something working. Though, I am doing it for local user who's avatar may already be cached. So it may require another ACE to get the userInfo, wait for that to be available, then getFriendAvatar.

    The test project includes the function to change the data to a dataURL which a sprite can load.

    Let me know if you have any questions - it's a basic test case.

    I find that I need to use the steam ID from looking at my profile on steam website my profile URL.

    (Put the steam ID in the top text box, then press Get Avatar button. Need to export as nw.js 0.82 and add steam_appid.txt to the usual spot.

    https://www.construct.net/en/make-games/addons/244/greengrinds

    ...

    Thanks a lot Mikal. This seems to work perfectly fine in Construct 3 as is. Also thanks for updating the plugin!

    Since you are well experienced with this. Would it be possible to make this more compact and JS only? I basically want this to be compatible with C2 as well. The customer would just need to use the existing Greenworks plugin and execute your code. The resulting image data could just be passed using: c2_callFunction("steamAvatarData", ["DATAHERE"])

    It's alright if you are too busy to do backporting work. I still appreciate solving this long issue of mine and making me ditch JIMP for good.

  • It looks like it ultimately is calling this method, in which case "an integer handle" is really just an actual "int", i.e. a normal 32-bit number. So you can just pass that around the event system as a standard number parameter.

    I'm a bit confused and not sure what this means. Does that mean that the sprite object can make use of the 32bit number already?