Magistross's Recent Forum Activity

  • I would use permutation tables built with the AdvancedRandom plugin. One table per "matrix", with width*height (and a maximum of Globals.Destroy_Max) permutations.

    Here's a copy of your project file modified with my suggestion.

    drive.google.com/file/d/1u65oIXb1i1r-2E1awDpd3AOxyhon4cLY/view

  • Your syntax seems slightly off and I think you need to at least define one attribute of the ::-webkit-scrollbar pseudo element for the other one to kick in.

    #myIncorrectList::-webkit-scrollbar {display: inherit;} #myIncorrectList::-webkit-scrollbar-thumb { background: #d23737; border: 4px none #99a30a; border-radius: 20px; }

  • It seems Chrome's web worker stack size is smaller than the main thread. Judging by the fact that sometimes it work, sometimes it doesn't, you are probably barely over the limit. So depending on the RNG, your recursive function Road_Destroy might cause a stack overflow.

    I suggest rewriting the function in an iterative manner (using a while). Less function calls means less overhead added to the call stack.

    Also, this particular function sometimes do nothing if the RNG select the same road twice or more, wasting numerous operations. It might not be noticeable in CPU time, but it probably explain why the recursive function sometimes caused the exception. It could be rewritten so it only select "undeleted" road every time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I see. I am trying to replicate chunks of what you did in my project to understand what you've done and wrap my head around it but I am failing quite a bit. So one thing I am doing is the below:

    The Get expression of the JSON object can only return string or numeric values. The expression you written actually returns an object and C3 can't deal with that so it defaults to 0. You can however use GetAsBeautifiedString or GetAsCompactString to get objects in JSON format.

    Would you say in that case, XML would work better?

    It's pretty much the same I would say. Altough XPath is probably easier, it has the same caveats in terms of iterating. If you use "for each node" for a particular XPath, you can't use "stop loop" and that's a bummer.

    Personally, I'm partial to JSON, simply for that fact that I find it more concise.

    Would you say it would be less of a headache if I try to write this one thing (searching for the correct component) in JS and attach it as a script instead?

    Indeed, if you feel confortable with scripting, you could replicate what I did in a much less convulated manner.

    The JSON plugins expose an API that makes it easier to do interactions between event sheets and scripts, if you go that way.

    construct.net/make-games/manuals/construct-3/scripting/scripting-reference/plugin-interfaces/json

  • Here are some answers to your questions :

    1- This function only returns the index of a specific recipe name inside the JSON. It's useful to build the JSON Path to other properties of a given recipe, namely the components and the quantity needed.

    2- That's precisely it. The "stop loop" system action cannot stop loops other than system loops. It's useful to stop iterating through the JSON if you already found what you wanted. It can optimize speed a bit, given a much bigger JSON file and components list. However it also has the drawback of making the syntax a little bit harder to read and write.

    3- loopindex("components") means the loopindex of the "components" system loop. However, it is not needed since there is only one active loop at that point. I used nested loops at first, but changed it afterward. I could have removed the ("components") part and used JSON.Get("recipes." & recipeIndex & ".components." & loopindex & ".name") instead. For the first component of the first recipe, it translates to "recipes.0.components.0.name" and returns "Wormwood". The same statement would be written "recipes[0].components[0].name" in normal javascript. C3 use a peculiar syntax to access an array's items.

    4- That's right. I could have used an "else event" and used 2 actions instead of one but a ternary operator was more concise and still readable. C3 format for the ternary operator is indeed the same as C# or Javascript.

  • Feeling this was right up my alley I took a stab at it using the provided recipes JSON exemple.

    I use an array to store the currently owned components. "Crafting" recipes in this exemple simply remove the components, but in real use case you'd add it to your inventory of course !

    drive.google.com/file/d/1F1jzwfNWpln8CbLtyPz5jnK6pyh9uwJm/view

  • I'm trying to generate random numbers that don't repeat

    Construct 3 introduced the Advanced Random plugin that can do exactly that. Using a permutation table, it should be really easy to do.

    Example :

    Result :

  • The manual section pertaining to Dictionary and project files could indeed use a bit a of an addendum on how to load and use project files in dictionaries and the likes.

    When you use project files, your first reflex should be to add the AJAX object immediately. That's the only vanilla way of using said files to load stuff.

    Documentation on AJAX object : construct.net/make-games/manuals/construct-3/plugin-reference/ajax

    Basically, you use the "request project file" action, and when the request is completed, you can load the expression AJAX.LastData inside your dictionary.

  • It has to use a tilemap, but the tilemap itself can be hidden. When you build your world, you'd have to sync the tilemap with each sprite placed, and you can use a simple binary tilemap to do so (empty tile for passable terrain and filled tile for obstacle).

  • What could work is temporarily disabling your method of input to "continue" the dialogue, every time it is used to skip.

    This way you limit how fast a dialogue can be skipped through.

  • I think this is an outstanding issue with the SpriteFont plugin. Turning on high quality scaling (scaling before rendering) and using linear sampling seems to misalign the spritefont's sprite and screw the proper "tiling" of letters.

    I recommand either using point sampling or low quality scaling to circumvent the problem.

  • Isometric movement can be simply implemented with a "Custom" movement and dealing with each of the 9 movement possibilities (8 directions + stopping). You basically replicate an 8 directions movement but systematically set the vertical speed to half the "normal" value.

    Here's a rather simple exemple.

    drive.google.com/file/d/1uaA4pFmVPtippjllw-KPo4J-oOcJ52v-/view

Magistross's avatar

Magistross

Member since 4 Jul, 2011

Twitter
Magistross has 14 followers

Trophy Case

  • 13-Year Club
  • Entrepreneur Sold something in the asset store
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

20/44
How to earn trophies