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"}
{"name":"591297","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/1\/71a56b49b1aa3dae3edb92b7cc60f6af.png","w":648,"h":514,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/1\/71a56b49b1aa3dae3edb92b7cc60f6af"}
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.
$ 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
1. the cpu usage was always 100%. I changed rest(0) to rest(1) and the usage dropped to 70% which is still fairly high for an amd 2.2 ghz which leads me to believe this kind of physics is difficult to use in games.
2. after a while the game hung, I dont think it crashed because the cpu usage was constant. maybe an infinite loop or something.
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.
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.
if i could kiss you.. i would.
Yep, cool. Now somebody make a platformer with it, for the love of Alex...
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.
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.
Cool stuff. Did you notice any extensions for shapes other than boxes on your travels?
Not that boxes wouldn't be good enough for 95% of most gameplay.
Thanks!
Currently I've got circles as well.
{"name":"591304","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/7\/779d319efdf3a7e97d1293884e25a08b.png","w":535,"h":412,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/7\/779d319efdf3a7e97d1293884e25a08b"}
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.
Oh how fun! Can't wait!
Those demos are really nice.
However it freezes when I put a lot of objects.
Great work!
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.