![]() |
|
Box2D physics for Allegro |
Johan Peitz
Member #9
April 2000
![]() |
Hello Allegators! {"name":"591296","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/8\/b8da1efc57ceb750f7a17d27b1cad77e.png","w":649,"h":514,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/8\/b8da1efc57ceb750f7a17d27b1cad77e"} I've been busy porting Erin Catto's Box2D physics tutorial to Allegro and it went pretty smooth. Not much porting to do really since most of it is math which didn't require any porting so mostly I've been converting openGl calls to Allegro. Other than that I've rearranged the demos a bit and made the main code a bit easier to use (less pointers - more stl). I'd like to work more on it and make it easily plugin able to any game but I don't know how much time I have for that... In the meantime I thought I might as well present what I've got and see if anyone of you guys might need some box physics. Feel free to do whatever you want with it (more or less). Also, feel free to comment give me some tips on what to improve etc etc. Soruce and binary (win) attached. -- |
kazzmir
Member #1,786
December 2001
![]() |
$ g++ *.cpp -o game `allegro-config --libs` main.cpp:775: error: `main' must return `int' The physics is really cool. I can't say that I understand that math after looking through the source but it doesn't look that complicated. I'll wait for someone else to explain it in laymen's terms I suppose. Two things |
GrantG
Member #8,173
December 2006
![]() |
Yea I got it to freeze as well, after I filled half of the screen with boxes, but it didn't slowly start lagging (it was running quite fast actually), it just suddenly froze.
|
Johan Peitz
Member #9
April 2000
![]() |
Actually, it doesn't freeze. The physics algo is currently O(n^2) and once there are too many boxes it never has the time to draw anything at all, but it still runs. Press 1 or any other demo key to reset it. -- |
Albin Engström
Member #8,110
December 2006
![]() |
if i could kiss you.. i would. |
nonnus29
Member #2,606
August 2002
![]() |
Yep, cool. Now somebody make a platformer with it, for the love of Alex...
|
Paul Pridham
Member #250
April 2000
![]() |
Johan said: The physics algo is currently O(n^2) Ahh, it would be nice if the interactions could be sectorized. That would help a ton for platformery type games. ---- |
Johan Peitz
Member #9
April 2000
![]() |
Luckily, that's what I'm working on right now! (Sectors.) I found someone elses addon to Box2D and it does this except that it is a bit wonky on my end so I'm trying to get it working properly. -- |
Paul Pridham
Member #250
April 2000
![]() |
Cool stuff. Did you notice any extensions for shapes other than boxes on your travels? ---- |
Johan Peitz
Member #9
April 2000
![]() |
Thanks! Currently I've got circles as well. I've got a really stupid bug right now that makes random objects fly around. It's probably because I only used parts of the updated code I found, so I'll just compare what's left of it. Some time. -- |
Ceagon Xylas
Member #5,495
February 2005
![]() |
Oh how fun! Can't wait! |
Paul whoknows
Member #5,081
September 2004
![]() |
Those demos are really nice. ____ "The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner. |
Kauhiz
Member #4,798
July 2004
|
Peitz said: Actually, it doesn't freeze. The physics algo is currently O(n^2) and once there are too many boxes it never has the time to draw anything at all, but it still runs. Press 1 or any other demo key to reset it.
--- |
|