Simple 2D game... Simple collision? Probably not? =-=

Published December 19, 2011
Advertisement
Thinking on my next step on my game that's start coding the whole stuff, [s]so I can realize I'm not gonna make it and give up already[/s], and I have to choose an engine...
HGE's great for it's simplicity, how they say, make games, not engines! But Allegro seems more powerful and is a lot more realiable, not to mention it's cross-platform, [s]as if anyone cares for cross-platforming[/s]. But yesterday I discovered pmask, a really good collision utility for allegro and SDL! It's detection is perfect and it's unbelievably fast for that kind of precision...

For those interested: PMASK
There're two exe demo showing it's incredibly good performance and detection precision! Give them a try!
Did I say it is "pixel perfect"? D:

@Edit: It turns out that PMASK is only Allegro4... what a disappointment! Anyway, the author's released his work (thanks for it if you're reading this haha) on public domain, anyone can port it!
I guess I'll have to read his code and see how he's done the computing. Maybe I can make a ported version for allegro 5 or maybe I'm laughably wrong thinking it's incompatible...

@Edit2: nightcracker has posted the following files on the comments:
https://raw.github.com/gist/1460947/e94f96497ee759e64828a3e0b3ea7defb170a7b8/bitmask.c
https://raw.github.com/gist/1460953/199aed3e3d6acf9353e25c1eb582c53eaa8777ea/bitmask.h
Thanks again!
1 likes 7 comments

Comments

Programming020195BRook
I would strongly recommend Allegro!!! I've been using this for along time, and it's come along way in Allegro 5! Engines are never bad to use, mind you it saves time! But people don't realize after you've completed a few games just by using an API, you've already made a lot of reusable code! One trick is to program your games as normal, but with a generic way of handling how the code works, simply so you can re-use it with ease.

I suggest you just pick one thing, and stick with it until you've made at least one complete game with it. You will either love, or hate the experience.

I look forward to your progress! :)
December 20, 2011 01:23 AM
DejaimeNeto
Thanks for the cheer! I am going to use allegro 5. HGE's simplicity is nice, but I can't deal with lack of proper documentation, as well as being windows only... Still, if I can't make pmask work for me, I'll have to code the perfect collision myself! Well, better put my brain in the oven and fingers to work!

Thanks for the comment!
December 21, 2011 09:35 PM
BeerNutts
Hi dejaime,

I'm not familiar with Allegro, but, I tout SFML a lot. Have you looked atSFML as well? If so, why did you choose Allegro instead of SFML? I'm curious if I should look into Allegro now.

Thanks.
December 23, 2011 06:25 AM
DejaimeNeto
I actually considered SDL, Allegro, OpenGL and DirectX! (HGE was just mentioned since this journal aims to begginners and high level libraries are good for who want to dive in and learn!)

I like allegro due to lots of reasons, I'll list [i]some [/i]here:
0 - Nice and really helpful community
1 - Portability/Flexibility.
Allegro runs pretty well on Win/Mac/Nix and iPhone... There's even an Andoird port mantained by the community!
2 - Extremely easy to learn/use. <-- this is really important!
3 - Inpeccable documentation!

4 - the technical side:
4.1 - Modular
4.2 - Threading
4.3 - Hardware Accelerated
4.4 - Good Timers implementation
4.5 - Great Events System for Keyboard input, timers and display (such as resize or minimized the window, etc)
and probably 100 more I can't remember right now! haha

I really like allegro, it's good to use and easy to set up!
Not to mention it's also free.

I only got to know SMFL after I was actually using allegro for about 4 months, I didn't really give it a chance (yet)...

I think it's also good to say that the next allegro version[size="1"] (5.1, the unstable is already downloadable) [/size]will have shaders!
December 23, 2011 04:26 PM
nightcracker
You might want to publish this:

[url="https://raw.github.com/gist/1460947/e94f96497ee759e64828a3e0b3ea7defb170a7b8/bitmask.c"]https://raw.github.c...0a7b8/bitmask.c[/url]
[url="https://raw.github.com/gist/1460953/199aed3e3d6acf9353e25c1eb582c53eaa8777ea/bitmask.h"]https://raw.github.c...777ea/bitmask.h[/url]

I ripped it out of pygame, it has very good performance. LGPL.
December 24, 2011 11:36 AM
DejaimeNeto
I'll add that to the post! Thanks for it!

I am actually half-way on my own collision engine that'll put together spacial hashing, bounding boxes and precise pixel perfect collision, all coded under allegro's bitmaps. It's working nicely as of now, but the grid is hardcoded, I am still to create a way of cofiguring the grid...
December 24, 2011 02:31 PM
DejaimeNeto
By some weird reason, my anti-virus detected the HGE compressed file as a trojan while didn't detect anything in the uncompressed folder.
AVs and their problems with compressed files...
May 23, 2012 12:38 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement