Squish's Forum Posts

  • Ok so what I think you're trying to do is add speech samples to supplement the text.

    So:

    (I'm using example paths and so on, but just substitute for your data structure).

    On start of period "blah1"

    Xaudio2 autoplay file "Audio\Speech\NPC\bob_blah1.wav"

    Play the sound file.

    Set Variable_Holder_SpriteObject.value('Last_Speech") to xaudio.lastplayed

    This saves the number of the last channel in a variable holder object, substitute with a global if that's your preference. This is so that you can stop the specific sound playing if the player skips this line of dialogue.

    Dialog_text write "What began as a conflict over the transfer of consciousness from mind to machine would escalate into a war that would span over 4,000 years, and destroy thousands of worlds"

    Type the actual dialogue into the text box. Adjust speed to match your sound file.

    On end of period "blah 1"

    Xaudio stop channel Variable_Holder_SpriteObject.value('Last_Speech')

    On start of period "blah2"

    rinse, lather, repeat.

  • fixed

  • I just found a major snafu that has been there since probably around the time I started using Construct, as I found it way back in my backups from weeks ago. (I've only been using construct about 1-2 months). It was probably the result of me experimenting with Construct itself, before I had any idea how some features work.

    The idea for this thread is to create a reference of silly mistakes that will probably help others, and will be a general source of amusement also.

    Here are some of my bonehead mistakes:

    Put the keyboard/mouse object as a container with another object. For months I thought it Construct was tying player control to the first created controllable object. I made all kinds of work arounds to keep that object alive so that keyboard controls would still be there on the next run. *facepalm*

    (the problem here is that when the object is destroyed, the keyboard/mouse object is also destroyed due to the container behaviour - and hence no kb/m control).

    Somehow managed to put random(50) into the initial value of a private variable. This crashed the hell out of Construct but ONLY after I'd uncovered and fixed another bug that was essentially suppressing this.

    Inappropriate use of 'while's

    Never use while, unless you ABSOLUTELY understand exactly what it does and why it's there.

    Granted though, I was experimenting mostly but I found one in there that was eating a lot of CPU time and causing issues because I'd forgotten about it. Removing it had no effect on the behaviour of the items but freed up quite a bit of CPU time.

    Post your own crazy Construct screwups.

  • It certainly is, but you'll need to be a lot more specific for anyone to be able to help you.

  • That makes sense. If you use "get angle between point A and Point B" (and then rotate the result 180� so that it's the opposite direction) and then apply force, you should have a radial push outwards.

  • There is already a warning when you remove a global variable. It states "any events tied to this variable will be removed"

    On any moderately complex event sheet it's going to be quite difficult to definitively find where that might be, and sometimes the search doesn't quite catch everything.

    It would be nice to have a list of events/actions/expressions that are tied to that variable presented when deleting.

    Eg.

    Global('MyVar') is used in:

    Line 44 - if Myvar = 10 set text "You're FANTASTIC player!"

    Line 230 - (Always) set myvar = 5

  • I used to do that too until I read the wiki page on optimising.

    My project is usually at about 70-80% CPU waiting, so as the tutorial explains, improving CPU efficiency in events isn't going to amount to anything.

    This sort of problem is better left to the pros, I surmised .

  • I've made any number of bonehead mistakes that boil down to one simple logic problem like that.

  • It would have been better to leave your original post in so that others can make use of your newfound wisdom.

  • It will pick all the sprites with x > 0.

    You can add more conditions under the loop for loop specific refinements

    eg.

    For each sprite

    PV "something" = n -> do stuff

    If you put the other condition above the for each, Construct will pick all of those first, and then do the for each. I don't know if it makes much difference, but I find it to be more reliable if the conditions are under the loop.

  • Hmm. I haven't tried this specific scenario, but I did make a kind of physics based explosion by spawning multiple instances of a physics enabled object, and adding force via events to each one.

    Possibly, you could use an explosion sprite that grows outward, and use collision events to add force, although this is just musing and I haven't tried anything remotely like it.

    Another thing with physics objects is that they don't like overlapping at all. They tend to fly out violently when stuck on top of each other.

    Always: physics object overlaps explosion sprite

    Set physics object x to explosion sprite x

    Set physics object y to explosion sprite y

    If more than one overlaps, the physics engine will fling them outwards unpredictably. I don't know if this is any use - but perhaps it will inspire more ideas.

  • Inspired by another post, I am reminded of some difficulties I had with playing Mp3s.

    Specifically - the MP3s would work just fine on my main computer, but when played on another computer most of the time some tracks would play and others wouldn't. I couldn't seem to nail it down to one particular operating system or codec suite either.

    In the end, I eventually (and accidentally, to an extent) noticed that some of the source MP3s were in 48000 khz - which in some respects isn't a standard frequency. I decoded the MP3's to .wav and converted the sample rates from 48,000,16-bit,stereo to 44,100/16/s and the problem vanished. I was able to use either VBR or CBR (variable/constant bitrate) and each would work fine. It was just that the 48,000 bps was causing compatibility issues.

    Traditional standard frequencies

    11025 khz

    22050 khz all either stereo/mono and 16/8 bit

    44100 khz

    CD Audio is 44,100, 16-bit, stereo. DAT tapes pushed this a little at 48,000 khz but didn't really manage to catch on, and the original MP3 specification tends to bug out with anything other than the standard frequencies.

    I don't know what the case is with OGGs for music, but it's a pity because OGG is an excellent format, (I just hate the name).

  • Why would you need to use a .wav for music, by the way? It's pretty simple to convert to MP3 or even OGG (although OGG is having dramas at the moment). If you're concerned about quality, you can use high rate MP3 (320kbps VBR) which seems to work quite well in my testing. During the game, having high-quality music is a bit of a waste anyway with all the sound effects mixed in.

    Just make sure your source wavs use standard frequencies:

    11025, 22050, 44100

    16 bit

    mono/stereo

    I'll put a detailed post in help/tech support in case others are having problems.

  • This probably isn't very helpful, but you can either use the sprite font plugin or pre-render your text as a .png and create a tiled background (instead of a sprite - which if I understand correctly will use more vram).

    It's dirty, but it gets around the font/text issues until the devs have had time to iron out the bugs in Construct.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Throughout the course of developing my Construct project I've created a number of handy little bits and pieces that would almost certainly serve some use to others in the future.

    I would like an area on the Construct wiki site where users can submit useful components for others to use.

    For example. I built a high-score table, and it is reasonably solid and adjustable. (Ie. Instead of using hard-coded numbers, it uses loops to count the number of columns/rows in the given array). This could save someone a lot of work and bugtesting for their own projects.

    I also designed a nice little slider that can set an arbitrary number between 1 and whatever you desire. The output is thrown into a visible text box that can be read by other events/actions. I've also created dial style controls that do the same thing (they're used for angles).

    Now I need a place where I (and others) can share these useful components that doesn't require digging through hundreds of posts in the forum. I have indeed seen the "Sorry, you can't search right now - try again in a few minutes" message more than enough times.