Does anyone know of, or have implemented, a physics engine which runs
smoothly in Android?
I have spent the last couple of days trying Phys2D and JBox2D, however
both perform very poorly - I am struggling to get even a few objects
to simulate smoothly as frequent garbage collection spoils it.
One question I do have is will these run smoother on an actual G1
device or is the performance of the emulator accurate?
I have a simple 2D physics engine written and running. It uses
the now famous Jacobson physics tricks (Verlet integration and hard
constraints). I can manage 40 balls on the screen, with fill n^2
interaction between balls. I am working on spatial data structure
optimizations now to improve the computational complexity of the
collision detection code. I run the constraint update loop five times
per frame and get 30 frames per second. Once the engine is up and
running there are no memory allocations done in my program. And once
the system settles down from the app launch there are very few GC
events from other programs. Though they do still happen. Viewing
LogCat I see a GC every 10 or 20 seconds because of some background
application. But between those events I get a consistent frame rate.
I am using OpenGL for my rendering.
-Anton
On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> Does anyone know of, or have implemented, a physics engine which runs
> smoothly in Android?
> I have spent the last couple of days trying Phys2D and JBox2D, however
> both perform very poorly - I am struggling to get even a few objects
> to simulate smoothly as frequent garbage collection spoils it.
> One question I do have is will these run smoother on an actual G1
> device or is the performance of the emulator accurate?
> I have a simple 2D physics engine written and running. It uses
> the now famous Jacobson physics tricks (Verlet integration and hard
> constraints). I can manage 40 balls on the screen, with fill n^2
> interaction between balls. I am working on spatial data structure
> optimizations now to improve the computational complexity of the
> collision detection code. I run the constraint update loop five times
> per frame and get 30 frames per second. Once the engine is up and
> running there are no memory allocations done in my program. And once
> the system settles down from the app launch there are very few GC
> events from other programs. Though they do still happen. Viewing
> LogCat I see a GC every 10 or 20 seconds because of some background
> application. But between those events I get a consistent frame rate.
> I am using OpenGL for my rendering.
> -Anton
> On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > Does anyone know of, or have implemented, a physics engine which runs
> > smoothly in Android?
> > I have spent the last couple of days trying Phys2D and JBox2D, however
> > both perform very poorly - I am struggling to get even a few objects
> > to simulate smoothly as frequent garbage collection spoils it.
> > One question I do have is will these run smoother on an actual G1
> > device or is the performance of the emulator accurate?
Could be good. I tried to check out the demo but it crashed my
browser. :) I'm sure that's not really indicative of the engine, and
more of my browser's stability. I did look through the code and found
that it does a lot of memory allocation in it's inner loops (Verlet
update step in particular), and that it uses floating point math,
though it looks like there is a branch that uses fixed point that
might be worth trying out.
-Anton
On Mar 30, 2:41 pm, Streets Of Boston <flyingdutc...@gmail.com> wrote:
> On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > I have a simple 2D physics engine written and running. It uses
> > the now famous Jacobson physics tricks (Verlet integration and hard
> > constraints). I can manage 40 balls on the screen, with fill n^2
> > interaction between balls. I am working on spatial data structure
> > optimizations now to improve the computational complexity of the
> > collision detection code. I run the constraint update loop five times
> > per frame and get 30 frames per second. Once the engine is up and
> > running there are no memory allocations done in my program. And once
> > the system settles down from the app launch there are very few GC
> > events from other programs. Though they do still happen. Viewing
> > LogCat I see a GC every 10 or 20 seconds because of some background
> > application. But between those events I get a consistent frame rate.
> > I am using OpenGL for my rendering.
> > -Anton
> > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > Does anyone know of, or have implemented, a physics engine which runs
> > > smoothly in Android?
> > > I have spent the last couple of days trying Phys2D and JBox2D, however
> > > both perform very poorly - I am struggling to get even a few objects
> > > to simulate smoothly as frequent garbage collection spoils it.
> > > One question I do have is will these run smoother on an actual G1
> > > device or is the performance of the emulator accurate?
> Could be good. I tried to check out the demo but it crashed my
> browser. :) I'm sure that's not really indicative of the engine, and
> more of my browser's stability. I did look through the code and found
> that it does a lot of memory allocation in it's inner loops (Verlet
> update step in particular), and that it uses floating point math,
> though it looks like there is a branch that uses fixed point that
> might be worth trying out.
> -Anton
> On Mar 30, 2:41 pm, Streets Of Boston <flyingdutc...@gmail.com> wrote:
> > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > I have a simple 2D physics engine written and running. It uses
> > > the now famous Jacobson physics tricks (Verlet integration and hard
> > > constraints). I can manage 40 balls on the screen, with fill n^2
> > > interaction between balls. I am working on spatial data structure
> > > optimizations now to improve the computational complexity of the
> > > collision detection code. I run the constraint update loop five times
> > > per frame and get 30 frames per second. Once the engine is up and
> > > running there are no memory allocations done in my program. And once
> > > the system settles down from the app launch there are very few GC
> > > events from other programs. Though they do still happen. Viewing
> > > LogCat I see a GC every 10 or 20 seconds because of some background
> > > application. But between those events I get a consistent frame rate.
> > > I am using OpenGL for my rendering.
> > > -Anton
> > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > Does anyone know of, or have implemented, a physics engine which runs
> > > > smoothly in Android?
> > > > I have spent the last couple of days trying Phys2D and JBox2D, however
> > > > both perform very poorly - I am struggling to get even a few objects
> > > > to simulate smoothly as frequent garbage collection spoils it.
> > > > One question I do have is will these run smoother on an actual G1
> > > > device or is the performance of the emulator accurate?
That's what I did. :) Firefox 3.0.8. I just tried it again and
had the same thing happen. I'll give it another go when I get home
and have my development machine at my disposal.
By the way, nice name. :) Always good to meet a fellow Anton.
-Anton
On Mar 30, 4:01 pm, Streets Of Boston <flyingdutc...@gmail.com> wrote:
> On Mar 30, 5:59 pm, Anton <socialhac...@gmail.com> wrote:
> > Could be good. I tried to check out the demo but it crashed my
> > browser. :) I'm sure that's not really indicative of the engine, and
> > more of my browser's stability. I did look through the code and found
> > that it does a lot of memory allocation in it's inner loops (Verlet
> > update step in particular), and that it uses floating point math,
> > though it looks like there is a branch that uses fixed point that
> > might be worth trying out.
> > -Anton
> > On Mar 30, 2:41 pm, Streets Of Boston <flyingdutc...@gmail.com> wrote:
> > > I wonder how well this one works on Android:
> > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > > I have a simple 2D physics engine written and running. It uses
> > > > the now famous Jacobson physics tricks (Verlet integration and hard
> > > > constraints). I can manage 40 balls on the screen, with fill n^2
> > > > interaction between balls. I am working on spatial data structure
> > > > optimizations now to improve the computational complexity of the
> > > > collision detection code. I run the constraint update loop five times
> > > > per frame and get 30 frames per second. Once the engine is up and
> > > > running there are no memory allocations done in my program. And once
> > > > the system settles down from the app launch there are very few GC
> > > > events from other programs. Though they do still happen. Viewing
> > > > LogCat I see a GC every 10 or 20 seconds because of some background
> > > > application. But between those events I get a consistent frame rate.
> > > > I am using OpenGL for my rendering.
> > > > -Anton
> > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > Does anyone know of, or have implemented, a physics engine which runs
> > > > > smoothly in Android?
> > > > > I have spent the last couple of days trying Phys2D and JBox2D, however
> > > > > both perform very poorly - I am struggling to get even a few objects
> > > > > to simulate smoothly as frequent garbage collection spoils it.
> > > > > One question I do have is will these run smoother on an actual G1
> > > > > device or is the performance of the emulator accurate?
On Tue, Mar 31, 2009 at 2:19 AM, Anton <socialhac...@gmail.com> wrote:
> That's what I did. :) Firefox 3.0.8. I just tried it again and
> had the same thing happen. I'll give it another go when I get home
> and have my development machine at my disposal.
> By the way, nice name. :) Always good to meet a fellow Anton.
> -Anton
> On Mar 30, 4:01 pm, Streets Of Boston <flyingdutc...@gmail.com> wrote:
> > Try the demo on firefox. It works really well.
> > On Mar 30, 5:59 pm, Anton <socialhac...@gmail.com> wrote:
> > > Could be good. I tried to check out the demo but it crashed my
> > > browser. :) I'm sure that's not really indicative of the engine, and
> > > more of my browser's stability. I did look through the code and found
> > > that it does a lot of memory allocation in it's inner loops (Verlet
> > > update step in particular), and that it uses floating point math,
> > > though it looks like there is a branch that uses fixed point that
> > > might be worth trying out.
> > > -Anton
> > > On Mar 30, 2:41 pm, Streets Of Boston <flyingdutc...@gmail.com> wrote:
> > > > I wonder how well this one works on Android:
> > > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > > > I have a simple 2D physics engine written and running. It uses
> > > > > the now famous Jacobson physics tricks (Verlet integration and hard
> > > > > constraints). I can manage 40 balls on the screen, with fill n^2
> > > > > interaction between balls. I am working on spatial data structure
> > > > > optimizations now to improve the computational complexity of the
> > > > > collision detection code. I run the constraint update loop five
> times
> > > > > per frame and get 30 frames per second. Once the engine is up and
> > > > > running there are no memory allocations done in my program. And
> once
> > > > > the system settles down from the app launch there are very few GC
> > > > > events from other programs. Though they do still happen. Viewing
> > > > > LogCat I see a GC every 10 or 20 seconds because of some background
> > > > > application. But between those events I get a consistent frame
> rate.
> > > > > I am using OpenGL for my rendering.
> > > > > -Anton
> > > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > Does anyone know of, or have implemented, a physics engine which
> runs
> > > > > > smoothly in Android?
> > > > > > I have spent the last couple of days trying Phys2D and JBox2D,
> however
> > > > > > both perform very poorly - I am struggling to get even a few
> objects
> > > > > > to simulate smoothly as frequent garbage collection spoils it.
> > > > > > One question I do have is will these run smoother on an actual G1
> > > > > > device or is the performance of the emulator accurate?
> > > > > > Thanks- Hide quoted text -
> > > > > - Show quoted text -- Hide quoted text -
I did take a look at Simpull, however the demo application failed to
run as it relied on some library which wasn't supplied or referenced
to - I just got annoyed after spending two days failing to get Phys2D
and JBox2D to work in Android and didn't bother trying to work out the
problems!
I might give it another look though...
On Mar 30, 10:41 pm, Streets Of Boston <flyingdutc...@gmail.com>
wrote:
> On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > I have a simple 2D physics engine written and running. It uses
> > the now famous Jacobson physics tricks (Verlet integration and hard
> > constraints). I can manage 40 balls on the screen, with fill n^2
> > interaction between balls. I am working on spatial data structure
> > optimizations now to improve the computational complexity of the
> > collision detection code. I run the constraint update loop five times
> > per frame and get 30 frames per second. Once the engine is up and
> > running there are no memory allocations done in my program. And once
> > the system settles down from the app launch there are very few GC
> > events from other programs. Though they do still happen. Viewing
> > LogCat I see a GC every 10 or 20 seconds because of some background
> > application. But between those events I get a consistent frame rate.
> > I am using OpenGL for my rendering.
> > -Anton
> > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > Does anyone know of, or have implemented, a physics engine which runs
> > > smoothly in Android?
> > > I have spent the last couple of days trying Phys2D and JBox2D, however
> > > both perform very poorly - I am struggling to get even a few objects
> > > to simulate smoothly as frequent garbage collection spoils it.
> > > One question I do have is will these run smoother on an actual G1
> > > device or is the performance of the emulator accurate?
> I did take a look at Simpull, however the demo application failed to
> run as it relied on some library which wasn't supplied or referenced
> to - I just got annoyed after spending two days failing to get Phys2D
> and JBox2D to work in Android and didn't bother trying to work out the
> problems!
> I might give it another look though...
> On Mar 30, 10:41 pm, Streets Of Boston <flyingdutc...@gmail.com>
> wrote:
> > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > I have a simple 2D physics engine written and running. It uses
> > > the now famous Jacobson physics tricks (Verlet integration and hard
> > > constraints). I can manage 40 balls on the screen, with fill n^2
> > > interaction between balls. I am working on spatial data structure
> > > optimizations now to improve the computational complexity of the
> > > collision detection code. I run the constraint update loop five times
> > > per frame and get 30 frames per second. Once the engine is up and
> > > running there are no memory allocations done in my program. And once
> > > the system settles down from the app launch there are very few GC
> > > events from other programs. Though they do still happen. Viewing
> > > LogCat I see a GC every 10 or 20 seconds because of some background
> > > application. But between those events I get a consistent frame rate.
> > > I am using OpenGL for my rendering.
> > > -Anton
> > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > Does anyone know of, or have implemented, a physics engine which runs
> > > > smoothly in Android?
> > > > I have spent the last couple of days trying Phys2D and JBox2D, however
> > > > both perform very poorly - I am struggling to get even a few objects
> > > > to simulate smoothly as frequent garbage collection spoils it.
> > > > One question I do have is will these run smoother on an actual G1
> > > > device or is the performance of the emulator accurate?
Not tried but if you can provide us with some example source code or
put something on the market, I'm sure we could take a look.
G1 performance is significantly faster than emulator, but there are
limitations.
Particularly with garbage collection and memory allocation on code
that gets run continuously in loops, so I don't know how optimised
these physics engines are for this purpose.
Would be interesting to find out though.
On Mar 31, 12:52 pm, mscwd01 <mscw...@gmail.com> wrote:
> "Has anyone tested Phys2D or JBox2D on an actual device to see if they
> run better than on the emulator?
> I have a feeling the performance will better on a G1 than the emulator
> for some reason!
> On Mar 31, 12:51 pm, mscwd01 <mscw...@gmail.com> wrote:
> > I did take a look at Simpull, however the demo application failed to
> > run as it relied on some library which wasn't supplied or referenced
> > to - I just got annoyed after spending two days failing to get Phys2D
> > and JBox2D to work in Android and didn't bother trying to work out the
> > problems!
> > I might give it another look though...
> > On Mar 30, 10:41 pm, Streets Of Boston <flyingdutc...@gmail.com>
> > wrote:
> > > I wonder how well this one works on Android:
> > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > > I have a simple 2D physics engine written and running. It uses
> > > > the now famous Jacobson physics tricks (Verlet integration and hard
> > > > constraints). I can manage 40 balls on the screen, with fill n^2
> > > > interaction between balls. I am working on spatial data structure
> > > > optimizations now to improve the computational complexity of the
> > > > collision detection code. I run the constraint update loop five times
> > > > per frame and get 30 frames per second. Once the engine is up and
> > > > running there are no memory allocations done in my program. And once
> > > > the system settles down from the app launch there are very few GC
> > > > events from other programs. Though they do still happen. Viewing
> > > > LogCat I see a GC every 10 or 20 seconds because of some background
> > > > application. But between those events I get a consistent frame rate.
> > > > I am using OpenGL for my rendering.
> > > > -Anton
> > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > Does anyone know of, or have implemented, a physics engine which runs
> > > > > smoothly in Android?
> > > > > I have spent the last couple of days trying Phys2D and JBox2D, however
> > > > > both perform very poorly - I am struggling to get even a few objects
> > > > > to simulate smoothly as frequent garbage collection spoils it.
> > > > > One question I do have is will these run smoother on an actual G1
> > > > > device or is the performance of the emulator accurate?
I'll try and wrap my Phys2D & JBox2D examples into a .apk sometime.
I'm very busy at the moment though so it may be later in the week by
the time I get to do it. I'll provide a link in this thread if I get
to do it.
Other than that, i'll have to wait until the HTC Magic is released
soon ;)
On Mar 31, 2:49 pm, "admin.androidsl...@googlemail.com"
<admin.androidsl...@googlemail.com> wrote:
> Not tried but if you can provide us with some example source code or
> put something on the market, I'm sure we could take a look.
> G1 performance is significantly faster than emulator, but there are
> limitations.
> Particularly with garbage collection and memory allocation on code
> that gets run continuously in loops, so I don't know how optimised
> these physics engines are for this purpose.
> Would be interesting to find out though.
> On Mar 31, 12:52 pm, mscwd01 <mscw...@gmail.com> wrote:
> > Oh I forgot to re-ask...
> > "Has anyone tested Phys2D or JBox2D on an actual device to see if they
> > run better than on the emulator?
> > I have a feeling the performance will better on a G1 than the emulator
> > for some reason!
> > On Mar 31, 12:51 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > I did take a look at Simpull, however the demo application failed to
> > > run as it relied on some library which wasn't supplied or referenced
> > > to - I just got annoyed after spending two days failing to get Phys2D
> > > and JBox2D to work in Android and didn't bother trying to work out the
> > > problems!
> > > I might give it another look though...
> > > On Mar 30, 10:41 pm, Streets Of Boston <flyingdutc...@gmail.com>
> > > wrote:
> > > > I wonder how well this one works on Android:
> > > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > > > I have a simple 2D physics engine written and running. It uses
> > > > > the now famous Jacobson physics tricks (Verlet integration and hard
> > > > > constraints). I can manage 40 balls on the screen, with fill n^2
> > > > > interaction between balls. I am working on spatial data structure
> > > > > optimizations now to improve the computational complexity of the
> > > > > collision detection code. I run the constraint update loop five times
> > > > > per frame and get 30 frames per second. Once the engine is up and
> > > > > running there are no memory allocations done in my program. And once
> > > > > the system settles down from the app launch there are very few GC
> > > > > events from other programs. Though they do still happen. Viewing
> > > > > LogCat I see a GC every 10 or 20 seconds because of some background
> > > > > application. But between those events I get a consistent frame rate.
> > > > > I am using OpenGL for my rendering.
> > > > > -Anton
> > > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > Does anyone know of, or have implemented, a physics engine which runs
> > > > > > smoothly in Android?
> > > > > > I have spent the last couple of days trying Phys2D and JBox2D, however
> > > > > > both perform very poorly - I am struggling to get even a few objects
> > > > > > to simulate smoothly as frequent garbage collection spoils it.
> > > > > > One question I do have is will these run smoother on an actual G1
> > > > > > device or is the performance of the emulator accurate?
Sorry guys for the demo being out of whack for Simpull to the Core.
The version of PulpCore that I integrated simpull with did not support
Chrome, but you should be able to see it in IE, FF Safari. It is nice
to take a look at that demo to get a feel for what the engine is
capable of, but the performance does not translate over to the fixed
point branch/version of simpull when running on Android.
I ran tests on both the emulator and the actual device and there was a
significant increase in performance because of the fixed point
implementation, but I got very frustrated that it still did not
support the amount of objects in a scene that I considered good for a
physics-based game. It seemed to handle ~10 objects moving and
colliding OK. It has been a while since I was playing with it, so I
do not really remember the exact number of objects or the frame rate.
I mostly remember being upset with it.
I am leaving the physics ideas for games out of the picture when
thinking Android for now. Someone would have to write a ground up
engine with all the performance and memory concerns of Android in
mind, which was not the case with Simpull.....I created it for
applets, then thought to port over to fixed-point for Android. It
works well with small scenes, but certainly not the staple engine to
use in my opinion.
Also, Phys2D will not run worth a damn on Android. I tried it and I
even went through some heavy performance tuning. Garbage collection
is the major issue even after all I did. I seriously doubt JBox2D
will run well either. I'll stick to what I said earlier, a ground-up
solution by someone smarter than me is probably required.
On Mar 31, 9:49 am, "admin.androidsl...@googlemail.com"
<admin.androidsl...@googlemail.com> wrote:
> Not tried but if you can provide us with some example source code or
> put something on the market, I'm sure we could take a look.
> G1 performance is significantly faster than emulator, but there are
> limitations.
> Particularly with garbage collection and memory allocation on code
> that gets run continuously in loops, so I don't know how optimised
> these physics engines are for this purpose.
> Would be interesting to find out though.
> On Mar 31, 12:52 pm, mscwd01 <mscw...@gmail.com> wrote:
> > Oh I forgot to re-ask...
> > "Has anyone tested Phys2D or JBox2D on an actual device to see if they
> > run better than on the emulator?
> > I have a feeling the performance will better on a G1 than the emulator
> > for some reason!
> > On Mar 31, 12:51 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > I did take a look at Simpull, however the demo application failed to
> > > run as it relied on some library which wasn't supplied or referenced
> > > to - I just got annoyed after spending two days failing to get Phys2D
> > > and JBox2D to work in Android and didn't bother trying to work out the
> > > problems!
> > > I might give it another look though...
> > > On Mar 30, 10:41 pm, Streets Of Boston <flyingdutc...@gmail.com>
> > > wrote:
> > > > I wonder how well this one works on Android:
> > > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > > > I have a simple 2D physics engine written and running. It uses
> > > > > the now famous Jacobson physics tricks (Verlet integration and hard
> > > > > constraints). I can manage 40 balls on the screen, with fill n^2
> > > > > interaction between balls. I am working on spatial data structure
> > > > > optimizations now to improve the computational complexity of the
> > > > > collision detection code. I run the constraint update loop five times
> > > > > per frame and get 30 frames per second. Once the engine is up and
> > > > > running there are no memory allocations done in my program. And once
> > > > > the system settles down from the app launch there are very few GC
> > > > > events from other programs. Though they do still happen. Viewing
> > > > > LogCat I see a GC every 10 or 20 seconds because of some background
> > > > > application. But between those events I get a consistent frame rate.
> > > > > I am using OpenGL for my rendering.
> > > > > -Anton
> > > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > Does anyone know of, or have implemented, a physics engine which runs
> > > > > > smoothly in Android?
> > > > > > I have spent the last couple of days trying Phys2D and JBox2D, however
> > > > > > both perform very poorly - I am struggling to get even a few objects
> > > > > > to simulate smoothly as frequent garbage collection spoils it.
> > > > > > One question I do have is will these run smoother on an actual G1
> > > > > > device or is the performance of the emulator accurate?
On Mar 31, 6:49 am, "admin.androidsl...@googlemail.com"
<admin.androidsl...@googlemail.com> wrote:
> Not tried but if you can provide us with some example source code or
> put something on the market, I'm sure we could take a look.
Perhaps putting it on a website rather than the Market would be best.
The market already has plenty of "Tests" and "demos" that are not
really intended for the average user. Just upload it to a website
somewhere, provide us with the link and then group members can test it
out on actual hardware.
As others have mentioned, the emulator is much slower than the actual
hardware, as most emulators are unless the processor on the host
system is fast enough. A game I was working on ran horribly slow in
the emulator, but ran at about 50 FPS on the G1 hardware. Anyways,
nothing beats testing on the actual hardware. Emulation and
simulation are good to start, but you should always move on to the
actual hardware for final testing.
Right. The single biggest issue is GC. I guess if vectors and all
other objects, which are frequently created, get pulled out of an
object pool, and reused (that's quite tricky though, because of the
explicit "returnToPool" call) all engines will shine. In several
places, temporary/scratch objects can be used for results, e.g.:
Vector2f v = someComputation(...) can be rewritten as
Vector2f v = someComputation(mScratchVector, ...);
but there are still places, where objects need to allocated, and an
object pool (preferably an intrusive one, which requires classes to
have prev/next links/nodes) would be the only way.
On Tue, Mar 31, 2009 at 5:28 PM, shaun <shashepp...@gmail.com> wrote:
> I am the author of simpull.
> Sorry guys for the demo being out of whack for Simpull to the Core.
> The version of PulpCore that I integrated simpull with did not support
> Chrome, but you should be able to see it in IE, FF Safari. It is nice
> to take a look at that demo to get a feel for what the engine is
> capable of, but the performance does not translate over to the fixed
> point branch/version of simpull when running on Android.
> I ran tests on both the emulator and the actual device and there was a
> significant increase in performance because of the fixed point
> implementation, but I got very frustrated that it still did not
> support the amount of objects in a scene that I considered good for a
> physics-based game. It seemed to handle ~10 objects moving and
> colliding OK. It has been a while since I was playing with it, so I
> do not really remember the exact number of objects or the frame rate.
> I mostly remember being upset with it.
> I am leaving the physics ideas for games out of the picture when
> thinking Android for now. Someone would have to write a ground up
> engine with all the performance and memory concerns of Android in
> mind, which was not the case with Simpull.....I created it for
> applets, then thought to port over to fixed-point for Android. It
> works well with small scenes, but certainly not the staple engine to
> use in my opinion.
> Also, Phys2D will not run worth a damn on Android. I tried it and I
> even went through some heavy performance tuning. Garbage collection
> is the major issue even after all I did. I seriously doubt JBox2D
> will run well either. I'll stick to what I said earlier, a ground-up
> solution by someone smarter than me is probably required.
> On Mar 31, 9:49 am, "admin.androidsl...@googlemail.com"
> <admin.androidsl...@googlemail.com> wrote:
>> Not tried but if you can provide us with some example source code or
>> put something on the market, I'm sure we could take a look.
>> G1 performance is significantly faster than emulator, but there are
>> limitations.
>> Particularly with garbage collection and memory allocation on code
>> that gets run continuously in loops, so I don't know how optimised
>> these physics engines are for this purpose.
>> Would be interesting to find out though.
>> On Mar 31, 12:52 pm, mscwd01 <mscw...@gmail.com> wrote:
>> > Oh I forgot to re-ask...
>> > "Has anyone tested Phys2D or JBox2D on an actual device to see if they
>> > run better than on the emulator?
>> > I have a feeling the performance will better on a G1 than the emulator
>> > for some reason!
>> > On Mar 31, 12:51 pm, mscwd01 <mscw...@gmail.com> wrote:
>> > > I did take a look at Simpull, however the demo application failed to
>> > > run as it relied on some library which wasn't supplied or referenced
>> > > to - I just got annoyed after spending two days failing to get Phys2D
>> > > and JBox2D to work in Android and didn't bother trying to work out the
>> > > problems!
>> > > I might give it another look though...
>> > > On Mar 30, 10:41 pm, Streets Of Boston <flyingdutc...@gmail.com>
>> > > wrote:
>> > > > I wonder how well this one works on Android:
>> > > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
>> > > > > I have a simple 2D physics engine written and running. It uses
>> > > > > the now famous Jacobson physics tricks (Verlet integration and hard
>> > > > > constraints). I can manage 40 balls on the screen, with fill n^2
>> > > > > interaction between balls. I am working on spatial data structure
>> > > > > optimizations now to improve the computational complexity of the
>> > > > > collision detection code. I run the constraint update loop five times
>> > > > > per frame and get 30 frames per second. Once the engine is up and
>> > > > > running there are no memory allocations done in my program. And once
>> > > > > the system settles down from the app launch there are very few GC
>> > > > > events from other programs. Though they do still happen. Viewing
>> > > > > LogCat I see a GC every 10 or 20 seconds because of some background
>> > > > > application. But between those events I get a consistent frame rate.
>> > > > > I am using OpenGL for my rendering.
>> > > > > -Anton
>> > > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
>> > > > > > Does anyone know of, or have implemented, a physics engine which runs
>> > > > > > smoothly in Android?
>> > > > > > I have spent the last couple of days trying Phys2D and JBox2D, however
>> > > > > > both perform very poorly - I am struggling to get even a few objects
>> > > > > > to simulate smoothly as frequent garbage collection spoils it.
>> > > > > > One question I do have is will these run smoother on an actual G1
>> > > > > > device or is the performance of the emulator accurate?
Thanks for your feedback Shaun, I too unfortunately think a bespoke
engine will need to be written for Android, which is a real pity as
the iPhone has several physics engines which can easily handle
hundreds of objects.
Having said that Anton (2nd reply) has said he has an engine running,
it would be nice to see a demo of this if that'd be possible?
Clark, i'd definately host any .apk's on my own site, I wouldn't put
it on the marketplace if it wasn't a "finished" app - do people
actually do that?!
I think i'll stay away from developing games with physics for the time
being and concentrate on something else, I cant see it being feasible
to include it any time soon which is a real pity.
On Mar 31, 3:28 pm, shaun <shashepp...@gmail.com> wrote:
> Sorry guys for the demo being out of whack for Simpull to the Core.
> The version of PulpCore that I integrated simpull with did not support
> Chrome, but you should be able to see it in IE, FF Safari. It is nice
> to take a look at that demo to get a feel for what the engine is
> capable of, but the performance does not translate over to the fixed
> point branch/version of simpull when running on Android.
> I ran tests on both the emulator and the actual device and there was a
> significant increase in performance because of the fixed point
> implementation, but I got very frustrated that it still did not
> support the amount of objects in a scene that I considered good for a
> physics-based game. It seemed to handle ~10 objects moving and
> colliding OK. It has been a while since I was playing with it, so I
> do not really remember the exact number of objects or the frame rate.
> I mostly remember being upset with it.
> I am leaving the physics ideas for games out of the picture when
> thinking Android for now. Someone would have to write a ground up
> engine with all the performance and memory concerns of Android in
> mind, which was not the case with Simpull.....I created it for
> applets, then thought to port over to fixed-point for Android. It
> works well with small scenes, but certainly not the staple engine to
> use in my opinion.
> Also, Phys2D will not run worth a damn on Android. I tried it and I
> even went through some heavy performance tuning. Garbage collection
> is the major issue even after all I did. I seriously doubt JBox2D
> will run well either. I'll stick to what I said earlier, a ground-up
> solution by someone smarter than me is probably required.
> On Mar 31, 9:49 am, "admin.androidsl...@googlemail.com"
> <admin.androidsl...@googlemail.com> wrote:
> > Not tried but if you can provide us with some example source code or
> > put something on the market, I'm sure we could take a look.
> > G1 performance is significantly faster than emulator, but there are
> > limitations.
> > Particularly with garbage collection and memory allocation on code
> > that gets run continuously in loops, so I don't know how optimised
> > these physics engines are for this purpose.
> > Would be interesting to find out though.
> > On Mar 31, 12:52 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > Oh I forgot to re-ask...
> > > "Has anyone tested Phys2D or JBox2D on an actual device to see if they
> > > run better than on the emulator?
> > > I have a feeling the performance will better on a G1 than the emulator
> > > for some reason!
> > > On Mar 31, 12:51 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > I did take a look at Simpull, however the demo application failed to
> > > > run as it relied on some library which wasn't supplied or referenced
> > > > to - I just got annoyed after spending two days failing to get Phys2D
> > > > and JBox2D to work in Android and didn't bother trying to work out the
> > > > problems!
> > > > I might give it another look though...
> > > > On Mar 30, 10:41 pm, Streets Of Boston <flyingdutc...@gmail.com>
> > > > wrote:
> > > > > I wonder how well this one works on Android:
> > > > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > > > > I have a simple 2D physics engine written and running. It uses
> > > > > > the now famous Jacobson physics tricks (Verlet integration and hard
> > > > > > constraints). I can manage 40 balls on the screen, with fill n^2
> > > > > > interaction between balls. I am working on spatial data structure
> > > > > > optimizations now to improve the computational complexity of the
> > > > > > collision detection code. I run the constraint update loop five times
> > > > > > per frame and get 30 frames per second. Once the engine is up and
> > > > > > running there are no memory allocations done in my program. And once
> > > > > > the system settles down from the app launch there are very few GC
> > > > > > events from other programs. Though they do still happen. Viewing
> > > > > > LogCat I see a GC every 10 or 20 seconds because of some background
> > > > > > application. But between those events I get a consistent frame rate.
> > > > > > I am using OpenGL for my rendering.
> > > > > > -Anton
> > > > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > > Does anyone know of, or have implemented, a physics engine which runs
> > > > > > > smoothly in Android?
> > > > > > > I have spent the last couple of days trying Phys2D and JBox2D, however
> > > > > > > both perform very poorly - I am struggling to get even a few objects
> > > > > > > to simulate smoothly as frequent garbage collection spoils it.
> > > > > > > One question I do have is will these run smoother on an actual G1
> > > > > > > device or is the performance of the emulator accurate?
I started going down the path of Object pooling. It seemed the only
solution when taking an existing engine and making work on a resource
constrained system like Android on a phone. Determining the strategy
for returning objects to the pool proved quite tough for me. I have
no doubt there are some experts on embedded systems programming with
tons of experience with object pooling. We just would be too lucky if
that person(s) was also experienced with Java, physics engines and had
a passion for open source and games! Is that too much to ask? LOL!!
On Mar 31, 12:17 pm, mscwd01 <mscw...@gmail.com> wrote:
> Thanks for your feedback Shaun, I too unfortunately think a bespoke
> engine will need to be written for Android, which is a real pity as
> the iPhone has several physics engines which can easily handle
> hundreds of objects.
> Having said that Anton (2nd reply) has said he has an engine running,
> it would be nice to see a demo of this if that'd be possible?
> Clark, i'd definately host any .apk's on my own site, I wouldn't put
> it on the marketplace if it wasn't a "finished" app - do people
> actually do that?!
> I think i'll stay away from developing games with physics for the time
> being and concentrate on something else, I cant see it being feasible
> to include it any time soon which is a real pity.
> On Mar 31, 3:28 pm, shaun <shashepp...@gmail.com> wrote:
> > I am the author of simpull.
> > Sorry guys for the demo being out of whack for Simpull to the Core.
> > The version of PulpCore that I integrated simpull with did not support
> > Chrome, but you should be able to see it in IE, FF Safari. It is nice
> > to take a look at that demo to get a feel for what the engine is
> > capable of, but the performance does not translate over to the fixed
> > point branch/version of simpull when running on Android.
> > I ran tests on both the emulator and the actual device and there was a
> > significant increase in performance because of the fixed point
> > implementation, but I got very frustrated that it still did not
> > support the amount of objects in a scene that I considered good for a
> > physics-based game. It seemed to handle ~10 objects moving and
> > colliding OK. It has been a while since I was playing with it, so I
> > do not really remember the exact number of objects or the frame rate.
> > I mostly remember being upset with it.
> > I am leaving the physics ideas for games out of the picture when
> > thinking Android for now. Someone would have to write a ground up
> > engine with all the performance and memory concerns of Android in
> > mind, which was not the case with Simpull.....I created it for
> > applets, then thought to port over to fixed-point for Android. It
> > works well with small scenes, but certainly not the staple engine to
> > use in my opinion.
> > Also, Phys2D will not run worth a damn on Android. I tried it and I
> > even went through some heavy performance tuning. Garbage collection
> > is the major issue even after all I did. I seriously doubt JBox2D
> > will run well either. I'll stick to what I said earlier, a ground-up
> > solution by someone smarter than me is probably required.
> > On Mar 31, 9:49 am, "admin.androidsl...@googlemail.com"
> > <admin.androidsl...@googlemail.com> wrote:
> > > Not tried but if you can provide us with some example source code or
> > > put something on the market, I'm sure we could take a look.
> > > G1 performance is significantly faster than emulator, but there are
> > > limitations.
> > > Particularly with garbage collection and memory allocation on code
> > > that gets run continuously in loops, so I don't know how optimised
> > > these physics engines are for this purpose.
> > > Would be interesting to find out though.
> > > On Mar 31, 12:52 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > Oh I forgot to re-ask...
> > > > "Has anyone tested Phys2D or JBox2D on an actual device to see if they
> > > > run better than on the emulator?
> > > > I have a feeling the performance will better on a G1 than the emulator
> > > > for some reason!
> > > > On Mar 31, 12:51 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > I did take a look at Simpull, however the demo application failed to
> > > > > run as it relied on some library which wasn't supplied or referenced
> > > > > to - I just got annoyed after spending two days failing to get Phys2D
> > > > > and JBox2D to work in Android and didn't bother trying to work out the
> > > > > problems!
> > > > > I might give it another look though...
> > > > > On Mar 30, 10:41 pm, Streets Of Boston <flyingdutc...@gmail.com>
> > > > > wrote:
> > > > > > I wonder how well this one works on Android:
> > > > > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > > > > > I have a simple 2D physics engine written and running. It uses
> > > > > > > the now famous Jacobson physics tricks (Verlet integration and hard
> > > > > > > constraints). I can manage 40 balls on the screen, with fill n^2
> > > > > > > interaction between balls. I am working on spatial data structure
> > > > > > > optimizations now to improve the computational complexity of the
> > > > > > > collision detection code. I run the constraint update loop five times
> > > > > > > per frame and get 30 frames per second. Once the engine is up and
> > > > > > > running there are no memory allocations done in my program. And once
> > > > > > > the system settles down from the app launch there are very few GC
> > > > > > > events from other programs. Though they do still happen. Viewing
> > > > > > > LogCat I see a GC every 10 or 20 seconds because of some background
> > > > > > > application. But between those events I get a consistent frame rate.
> > > > > > > I am using OpenGL for my rendering.
> > > > > > > -Anton
> > > > > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > > > Does anyone know of, or have implemented, a physics engine which runs
> > > > > > > > smoothly in Android?
> > > > > > > > I have spent the last couple of days trying Phys2D and JBox2D, however
> > > > > > > > both perform very poorly - I am struggling to get even a few objects
> > > > > > > > to simulate smoothly as frequent garbage collection spoils it.
> > > > > > > > One question I do have is will these run smoother on an actual G1
> > > > > > > > device or is the performance of the emulator accurate?
On Tue, Mar 31, 2009 at 9:26 PM, shaun <shashepp...@gmail.com> wrote:
> I started going down the path of Object pooling. It seemed the only
> solution when taking an existing engine and making work on a resource
> constrained system like Android on a phone. Determining the strategy
> for returning objects to the pool proved quite tough for me. I have
> no doubt there are some experts on embedded systems programming with
> tons of experience with object pooling. We just would be too lucky if
> that person(s) was also experienced with Java, physics engines and had
> a passion for open source and games! Is that too much to ask? LOL!!
> On Mar 31, 12:17 pm, mscwd01 <mscw...@gmail.com> wrote:
> > Thanks for your feedback Shaun, I too unfortunately think a bespoke
> > engine will need to be written for Android, which is a real pity as
> > the iPhone has several physics engines which can easily handle
> > hundreds of objects.
> > Having said that Anton (2nd reply) has said he has an engine running,
> > it would be nice to see a demo of this if that'd be possible?
> > Clark, i'd definately host any .apk's on my own site, I wouldn't put
> > it on the marketplace if it wasn't a "finished" app - do people
> > actually do that?!
> > I think i'll stay away from developing games with physics for the time
> > being and concentrate on something else, I cant see it being feasible
> > to include it any time soon which is a real pity.
> > On Mar 31, 3:28 pm, shaun <shashepp...@gmail.com> wrote:
> > > I am the author of simpull.
> > > Sorry guys for the demo being out of whack for Simpull to the Core.
> > > The version of PulpCore that I integrated simpull with did not support
> > > Chrome, but you should be able to see it in IE, FF Safari. It is nice
> > > to take a look at that demo to get a feel for what the engine is
> > > capable of, but the performance does not translate over to the fixed
> > > point branch/version of simpull when running on Android.
> > > I ran tests on both the emulator and the actual device and there was a
> > > significant increase in performance because of the fixed point
> > > implementation, but I got very frustrated that it still did not
> > > support the amount of objects in a scene that I considered good for a
> > > physics-based game. It seemed to handle ~10 objects moving and
> > > colliding OK. It has been a while since I was playing with it, so I
> > > do not really remember the exact number of objects or the frame rate.
> > > I mostly remember being upset with it.
> > > I am leaving the physics ideas for games out of the picture when
> > > thinking Android for now. Someone would have to write a ground up
> > > engine with all the performance and memory concerns of Android in
> > > mind, which was not the case with Simpull.....I created it for
> > > applets, then thought to port over to fixed-point for Android. It
> > > works well with small scenes, but certainly not the staple engine to
> > > use in my opinion.
> > > Also, Phys2D will not run worth a damn on Android. I tried it and I
> > > even went through some heavy performance tuning. Garbage collection
> > > is the major issue even after all I did. I seriously doubt JBox2D
> > > will run well either. I'll stick to what I said earlier, a ground-up
> > > solution by someone smarter than me is probably required.
> > > On Mar 31, 9:49 am, "admin.androidsl...@googlemail.com"
> > > <admin.androidsl...@googlemail.com> wrote:
> > > > Not tried but if you can provide us with some example source code or
> > > > put something on the market, I'm sure we could take a look.
> > > > G1 performance is significantly faster than emulator, but there are
> > > > limitations.
> > > > Particularly with garbage collection and memory allocation on code
> > > > that gets run continuously in loops, so I don't know how optimised
> > > > these physics engines are for this purpose.
> > > > Would be interesting to find out though.
> > > > On Mar 31, 12:52 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > Oh I forgot to re-ask...
> > > > > "Has anyone tested Phys2D or JBox2D on an actual device to see if
> they
> > > > > run better than on the emulator?
> > > > > I have a feeling the performance will better on a G1 than the
> emulator
> > > > > for some reason!
> > > > > On Mar 31, 12:51 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > I did take a look at Simpull, however the demo application failed
> to
> > > > > > run as it relied on some library which wasn't supplied or
> referenced
> > > > > > to - I just got annoyed after spending two days failing to get
> Phys2D
> > > > > > and JBox2D to work in Android and didn't bother trying to work
> out the
> > > > > > problems!
> > > > > > I might give it another look though...
> > > > > > On Mar 30, 10:41 pm, Streets Of Boston <flyingdutc...@gmail.com>
> > > > > > wrote:
> > > > > > > I wonder how well this one works on Android:
> > > > > > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > > > > > > I have a simple 2D physics engine written and running.
> It uses
> > > > > > > > the now famous Jacobson physics tricks (Verlet integration
> and hard
> > > > > > > > constraints). I can manage 40 balls on the screen, with fill
> n^2
> > > > > > > > interaction between balls. I am working on spatial data
> structure
> > > > > > > > optimizations now to improve the computational complexity of
> the
> > > > > > > > collision detection code. I run the constraint update loop
> five times
> > > > > > > > per frame and get 30 frames per second. Once the engine is
> up and
> > > > > > > > running there are no memory allocations done in my program.
> And once
> > > > > > > > the system settles down from the app launch there are very
> few GC
> > > > > > > > events from other programs. Though they do still happen.
> Viewing
> > > > > > > > LogCat I see a GC every 10 or 20 seconds because of some
> background
> > > > > > > > application. But between those events I get a consistent
> frame rate.
> > > > > > > > I am using OpenGL for my rendering.
> > > > > > > > -Anton
> > > > > > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > > > > Does anyone know of, or have implemented, a physics engine
> which runs
> > > > > > > > > smoothly in Android?
> > > > > > > > > I have spent the last couple of days trying Phys2D and
> JBox2D, however
> > > > > > > > > both perform very poorly - I am struggling to get even a
> few objects
> > > > > > > > > to simulate smoothly as frequent garbage collection spoils
> it.
> > > > > > > > > One question I do have is will these run smoother on an
> actual G1
> > > > > > > > > device or is the performance of the emulator accurate?
I'll definitely post the app tonight for you guys to check out (at
work now). I am an embedded systems programmer by trade. But I do
physics toys for fun and am just getting into Java/Android
optimizations. I will point out that optimizing for Java and
optimizing for Android are very different. As people have pointed out
before, the key things to be careful with on Android are memory
allocation and floating point math. I've removed both of these from
my physics loop. I also found that function call overhead was quite
large and had to manually inline all of my fixed point math code. I
think that with the correct spatial data structures I can get a couple
hundred objects interacting. I have a 2D rigid body physics engine
that is currently all C++ (no exceptions or templates or RTTI or
multiple inheritance) that I may port over as well.
However, having said all of that, I think it may be the case that
we will just have to wait until a native SDK is available to really
write a top notch physics engine. It's sort of the perfect example of
a piece of code that doesn't need anything more than libc and JNI
bindings. And since you only call it a couple times per frame the JNI
overhead would be well amortized.
Anton
On Mar 31, 9:17 am, mscwd01 <mscw...@gmail.com> wrote:
> Thanks for your feedback Shaun, I too unfortunately think a bespoke
> engine will need to be written for Android, which is a real pity as
> the iPhone has several physics engines which can easily handle
> hundreds of objects.
> Having said that Anton (2nd reply) has said he has an engine running,
> it would be nice to see a demo of this if that'd be possible?
> Clark, i'd definately host any .apk's on my own site, I wouldn't put
> it on the marketplace if it wasn't a "finished" app - do people
> actually do that?!
> I think i'll stay away from developing games with physics for the time
> being and concentrate on something else, I cant see it being feasible
> to include it any time soon which is a real pity.
> On Mar 31, 3:28 pm, shaun <shashepp...@gmail.com> wrote:
> > I am the author of simpull.
> > Sorry guys for the demo being out of whack for Simpull to the Core.
> > The version of PulpCore that I integrated simpull with did not support
> > Chrome, but you should be able to see it in IE, FF Safari. It is nice
> > to take a look at that demo to get a feel for what the engine is
> > capable of, but the performance does not translate over to the fixed
> > point branch/version of simpull when running on Android.
> > I ran tests on both the emulator and the actual device and there was a
> > significant increase in performance because of the fixed point
> > implementation, but I got very frustrated that it still did not
> > support the amount of objects in a scene that I considered good for a
> > physics-based game. It seemed to handle ~10 objects moving and
> > colliding OK. It has been a while since I was playing with it, so I
> > do not really remember the exact number of objects or the frame rate.
> > I mostly remember being upset with it.
> > I am leaving the physics ideas for games out of the picture when
> > thinking Android for now. Someone would have to write a ground up
> > engine with all the performance and memory concerns of Android in
> > mind, which was not the case with Simpull.....I created it for
> > applets, then thought to port over to fixed-point for Android. It
> > works well with small scenes, but certainly not the staple engine to
> > use in my opinion.
> > Also, Phys2D will not run worth a damn on Android. I tried it and I
> > even went through some heavy performance tuning. Garbage collection
> > is the major issue even after all I did. I seriously doubt JBox2D
> > will run well either. I'll stick to what I said earlier, a ground-up
> > solution by someone smarter than me is probably required.
> > On Mar 31, 9:49 am, "admin.androidsl...@googlemail.com"
> > <admin.androidsl...@googlemail.com> wrote:
> > > Not tried but if you can provide us with some example source code or
> > > put something on the market, I'm sure we could take a look.
> > > G1 performance is significantly faster than emulator, but there are
> > > limitations.
> > > Particularly with garbage collection and memory allocation on code
> > > that gets run continuously in loops, so I don't know how optimised
> > > these physics engines are for this purpose.
> > > Would be interesting to find out though.
> > > On Mar 31, 12:52 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > Oh I forgot to re-ask...
> > > > "Has anyone tested Phys2D or JBox2D on an actual device to see if they
> > > > run better than on the emulator?
> > > > I have a feeling the performance will better on a G1 than the emulator
> > > > for some reason!
> > > > On Mar 31, 12:51 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > I did take a look at Simpull, however the demo application failed to
> > > > > run as it relied on some library which wasn't supplied or referenced
> > > > > to - I just got annoyed after spending two days failing to get Phys2D
> > > > > and JBox2D to work in Android and didn't bother trying to work out the
> > > > > problems!
> > > > > I might give it another look though...
> > > > > On Mar 30, 10:41 pm, Streets Of Boston <flyingdutc...@gmail.com>
> > > > > wrote:
> > > > > > I wonder how well this one works on Android:
> > > > > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > > > > > I have a simple 2D physics engine written and running. It uses
> > > > > > > the now famous Jacobson physics tricks (Verlet integration and hard
> > > > > > > constraints). I can manage 40 balls on the screen, with fill n^2
> > > > > > > interaction between balls. I am working on spatial data structure
> > > > > > > optimizations now to improve the computational complexity of the
> > > > > > > collision detection code. I run the constraint update loop five times
> > > > > > > per frame and get 30 frames per second. Once the engine is up and
> > > > > > > running there are no memory allocations done in my program. And once
> > > > > > > the system settles down from the app launch there are very few GC
> > > > > > > events from other programs. Though they do still happen. Viewing
> > > > > > > LogCat I see a GC every 10 or 20 seconds because of some background
> > > > > > > application. But between those events I get a consistent frame rate.
> > > > > > > I am using OpenGL for my rendering.
> > > > > > > -Anton
> > > > > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > > > Does anyone know of, or have implemented, a physics engine which runs
> > > > > > > > smoothly in Android?
> > > > > > > > I have spent the last couple of days trying Phys2D and JBox2D, however
> > > > > > > > both perform very poorly - I am struggling to get even a few objects
> > > > > > > > to simulate smoothly as frequent garbage collection spoils it.
> > > > > > > > One question I do have is will these run smoother on an actual G1
> > > > > > > > device or is the performance of the emulator accurate?
It's pretty basic, but it shows that you can do some amount of
physics on the G-phone at a reasonable rate. And as always, there are
many improvements to be made. :)
-Anton
On Mar 31, 2:12 pm, Anton <socialhac...@gmail.com> wrote:
> I'll definitely post the app tonight for you guys to check out (at
> work now). I am an embedded systems programmer by trade. But I do
> physics toys for fun and am just getting into Java/Android
> optimizations. I will point out that optimizing for Java and
> optimizing for Android are very different. As people have pointed out
> before, the key things to be careful with on Android are memory
> allocation and floating point math. I've removed both of these from
> my physics loop. I also found that function call overhead was quite
> large and had to manually inline all of my fixed point math code. I
> think that with the correct spatial data structures I can get a couple
> hundred objects interacting. I have a 2D rigid body physics engine
> that is currently all C++ (no exceptions or templates or RTTI or
> multiple inheritance) that I may port over as well.
> However, having said all of that, I think it may be the case that
> we will just have to wait until a native SDK is available to really
> write a top notch physics engine. It's sort of the perfect example of
> a piece of code that doesn't need anything more than libc and JNI
> bindings. And since you only call it a couple times per frame the JNI
> overhead would be well amortized.
> Anton
> On Mar 31, 9:17 am, mscwd01 <mscw...@gmail.com> wrote:
> > Thanks for your feedback Shaun, I too unfortunately think a bespoke
> > engine will need to be written for Android, which is a real pity as
> > the iPhone has several physics engines which can easily handle
> > hundreds of objects.
> > Having said that Anton (2nd reply) has said he has an engine running,
> > it would be nice to see a demo of this if that'd be possible?
> > Clark, i'd definately host any .apk's on my own site, I wouldn't put
> > it on the marketplace if it wasn't a "finished" app - do people
> > actually do that?!
> > I think i'll stay away from developing games with physics for the time
> > being and concentrate on something else, I cant see it being feasible
> > to include it any time soon which is a real pity.
> > On Mar 31, 3:28 pm, shaun <shashepp...@gmail.com> wrote:
> > > I am the author of simpull.
> > > Sorry guys for the demo being out of whack for Simpull to the Core.
> > > The version of PulpCore that I integrated simpull with did not support
> > > Chrome, but you should be able to see it in IE, FF Safari. It is nice
> > > to take a look at that demo to get a feel for what the engine is
> > > capable of, but the performance does not translate over to the fixed
> > > point branch/version of simpull when running on Android.
> > > I ran tests on both the emulator and the actual device and there was a
> > > significant increase in performance because of the fixed point
> > > implementation, but I got very frustrated that it still did not
> > > support the amount of objects in a scene that I considered good for a
> > > physics-based game. It seemed to handle ~10 objects moving and
> > > colliding OK. It has been a while since I was playing with it, so I
> > > do not really remember the exact number of objects or the frame rate.
> > > I mostly remember being upset with it.
> > > I am leaving the physics ideas for games out of the picture when
> > > thinking Android for now. Someone would have to write a ground up
> > > engine with all the performance and memory concerns of Android in
> > > mind, which was not the case with Simpull.....I created it for
> > > applets, then thought to port over to fixed-point for Android. It
> > > works well with small scenes, but certainly not the staple engine to
> > > use in my opinion.
> > > Also, Phys2D will not run worth a damn on Android. I tried it and I
> > > even went through some heavy performance tuning. Garbage collection
> > > is the major issue even after all I did. I seriously doubt JBox2D
> > > will run well either. I'll stick to what I said earlier, a ground-up
> > > solution by someone smarter than me is probably required.
> > > On Mar 31, 9:49 am, "admin.androidsl...@googlemail.com"
> > > <admin.androidsl...@googlemail.com> wrote:
> > > > Not tried but if you can provide us with some example source code or
> > > > put something on the market, I'm sure we could take a look.
> > > > G1 performance is significantly faster than emulator, but there are
> > > > limitations.
> > > > Particularly with garbage collection and memory allocation on code
> > > > that gets run continuously in loops, so I don't know how optimised
> > > > these physics engines are for this purpose.
> > > > Would be interesting to find out though.
> > > > On Mar 31, 12:52 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > Oh I forgot to re-ask...
> > > > > "Has anyone tested Phys2D or JBox2D on an actual device to see if they
> > > > > run better than on the emulator?
> > > > > I have a feeling the performance will better on a G1 than the emulator
> > > > > for some reason!
> > > > > On Mar 31, 12:51 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > I did take a look at Simpull, however the demo application failed to
> > > > > > run as it relied on some library which wasn't supplied or referenced
> > > > > > to - I just got annoyed after spending two days failing to get Phys2D
> > > > > > and JBox2D to work in Android and didn't bother trying to work out the
> > > > > > problems!
> > > > > > I might give it another look though...
> > > > > > On Mar 30, 10:41 pm, Streets Of Boston <flyingdutc...@gmail.com>
> > > > > > wrote:
> > > > > > > I wonder how well this one works on Android:
> > > > > > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > > > > > > I have a simple 2D physics engine written and running. It uses
> > > > > > > > the now famous Jacobson physics tricks (Verlet integration and hard
> > > > > > > > constraints). I can manage 40 balls on the screen, with fill n^2
> > > > > > > > interaction between balls. I am working on spatial data structure
> > > > > > > > optimizations now to improve the computational complexity of the
> > > > > > > > collision detection code. I run the constraint update loop five times
> > > > > > > > per frame and get 30 frames per second. Once the engine is up and
> > > > > > > > running there are no memory allocations done in my program. And once
> > > > > > > > the system settles down from the app launch there are very few GC
> > > > > > > > events from other programs. Though they do still happen. Viewing
> > > > > > > > LogCat I see a GC every 10 or 20 seconds because of some background
> > > > > > > > application. But between those events I get a consistent frame rate.
> > > > > > > > I am using OpenGL for my rendering.
> > > > > > > > -Anton
> > > > > > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > > > > Does anyone know of, or have implemented, a physics engine which runs
> > > > > > > > > smoothly in Android?
> > > > > > > > > I have spent the last couple of days trying Phys2D and JBox2D, however
> > > > > > > > > both perform very poorly - I am struggling to get even a few objects
> > > > > > > > > to simulate smoothly as frequent garbage collection spoils it.
> > > > > > > > > One question I do have is will these run smoother on an actual G1
> > > > > > > > > device or is the performance of the emulator accurate?
It certainly runs much smoother than the Phys2D and JBox2D engines I
have tried and you have more objects being simulated - so you must
have done something right ;)
I would expect it to run 2-3 times faster on an actual device too from
what I have read.
Once you have finished off the improvements do you have any plans to
release it?
Thanks
On Apr 1, 7:44 am, Anton <socialhac...@gmail.com> wrote:
> It's pretty basic, but it shows that you can do some amount of
> physics on the G-phone at a reasonable rate. And as always, there are
> many improvements to be made. :)
> -Anton
> On Mar 31, 2:12 pm, Anton <socialhac...@gmail.com> wrote:
> > I'll definitely post the app tonight for you guys to check out (at
> > work now). I am an embedded systems programmer by trade. But I do
> > physics toys for fun and am just getting into Java/Android
> > optimizations. I will point out that optimizing for Java and
> > optimizing for Android are very different. As people have pointed out
> > before, the key things to be careful with on Android are memory
> > allocation and floating point math. I've removed both of these from
> > my physics loop. I also found that function call overhead was quite
> > large and had to manually inline all of my fixed point math code. I
> > think that with the correct spatial data structures I can get a couple
> > hundred objects interacting. I have a 2D rigid body physics engine
> > that is currently all C++ (no exceptions or templates or RTTI or
> > multiple inheritance) that I may port over as well.
> > However, having said all of that, I think it may be the case that
> > we will just have to wait until a native SDK is available to really
> > write a top notch physics engine. It's sort of the perfect example of
> > a piece of code that doesn't need anything more than libc and JNI
> > bindings. And since you only call it a couple times per frame the JNI
> > overhead would be well amortized.
> > Anton
> > On Mar 31, 9:17 am, mscwd01 <mscw...@gmail.com> wrote:
> > > Thanks for your feedback Shaun, I too unfortunately think a bespoke
> > > engine will need to be written for Android, which is a real pity as
> > > the iPhone has several physics engines which can easily handle
> > > hundreds of objects.
> > > Having said that Anton (2nd reply) has said he has an engine running,
> > > it would be nice to see a demo of this if that'd be possible?
> > > Clark, i'd definately host any .apk's on my own site, I wouldn't put
> > > it on the marketplace if it wasn't a "finished" app - do people
> > > actually do that?!
> > > I think i'll stay away from developing games with physics for the time
> > > being and concentrate on something else, I cant see it being feasible
> > > to include it any time soon which is a real pity.
> > > On Mar 31, 3:28 pm, shaun <shashepp...@gmail.com> wrote:
> > > > I am the author of simpull.
> > > > Sorry guys for the demo being out of whack for Simpull to the Core.
> > > > The version of PulpCore that I integrated simpull with did not support
> > > > Chrome, but you should be able to see it in IE, FF Safari. It is nice
> > > > to take a look at that demo to get a feel for what the engine is
> > > > capable of, but the performance does not translate over to the fixed
> > > > point branch/version of simpull when running on Android.
> > > > I ran tests on both the emulator and the actual device and there was a
> > > > significant increase in performance because of the fixed point
> > > > implementation, but I got very frustrated that it still did not
> > > > support the amount of objects in a scene that I considered good for a
> > > > physics-based game. It seemed to handle ~10 objects moving and
> > > > colliding OK. It has been a while since I was playing with it, so I
> > > > do not really remember the exact number of objects or the frame rate.
> > > > I mostly remember being upset with it.
> > > > I am leaving the physics ideas for games out of the picture when
> > > > thinking Android for now. Someone would have to write a ground up
> > > > engine with all the performance and memory concerns of Android in
> > > > mind, which was not the case with Simpull.....I created it for
> > > > applets, then thought to port over to fixed-point for Android. It
> > > > works well with small scenes, but certainly not the staple engine to
> > > > use in my opinion.
> > > > Also, Phys2D will not run worth a damn on Android. I tried it and I
> > > > even went through some heavy performance tuning. Garbage collection
> > > > is the major issue even after all I did. I seriously doubt JBox2D
> > > > will run well either. I'll stick to what I said earlier, a ground-up
> > > > solution by someone smarter than me is probably required.
> > > > On Mar 31, 9:49 am, "admin.androidsl...@googlemail.com"
> > > > <admin.androidsl...@googlemail.com> wrote:
> > > > > Not tried but if you can provide us with some example source code or
> > > > > put something on the market, I'm sure we could take a look.
> > > > > G1 performance is significantly faster than emulator, but there are
> > > > > limitations.
> > > > > Particularly with garbage collection and memory allocation on code
> > > > > that gets run continuously in loops, so I don't know how optimised
> > > > > these physics engines are for this purpose.
> > > > > Would be interesting to find out though.
> > > > > On Mar 31, 12:52 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > Oh I forgot to re-ask...
> > > > > > "Has anyone tested Phys2D or JBox2D on an actual device to see if they
> > > > > > run better than on the emulator?
> > > > > > I have a feeling the performance will better on a G1 than the emulator
> > > > > > for some reason!
> > > > > > On Mar 31, 12:51 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > > I did take a look at Simpull, however the demo application failed to
> > > > > > > run as it relied on some library which wasn't supplied or referenced
> > > > > > > to - I just got annoyed after spending two days failing to get Phys2D
> > > > > > > and JBox2D to work in Android and didn't bother trying to work out the
> > > > > > > problems!
> > > > > > > I might give it another look though...
> > > > > > > On Mar 30, 10:41 pm, Streets Of Boston <flyingdutc...@gmail.com>
> > > > > > > wrote:
> > > > > > > > I wonder how well this one works on Android:
> > > > > > > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > > > > > > > I have a simple 2D physics engine written and running. It uses
> > > > > > > > > the now famous Jacobson physics tricks (Verlet integration and hard
> > > > > > > > > constraints). I can manage 40 balls on the screen, with fill n^2
> > > > > > > > > interaction between balls. I am working on spatial data structure
> > > > > > > > > optimizations now to improve the computational complexity of the
> > > > > > > > > collision detection code. I run the constraint update loop five times
> > > > > > > > > per frame and get 30 frames per second. Once the engine is up and
> > > > > > > > > running there are no memory allocations done in my program. And once
> > > > > > > > > the system settles down from the app launch there are very few GC
> > > > > > > > > events from other programs. Though they do still happen. Viewing
> > > > > > > > > LogCat I see a GC every 10 or 20 seconds because of some background
> > > > > > > > > application. But between those events I get a consistent frame rate.
> > > > > > > > > I am using OpenGL for my rendering.
> > > > > > > > > -Anton
> > > > > > > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > > > > > Does anyone know of, or have implemented, a physics engine which runs
> > > > > > > > > > smoothly in Android?
> > > > > > > > > > I have spent the last couple of days trying Phys2D and JBox2D, however
> > > > > > > > > > both perform very poorly - I am struggling to get even a few objects
> > > > > > > > > > to simulate smoothly as frequent garbage collection spoils it.
> > > > > > > > > > One question I do have is will these run smoother on an actual G1
> > > > > > > > > > device or is the performance of the emulator accurate?
On Wed, Apr 1, 2009 at 3:04 PM, mscwd01 <mscw...@gmail.com> wrote:
> Thanks for the demo Anton,
> It certainly runs much smoother than the Phys2D and JBox2D engines I
> have tried and you have more objects being simulated - so you must
> have done something right ;)
> I would expect it to run 2-3 times faster on an actual device too from
> what I have read.
> Once you have finished off the improvements do you have any plans to
> release it?
> Thanks
> On Apr 1, 7:44 am, Anton <socialhac...@gmail.com> wrote:
>> OK, for anyone interested in my simple physics demo, check out:
>> It's pretty basic, but it shows that you can do some amount of
>> physics on the G-phone at a reasonable rate. And as always, there are
>> many improvements to be made. :)
>> -Anton
>> On Mar 31, 2:12 pm, Anton <socialhac...@gmail.com> wrote:
>> > I'll definitely post the app tonight for you guys to check out (at
>> > work now). I am an embedded systems programmer by trade. But I do
>> > physics toys for fun and am just getting into Java/Android
>> > optimizations. I will point out that optimizing for Java and
>> > optimizing for Android are very different. As people have pointed out
>> > before, the key things to be careful with on Android are memory
>> > allocation and floating point math. I've removed both of these from
>> > my physics loop. I also found that function call overhead was quite
>> > large and had to manually inline all of my fixed point math code. I
>> > think that with the correct spatial data structures I can get a couple
>> > hundred objects interacting. I have a 2D rigid body physics engine
>> > that is currently all C++ (no exceptions or templates or RTTI or
>> > multiple inheritance) that I may port over as well.
>> > However, having said all of that, I think it may be the case that
>> > we will just have to wait until a native SDK is available to really
>> > write a top notch physics engine. It's sort of the perfect example of
>> > a piece of code that doesn't need anything more than libc and JNI
>> > bindings. And since you only call it a couple times per frame the JNI
>> > overhead would be well amortized.
>> > Anton
>> > On Mar 31, 9:17 am, mscwd01 <mscw...@gmail.com> wrote:
>> > > Thanks for your feedback Shaun, I too unfortunately think a bespoke
>> > > engine will need to be written for Android, which is a real pity as
>> > > the iPhone has several physics engines which can easily handle
>> > > hundreds of objects.
>> > > Having said that Anton (2nd reply) has said he has an engine running,
>> > > it would be nice to see a demo of this if that'd be possible?
>> > > Clark, i'd definately host any .apk's on my own site, I wouldn't put
>> > > it on the marketplace if it wasn't a "finished" app - do people
>> > > actually do that?!
>> > > I think i'll stay away from developing games with physics for the time
>> > > being and concentrate on something else, I cant see it being feasible
>> > > to include it any time soon which is a real pity.
>> > > On Mar 31, 3:28 pm, shaun <shashepp...@gmail.com> wrote:
>> > > > I am the author of simpull.
>> > > > Sorry guys for the demo being out of whack for Simpull to the Core.
>> > > > The version of PulpCore that I integrated simpull with did not support
>> > > > Chrome, but you should be able to see it in IE, FF Safari. It is nice
>> > > > to take a look at that demo to get a feel for what the engine is
>> > > > capable of, but the performance does not translate over to the fixed
>> > > > point branch/version of simpull when running on Android.
>> > > > I ran tests on both the emulator and the actual device and there was a
>> > > > significant increase in performance because of the fixed point
>> > > > implementation, but I got very frustrated that it still did not
>> > > > support the amount of objects in a scene that I considered good for a
>> > > > physics-based game. It seemed to handle ~10 objects moving and
>> > > > colliding OK. It has been a while since I was playing with it, so I
>> > > > do not really remember the exact number of objects or the frame rate.
>> > > > I mostly remember being upset with it.
>> > > > I am leaving the physics ideas for games out of the picture when
>> > > > thinking Android for now. Someone would have to write a ground up
>> > > > engine with all the performance and memory concerns of Android in
>> > > > mind, which was not the case with Simpull.....I created it for
>> > > > applets, then thought to port over to fixed-point for Android. It
>> > > > works well with small scenes, but certainly not the staple engine to
>> > > > use in my opinion.
>> > > > Also, Phys2D will not run worth a damn on Android. I tried it and I
>> > > > even went through some heavy performance tuning. Garbage collection
>> > > > is the major issue even after all I did. I seriously doubt JBox2D
>> > > > will run well either. I'll stick to what I said earlier, a ground-up
>> > > > solution by someone smarter than me is probably required.
>> > > > On Mar 31, 9:49 am, "admin.androidsl...@googlemail.com"
>> > > > <admin.androidsl...@googlemail.com> wrote:
>> > > > > Not tried but if you can provide us with some example source code or
>> > > > > put something on the market, I'm sure we could take a look.
>> > > > > G1 performance is significantly faster than emulator, but there are
>> > > > > limitations.
>> > > > > Particularly with garbage collection and memory allocation on code
>> > > > > that gets run continuously in loops, so I don't know how optimised
>> > > > > these physics engines are for this purpose.
>> > > > > Would be interesting to find out though.
>> > > > > On Mar 31, 12:52 pm, mscwd01 <mscw...@gmail.com> wrote:
>> > > > > > Oh I forgot to re-ask...
>> > > > > > "Has anyone tested Phys2D or JBox2D on an actual device to see if they
>> > > > > > run better than on the emulator?
>> > > > > > I have a feeling the performance will better on a G1 than the emulator
>> > > > > > for some reason!
>> > > > > > On Mar 31, 12:51 pm, mscwd01 <mscw...@gmail.com> wrote:
>> > > > > > > I did take a look at Simpull, however the demo application failed to
>> > > > > > > run as it relied on some library which wasn't supplied or referenced
>> > > > > > > to - I just got annoyed after spending two days failing to get Phys2D
>> > > > > > > and JBox2D to work in Android and didn't bother trying to work out the
>> > > > > > > problems!
>> > > > > > > I might give it another look though...
>> > > > > > > On Mar 30, 10:41 pm, Streets Of Boston <flyingdutc...@gmail.com>
>> > > > > > > wrote:
>> > > > > > > > I wonder how well this one works on Android:
>> > > > > > > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
>> > > > > > > > > I have a simple 2D physics engine written and running. It uses
>> > > > > > > > > the now famous Jacobson physics tricks (Verlet integration and hard
>> > > > > > > > > constraints). I can manage 40 balls on the screen, with fill n^2
>> > > > > > > > > interaction between balls. I am working on spatial data structure
>> > > > > > > > > optimizations now to improve the computational complexity of the
>> > > > > > > > > collision detection code. I run the constraint update loop five times
>> > > > > > > > > per frame and get 30 frames per second. Once the engine is up and
>> > > > > > > > > running there are no memory allocations done in my program. And once
>> > > > > > > > > the system settles down from the app launch there are very few GC
>> > > > > > > > > events from other programs. Though they do still happen. Viewing
>> > > > > > > > > LogCat I see a GC every 10 or 20 seconds because of some background
>> > > > > > > > > application. But between those events I get a consistent frame rate.
>> > > > > > > > > I am using OpenGL for my rendering.
>> > > > > > > > > -Anton
>> > > > > > > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
>> > > > > > > > > > Does anyone know of, or have implemented, a physics engine which runs
>> > > > > > > > > > smoothly in Android?
>> > > > > > > > > > I have spent the last couple of days trying Phys2D and JBox2D, however
>> > > > > > > > > > both perform very poorly - I am struggling to get even a few objects
>> > > > > > > > > > to simulate smoothly as frequent garbage collection spoils it.
>> > > > > > > > > > One question I do have is will these run smoother on an actual G1
>> > > > > > > > > > device or is the performance of the emulator accurate?
It's fast, not superfast, but there are quite a number of balls in the
pit. I'm impressed.
If this code could get into the native system, into the firmware...
On Apr 1, 2:44 am, Anton <socialhac...@gmail.com> wrote:
> It's pretty basic, but it shows that you can do some amount of
> physics on the G-phone at a reasonable rate. And as always, there are
> many improvements to be made. :)
> -Anton
> On Mar 31, 2:12 pm, Anton <socialhac...@gmail.com> wrote:
> > I'll definitely post the app tonight for you guys to check out (at
> > work now). I am an embedded systems programmer by trade. But I do
> > physics toys for fun and am just getting into Java/Android
> > optimizations. I will point out that optimizing for Java and
> > optimizing for Android are very different. As people have pointed out
> > before, the key things to be careful with on Android are memory
> > allocation and floating point math. I've removed both of these from
> > my physics loop. I also found that function call overhead was quite
> > large and had to manually inline all of my fixed point math code. I
> > think that with the correct spatial data structures I can get a couple
> > hundred objects interacting. I have a 2D rigid body physics engine
> > that is currently all C++ (no exceptions or templates or RTTI or
> > multiple inheritance) that I may port over as well.
> > However, having said all of that, I think it may be the case that
> > we will just have to wait until a native SDK is available to really
> > write a top notch physics engine. It's sort of the perfect example of
> > a piece of code that doesn't need anything more than libc and JNI
> > bindings. And since you only call it a couple times per frame the JNI
> > overhead would be well amortized.
> > Anton
> > On Mar 31, 9:17 am, mscwd01 <mscw...@gmail.com> wrote:
> > > Thanks for your feedback Shaun, I too unfortunately think a bespoke
> > > engine will need to be written for Android, which is a real pity as
> > > the iPhone has several physics engines which can easily handle
> > > hundreds of objects.
> > > Having said that Anton (2nd reply) has said he has an engine running,
> > > it would be nice to see a demo of this if that'd be possible?
> > > Clark, i'd definately host any .apk's on my own site, I wouldn't put
> > > it on the marketplace if it wasn't a "finished" app - do people
> > > actually do that?!
> > > I think i'll stay away from developing games with physics for the time
> > > being and concentrate on something else, I cant see it being feasible
> > > to include it any time soon which is a real pity.
> > > On Mar 31, 3:28 pm, shaun <shashepp...@gmail.com> wrote:
> > > > I am the author of simpull.
> > > > Sorry guys for the demo being out of whack for Simpull to the Core.
> > > > The version of PulpCore that I integrated simpull with did not support
> > > > Chrome, but you should be able to see it in IE, FF Safari. It is nice
> > > > to take a look at that demo to get a feel for what the engine is
> > > > capable of, but the performance does not translate over to the fixed
> > > > point branch/version of simpull when running on Android.
> > > > I ran tests on both the emulator and the actual device and there was a
> > > > significant increase in performance because of the fixed point
> > > > implementation, but I got very frustrated that it still did not
> > > > support the amount of objects in a scene that I considered good for a
> > > > physics-based game. It seemed to handle ~10 objects moving and
> > > > colliding OK. It has been a while since I was playing with it, so I
> > > > do not really remember the exact number of objects or the frame rate.
> > > > I mostly remember being upset with it.
> > > > I am leaving the physics ideas for games out of the picture when
> > > > thinking Android for now. Someone would have to write a ground up
> > > > engine with all the performance and memory concerns of Android in
> > > > mind, which was not the case with Simpull.....I created it for
> > > > applets, then thought to port over to fixed-point for Android. It
> > > > works well with small scenes, but certainly not the staple engine to
> > > > use in my opinion.
> > > > Also, Phys2D will not run worth a damn on Android. I tried it and I
> > > > even went through some heavy performance tuning. Garbage collection
> > > > is the major issue even after all I did. I seriously doubt JBox2D
> > > > will run well either. I'll stick to what I said earlier, a ground-up
> > > > solution by someone smarter than me is probably required.
> > > > On Mar 31, 9:49 am, "admin.androidsl...@googlemail.com"
> > > > <admin.androidsl...@googlemail.com> wrote:
> > > > > Not tried but if you can provide us with some example source code or
> > > > > put something on the market, I'm sure we could take a look.
> > > > > G1 performance is significantly faster than emulator, but there are
> > > > > limitations.
> > > > > Particularly with garbage collection and memory allocation on code
> > > > > that gets run continuously in loops, so I don't know how optimised
> > > > > these physics engines are for this purpose.
> > > > > Would be interesting to find out though.
> > > > > On Mar 31, 12:52 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > Oh I forgot to re-ask...
> > > > > > "Has anyone tested Phys2D or JBox2D on an actual device to see if they
> > > > > > run better than on the emulator?
> > > > > > I have a feeling the performance will better on a G1 than the emulator
> > > > > > for some reason!
> > > > > > On Mar 31, 12:51 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > > I did take a look at Simpull, however the demo application failed to
> > > > > > > run as it relied on some library which wasn't supplied or referenced
> > > > > > > to - I just got annoyed after spending two days failing to get Phys2D
> > > > > > > and JBox2D to work in Android and didn't bother trying to work out the
> > > > > > > problems!
> > > > > > > I might give it another look though...
> > > > > > > On Mar 30, 10:41 pm, Streets Of Boston <flyingdutc...@gmail.com>
> > > > > > > wrote:
> > > > > > > > I wonder how well this one works on Android:
> > > > > > > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > > > > > > > I have a simple 2D physics engine written and running. It uses
> > > > > > > > > the now famous Jacobson physics tricks (Verlet integration and hard
> > > > > > > > > constraints). I can manage 40 balls on the screen, with fill n^2
> > > > > > > > > interaction between balls. I am working on spatial data structure
> > > > > > > > > optimizations now to improve the computational complexity of the
> > > > > > > > > collision detection code. I run the constraint update loop five times
> > > > > > > > > per frame and get 30 frames per second. Once the engine is up and
> > > > > > > > > running there are no memory allocations done in my program. And once
> > > > > > > > > the system settles down from the app launch there are very few GC
> > > > > > > > > events from other programs. Though they do still happen. Viewing
> > > > > > > > > LogCat I see a GC every 10 or 20 seconds because of some background
> > > > > > > > > application. But between those events I get a consistent frame rate.
> > > > > > > > > I am using OpenGL for my rendering.
> > > > > > > > > -Anton
> > > > > > > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > > > > > Does anyone know of, or have implemented, a physics engine which runs
> > > > > > > > > > smoothly in Android?
> > > > > > > > > > I have spent the last couple of days trying Phys2D and JBox2D, however
> > > > > > > > > > both perform very poorly - I am struggling to get even a few objects
> > > > > > > > > > to simulate smoothly as frequent garbage collection spoils it.
> > > > > > > > > > One question I do have is will these run smoother on an actual G1
> > > > > > > > > > device or is the performance of the emulator accurate?
> > > > > > > > > > Thanks- Hide quoted text -
> > > > > > > > > - Show quoted text -- Hide quoted text -
It does look smooth on the G1. The use of accelerometers is quite cool.
Good job on minimizing the GC jitters. The screen has horrible ghosting with
green to grey transitions, however, which mars the smooth framerate a bit.
Red balls would probably reduce that.
On Wed, Apr 1, 2009 at 7:04 AM, mscwd01 <mscw...@gmail.com> wrote:
> Thanks for the demo Anton,
> It certainly runs much smoother than the Phys2D and JBox2D engines I
> have tried and you have more objects being simulated - so you must
> have done something right ;)
> I would expect it to run 2-3 times faster on an actual device too from
> what I have read.
> Once you have finished off the improvements do you have any plans to
> release it?
> Thanks
> On Apr 1, 7:44 am, Anton <socialhac...@gmail.com> wrote:
> > OK, for anyone interested in my simple physics demo, check out:
> > It's pretty basic, but it shows that you can do some amount of
> > physics on the G-phone at a reasonable rate. And as always, there are
> > many improvements to be made. :)
> > -Anton
> > On Mar 31, 2:12 pm, Anton <socialhac...@gmail.com> wrote:
> > > I'll definitely post the app tonight for you guys to check out (at
> > > work now). I am an embedded systems programmer by trade. But I do
> > > physics toys for fun and am just getting into Java/Android
> > > optimizations. I will point out that optimizing for Java and
> > > optimizing for Android are very different. As people have pointed out
> > > before, the key things to be careful with on Android are memory
> > > allocation and floating point math. I've removed both of these from
> > > my physics loop. I also found that function call overhead was quite
> > > large and had to manually inline all of my fixed point math code. I
> > > think that with the correct spatial data structures I can get a couple
> > > hundred objects interacting. I have a 2D rigid body physics engine
> > > that is currently all C++ (no exceptions or templates or RTTI or
> > > multiple inheritance) that I may port over as well.
> > > However, having said all of that, I think it may be the case that
> > > we will just have to wait until a native SDK is available to really
> > > write a top notch physics engine. It's sort of the perfect example of
> > > a piece of code that doesn't need anything more than libc and JNI
> > > bindings. And since you only call it a couple times per frame the JNI
> > > overhead would be well amortized.
> > > Anton
> > > On Mar 31, 9:17 am, mscwd01 <mscw...@gmail.com> wrote:
> > > > Thanks for your feedback Shaun, I too unfortunately think a bespoke
> > > > engine will need to be written for Android, which is a real pity as
> > > > the iPhone has several physics engines which can easily handle
> > > > hundreds of objects.
> > > > Having said that Anton (2nd reply) has said he has an engine running,
> > > > it would be nice to see a demo of this if that'd be possible?
> > > > Clark, i'd definately host any .apk's on my own site, I wouldn't put
> > > > it on the marketplace if it wasn't a "finished" app - do people
> > > > actually do that?!
> > > > I think i'll stay away from developing games with physics for the
> time
> > > > being and concentrate on something else, I cant see it being feasible
> > > > to include it any time soon which is a real pity.
> > > > On Mar 31, 3:28 pm, shaun <shashepp...@gmail.com> wrote:
> > > > > I am the author of simpull.
> > > > > Sorry guys for the demo being out of whack for Simpull to the Core.
> > > > > The version of PulpCore that I integrated simpull with did not
> support
> > > > > Chrome, but you should be able to see it in IE, FF Safari. It is
> nice
> > > > > to take a look at that demo to get a feel for what the engine is
> > > > > capable of, but the performance does not translate over to the
> fixed
> > > > > point branch/version of simpull when running on Android.
> > > > > I ran tests on both the emulator and the actual device and there
> was a
> > > > > significant increase in performance because of the fixed point
> > > > > implementation, but I got very frustrated that it still did not
> > > > > support the amount of objects in a scene that I considered good for
> a
> > > > > physics-based game. It seemed to handle ~10 objects moving and
> > > > > colliding OK. It has been a while since I was playing with it, so
> I
> > > > > do not really remember the exact number of objects or the frame
> rate.
> > > > > I mostly remember being upset with it.
> > > > > I am leaving the physics ideas for games out of the picture when
> > > > > thinking Android for now. Someone would have to write a ground up
> > > > > engine with all the performance and memory concerns of Android in
> > > > > mind, which was not the case with Simpull.....I created it for
> > > > > applets, then thought to port over to fixed-point for Android. It
> > > > > works well with small scenes, but certainly not the staple engine
> to
> > > > > use in my opinion.
> > > > > Also, Phys2D will not run worth a damn on Android. I tried it and
> I
> > > > > even went through some heavy performance tuning. Garbage
> collection
> > > > > is the major issue even after all I did. I seriously doubt JBox2D
> > > > > will run well either. I'll stick to what I said earlier, a
> ground-up
> > > > > solution by someone smarter than me is probably required.
> > > > > On Mar 31, 9:49 am, "admin.androidsl...@googlemail.com"
> > > > > <admin.androidsl...@googlemail.com> wrote:
> > > > > > Not tried but if you can provide us with some example source code
> or
> > > > > > put something on the market, I'm sure we could take a look.
> > > > > > G1 performance is significantly faster than emulator, but there
> are
> > > > > > limitations.
> > > > > > Particularly with garbage collection and memory allocation on
> code
> > > > > > that gets run continuously in loops, so I don't know how
> optimised
> > > > > > these physics engines are for this purpose.
> > > > > > Would be interesting to find out though.
> > > > > > On Mar 31, 12:52 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > > Oh I forgot to re-ask...
> > > > > > > "Has anyone tested Phys2D or JBox2D on an actual device to see
> if they
> > > > > > > run better than on the emulator?
> > > > > > > I have a feeling the performance will better on a G1 than the
> emulator
> > > > > > > for some reason!
> > > > > > > On Mar 31, 12:51 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > > > I did take a look at Simpull, however the demo application
> failed to
> > > > > > > > run as it relied on some library which wasn't supplied or
> referenced
> > > > > > > > to - I just got annoyed after spending two days failing to
> get Phys2D
> > > > > > > > and JBox2D to work in Android and didn't bother trying to
> work out the
> > > > > > > > problems!
> > > > > > > > I might give it another look though...
> > > > > > > > On Mar 30, 10:41 pm, Streets Of Boston <
> flyingdutc...@gmail.com>
> > > > > > > > wrote:
> > > > > > > > > I wonder how well this one works on Android:
> > > > > > > > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > > > > > > > > I have a simple 2D physics engine written and
> running. It uses
> > > > > > > > > > the now famous Jacobson physics tricks (Verlet
> integration and hard
> > > > > > > > > > constraints). I can manage 40 balls on the screen, with
> fill n^2
> > > > > > > > > > interaction between balls. I am working on spatial data
> structure
> > > > > > > > > > optimizations now to improve the computational complexity
> of the
> > > > > > > > > > collision detection code. I run the constraint update
> loop five times
> > > > > > > > > > per frame and get 30 frames per second. Once the engine
> is up and
> > > > > > > > > > running there are no memory allocations done in my
> program. And once
> > > > > > > > > > the system settles down from the app launch there are
> very few GC
> > > > > > > > > > events from other programs. Though they do still happen.
> Viewing
> > > > > > > > > > LogCat I see a GC every 10 or 20 seconds because of some
> background
> > > > > > > > > > application. But between those events I get a consistent
> frame rate.
> > > > > > > > > > I am using OpenGL for my rendering.
> > > > > > > > > > -Anton
> > > > > > > > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > > > > > > Does anyone know of, or have implemented, a physics
> engine which runs
> > > > > > > > > > > smoothly in Android?
> > > > > > > > > > > I have spent the last couple of days trying Phys2D and
> JBox2D, however
> > > > > > > > > > > both perform very poorly - I am struggling to get even
> a few objects
> > > > > > > > > > > to simulate smoothly as frequent garbage collection
> spoils it.
> > > > > > > > > > > One question I do have is will these run smoother on an
> actual G1
> > > > > > > > > > > device or is the performance of the emulator accurate?
I was also disappointed with jbox2d's performance so I checked APE
(Actionscript Physics Engine) from http://www.cove.org/ape/ .
It was converted to java (http://www.cove.org/ape/java_ape.zip) so I
started to convert the java version to Android.
The performance is quite OK for 10-20 objects at the first start of
the app but if you exit with the back key and restart it form the
installed copy
(either in the emulator or on the dev phone) then it gets slower and
slower with each start. If you restart it from the emulator (by
reinstalling it) then it is faster again.
Neither the pressed keys are not working (probably it is because of my
poor Android programming knowledge).
Here is a zipped Android project of it. Please experiment with it and
send results to here i.e. is it slow for you also after re-re-re-..
staring?
www.kotiposti.net/lkelemen/android/testape2d.zip
thanks
Lajos Kelemen
On Mar 31, 9:26 pm, shaun <shashepp...@gmail.com> wrote:
> I started going down the path of Object pooling. It seemed the only
> solution when taking an existing engine and making work on a resource
> constrained system like Android on a phone. Determining the strategy
> for returning objects to the pool proved quite tough for me. I have
> no doubt there are some experts on embedded systems programming with
> tons of experience with object pooling. We just would be too lucky if
> that person(s) was also experienced with Java, physics engines and had
> a passion for open source and games! Is that too much to ask? LOL!!
> On Mar 31, 12:17 pm, mscwd01 <mscw...@gmail.com> wrote:
> > Thanks for your feedback Shaun, I too unfortunately think a bespoke
> > engine will need to be written for Android, which is a real pity as
> > the iPhone has several physics engines which can easily handle
> > hundreds of objects.
> > Having said that Anton (2nd reply) has said he has an engine running,
> > it would be nice to see a demo of this if that'd be possible?
> > Clark, i'd definately host any .apk's on my own site, I wouldn't put
> > it on the marketplace if it wasn't a "finished" app - do people
> > actually do that?!
> > I think i'll stay away from developing games with physics for the time
> > being and concentrate on something else, I cant see it being feasible
> > to include it any time soon which is a real pity.
> > On Mar 31, 3:28 pm, shaun <shashepp...@gmail.com> wrote:
> > > I am the author ofsimpull.
> > > Sorry guys for the demo being out of whack forSimpullto the Core.
> > > The version of PulpCore that I integratedsimpullwith did not support
> > > Chrome, but you should be able to see it in IE, FF Safari. It is nice
> > > to take a look at that demo to get a feel for what the engine is
> > > capable of, but the performance does not translate over to the fixed
> > > point branch/version ofsimpullwhen running on Android.
> > > I ran tests on both the emulator and the actual device and there was a
> > > significant increase in performance because of the fixed point
> > > implementation, but I got very frustrated that it still did not
> > > support the amount of objects in a scene that I considered good for a
> > > physics-based game. It seemed to handle ~10 objects moving and
> > > colliding OK. It has been a while since I was playing with it, so I
> > > do not really remember the exact number of objects or the frame rate.
> > > I mostly remember being upset with it.
> > > I am leaving the physics ideas for games out of the picture when
> > > thinking Android for now. Someone would have to write a ground up
> > > engine with all the performance and memory concerns of Android in
> > > mind, which was not the case withSimpull.....I created it for
> > > applets, then thought to port over to fixed-point for Android. It
> > > works well with small scenes, but certainly not the staple engine to
> > > use in my opinion.
> > > Also, Phys2D will not run worth a damn on Android. I tried it and I
> > > even went through some heavy performance tuning. Garbage collection
> > > is the major issue even after all I did. I seriously doubt JBox2D
> > > will run well either. I'll stick to what I said earlier, a ground-up
> > > solution by someone smarter than me is probably required.
> > > On Mar 31, 9:49 am, "admin.androidsl...@googlemail.com"
> > > <admin.androidsl...@googlemail.com> wrote:
> > > > Not tried but if you can provide us with some example source code or
> > > > put something on the market, I'm sure we could take a look.
> > > > G1 performance is significantly faster than emulator, but there are
> > > > limitations.
> > > > Particularly with garbage collection and memory allocation on code
> > > > that gets run continuously in loops, so I don't know how optimised
> > > > these physics engines are for this purpose.
> > > > Would be interesting to find out though.
> > > > On Mar 31, 12:52 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > Oh I forgot to re-ask...
> > > > > "Has anyone tested Phys2D or JBox2D on an actual device to see if they
> > > > > run better than on the emulator?
> > > > > I have a feeling the performance will better on a G1 than the emulator
> > > > > for some reason!
> > > > > On Mar 31, 12:51 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > I did take a look atSimpull, however the demo application failed to
> > > > > > run as it relied on some library which wasn't supplied or referenced
> > > > > > to - I just got annoyed after spending two days failing to get Phys2D
> > > > > > and JBox2D to work in Android and didn't bother trying to work out the
> > > > > > problems!
> > > > > > I might give it another look though...
> > > > > > On Mar 30, 10:41 pm, Streets Of Boston <flyingdutc...@gmail.com>
> > > > > > wrote:
> > > > > > > I wonder how well this one works on Android:
> > > > > > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > > > > > > I have a simple 2D physics engine written and running. It uses
> > > > > > > > the now famous Jacobson physics tricks (Verlet integration and hard
> > > > > > > > constraints). I can manage 40 balls on the screen, with fill n^2
> > > > > > > > interaction between balls. I am working on spatial data structure
> > > > > > > > optimizations now to improve the computational complexity of the
> > > > > > > > collision detection code. I run the constraint update loop five times
> > > > > > > > per frame and get 30 frames per second. Once the engine is up and
> > > > > > > > running there are no memory allocations done in my program. And once
> > > > > > > > the system settles down from the app launch there are very few GC
> > > > > > > > events from other programs. Though they do still happen. Viewing
> > > > > > > > LogCat I see a GC every 10 or 20 seconds because of some background
> > > > > > > > application. But between those events I get a consistent frame rate.
> > > > > > > > I am using OpenGL for my rendering.
> > > > > > > > -Anton
> > > > > > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > > > > Does anyone know of, or have implemented, a physics engine which runs
> > > > > > > > > smoothly in Android?
> > > > > > > > > I have spent the last couple of days trying Phys2D and JBox2D, however
> > > > > > > > > both perform very poorly - I am struggling to get even a few objects
> > > > > > > > > to simulate smoothly as frequent garbage collection spoils it.
> > > > > > > > > One question I do have is will these run smoother on an actual G1
> > > > > > > > > device or is the performance of the emulator accurate?
> I was also disappointed with jbox2d's performance so I checked APE
> (Actionscript Physics Engine) fromhttp://www.cove.org/ape/.
> It was converted to java (http://www.cove.org/ape/java_ape.zip) so I
> started to convert the java version to Android.
> The performance is quite OK for 10-20 objects at the first start of
> the app but if you exit with the back key and restart it form the
> installed copy
> (either in the emulator or on the dev phone) then it gets slower and
> slower with each start. If you restart it from the emulator (by
> reinstalling it) then it is faster again.
> Neither the pressed keys are not working (probably it is because of my
> poor Android programming knowledge).
> Here is a zipped Android project of it. Please experiment with it and
> send results to here i.e. is it slow for you also after re-re-re-..
> staring?www.kotiposti.net/lkelemen/android/testape2d.zip
> thanks
> Lajos Kelemen
> On Mar 31, 9:26 pm, shaun <shashepp...@gmail.com> wrote:
> > I started going down the path of Object pooling. It seemed the only
> > solution when taking an existing engine and making work on a resource
> > constrained system like Android on a phone. Determining the strategy
> > for returning objects to the pool proved quite tough for me. I have
> > no doubt there are some experts on embedded systems programming with
> > tons of experience with object pooling. We just would be too lucky if
> > that person(s) was also experienced with Java, physics engines and had
> > a passion for open source and games! Is that too much to ask? LOL!!
> > On Mar 31, 12:17 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > Thanks for your feedback Shaun, I too unfortunately think a bespoke
> > > engine will need to be written for Android, which is a real pity as
> > > the iPhone has several physics engines which can easily handle
> > > hundreds of objects.
> > > Having said that Anton (2nd reply) has said he has an engine running,
> > > it would be nice to see a demo of this if that'd be possible?
> > > Clark, i'd definately host any .apk's on my own site, I wouldn't put
> > > it on the marketplace if it wasn't a "finished" app - do people
> > > actually do that?!
> > > I think i'll stay away from developing games with physics for the time
> > > being and concentrate on something else, I cant see it being feasible
> > > to include it any time soon which is a real pity.
> > > On Mar 31, 3:28 pm, shaun <shashepp...@gmail.com> wrote:
> > > > I am the author ofsimpull.
> > > > Sorry guys for the demo being out of whack forSimpullto the Core.
> > > > The version of PulpCore that I integratedsimpullwith did not support
> > > > Chrome, but you should be able to see it in IE, FF Safari. It is nice
> > > > to take a look at that demo to get a feel for what the engine is
> > > > capable of, but the performance does not translate over to the fixed
> > > > point branch/version ofsimpullwhen running on Android.
> > > > I ran tests on both the emulator and the actual device and there was a
> > > > significant increase in performance because of the fixed point
> > > > implementation, but I got very frustrated that it still did not
> > > > support the amount of objects in a scene that I considered good for a
> > > > physics-based game. It seemed to handle ~10 objects moving and
> > > > colliding OK. It has been a while since I was playing with it, so I
> > > > do not really remember the exact number of objects or the frame rate.
> > > > I mostly remember being upset with it.
> > > > I am leaving the physics ideas for games out of the picture when
> > > > thinking Android for now. Someone would have to write a ground up
> > > > engine with all the performance and memory concerns of Android in
> > > > mind, which was not the case withSimpull.....I created it for
> > > > applets, then thought to port over to fixed-point for Android. It
> > > > works well with small scenes, but certainly not the staple engine to
> > > > use in my opinion.
> > > > Also, Phys2D will not run worth a damn on Android. I tried it and I
> > > > even went through some heavy performance tuning. Garbage collection
> > > > is the major issue even after all I did. I seriously doubt JBox2D
> > > > will run well either. I'll stick to what I said earlier, a ground-up
> > > > solution by someone smarter than me is probably required.
> > > > On Mar 31, 9:49 am, "admin.androidsl...@googlemail.com"
> > > > <admin.androidsl...@googlemail.com> wrote:
> > > > > Not tried but if you can provide us with some example source code or
> > > > > put something on the market, I'm sure we could take a look.
> > > > > G1 performance is significantly faster than emulator, but there are
> > > > > limitations.
> > > > > Particularly with garbage collection and memory allocation on code
> > > > > that gets run continuously in loops, so I don't know how optimised
> > > > > these physics engines are for this purpose.
> > > > > Would be interesting to find out though.
> > > > > On Mar 31, 12:52 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > Oh I forgot to re-ask...
> > > > > > "Has anyone tested Phys2D or JBox2D on an actual device to see if they
> > > > > > run better than on the emulator?
> > > > > > I have a feeling the performance will better on a G1 than the emulator
> > > > > > for some reason!
> > > > > > On Mar 31, 12:51 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > > I did take a look atSimpull, however the demo application failed to
> > > > > > > run as it relied on some library which wasn't supplied or referenced
> > > > > > > to - I just got annoyed after spending two days failing to get Phys2D
> > > > > > > and JBox2D to work in Android and didn't bother trying to work out the
> > > > > > > problems!
> > > > > > > I might give it another look though...
> > > > > > > On Mar 30, 10:41 pm, Streets Of Boston <flyingdutc...@gmail.com>
> > > > > > > wrote:
> > > > > > > > I wonder how well this one works on Android:
> > > > > > > > On Mar 30, 4:58 pm, Anton <socialhac...@gmail.com> wrote:
> > > > > > > > > I have a simple 2D physics engine written and running. It uses
> > > > > > > > > the now famous Jacobson physics tricks (Verlet integration and hard
> > > > > > > > > constraints). I can manage 40 balls on the screen, with fill n^2
> > > > > > > > > interaction between balls. I am working on spatial data structure
> > > > > > > > > optimizations now to improve the computational complexity of the
> > > > > > > > > collision detection code. I run the constraint update loop five times
> > > > > > > > > per frame and get 30 frames per second. Once the engine is up and
> > > > > > > > > running there are no memory allocations done in my program. And once
> > > > > > > > > the system settles down from the app launch there are very few GC
> > > > > > > > > events from other programs. Though they do still happen. Viewing
> > > > > > > > > LogCat I see a GC every 10 or 20 seconds because of some background
> > > > > > > > > application. But between those events I get a consistent frame rate.
> > > > > > > > > I am using OpenGL for my rendering.
> > > > > > > > > -Anton
> > > > > > > > > On Mar 30, 1:14 pm, mscwd01 <mscw...@gmail.com> wrote:
> > > > > > > > > > Does anyone know of, or have implemented, a physics engine which runs
> > > > > > > > > > smoothly in Android?
> > > > > > > > > > I have spent the last couple of days trying Phys2D and JBox2D, however
> > > > > > > > > > both perform very poorly - I am struggling to get even a few objects
> > > > > > > > > > to simulate smoothly as frequent garbage collection spoils it.
> > > > > > > > > > One question I do have is will these run smoother on an actual G1
> > > > > > > > > > device or is the performance of the emulator accurate?