XHXIAIEIN's Forum Posts

  • Icons in text example: #open=icons-in-text

    Animation Tag [icon=piggy]
    Animation Frame [icon=1] same as [icon=monster]
     
    BBCode Set Size: 
    [size=32][icon=piggy][/size]
    [size=64][icon=piggy][/size]
    
    BBCode Adjusting vertical alignment: 
    [icon=piggy]
    [iconoffsety=0][icon=piggy][/iconoffsety]
    [iconoffsety=50%][icon=piggy][/iconoffsety]
    
  • Tom The Steam deck desktop mode comes with an app store called discover. I found that there are several game engines in it, but Construct is not on the list. In fact, Recently my laptop broke and I have been using steamdeck to run Construct for 2 weeks and everything is fine. I think we can put a version on discover, maybe it can attract some new users.

    apps.kde.org/discover

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks! it can works.

    This function gets the color value from 0-1, which needs to be converted to 0~255.

    function convertTo255(value) {
     return Math.round(value * 255);
    }
    
    const ALPHAEX_SHIFT = 1024;
    const ALPHAEX_MAX = 1023;
    const RGBEX_SHIFT = 16384;
    const RGBEX_MAX = 8191;
    
    const RGB_MASK = [255, 65280, 16711680];
    const RGB_SHIFT = [0, 8, 16];
    const RGB_FACTOR = [RGBEX_SHIFT * RGBEX_SHIFT * ALPHAEX_SHIFT, RGBEX_SHIFT * ALPHAEX_SHIFT, ALPHAEX_SHIFT]; 
    
    function getColorValue(rgb, index) {
     if (rgb >= 0) {
     return (rgb & RGB_MASK[index]) >> RGB_SHIFT[index];
     } else {
     let v = Math.floor(-rgb % RGB_FACTOR[index] / RGB_FACTOR[index] / ALPHAEX_SHIFT);
     if (v > RGBEX_MAX) v -= RGBEX_SHIFT;
     return v / 1024;
     }
    }
    
    function GetRValue(rgb) {
     return getColorValue(rgb, 0) / 255;
    };
    
    function GetGValue(rgb) {
     return getColorValue(rgb, 1) / 255;
    };
    
    function GetBValue(rgb) {
     return getColorValue(rgb, 2) / 255;
    };
    
    function isNegativeZero(n) {
     return Object.is(n, -0);
    }
    
    function GetAValue(rgb) {
     if (isNegativeZero(rgb))
     return 0;
     else if (rgb >= 0)
     return 1;
     else {
     const v = Math.floor(-rgb % ALPHAEX_SHIFT);
     return v / ALPHAEX_MAX;
     }
    };
    
    function convertTo255(value) {
     return Math.round(value * 255);
    }
    

    Use:

    //------------------------------------------------
    // Set Global Var
    //------------------------------------------------
    const colorValue = runtime.globalVars.colorValue;
    runtime.globalVars.r = convertTo255(C3.GetRValue(colorValue));
    runtime.globalVars.g = convertTo255(C3.GetGValue(colorValue));
    runtime.globalVars.b = convertTo255(C3.GetBValue(colorValue));
    
  • Converting a colorValue back to RGB 255:

    R = int((-colorValue / 2^38) % 1025 * 255 / 1023)

    G = int((-colorValue / 2^24) % 1025 * 255 / 1023)

    B = int((-colorValue / 2^10) % 1025 * 255 / 1023)

    A = int((-colorValue) % 1025 * 255 / 1023)

    I tested using some colors but the formula didn't give the expected results

    -> System: Set colorValue to Sprite.ColorValue

    const colorValue = runtime.globalVars.colorValue;
    runtime.globalVars.r = Math.round((-colorValue / Math.pow(2, 38)) % 1025 * 255 / 1023);
    runtime.globalVars.g = Math.round((-colorValue / Math.pow(2, 24)) % 1025 * 255 / 1023);
    runtime.globalVars.b = Math.round((-colorValue / Math.pow(2, 10)) % 1025 * 255 / 1023);
    runtime.globalVars.a = Math.round((-colorValue) % 1025 * 255 / 1023);
    
    White (255, 255, 255)	// -281492157629439 -> (255,4,196,60)
    Dark(10, 20, 30)		// -10996458578943 -> (10,116,220,36)
    Grey(128, 128, 128)		// -141295868185599 -> (128,122,218,37)
    Red(255, 0, 0)			// -281474976711679 -> (255,4,192,63)
    Green(0, 255, 0)		// -17179870207 -> (0,255,4,251)
    Blue(70, 59, 222)		// -77244652187647 -> (70,216,94,161)
    
  • Ashley I'm confused about the ColorValue expression, which returns an integer that contains negative numbers. Is there a way to convert it to a regular color value?

    For example, Allow expression input parameters:

    ColorValue("R")

    ColorValue("G")

    ColorValue("B")

    ColorValue("A")

  • Maybe the Timer behavior could add an "exact calculation" property that is enabled by default. People who are more performance-critical can disable it to get a limited version of a timer?

  • I often use Timer instead of Function because it provides a delayed execution solution.

  • > There is also a developer who improved this weapp-adapter: github.com/finscn/weapp-adapter/blob/master/README_EN.md

    That link lists 5 known bugs in the WeChat game library, some look really nasty and difficult to work around, and I bet if we ported Construct we'd find a lot more. So I think my intuition was correct - supporting it would be a nightmare!

    I also tried to contact the mini games team but there was no news. They simply ignored my request because I was just a small user. But Other HTML 5 engines have already provided corresponding solutions, many of which are open source.(I linked to their code base in my previous post). Maybe Construct can reduce a lot of troubles on this road.

    But considering the current situation, I will not insist on this topic, because taking up too much energy in there may cause other plans behind C3 to be postponed indefinitely.

    I will continue to try to contact the mini games team to see if they can provide some technical support or support webview.

  • > The running environment of the mini game on iOS is JavaScriptCore, V8 on Android, they are all running environments without BOM and DOM, and there are no global document and window objects. Therefore, when you want to use the DOM API to create elements such as Canvas and Image, an error will occur.

    Yes, it doesn't support webview so they provide an 'adapter' to simulate a browser environment. Convert the DOM into their environment via the WXAPI provided by the adapter.

    There is also a developer who improved this weapp-adapter: github.com/finscn/weapp-adapter/blob/master/README_EN.md

  • Hi, Ashley! Please forgive me for still insisting on continuing to promote this topic. In fact, I noticed that in the development documentation of the mini game, there is an weapp-adapter which may be used to simulate the support of the browser environment.This might help support efforts, would you like to check it out again?

    you can download this: res.wx.qq.com/wxdoc/dist/assets/media/weapp-adapter.9568fddf.zip

    ---

    The article also mentioned some other HTML5 engine adaptation solutions. For example:

    If contact the minigame official, can even provide some public code of the C3 runtime library, which will help reduce the package size. Because minigame requires that the game package size cannot be larger than 4M:

    developers.weixin.qq.com/minigame/dev/guide/base-ability/game-engine-plugin.html

    --

    Wechat miniprogram

    github.com/stackOverMind/WeApp-adapter

    --

    Or is there any way to let third-party developers complete this work? Any good suggestions if I'm going to hire some professional programmer to do this? Because the adapter does not work like a plug-in, should we export HTML5 first and then write it manually?

  • Tom Currently a lot of old broken addons are still sorted to top making discoverability a bit bad. They are no longer applicable in the current version, or the original author has given up maintenance.

    Hopefully that a filtering rule can be added to only base on the voting in the recent year - and make it the default. so that new plugins are more likely to be seen, rather than historical accumulated votes.

  • The main point about RPG maker is their users don't ever finish any games and put them on Steam. They might fantasize about making a living writing games but they pay for a platform that doesn't require programming and has a very poor success rate at making you a game published star.

    While it's not nice to discuss other engines here, I had to come out and clarify. RPG Maker There have been countless great games released since RM 2000, even before Steam was popular

    "Doraemon: Nobita's Resident Evil", "Ruina", "Rainblood", "To the Moon", "Ib", "Mad Father", "The Witch's House", "Yume Nikki", "Blue Demon", "Tales of the Black Forest".... There are too many!!

    Moreover, the power of RPG Maker is due to the expansion of plug-in scripts and its powerful user community. No matter where you are, there are many technical personnel sharing plug-in scripts. Even developers who do not understand programming at all can use plug-in scripts to Modify certain parameters according to the requirements to achieve certain functions. The youngest developer I have ever seen is less than 10 years old and has learned how to download third-party scripts to assemble his own adventure world.

    There are also senior programmers who modify the engine to allow RPG Maker to achieve more gameplay options. From traditional turn-based RPG, to ARPG, to RTS, TD, and even simulated MMO RPG.

    -

    I think C3 is moving towards this step as well. The official provides us with hundreds of examples of game mechanics on the initial page. Let us learn the usage of events and the use of advanced scripts. Comparing the quality of the cases, this is currently not seen in other engines. The C3 cases are very complete. This is all to help users become better familiar with using Construct.

  • exp() It seems that it can also be used to handle camera zoom

    twitter.com/XorDev/status/1703873385946607924

    LayoutScale *= exp(Mouse.WheelDeltaY * 0.1)
    

    ---

    ln() Can be used to help us convert pow() into exp(). You know that The pow() function is not provided in C3.

    zoom_target *= pow(0.8, Mouse.WheelDeltaY)
    
    zoom_target *= exp(ln(0.8) * Mouse.WheelDeltaY)
    

    ---

    sign() Can be used to determine whether a value is positive or negative. Therefore, it is useful to use it in places with Vector attributes such as Platform or 8 direction behavior to mirror the animation. You can easily see it in the built-in examples.

    Set width = sign(PlayerCollision.Platform.VectorX) * Self.ImageWidth
    
  • lerp() It is very commonly used by everyone.It allows us to move more smoothly

    lerp(Self.Angle, TargetAngle, 10 * dt)
    
    lerp(Self.Angle, TargetAngle, 1 - 0.000001 ^ dt)
    
    anglelerp(Self.Angle, TargetAngle, 1 - 0.000001 ^ dt)
    

    ---

    Unlerp() can gives you the percentage of point between two values.

    unlerp(sprite.bboxleft, sprite.bboxright, mouse.x)
    

    If yout run it will find that the value is between 0 and 1. Of course, even if it goes out of range, it will still continue to go negative, or go past 1. It can be used to make scroll bars.

    Since this is a "progress", it can also be used to create animation functions similar to Timeline. For example,If used together with lerp, can be used to map one range of numbers to another range of numbers.

    lerp(0, 200, unlerp(sprite.bboxleft, sprite.bboxright, mouse.x))
    

    Think of this 0 and 200 as the properties of the object. As long as you control the progress, for example, hang it on the Tween value, it can proceed at the expected pace.

    I made a example:

    cdn.discordapp.com/attachments/225550155531812865/1136725591329083525/UI_Mapping_Object_Event.c3p