dop2000's Forum Posts

  • I am using dictionaries.AsJSON inside of arrays, and then the arrays are stored as JSON inside another array

    It's a very inefficient way to store data, like you said escaping " with backslashes is probably making 80% of the entire string. I don't think compressing the string with zlib will magically reduce its size from 30KB to 1KB. I suggest you change the way the data is stored. Use just one array or JSON. Don't nest JSONs inside of JSONs inside of JSONs.

    In this game many thousands of objects are stored in a single JSON file. I'm using a string like this, which is pretty compact and easy to read:

    {
     "island1": {
     "objects": [
     {"o": "Tree,animationname","x": 100,"y": 200},
     {"o": "Rock,animationname","x": 405,"y": 112}
     ]
     },
     "island2": {...}
    }
    
  • It depends on how levels are built in your game and what information you need to store in the string. For example, if there are three object types players can place on a 50x30 grid, then you can encode the entire grid into a string 1500 characters long, where letters A-C represent an object and a dot represents an empty cell:

    A.A...BAC.....A.B..CBB.ABC.CCB....

    Another totally different approach is to upload the string to an online service like Pastebin.com

    When you upload a string, you get a unique URL, which can be used to download this string. So people can share and exchange URLs in Discord, instead of full strings.

    Both uploading and downloading from Pastebin can be done with AJAX.

  • One thought is to put all my sprites into a family and then trying pick last created [family]

    This is the right method, I use it all the time.

    I tried doing a for loop from 0 to family.AllChildCount but this only returned a single iteration of the loop. It is not properly counting (or detecting) the family's children.

    AllChildCount expression is related to hierarchies. Family "children" are usually called members, and unfortunately there is no way to get a list of all family members in events. You can make your own list of members, for example with an array.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • oosyrag haha, I too still learning basic things about Construct. A few weeks ago someone told me that the default order of instances is based on their zIndex, not on their UID or the order they were added to the layout. I always thought that an instance with IID=0 is the instance with the lowest UID. (facepalm)

    By the way, the order of conditions is especially important when using "For each" loops. I prefer picking the instances first, then iterating them, I believe it's better for performance:

    Enemy is on screen
    Enemy is overlapping Zone
    For Each Enemy 
    ......
    
  • I believe you can echo this variable in the php. And then in your Construct project you will be able to get it in the AJAX response. Use "On AJAX completed" event and AJAX.LastData expression should contain that value.

  • You can set the layer as Global, then all objects from it will appear on all layouts where you add a layer with this name.

    Another option is to use hierarchies. Select all objects of the help window, right-click on the parent object (for example WindowBackground sprite) and add all other objects to the hierarchy. Then you will be able to create the entire hierarchy in runtime - WindowBackground will be created with all its children. This way you can store the whole help window on an unused layout and only spawn it when needed.

    I actually have a separate layout "DialogueAssets" in my project with dozens of hierarchies for different menus, dialogue and popup windows etc.

  • The order of conditions in an event is important. This will check the condition once, and if it's true, repeat the loop 10 times:

    Condition
    Repeat 10 times
    

    This will repeat the loop 10 times, every time checking the condition:

    Repeat 10 times
    Condition
    

    You can also use sub-events to make it more clear:

    Repeat 10 times
    ... // sub-event
    ... Condition
    
  • There was a paid plugin Box2D+ for C2 which had collision filtering and tons of other useful features. I wish someone could port that plugin for C3.

  • I have to post a link to he Youtuber 'Wanderbots' gameplay video.

    That's a great video, but he's playing an old version of the game and he skipped the tutorial. That's why he has no idea what to do, but it's actually more fun this way :)

  • Thanks! Yes, it's made entirely in C3!

  • Thank you! :)

  • can I make it only turn clockwise? and how would I add a sound effect to it?

    You can disable event #5 in my example ("Else") to only turn clockwise.

    And play a sound, say every 0.1s while the sprite is rotating.

  • The file may be corrupted. Try renaming .C3P extension to .ZIP and opening with Windows or WinZip.

  • From the task manager. Where else can I see this memory footprint?

  • You can use this method: