开发者

3d game with Python, starting from nothing [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. 开发者_如何学CYou can edit the question so it can be answered with facts and citations.

Closed 3 years ago.

Improve this question

So we want to program a 3d game for school, we can probably use blender for the 3d models, however we are totally clueless as to how to use them in a game/application.

Are there any recommended guides/documents we should read on general 3d game programming and perhaps python specific stuff.

We are also possibly considering programming it in C++ but for now I think it's easier to use Python as we can fully focus on the 3d mechanics that way.


Panda3D is a nice, powerful game engine which allows for scripting in Python. This looks like a good place to start.

If you seek something more low-level, there's still PyOpenGL or pygame.


There's Pygame: A game framework for the Python language. If you need to know the basics for game development (engine, flow, ui, mathematics), this framework with all its examples will help you a lot. This won't take you by the hand and guide you step by step through game-development, but if you need a reference and a decent framework, than this is a good start.

There's also PyOpenGL: The official Python wrapper for OpenGL programming. Again with lots of programming examples in the field and tons of code snippets on how to use 3d models and the likes. Can be used together with PyGame.

But you should start by familiarizing yourself with some 3D basics. Look around at the GameDev.net site. Learn a thing or two about matrices (and perhaps quaternions). There are lots of beginners tutorials and references available to get you started.

edit: I almost forgot: there's also Panda3D with extensive scripting possibilities for Python. Maybe that'll offer a higher level of game development.


You can actually develop games in Blender via Python. There are quite a few tutorials, I'll let you google around for the style you like.

More info here


An alternative to PyGame, which I personally prefer, is pyglet. http://pyglet.org


If you want to write a 3D game you might want to start by understanding the basics of programming and computer science. Starting with the top and learning a language, then find yourself a good graphics library for example Panda, Pygame are all good choices, then there are other parts to consider like networking with twisted for example or a physics engine. It might also be a good choice to consider using a working engine like the unreal engine as often game designers get too wrapped up in game mechanics and not the game itself


You should be aware that 3D game consists of

  • animated 3D models
  • 3D environment (including NPCs and objects)
  • simulation of interaction between the environment and the models (game logic and game mechanics)
  • user interface (starting, saving and game settings)

The game logic and mechanics is going to usually the biggest and most complicated part and you should try to wrap your head against that first.

Modeling 3D objects and environment should be much easier after that.


I would implement the time-critical stuff as 3D and its object handling + rendering in raw C/C++ and let an embedded Python with external modules handle the game logic (object movement, object properties, scripting and so on).


It's quit easy to code simple 3D games. The position of any object on the screen can always be calculated as simply as:

position = (x/z*fov,x/z*fov)

where x and z are both horizontal axis and fov is the player's field of view, in [radians/degrees/pixels/...].

When you rotate around, the word is rotating not you. It means that you are always looking against positive z. Quaternions is the best way to rotate the world around you.

Ps. use vertexarrays or arrays to for the fastest possible 3d graphics

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜