Is it possible to create 3d games with pygame?

Asked

Viewed 1,722 times

3

Is it possible? And if possible I need to know how to draw my own 3d images or is there a website that provides free 3d images?

  • Pygame comes as an abstraction layer between Python and SDL. If I’m not mistaken SDL is focused on 2D. I can’t remember if there’s a support for 3D, or if you should do it in your hand. But if you just want a Donkeykong-like alternative, that was a set of impressions of a 3D model in a 2D Sprite giving depth feel

  • 1

    Hello, welcome to SOPT. I have serious doubts about this question being well formatted for this site. I suggest to do the [tour] and read [Ask]. In the meantime, in the courtroom... yes, it is possible. But as you have already commented, Pygame will not help you directly with 3D. You’ll need other things, like Pyopengl. There are also other alternatives (read more here).

  • 2

    About obtaining 3D models and textures, the ideal is that you do it yourself (or hire someone who does it). But you can buy it on the Internet too. There are numerous sites like Turbosquid who sell 3D models, but the problem is that not all models you buy will be ready to be used in games (there are several issues involved, from file format to mesh complexity, use of normal maps, etc).

1 answer

3


The module pygame of Python is based on libsdl. Known as Simple Directmedia Layer or SDL.

SDL is not a 3D graphical library. According to the information contained in official page:

SDL is a cross-platform multimedia library designed to provide low-level access to audio, keyboard, mouse, joystick, and graphics hardware via Opengl and Direct3d.

That one "Access to graphics hardware via Opengl and Direct3d" means that SDL contains some auxiliary functions to facilitate cross-platform use of Opengl, but you will still need to implement a layer (engine) for raw Opengl, capable of converting 2D to 3D and vice versa.

If you want a more specific approach to 3D, maybe Engines 3D, such as the Ogre or Irrlicht, that use Opengl (or Direct3d in Windows) and provide API for 3D graphics models.

  • Pygame has an openGL module as well - but it is very low level and very difficult to use . so "it is possible but not recommended". The other engines, and also Blender, with the Blender Game Engine are more appropriate.

  • @jsbueno: I would say: Recommended for didactic purposes and proof of concept. (without saying that implement a engine capable of processing 3D graphic models is certainly quite fun!)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.