AI jumping. Testing and help.

For questions about using Classic.

Post » Thu Dec 02, 2010 7:50 pm

So I'm trying to teach this square how to jump properly on it's own. I've got it working well on my computer, but it seems like it doesn't work for anyone else. So if you could try this thing and post the results I'd be very thankful. Press R to restart. (Don't mind the ones that falls into the gaps, if one guy makes it then it works.)


I get the feeling the problems are related to the way the built in platform movement works. Anyone who knows what could cause this irregularity? Also, for me it works like 19/20 times with V-synced, but never gets to the end with fixed or unlimited framerate. I use a calculation to determine the strength of the jump, which shouldn't be able to fail as far as i know, but somehow it still quite big mistakes from time to time. I don't need pixel-perfect, but I'd like to know where the problem lies and how i can narrow it down to something i can work with. I'd really prefer not having to use a custom movement since it's going to be tricky with lots of enemies.

http://dl.dropbox.com/u/930918/jumps.exe

If you'd like to help me and need more info, pm me and I'll send you the .cap.

Help is very appreciated.
Jonatan
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Thu Dec 02, 2010 8:53 pm

Only got 2 winners on about 20 runs. Most of the time they can't get past N5.
Is it a TimeDelta problem?
B
4
S
1
G
2
Posts: 91
Reputation: 1,057

Post » Thu Dec 02, 2010 9:48 pm

Might be a timedelta problem. I don't really understand fully how the platform movement interacts with the rest of construct.. that's pretty much what i need help figuring out.

For most people it seems to fail at n.5.
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Fri Dec 03, 2010 12:19 pm

Out of exactly 20 runs i got 0 winners. :(
B
7
S
2
G
4
Posts: 164
Reputation: 2,418

Post » Fri Dec 03, 2010 3:47 pm

After a bunch of resets without ever passing nr 5 I exited the app. But then I changed my mind, restarted the app but clicked too fast and the app ran in the background. Immediatly I had a winner. I then started to test a few running conditions for the app. Here are my results:

(1) Starting the app
[list:sd2gzb46]No winner after many tries. It always fails at 5[/list:u:sd2gzb46]
(2) Starting the app, set the windows focus to another thread, but don't cover the app's window
[list:sd2gzb46]The rate of winners raises strongly. Fails are either at 3 or at 5[/list:u:sd2gzb46]
(3) Starting the app, set the windows focus to another thread, and cover the app's window
[list:sd2gzb46]Same results as (2)[/list:u:sd2gzb46]
(4) Starting the app, set the windows focus to another thread, and cover the app's window, but randomly force the app to draw again by moving the covering window away
[list:sd2gzb46]Highest rate of winners. Almost always it works. The rare times it fails, it is at either 3 or 5[/list:u:sd2gzb46]

I don't know what to think about this. It is strange.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Fri Dec 03, 2010 7:09 pm

Yeah, that's really strange. I'm working on an alternative solusion now, using beizer curves for the jumps, but if possible I'd much rather use this method.

If any of the programmers see this, please give me your thoughts about what the problem might be.
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Fri Dec 03, 2010 9:59 pm

It does come down to frame rate. I posted this on the bug tracker a couple of months ago. Unfortunately my monitor can't run any other frame rates to test it a bit more. Here is the link to the bug tracker artifact


http://sourceforge.net/tracker/?func=de ... id=1003219
B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Post » Sun Dec 05, 2010 6:12 pm

try checking override time-delta in application properties? then the platform behavior will be frame rate Dependant.
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Sun Dec 05, 2010 6:29 pm

Thanks for the tip quazi, I'll try and see how it affects things.

I think i found some problems in the code messing up as well. Try this version and see how it does.

http://dl.dropbox.com/u/930918/Jump2.exe

edit: Here's with override timedelta. Seems like that fixed the randomness. Thanks quazi! Now the question is if I'll be able to build a good game on something that requires that box to be checked.

http://dl.dropbox.com/u/930918/timedeltaOverride.exe
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Sun Dec 05, 2010 8:18 pm

I did some tests to shed some light on the cause.

The max y position reached when jumping can be calculated with the following formula:
[code:1lcbmjqd]StartingY - (jumpStrength^2)/(2 * gravity)[/code:1lcbmjqd]
It seems that the platform behavior goes about 20 pixels higher than what is calculated when running 60fps.
I switched to unlimited framerate and it was only higher by 2 pixels on my computer.

The platform behavior seems to have a more accurate jump height with higher framerates, and a less accurate one with lower framerates.

Here's my test of the platform movements jump height with two other methods of computing motion.
[url:1lcbmjqd]http://dl.dropbox.com/u/5426011/examples3/JumpTest.cap[/url:1lcbmjqd] made in 0.99.96

A workaround could be to set gravity to zero and manually change the vertical velocity every tick with a more accurate method like Verlet.

Hope some of this is helpful.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest