oosyrag's Forum Posts

  • This is my first foray into utilizing a third party library - github.com/gorhill/Javascript-Voronoi/blob/master/rhill-voronoi-core.js

    The project file is here - dropbox.com/s/dr6abkphr8k4egd/Noise%20graph.c3p

    I have a Construct array of size n,2,1 where x and y coordinates are recorded at y=0 and y=1 respectively, while the x index is each set of coordinates.

    The script requires input in the following format - [{x:300,y:300}, {x:100,y:100}, {x:200,y:500}, {x:250,y:450}, {x:600,y:150}] - which I believe is a JSON array of objects (I'm also not particularly familiar with JSON).

    I've got another possibly unrelated issue where in the project the contents of the Construct array can be utilized fine in the project and when viewed in the debug preview, but when setting text to Array.asJSON the output is empty of contents.

    How should I best proceed to format and pass the data in the Construct array to the script function? I'm not against storing the coordinates in a different manner if it would simplify interfacing with the script, I'm just most familiar with using Construct arrays.

  • This is default behavior on android. For usability reasons, the back button should always consistently get you back to the home screen eventually.

    I believe you can interrupt this flow, against Google design recommendations, by opening a dialogue when the back button/guesture is called asking if the user is sure they want to quit. If the back button is pressed while the dialogue is open, it simply closes the dialogue.

    Basically make a situation where the back button is handled by an event/action of your own choosing at all times. Iirc there were also JavaScript options to disable the back button completely, but that would be decidedly unfriendly to your end users.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Normally you would have two sets of graphics/textures for your assets that the game option determines which to use, rather than simply changing the rendering mode.

  • How are you placing or generating your box positions in the first place?

    It would be most straightforward in a 1d array. You can increment the index in a loop until you run into an empty cell, or 0. Subtract 1 from that index and you'll have the position of the last number in a given set, which you can then swap with whatever you started with. The same loop can continue iterating through the entire array to swap every set of numbers it finds.

  • Chowdren is a name that has come up before. They have experience porting construct projects that have made commercial releases.

    construct.net/en/forum/construct-2/general-discussion-17/chowdren-fast-construct-134395

  • I've updated the example to include populating and displaying an array with the cell node coordinates.

    Unfortunately, after researching various Delaunay triangulation algorithms, I've found them to be beyond my ability to implement.

    I did find a JS library of Fortune's algorithm, which should work nicely. github.com/gorhill/Javascript-Voronoi/blob/master/rhill-voronoi-core.js

    Now to learn how to utilize external libraries in C3...

  • construct.net/en/make-games/manuals/construct-3/plugin-reference/browser

    On back button

    Triggered when the user presses the device's 'Back' button. Note not all devices have this button (e.g. iOS devices only have a 'Home' button) and not all platforms support this trigger.

  • I meant I suspect the official advanced random plugin was developed by Nepeo, since he was the one that wrote the blog post for it when it came out. But I think he's not with Scirra anymore?

  • After connecting to the signalling server, you can use the request room list action.

    Subsequently, you'll be able to use the on room list trigger condition. In that event, the various listroom expressions can get you information like if a room exists or already has one connected user (host) or not. Use that as a condition before allowing a user to join a room.

  • It's in the browser object, on back button condition.

  • I found https://en.wikipedia.org/wiki/Fortune%27s_algorithm?wprov=sfla1 when reading about Delaunay triangulation, I don't know if you're familiar with it, but I think that's what you want for deciding which lines to draw to make polygons.

    Also after sleeping on it, I realized building the point set from the plugin is easier than I imagined. In the example project, every value is plotted one pixel at a time into the canvas object already anyways. It should be simple to add a check for each pixel when drawing it. If it has no neighbors with a value lower than it, push that coordinate into an array. You'll then have an array with all the cell centers coordinates within the bounds of your relevant noise area, which you can use to moveto, snap to, draw on, run Delaunay triangulation or Fortune's algorithm on, ect.

    If you're following www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/, and want more control over the randomness distribution, I believe you need to run the Lloyd relaxation algorithm on the points before the noise is generated and then apply your own noise algorithm on those points afterwards. This won't work with the advanced random plugin, because that noise map would not take into account the new "relaxed" points. On the other hand, it LOOKS like (Nepeo?) already baked in one or two iterations of it into the advanced random plugin for cellular/Voronoi noise, since those don't look quite as clumpy as completely random nodes.

  • I believe this is still accurate, but probably not too critical for most users.

    construct.net/en/forum/construct-2/how-do-i-18/pick-newly-dynamically-99468

    Afaik that the actions following a created object, for that object, are exclusive to the newly created object in that event regardless of currently picked objects. The list of currently picked objects carries over to subsequent sub events as normal, but does not include the newly created object.

    The key is that newly created objects, outside of the immediate event they are created in, cannot be picked normally until the next top level event.

    Using the on created trigger, and the system pick last created condition will give you finer control.

    The normal way to pick and manipulate multiple instances of the same object involves using families. If you put the object into a family then you will be able to pick and reference between the sprite object and the family object.

  • Alternatively, as I always like to suggest, use an invisible helper sprite object pinned to the text object. Putting them in a container together would help facilitate picking as well.

  • I got the cell centers. Next to get the vertices. dropbox.com/s/dr6abkphr8k4egd/Noise%20graph.c3p

    reddit.com/r/proceduralgeneration/comments/mriko7/reverse_worleyvoronoi_noise

    Basically followed the first reply for finding the local minimum by checking each adjacent pixel iteratively. Might be resource intensive to do so in real time? But should be negligible if you do it one time on start of layout to build an array with all the node coordinates.

    The second reply would be how to proceed to get vertices.

    Third reply seems to be an elegant way to extrapolate the nearest minimum or maximum by just comparing the neighbors of a single point and their slopes. I vaguely understand the concept, but haven't really wrapped my head around how to implement it.

  • Thought about this some more... Since cellular noise and Voronoi noise using the same seed results in the same cells, you can run a search from any given point using the cellular noise data. Check each adjacent pixel (or other arbitrary resolution) from that point to see which has a higher value, loop until you reach the highest value. That would be the origin of that cell, which can be transposed on to the Voronoi noise map.

    If you have a set of node coordinates for each cell, you can use Delaunay triangulation to build a second set of coordinates, which would be the vertices. From those you can define edges which would be the cell borders.