What causes sudden, erratic gameplay?

Just started using Construct 2? Post your questions here

Post » Sun May 01, 2016 6:00 am

What causes sudden, erratic gameplay? 95% of the time, the game works fine but occasionally, my sprites would go haywire and act like lunatics. How do I avoid this? I would hate to publish something and have this problem for the users.
B
13
S
4
G
1
Posts: 54
Reputation: 1,440

Post » Sun May 01, 2016 6:16 am

Because we don't see any image or video or any deep down details of this problem, we will not be able to help you at all.

How about post some video of this problem on youtube and give us a link so we know what you are talking about? Also, provide us a cut down version of your capx if possible.
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,469

Post » Mon May 09, 2016 5:57 am

If you have alot of timers in the game that could happen. Or if you have multiple programs running at once on your computer that could effect gameplay too.
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613

Post » Tue May 10, 2016 3:04 pm

Does it grind to a halt before doing that?

Anyway, as @TwinBlazar said, can you show us a YouTube clip of it? What does debugging say?
In development: Avalon Isle
B
12
S
4
G
1
Posts: 44
Reputation: 1,496

Post » Sat May 14, 2016 7:09 pm

Sorry for the super delayed response. Here's the video:

https://www.dropbox.com/s/tq9c7l8ctszfw ... 1.mp4?dl=0

Game play: Pressing 1 has a set jump to land on platform 1 and pressing 2 has a set jump to land on platform 2. These are the only keys in game play.

Some things wrong:

The platforms should stop at the same spot on the left side every single time. There's a hidden sprite there and "on collision" everything stops moving, but it seems that the platforms go past this hidden sprite sometimes.

But most importantly:

If you skip to the end of the video, you can clearly see one of the platforms spaz out and move much quicker and stop much closer than it's supposed to. Every platform lands where the 1 and 2 are, nowhere else.

I didn't get THIS on video but there have been instances where the cat would go flying when I hit 1 or 2. Sometimes when I hit 1, it would jump as if it I hit 2, and sometimes when I hit 2, it would go FLYING off screen. And of course, sometimes the cat would just do a vertical leap and land back on the original platform.

I'm just wondering WHY this happens (it happens in both regular AND debugging mode). The CPU usage according to the debugging mode is 2.5 mb which is MUCH less than the suggested 100.
B
13
S
4
G
1
Posts: 54
Reputation: 1,440

Post » Sun May 15, 2016 2:47 pm

When a platform is moving at a certain speed it will go through solid objects and there is nothing you can do, unless you slow down pressing the right numbers. Your going to have to come up with a different method. My time is kinda crunched right now but if I get time I will come up with a different method. The invisible box method will not work when the speed of platforms is to high.
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613

Post » Sun May 15, 2016 3:09 pm

Dude its done only 2 lines of code to make player jump forward and for the moving land to move without invisible object. Apply this to your game and your golden here is the capx. file download.

http://www31.zippyshare.com/v/sL6oJKVN/file.html
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613

Post » Sun May 15, 2016 7:55 pm

@pixelPower, I don't think that solves the problem.

Here's a shot of how the jump works:

https://www.dropbox.com/s/e6k6og9b2ewvynh/jump.png?dl=0

The cat jumps up and forward. When it lands on the platform, EVERYTHING on screen moves. So the cat and all platforms (even invisible ones) move. When the platform touches the invisible 'home base', EVERYTHING stops moving. Everything is moving at the same speed and stops at the same time. No platform should be moving faster or slower than any other platform.
B
13
S
4
G
1
Posts: 54
Reputation: 1,440

Post » Mon May 16, 2016 3:56 am

At least from watching your video, you should expect diminished performance whenever debug is open. The "inspect" tab of debug can get REALLY cpu-intensive and will cause issues like this with fast-moving objects. There's no way around that, it's processing a crapload of stuff. It should be used for checking values and profiling stuff, never for actual gameplay comparison. The lag introduced by the debugger clearly makes the object miss or pass through your objects. This is both expected for stuff moving too quickly and a side effect of lag spikes. If it's always moving to the same Y value and the same timings, I don't think ANYTHING in your game should rely on collisions but just straight math and values.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Mon May 16, 2016 4:35 am

LanieCoder wrote:@pixelPower, I don't think that solves the problem.

Here's a shot of how the jump works:

https://www.dropbox.com/s/e6k6og9b2ewvynh/jump.png?dl=0

The cat jumps up and forward. When it lands on the platform, EVERYTHING on screen moves. So the cat and all platforms (even invisible ones) move. When the platform touches the invisible 'home base', EVERYTHING stops moving. Everything is moving at the same speed and stops at the same time. No platform should be moving faster or slower than any other platform.


Ok look at the code of course your player jumping method is different, I just did a different jump method to save time. But look at the platform code, that will work in your game. All you have to do is play with the values of the block movement and put it in your game.
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests