R0J0hound's Forum Posts

    • Post link icon

    I will continue to use it for the foreseeable future until there is something else that can replace it’s enjoyable niche for me. The end of support isn’t a worry for me.

    I don’t really have projects so I guess I’m not the typical customer. I just like tinkering with tiny projects here and there.

  • Well here’s the general idea how you can do it.

    Currently, it creates a grid of points over a sprite (at least in my example). Then it uses a loop to do all the edges between the points in an automated fashion. All the edges have a fixed length.

    The change needed is to make each edge length customizable. You could make it even calculate the lengths from the distances between the points.

    Seems unwieldy to me though. And very tedious to have to define the length of each edge.

  • The example just did a grid mesh of points and edges since that’s fairly simple to do, results in a nice uniform simulation and finally because it matches what c3 can do with its distort mesh, which also is a uniform grid.

    You could conceivably put points anywhere you wanted and have edges all over. The issue is it’s tedious to setup. Also it wouldn’t be simple to make work with the distort mesh.

    Just thinking aloud though.

    Where there’s a use case and an interest to do it there’s a way. What you want to do is still vague.

  • You’re welcome

  • As for the math part, sin and cos in construct take degrees and not radians like in that example.

    So just multiply the values inside the sin and cos by 180/pi and it should be correct. No idea if it’s the same noise function though.

  • Here's the example using an array.

    dropbox.com/s/1hevbeddf81x3u6/grid_motion_array.capx

    The array has 1 if something is at that grid space and 0 if nothing is there. That's initially setup at the start of layout.

    motion logic is basically this:

    want to move right?
    is right grid position empty?
    -- set current grid position to empty
    -- set right grid position to full
    -- start move

    You then look at the sprites in order as you have with "for each ordered".

  • I probably explained it poorly. The gist is to not check the objects current position for collisions, but the position it’s moving to.

  • On further thought you can avoid the array entirely. You just need another sprite for each moving sprite to be for collision detection. The idea is that additional sprite is where the moving sprite will be going and can be used for collision detection.

    Here's a c2 example that can load into c3. The tilemovement behavior isn't in c2 so i did it with events.

    dropbox.com/s/mnci1fyhtbimjlm/grid_motion.capx

  • One solution is to remove the solid behavior completely and do your collision detection yourself. An array can be useful for this since its grid based. Then you fill the array with wherever the objects are. The trick is when you move an object to update its position in the array to the goal position so it’s old position is free for other objects to move onto.

    The setup of the array could look like this:

    Start of layout:

    — Array: set size to (layoutWidth/32, layoutHeight/32, 1)

    ——array: for each xy

    —— compare tile at(array.curx,array.cury)=-1

    ———array: set (array.curx,array.cury) to 1

    —— for each fmotion

    ———array: set (fmotion.x/32,fmotion.y/32) to 1

    Then before simulating moving left for instance, you’d check if that spot was free, and if it was simulate the key press and update the array.

    Array at (fmotion.x/32-1, fmotion.y/32) =0

    — fmotion: simulate left pressed

    — array: set (fmotion.x/32, fmotion.y/32) to 0

    — array: set (fmotion.x/32-1, fmotion.y/32) to 1

    It would be very similar for the other three directions. You’d use that with the for each ordered logic you already have.

    That’s at least one idea. There may be clever ways to make it simpler. The issue with the solid behavior is it doesn’t know how to handle moving objects.

  • Test 4:

    Circuit simulator via "Node Voltage method"

    dropbox.com/s/qfnx3hsg1imuoks/mesh_circuit.capx

    An offshoot of some recent forum topics. It allows you to build a circuit out of batteries, resistors and wires. Then it figures out the voltages of each node and visualizes the current flow.

    Controls:

    * left click drag nodes, resistors and batteries.

    * right drag to make wires between nodes, or right drag from empty space to cut.

    * batteries and resistors can be dropped onto wires.

    * right click on batteries to reverse them.

    * double click to destroy node, or create new one.

  • I’m going to have to pass on this one and defer to other users that use c3 and are familiar with how to use the mesh distort feature.

    I’m avoiding using c3 so I’m not really much help here.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You probable should do "set mesh" at the start of the layout or something. It may keep resetting things there. besides, it would be set to the width and height of the array.

    And what are those two additional -1's in "set mesh point"? If they are uv's they could take i/(array.width-1) and j/(array.height-1) as values. If they are something else ignore that.

  • Well in the verlet_cloth_paster.capx the distortion is drawn in events 15-17. Those are the only parts dependent on the paster plugin. Remove the paster plugin and the capx should be openable in c3 since only vanilla features are used then.

    I don't use c3 so I won't be making a cp3 example, but as i understand it you can make it work with distortion mesh with one action added to event 16. Somewhere you'll also want to set the x and y divisions of the mesh distort to cloth.resx and cloth.resy.

    for each cloth
    array: for each xy element
    -- set i to array.curx
    -- set j to array.cury
    -- cloth: set distortion point (i,j) to (p(Array.At(i,j)).x, p(Array.At(i,j)).y)
  • Hi,

    What are the issues you’re encountering?

  • Looked around the web for a bit on how electronic simulators typically work. Seems the basis of it is Ohm's law (I=V/R) or in more useful terms: Current=(voltageOut-voltageIn)/resistance. That can be used to see how voltage changes when moving through a component.

    For a simple ring of components with one battery, you should be able to just start with the positive on the battery and loop around till the negative is reached. Just use ohm's law at each component, and if negative can't be reached then stop since there is no complete circuit.

    The general case with branches is a bit more interesting. Found this topic on it that seems to give a good starting point. Looks like it's done by solving a system of linear equations. To do this in construct we could store the system in an array, and implement an algo to solve it.

    electronics.stackexchange.com/questions/91416/how-do-circuit-simulators-actually-work

    I can see it working if everything is connected in loops. Not sure if it handles dead ends and loops without batteries. Might have to do some pruning beforehand.

    Anyways, seems to be a rabbit hole for sure when making a circuit simulator.