[PIGMI] Documentation review
Chris McCormick
chris at mccormick.cx
Mon Jan 24 21:08:38 PST 2011
Hi,
Thanks for your comments, great stuff.
On Sun, Jan 23, 2011 at 01:40:38PM +0800, Paul Turbett (Black Lab Games) wrote:
> Hmm, maybe that's the only thing (and not a big deal), could the Game and
> Entity class description links in the left be at the top?
Ah yes, good idea. It seems like there is no option in jsDoc to do that, but I
will try to hack it somehow. If anyone knows a better Javascript documentation
generator I would love to hear about it.
On Sun, Jan 23, 2011 at 03:56:44PM +0800, Doug wrote:
> - How would you integrate this with one of the js Box2D implementations?
> (need, effectively, a method / callback to pull 2d position, rotation state
> for every entity from the box2d core every frame; this applies with any
> other physics engine you slot in too; is there a way to do this per Entity?
> It wasn't clear to me)
Good use case, I will have a think about that. I think the best way to do it
would be in the entity's update() method you call the box2d singleton to
request the relevant parameters. In fact, you could just do it directly in the
draw() method. I might have a shot at doing this to see how it works out.
Thanks for the suggestion.
> - Along these lines, since you get the canvas reference in the draw()
> method, you can rotate your sprites arbitrarily using c.setTransform(), but
> once you do, your axis aligned collide code doesn't work any more, because
> the bounding box isn't axis aligned any more. That's fine, because Box2D
> handles collision detection; but how would you plug that into this?
That's correct, aabb only does what it says. If I was using a physics engine
like box2d I would rely entirely on the collision routines from the engine, not
the ones in jsGameSoup.
> - Your network model doesn't seem to support long polling connections. Have
> you considered depending on socket.io?
I need to look into the comet stuff, and I will take a look at socket.io too. I
really want to minimise dependencies. If someone wanted to use socket.io there
is nothing stopping them using it instead of the built-in networking stuff. I
purposely made everything as modular as possible so there aren't really
interdependencies between the different bits of the library.
> - Looks like there aren't any obvious external dependencies; have you
> considered looking into see if this would run under node.js? I believe there
> was a node.js canvas implementation floating around somewhere..?
Oh really? I will definitely look that up, thanks for the tip.
> If you could make this a library that ran equally as a desktop app using
> node.js, or a browser app depending on the situation, and think you'd get a
> lot of interest in it...
Well you can deploy on the desktop (Mac, Linux, PC) using the XULRunner
runtime. What I will probably do is write a small tutorial for how to do that
on the website.
You can also deploy on iPhone or Android using a WebKit surface as your main
app window, but I did some tests on my slow Android phone and it's too slow to
play. I think what I am going to do is use the Rhino javascript engine on
Android, and implement a clone of the browser's Canvas() object in OpenGL ES.
There is a pretty good match between OpenGL and the canvas methods anyway.
Since the only bit of the browser that jsGamesoup depends on is the <canvas>
tag/object, that should allow your games to run at very good speeds directly on
Android. If I can get that working it means you can write once and deploy on:
* Web
* PC
* Mac
* Linux
* Android (the only one that doesn't work yet)
If this sounds exciting to anyone and they don't want to wait for me to do it,
it's a Free Software project so feel free to send me patches. :)
Cheers,
Chris.
-------------------
http://mccormick.cx
More information about the pigmi-pigmi.org
mailing list