Jump to content
  • Advertisement
Sign in to follow this  
beinghuman

Regarding SDL, Chipmunk, and Maps

This topic is 3758 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am new to the game development scene although I have some experience with allegro and SDL. I have a few questions regarding SDL, Chipmunk, and level maps. I'm not sure if this is the correct category for this post, if it's not please move it. Are there any tutorials out there for integrating Chipmunk with SDL? I am planning on doing levels with textured polygons and I was wondering what is the best method of saving and loading level maps. Is there is a program that will compile the editable map to machine object or whatever? Should I just go with INI files?

Share this post


Link to post
Share on other sites
Advertisement
I think I'll move this over to For Beginners as it's not particularly API-specific.

SDL and Chipmunk handle very separate things so there's not really much integration to be done. You would just call the SDL and Chipmunk initialisations alongside each other, call the Chipmunk updates during your update and event handling loop in SDL, and shut both things down at the end. Apart from possibly basing Chipmunk object sizes on those from an SDL_Surface, there's no real interaction between the two. Chipmunk moves your objects and SDL renders them, but they don't communicate directly.

As for the 2nd question, when you say 'textured polygons', bear in mind that SDL doesn't work with textures or polygons at all. If you want to go down that route, you need to use OpenGL with SDL. If you're talking about 3D games, there are many existing formats for storing 3D data. I would say that doing it yourself with an INI file is fine for very, very basic stuff to begin with, but in the end you are going to want to use one of the standard formats which can be generated from a 3D modelling program. Hopefully some people here can advise you on potential formats. If you're still talking about 2D, then I don't know any general formats for storing 2D level data - if it's quite simple, then maybe your INI file idea will be ok, but it will depend on what you want to store.

Share this post


Link to post
Share on other sites
Quote:
Original post by Kylotan
I think I'll move this over to For Beginners as it's not particularly...


Kylotan,

BTW I'm talking 2D

I make classes for objects in my code. Could I not just use chipmunk to modify integer members of the object class. That way in my render method the surface will be drawn in the coordinates decided by chipmunk.

There are some demos for Chipmunk however there really isn't a basic tutorial for using it. If anyone knows of any I would truly appreciate it if you could link me.

And when I talk about polygons, I'm talking about drawing the 2d polygons with, oh.... SDL_gfx or I could go straight openGL, however I'm not that great with it. And texturing them with i dunno... dirt or grass. And be able to scale the size of the polgyon texture (still talking 2D).

Thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by beinghuman
I make classes for objects in my code. Could I not just use chipmunk to modify integer members of the object class. That way in my render method the surface will be drawn in the coordinates decided by chipmunk.


Yes, I expect that is exactly how you'd do it.

Quote:
And when I talk about polygons, I'm talking about drawing the 2d polygons with, oh.... SDL_gfx or I could go straight openGL, however I'm not that great with it. And texturing them with i dunno... dirt or grass. And be able to scale the size of the polgyon texture (still talking 2D).


If you want to do any non-trivial rotations and scalings, you really need to go to OpenGL - something like SDL_gfx won't be sufficient for more than a very small number of graphics.

It's worth being careful with your terminology - SDL_gfx does render geometric shapes - ie. polygons - but not using the same technology that we normally mean when we say 'polygons', ie. hardware-accelerated triangles. Similarly, the blitting that allows you to apply a 'texture' when rendering in SDL is not really using a 'texture' in modern graphical terms, nor is it using the typical polygons to display them. However, should you go with an OpenGL-based system to accomplish these tasks, that will obviously use polygons and textures, and will be a lot faster as a result.

Share this post


Link to post
Share on other sites
Quote:
Original post by Kylotan
Quote:
Original post by beinghuman
I make classes for objects in my code. Could I not just use chipmunk to modify integer members of the object class. That way in my render method the surface will be drawn in the coordinates decided by chipmunk.


Yes, I expect that is exactly how you'd do it.

Quote:
And when I talk about polygons, I'm talking about drawing the 2d polygons with, oh.... SDL_gfx or I could go straight openGL, however I'm not that great with it. And texturing them with i dunno... dirt or grass. And be able to scale the size of the polgyon texture (still talking 2D).


If you want to do any non-trivial rotations and scalings, you really need to go to OpenGL - something like SDL_gfx won't be sufficient for more than a very small number of...


I appreciate the help. I'll give it a shot.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!