So my game doesn't restart properly anymore... and more!

This forum is currently in read-only mode.
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Today I wanted to complete the final stage of my minigame, music! I downloaded a program, made some music to try it out, added it in my game while tweaking the actual game a bit and now after a player gets gameover, the problem occurs. On the Gameover layout, you click 'Play Again?' and then it takes you back to the main menu where everything is reseted back to the initial state. Then I start the game, but it takes 5-10 seconds for anything to happen!I backtracked, checking what I must've done wrong, but it still failed to restart properly.

    This is the layout order: Menu > Game > Gameover > Menu

    That's fine and all, I must've done a mistake. Now for the absurd part. Since a couple of days ago, everytime I make an .exe, I make a new one. So now I have four. The first three prior to adding the music were working fine and restarting properly and my brother who tested the game said it ran fine. Now, not only does the cap file and the fourth .exe not run properly, they all have the same error! The hell? Is that even possible?! Did it always not work or am I losing my mind?

    I'm sorry if this is hard to understand but I'm in a hurry as I have football training in 5 mins! I'll send the .cap by PM in 2-3 hours for anyone who's willing to help.

  • Check if you're not duplicating anything on "Play Again?". You have to clean the old game objects up. The slowdown hints to a large number of objects being processed, even if it doesn't look like that.

  • Check if you're not duplicating anything on "Play Again?". You have to clean the old game objects up. The slowdown hints to a large number of objects being processed, even if it doesn't look like that.

    I don't have access to my PC now (on laptop) but from what I recall, after running it in debug mode, the number of objects throughout are reasonable. Once when I was testing the game it did crash and say out of memory even though everything appeared normal. Don't the objects get cleared after a layout change?

    Since I'm back from football training (I lost half a fingernail) I'll explain more:

    The game starts from the start of the menu and at the start of the layout, it resets all necessary global variables to their original value. From the main menu I click begin to start the game. Immediately an enemy spawns from one of the four points, completely random on the first playthrough. When the HP runs out, it takes me to the Gameover layout, where you can click 'Play Again' or 'Quit'. If you select 'Play Again", it takes me to the menu and from there everything is reset again. So I click on begin and one enemy, always from the same position spawns (this only happens on the second playthrough for some odd reason). After that, it takes 10-20 seconds before another is spawned while is should only take 4-5 seconds. I'm not sure why, as in debug mode all the variables look normal and the FPS is at a constant 60.

    Wait, I remembered something: in debug mode, on the second playthrough, it was only when the variables moved the actual game began, so it seems something is stopping them to run immediately, even though they're reset again on the Game layout.

    I thought it might have been an issue with my graphics card initially (it's 95% dead), but after copying the .exe files to my laptop the same issues occur. I'll try solving the issue again later on and if I find the issue I'll give an update.

  • Update: Didn't find a solution, but did get a couple of errors and weird glitches. One glitch I know was becuase of my graphics card, since it happens while playing Team Fortress 2 and many other games, but for the others I'm lost.

    I tried it out once and on the third playthrough (not restarting, just clicking 'Play Again'), one of the spawn sprites moved to the middle of the screen where the player starts out at the start of the game... I have no idea why, but it's the same spawn sprite which always spawns an enemy first on the second playthrough (but that's not even happening anymore...). So I closed it and opened it again and that glitch with the spawn sprite relocating didn't happen, but when I got to my fourth playthrough this error appeared:

    A crash inside the runtime has been intercepted! The crash may be a bug in Construct. Please report this to Scirra.

    I'd love to report the bug but I'm not exactly sure what I'd be reporting

    If it helps, I also got this error when trying to edit an event sheet (happens to several actually):

    An invalid argument was encountered.

    Well, I'll go cry in the corner now

    EDIT: After realizing the game is taking longer to load on each playthrough I decided to take a time trial.

    First playthrough: Immediately

    Second: 18 seconds

    Third: 40 seconds

    Fourth: Didn't get it

    Fifth: 2 minutes 32 seconds!

    I think you're right Mipey, it does seem to be a memory issue.

  • I see, so the issue is with time periods of spawns. Have you checked the timer variables and TimeDelta? Since this stuff was introduced with music, have you tried disabling the music event?

    It is possible that after replays the timers (or loops) are somehow messed up, most likely by referring to a bloated variable.

    Let's assume this order, see if I understood you:

    • First play, everything normal, spawns on 4-5 second, DEATH, prompt for replay.
    • First replay, spawns on 4-5 seconds... on end of this game, you're prompted again.
    • From here on, things start misbehaving, long spawns but FPS is fine

    What is the difference between first and subsequent replays? The first one is CLEAN, it came straight from the first game. Others followed a replay. Following that train of thought, hopefully you can figure the error out.

  • The invalid argument is fixed, in the next build.

  • I see, so the issue is with time periods of spawns. Have you checked the timer variables and TimeDelta? Since this stuff was introduced with music, have you tried disabling the music event?

    It is possible that after replays the timers (or loops) are somehow messed up, most likely by referring to a bloated variable.

    Let's assume this order, see if I understood you:

    - First play, everything normal, spawns on 4-5 second, DEATH, prompt for replay.

    - First replay, spawns on 4-5 seconds... on end of this game, you're prompted again.

    - From here on, things start misbehaving, long spawns but FPS is fine

    What is the difference between first and subsequent replays? The first one is CLEAN, it came straight from the first game. Others followed a replay. Following that train of thought, hopefully you can figure the error out.

    All's correct except that on the first replay things start to misbehave. I put down the times of just how long it's taking, but I think you posted your message before I edited it in. As to what is different, I've checked several times but found nothing that I'd imagine will make the load times insanely high (won't hurt to check again ). Is there a way to manually clear all the objects or memory used by the game? Doesn't a layout change do this automatically? I know it does it with private variables.

    The invalid argument is fixed, in the next build.

    That's good to hear

  • Have you tried putting in a text object tracking the total object count? The runtime can give 'out of memory' errors if you continuously create objects and don't destroy them. All objects except ones marked global are destroyed when you change a layout, so if you're spawning a lot of global objects, they will still exist after you change layout.

    If you send me your .cap (to ) I can take a look and see what's going on. You'd need to provide clear instructions though and make it simple to see the problem (sometimes people send me really complicated games and say "just get to level 15, then...")!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have you tried putting in a text object tracking the total object count? The runtime can give 'out of memory' errors if you continuously create objects and don't destroy them. All objects except ones marked global are destroyed when you change a layout, so if you're spawning a lot of global objects, they will still exist after you change layout.

    If you send me your .cap (to ) I can take a look and see what's going on. You'd need to provide clear instructions though and make it simple to see the problem (sometimes people send me really complicated games and say "just get to level 15, then...")!

    Tried the text object counter idea, still showed no abnormal results. Email sent with lots of information explaining what's going on.

    Thank you!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)