Funky Koval's Forum Posts

  • That's what I was affraid of. Setting depth individually won't work though - I'm using 3DObjects as well as Sprites, so they'd have to not only be placed at a correct depth, but also "skewed" (if rotated to non-right angles), to fake a constant view cone - something Construct cannot do. I've tried non-equal layer zoom valutes too, but that didn't work.

    Thanks for your help.

  • The title says it all. Is there any way to modify EyeDistance dynamically at runtime, or at least on layout change? I'm working on a multi-resolution project utilizing depth extensively and I need the variable Eye Distance to keep the FOV constant across resolutions.

    Thanks in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For starting the app at a designated time, you can use Task Scheduler - included in Windows.

  • Thank you for the .cap, however this technique requires me to fire several "traces" (the red boxes) to accurately check for visibility - think of it as a field-of-view cone. I'm now checking if that approach is faster than the downscaled playfield I'm using. It definitelly seems much direct and cleaner. Thanks again.

  • That's what I want to avoid.

    To give a wider perspective - I have a game where the player can see very far into the playing filed (meaning a lot of objects are visible), but only interacts with a few of them at a time (the ones closest to him).

    I've tried handling visibility checks using "Per Pixel" collisions and overlap tests, but the performance was rather poor - that's why I thought of doing visiblity using "Angled Box", but switching to "Per-Pixel" for player interaction (collision, to be precise).

    Due to the nature of the game, "Box" will not do - the objects are elongated Sprites, so "Box" would create a lot of false visibility positives.

    Currently, I have it solved using a shrunk-down copy of the playing field set to per-pixel collisions - the performace is acceptable, but I have a large Event Sheet just for that purpose. Plus it complicates Pairing tasks.

    Thanks for your assistance.

  • It seems that while Angled Box is available as a collision method, the Event for toggling collision types at runtime does not list it - it still has only point, box and per pixel.

    Does anyone know of a workaround if one needs to toggle collision modes on the fly? Thanks.

  • Is it max 9 or max 2009? If the former, grab the free GuruWare .obj exporter - it's included in the newer versions. As for the error, I'd wager it's something with your graphics card - drivers maybe or invalid mapping on the mesh - double check your UVs in max just in case.

    I have yet to encounter a crash with .objs exported from max and my "game" uses them quite extensively.

  • newt:

    That won't work, since the data is not explicitly set by me - it is dynamically generated.

    Tulamide

    While the logic seems correct, the shader does not work - it may be pasting the new RGBA data, but as you've mentioned, it doesn't clear the "old" BG first.

    I've managed to find a solution, however - see the attached .cap file - best way to verify that it works is to hover your mouse over a spot and press the left mouse button to perform the paste. You'll see that the RGB values stay intact while A gets correctly modified.

    The visuals are not important - as long as the Image Manipulator picks up the correct data, all is good. Requires NuovoFill, ChannelToAlpha and AlphaReplacer.

    As the shader I've made is useful for a very narrow range of cases, I'll just post it here instead of the Addons forum:

    // AlphaReplacer

    // Funky Koval

    // PS 0.0

    // Replaces BG.A with FG.A. FG.RGB must be zeroed out.

    // ConstructEffect

    technique ConstructEffect

    {

        pass p0

        {

            VertexShader = null;

            PixelShader = null;

         AlphaBlendEnable = TRUE;

         SrcBlend        = INVSRCALPHA;

         DestBlend        = INVSRCCOLOR;       

        }

    }

    Thank you everyone for the assist.

    sendspace.com/file/2tys8o

  • I've been using the Canvas object in conjunction with Image Manipulator to store data in color (RGB) channels for later retrieval. I've reached a point where I require a fourth storage channel (Alpha) for this purpose, but I'm unable to paste to it, without destroying existing data in the color channels.

    I've tried Erase, Mask and most of Fisholith's Effects, but as mentioned they destroy the RGB data.

    An example of what I need would be pasting a pixel with RGBA values of 1 1 1 .3 onto a Canvas with .5 .8 .3 1 and getting .5 .8 .3 .3 as a result - the source RGB would be disgarded and the destination A would be replaced with source A.

    I've started writing an Effect for this purpose, but I've hit a snag with relative Sprite sizes (I'm guessing):

    // AlphaReplace

    // Funky Koval

    // PS 2.0

    // Replaces BG alpha with FG alpha preserving color values.

    // Foreground texture

    texture ForegroundTexture;

    // Foreground sampler

    sampler2D foreground = sampler_state {

        Texture = (ForegroundTexture);

        MinFilter = Point;

        MagFilter = Point;

        MipFilter = Point;

    };

    // Background texture

    texture BackgroundTexture;

    // Background sampler

    sampler2D background = sampler_state {

        Texture = (BackgroundTexture);

        MinFilter = Point;

        MagFilter = Point;

        MipFilter = Point;

    };

    // Effect function

    float4 EffectProcess( float2 Tex : TEXCOORD0 ) : COLOR0

    {

        float4 bg = tex2D(background, Tex);

        float4 fg = tex2D(foreground, Tex);     

        

        bg.a=fg.a;

        

        return bg;

    }

    // ConstructEffect

    technique ConstructEffect

    {

        pass p0

        {

            VertexShader = null;

            PixelShader = compile ps_2_0 EffectProcess();

        }

    }

    Any help would be most appreciated.

  • Bumpmapping:

    Not directly and probably not very precisely - you can bumpmap a 2D projection of your box by having it on a separate layer with a normal map texture applied and having that bump-mapping Effect on - the name escapes me at the moment. Then you'd probably have to use events to set up a "light" for the light direction.

    Squirrel!:

    Use Physics with springs to create a chain of objects, but for display, use Ribbon and bind each Ribbon vertex to each of the Physics chain object's pivot.

  • Like you've mentioned, GlovePIE will work by having a script that continuously loops a key hold action.

    AutoIt3 can do it too, plus it can compile your script into an executable.

  • Ah, yes, you are right. I completely forgot that OIDs and the For Each Object action both work by creation order. Thank you.

  • Just a small issue - does anyone know of a way to have a loop that functions like "For Each Object", but is named so I can, for example, check its index from a nested loop?

    Right now I'm using the System\For Each Object condition with a PV which gets incremented at index progression, but I'd rather do without the PV, if possible.

    Thanks.

  • This is mostly an utility effect - it replaces/multiplies the original Alpha channel with/by either the Red, Green or Blue channel.

    Parameters:

    Channel - specifies which color channel is used 1 - Red, 2 - Green, 3 - Blue

    Invert - inverts the channel values before replacement/merging 0 - invert, 1 - do not invert

    Replace/Multiply - 1 - replaces the Alpha with the color channel 2 - multiplies the Alpha by the color channel

    Invalid parameter values will cause the effect to not do anything.

    Color premultiplication is only done if the channel is not inverted and replaces instead of multiplying over Alpha - otherwise, only the Alpha channel is affected resulting in an "additive" look for colors.

    What's it good for? I personally use it combined with Erase/Mask to paste transparency into a Canvas.

    Enjoy:

    sendspace.com/file/jl0zr6

    Thanks go to tulamide for his support.

  • It does make perfect sense.

    However, blending modes won't help in this case and not because Construct only supports a subset.

    It seems that there are none that blend across channels. Alpha only blends with Alpha, R with R etc.

    Yet I managed to find a solution - I'm in the process of cannibalizing the Color Mask Effect to do what I require - the logic flow is quite clear and easy to replace with a simple channel shifter - I have the basic operation done, but before releasing, I want to add the following:

    -ability to manually select the channel to shift over to alpha

    -a choice of either multiplication by the existing alpha or replacement

    -an option to inverse the incoming channel

    Once done, I'll post it in the Completed addons forum.

    Thank you for pointing me in the right direction.