R0J0hound's Recent Forum Activity

  • You could set an instance variable to self.y and use “pick highest variable”.

    Or You could add a “for each ordered by sprite.y descending” with a stop loop action.

  • Yeah, the pick2 is for the reverse case.

    The pick alls aren’t needed but I added them to show that you need all the instances to be picked for this to work. Actually, it would work if the same instances were picked in both families too.

    This is what a normal filtering condition like this:

    Sprite1: width = sprite2.width

    Expands to roughly under the hood:

    // Sprite1 and Sprite2 are lists of the current picked instances. 
    for(let i=0; i<Sprite1.length; i++) 
    if(Sprite1[i].width == Sprite2[i%Sprite2.length].width)
     Pick Sprite1[i]

    A normal filtering condition is stuff like compare width, compare x, pick by comparison, … etc. Static conditions such as is overlapping or pick nth instance do their own thing.

    Anyways the relevant bit is what instance of other types are used in the condition. In practice we tend to just filter the other types down to one instance before doing a condition like that but it can be useful when the instance counts are the same.

    Actions reference other instances in the same way and has more utility. Most useful is “sprite1: set position to sprite2” if sprite1.count=sprite2.count then each sprite2 will have a sprite1 on it. And if sprite1.count=2*sprite2.count then each sprite2 will have two sprite1 on it.

    And yep that’s how else works with picking. You’d have to use a for each to avoid that.

  • Here's an example that uses mesh distort to make any polygon. Events 4-5 are the relevant ones. It takes the points variable as a comma separated list of xy coordinates as input. It sets the mesh size to 2 x count/2, then loops over the top row, and loops backwards over the bottom row to set the points.

    construct.net/en/forum/construct-3/how-do-i-8/manipulate-mesh-points-175978

  • Here’s a rough way to do lift. Basically you find the velocity perpendicular to the wing with a dot product and apply a force from that to do lift. It’s modeled after a lift formula found on Wikipedia. You’d tune it by adjusting the lift variable.

    Var vrel=0
    Var lift = 0.01
    
    Every tick
    — set vrel to sprite.physics.velocityX*cos(sprite.angle +90) + sprite.physics.velocityY*sin(sprite.angle +90)
    — sprite: apply force -sign(vrel)*lift*vrel*vrel at angle sprite.angle+90

    Drag can be done similarly but with sprite.angle instead of sprite.angle+90, and it would have its own drag variable to tune instead of lift.

    It can probably be modeled better by scaling the lift by the width of the wing and scaling the drag by the wings height. But that would require tuning the scaling variables more. It probably could give pretty convincing motion with a wing a tail and a prop to give thrust.

    There are probably many other improvements to make the model better

  • There’s a system action now to set the collision cell size. I don’t recall what release it was added.

  • You can indirectly do it with a distort mesh since that distorts the collision poly too.

    Say you have 64 point polygon you want to use, you’d take a sprite with a square collision poly and apply a 32x2 distort and position the points to the poly. It won’t necessarily look pretty so you’d have it invisible and attach the visual on top of that.

    So apart from distorts changing or adding collision poly points nothing is setup for modifying collision polys outside the editor.

    Maybe with JavaScript but you’d have to bypass the scripting api to get into the unsupported and undocumented innards that has a has the possibility of changing per release and breaking anything you do with it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well since cellular automata usually works by looking at neighboring cells a 2d array seems like an easy choice. Guess you could use a dictionary but wouldn't you need to add an entry for each cell?

    Both arrays and dictionaries are rated O(1) for accessing data, which means with a key or index they can access the value with one lookup. So Big O notation doesn't help too much. Arrays are more memory efficient since it's just a list of values, whereas dictionaries store keys and values and there could be other dead space reserved depending how the dictionaries are implemented. But I imagine the speed difference is negligible, you'll hit other bottlenecks first.

    Personally I'd choose the one that looks cleaner.

    Arrat.at(x,y) vs Dictionary.get(x&","&y) but whatever you want to do.

    All those other data objects are just arrays and dictionaries.

    cvs and json are parse text data and then internally are just arrays, and a mix of arrays and dictionaries. Binary is just a 1d array of numbers.

  • Construct's picking system is good for filtering instances but not great when you want to compare two different instances.

    plazatin's idea could look like this:

    var other=0
    
    pick sprite instance 1
    -- set other to sprite.variable
    
    pick sprite instance 2
    sprite: variable = other
    -- do something

    If you want to compare more than one value from another instance then you could store the iid instead:

    var other=0
    
    pick sprite instance 1
    -- set other to sprite.iid
    
    pick sprite instance 2
    sprite: variable = sprite(other).variable
    -- do something

    Another common approach is to add a family with just that type, and name it otherSprite. The only caveat is you'd need to add the variables to the family to make them accessable from both sprite and otherSprite.

    pick otherSprite instance 1
    pick sprite instance 2
    sprite: variable = otherSprite.variable
    -- do something
  • Well all I can find is the SpeechSynthesisVoice JavaScript api has a list of voices you can use that varies per device. I don’t see a way to add other voices from JavaScript.

    You can find lots of sites that provide a service to use your own voice to read text but most aren’t free and all look like they generate the audio on their servers?

    One library sounded promising for making your own tts voice but the setup had around 10 steps and it wasn’t clear how you could use the voice.

    Overall seems like a complicated mess.

  • Guess you could do it by marking all the instances in a way independent of the families. Unfortunately it can’t be a variable since that’s family specific, but maybe something global like opacity, or something you aren’t using.

    So the process would be to start by marking nothing then after filtering the sol set the mark and pick the other.

     Every tick
    — family1: set opacity to 100
    
    Some event that picks instances of family1
    — family1: set opacity to 50
    
    Family2: opacity=50
    — do stuff
    
    Every tick
    — family1: set opacity to 100

    It’s a bit annoying to have to utilize opacity so you could add picked Boolean variable per family as well.

    Basically you need a picked Boolean per family you want to copy the sol from. And for this to work the families involved need to all have the same object types. Hopefully the iid order of both families is the same too.

    Then with all instances of both picked you can use pick by evaluate as an implicit loop.

    Every tick
    — family1: set picked1 to false
    — family2: set picked2 to false
    
    Some event that picks instances of family1
    — family1: set picked1 to true
    
    Pick all family1
    Pick all family2
    Pick family2 by evaluate: family1.picked1
    — do stuff

    Either method requires resetting the picked value before using again.

    Edit: iid stuff shouldn’t be needed.

  • Doesn’t look like much is available beyond what the included text to speech plugin does. Limited local voices and many voices on the cloud but there seems to be limited selection. Maybe it’s hard to make one?

    From what I can tell there are two parts to doing text to speech.

    1. Convert text to a list of phonemes (or sounds) to say the words. Basically that would be done by applying all English pronunciation rules to the text. Could be tedious but a shortcut could be to utilize a website that can do the conversion to do it with all the dialog beforehand. Would make the code simpler.

    2. Have a recorded sound of each phoneme and their length so you can play that list. English has 44 so that’s mostly busywork to record and trim the recordings. Better playback varies volume, pitch and speed to replicate speech more closely but it would require more expertise to know in what ways to do that. A pro about doing it with just sounds is you can utilize any feature the audio plug-in provides.

    A prototype of the idea could be record a few phonemes to do some words to see how it sounds. Likely it would be fairly monotone and robotic.

    State of the art seems to utilize neural networks to extract phonemes from a sample of speech and a different one to blend the phonemes together to sound less robotic. But that’s out of the scope of my knowledge.

    That said I’m just sharing some ideas. I lack the time and expertise to make a complete solution at this time.

    Edit: tried a simple test where I tried recording the individual sounds and then combining them together manually. It came out pretty rough. More research is needed.

  • If you have a screenshot of the next level and a current level screenshot you can load those onto sprites and utilize distort meshes to do the rotation. Or with a clever 3d camera rotation you could load the images onto the sides of a cube and just rotate it.

    You can take a screenshot of the current level pretty easily but to screenshot the next level you’d need to load it, and let it render a frame before taking a screenshot. But that flicker wouldn’t be nice. A possible workaround is to screenshot the start of all the levels beforehand and use those images.

    Another idea is to do your own level loading instead of doing layout changes. That would allow you to load the next level before unloading the current one. Then you’d be able to draw the new level onto a drawing canvas and use that for the second image.

    Honestly getting the images is the limiting part in construct.