tulamide's Forum Posts

  • For a looped car engine sound have a look at Verve!. It also uses XAudio2 a lot (including fades)

    The click problem is a combination of the kind of your sound, Construct's builtin limiter and the poor quality of the D/As of standard soundcards. With a limiter all sound output is flattened towards maximum loudness. If there are sharp (and very low) frequencies in a sound, it will produce such clicks and the limiter makes them sound even louder. The best you can do is to use loud low frequencies as little as possible and to adjust the channels volume until the clicks disappear (just reducing the volume without changing the spectrum of frequencies may not suffice)

    For the fading you may have a look at Verve! again, but I also made a quick cap using "engIdle.wav" from Verve!, showing how to fade in with key press and fade out on release.

    There is also another problem, if you hit space a few times rapidly -- the sound suddenly refuses to stop playing (I think it might be starting it on another channel, or two other channels I can't really tell.)

    f course it refuses to stop; you're using autoplay, which always plays on a free channel. If you are starting a new sound while the old one is still playing it will play the new sound on a new channel. But you exit the loop only on channel 1.

  • If you are aiming for saving disk space, keeping your app size small, you can use ogg.

  • The only thing that comes to my mind is zooming. Depending on the hardware you may experience some "misaligning" when the zoom isn't exactly 100%.

    But this is a wild guess.

  • Quazi, the Gradients.fx also behaves this way, as can be seen here:

    But I really like PixelRebirth's solution. Elegant and not too processor expensive.

    EDIT: Namre, I think you didn't use it to your advantage. Don't add the effect to one of the objects, but to the layer that contains the objects. Of course, there is still missing a "center"- option, to define the position of the light source, but that's no big deal to implement. However, I repeat that Pixel's solution is probably the best.

  • I'm not sure i fully understand your explanation of how pixel shaders work, so this might be an unnescessary question, but is it possible to create an effect that removes other effects? In that case i would darken the main layer in some way, for example using tint plus to controll the color of the overall lighting, and then have light-sprites with this counter-effect to remove what tint is doing.

    This is not possible, I'm afraid. But with a combination of effects you might come close to what you have in mind. Have a look at this example, that's the closest I could get.

  • You're right, if you don't want the background to glow (although it would be unrealistic )

    Do you know about my effect "Gradients"? http://www.scirra.com/forum/viewtopic.php?f=29&t=7674

    Maybe it is more of help.

  • Ok, I think I solved it (I really hope so)!

    It wasn't my system, it wasn't my hardware. Construct had problems with the files in the application data folder. Simply copied the scirra folder from there to a backup storage (to investigate, what file exactly is causing the problem) and deleted the original. Runs smoothly again!

  • I would try the gradient object. In your example you would place a gradient on top of all other objects (most likely its own seperate layer). Make it cover the wished light's area. Set the color close to the light source to some opacity and the second color to 0% opacity.

  • I really tried everything. But to no avail. And it really is mysterious. The only process using processor time when the picture editor is about to be opened is Construct. 50% (one core) is used by Construct, the other 50% are idle. And Construct is heavily working with the RAM. In the task manager I can clearly see how RAM is requested and released over and over again. Example: Construct uses 13 MB, the picture editor starts and wooosh, one core 100% busy with Construct, memory load goes to 30 MB, back to 20 MB, raises to 58 MB, down to 18 MB, raises to 87 MB, etc. The virtual memory goes up by 100-200 MB at that time, and it really feels like there is a huge amount of data that needs to be transferred. But, we are talking about the try to open a 16x16px image.

    I deactivated my AV, I restarted, I re-installed, I updated the driver, DirectX and nothing helped. I changed nothing on my system. As I said, it really came all of a sudden, while I was working on a project. I didn't install anything, didn't download anything, didn't uninstall anything.

    I don't know, what else to do (besides wiping my harddisc and installing a fresh windows, what I really would like to avoid)

    Furthermore, I don't have any other problem. All of the apps work as usual, all of the games work as usual, everything works fine - just not Construct.

    I really am despondent.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • All of a sudden I'm no longer able to work reasonable with Construct. I was working on a project, everything worked fine as always. Then I added a sprite. The picture editor tries to open (the window opens, but not its content), one of my cores is working to capacity and Construct doesn't react anymore. After about a minute the editor finally opens and I can work normally. Since then, everytime I need to open the picture editor, Construct shows this behavior, no matter what .cap file or a totally new app, no matter the version (tried .96, .84, .62). Even a new installation didn't help.

    What has happened?

  • Is it possible to use or possibly tweak this plugin to achieve something like that? Perhaps a list where you specify what layers to affect.

    I'm not sure if there are easier ways to get to these results. However, pixel shader have only access to the current objects layer or the background (meaning everything rendered so far). The reason for this is, that a pixel shader is at the far end of the production line. When it comes to rendering the scene, a shader is called for every object such a shader is applied to. It will always render to a display size texture.

    Imagine you have three sprites "A", "B" and "C", in that order ("A" lowest, "C" highest) and the layout set to the color black. Every sprite is given an effect. When the scene is rendered, it starts with a display size texture set to the color black. Now sprite "A" is about to be rendered, so its effect is called. The result of the effect is rendered to its own texture in display size. Now the first texture and the second one are merged to the first one. Sprite "B" is now about to render, the same way as sprite "A". And it repeats for sprite "C". Finally the texture with all the other textures merged to is passed as output.

    If you would have had two layers, with "B" and "C" on layer 2 and instead of two effects for "B" and "C" you would have applied one effect to layer 2, then it would only do the black texture, sprite "A" texture and the layer 2 texture.

    A pixel shader gets a texture to work on, but isn't aware of the z-position of that texture or how many textures there might be.

    That said there might be a way with an altered version of 'Color Fusion (Masked)', but that would be a huge load for the gpu. I'm talking about 'keying'. It's something heavily used in films (look for the keywords "green screen", "blue screen", "chroma key", etc), but it is a post effect that uses a lot of processor power. It would be possible to enhance CF(M) in a way that it ignores a certain color and recolors and masks only those areas without that color. You would then setup your scene with a one-colored background instead of the starfield. Another layer above CF(M) would contain the starfield and an effect that replaces the key color areas with the starfield while showing the scene instead of the starfield where no key color is.

    A full HD game with two such effects might require a powerful graphics card...

    so, to the experienced constructors: Is there an easier way?

  • You are not defining in the right scope. I guess you want x, y, width, height and roomvar being members of the class and to be able to pass values to them when initializing the class?

    When using a variable name you are creating it on a global scope. To make it local you need to use 'self' within the class. Also 'width' and 'self.width' are then two different variables (they have different scope) and 'width' within the parantheses of __init__ is a parameter to that function.

    If you want a class that can be initialized with parameters {by calling something like "rd = RmDef(y=20, width=32)"} do this:

    import random
    
    class RmDef(object):	
        def __init__(self, x=0, y=0, width=0, height=0, roomvar=0):
            self.x = x
            self.y = y
            self.width = width
            self.height = height
            self.roomvar = roomvar
    
            self.roomvar = random.randint(1,3)
    			
            if self.roomvar == 1:
                self.width = random.randint(2, 4)
            elif self.roomvar == 2:
                self.width = random.randint(4, 6)
            elif self.roomvar == 3:
                self.width = random.randint(6, 8)[/code:1jsbbyde]
    If your class doesn't need initialization parameters, do this:
    [code:1jsbbyde]import random
    
    class RmDef(object):	
        def __init__(self):
            self.x = 0
            self.y = 0
            self.width = 0
            self.height = 0
            self.roomvar = 0
    
            self.roomvar = random.randint(1,3)
    			
            if self.roomvar == 1:
                self.width = random.randint(2, 4)
            elif self.roomvar == 2:
                self.width = random.randint(4, 6)
            elif self.roomvar == 3:
                self.width = random.randint(6, 8)[/code:1jsbbyde]
    
    It is good practice to always set the variables at the start of __init__ even if they won't be used at that moment. This way you don't lose overview.
  • Additionly I want to stress that you are not bound to square sizes. Any power-of-two size on width or height will suffice. Only the oldest graphics cards (generation one and maybe two) don't handle uneven sizes. All cards of the last 6 to 8 years will. So, if you have an original size of 129x257, then you don't need to convert it to something like 128x128 or 256x256. Instead it's safe to make it a 128x256 one. (And if your game will be played on a very old card by accident , it will use more VRAM but won't refuse to work, if there is enough.)

    Look at those threads for more info about that subject:

    http://www.scirra.com/forum/viewtopic.php?f=8&t=7786&p=60406#p60406

    look at the example cap in that post

    http://www.scirra.com/forum/viewtopic.php?f=3&t=7578&p=58897#p58897

  • abs(n) works on numbers, either integer or float.

    If you just need the positive value of a number, you could also do sign(n) * n

  • Thank you