narFsnw's Recent Forum Activity

  • Hi,

    What is the expected behavior for Construct to pick objects when the object was created in a separated block?

    I created this little test. It creates an object and then try to pick it in different ways.

    (see the full image: https://dl.dropboxusercontent.com/u/313 ... et%201.png)

    What I'm wondering is why the "Pick all xxxx" doesn't catch the newly created object.

    Here's the link to my capx: https://dl.dropboxusercontent.com/u/313 ... reate.capx

  • In other words, it's exactly the same issue as this one:

    ...but it now requires the game to be relaunched (closing or refreshing the tab or using the "reload" button in the debugger) for the issue to happen.

  • Oh my god! I'm so blind!!

    It was right there all along! In the list of System conditions!

    For the reference, here's where it is:

    Add condition > System > Is value type

  • One solution could be to write a function that would check, character by character, if they are all digits or all letters. But I'm trying to know if there's already a function built it. Something like function isNumber() or isNaN(). Is there anything like that?

  • I have a function that receive 2 parameters: a number and a string.

    Because I'm dumb when I code (happens to everybody!), I sometime send the parameter inverted: the number instead of the string and the string in place of the number.

    I want to make this function stupid proof by checking if the parameter received are indeed of the right type. Something like:

    If type of function.param(0) == "number"
    --> browser.log("Incorrect parameter")
    
    If type of function.param(1) == "text"
    --> browser.log("incorrect parameter")[/code:3akx0gtu]
    
    How can I do that? How can I check the type of a variable?
  • The issue have been submitted here:

  • Problem Description

    Memory leak (or save file leak?): the "collmemory" section of a savefile gets larger and larger after the game has been closed, relaunched and loaded from a savefile.

    Attach a Capx

    https://dl.dropboxusercontent.com/u/313 ... empty.capx

    Description of Capx

    Spawn objects that are destroyed on collision with another object. The capx also autosave every 1 sec and output the savefile to the browser console.

    Steps to Reproduce Bug

    • Launch the game (Layout "menu").
    • Click on the "New Game" button.
    • Open the browser console: The game saves and output the savefile every 1 sec in the console.
    • Notice that the section "collmemory" (near the bottom) stays empty.
    • Close the game (close the entire tab running the game).
    • Re-launch the game (Layout "menu").
    • Click on the "Load" button
    • Observe the browser console again: the "collmemory" section in the savefile gets bigger and bigger.

    Observed Result

    Memory leak in the savefile: the "collmemory" section keep expending.

    Expected Result

    No memory leak in the savefile: the "collmemory" section doesn't expend.

    Affected Browsers

    • Chrome: (YES)
    • Internet Explorer: (YES)

    Operating System and Service Pack

    Windows 8.1

    Construct 2 Version ID

    r206, 64bits

  • Ah! I finally managed to reproduce the issue in a small capx. I'll write a new bug report in a moment...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley Unfortunately, i'm sad to report that the fix does not entirely solve the issue. It did solve the issue in R0J0hound 's small test capx, but in the context of my game, the issue still occur. Some (not all) "collmemory" sections keep expending.

    Problem is, depite my best efforts, I've been unable so far to reduce my project to a small capx that would contain just the issue. Starting from an empty capx, I'm just unable to reproduce the issue. Starting from my game and removing stuff, the issue comes and goes without me being able to understand it.

    Any ideas or advices?

  • Yup! That worked! It cleans every collmemory now. Excellent!

    Here's the final line, as a reference:

    RegexReplace(SaveStateJSON, """collmemory"":\{.*?\}", "g", """collmemory"":{}")[/code:2vsjvf20]
    
    I really need to learn regex for real!
  • Very good idea, R0J0hound !

    One thing though: do you know why it only clean the first collmemory and not the others? I'm not good enough with regular expressions to see why, but right now, it only clean the first collmemory.

  • So, if I understand correctly from what you're saying, the issue will continue to occurs (the savefile will get bigger) unless my players erase their savefile and start a new one?

narFsnw's avatar

narFsnw

Member since 20 Oct, 2013

None one is following narFsnw yet!

Connect with narFsnw

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies