Book Image

Panda3D 1.7 Game Developer's Cookbook

Book Image

Panda3D 1.7 Game Developer's Cookbook

Overview of this book

Table of Contents (20 chapters)
Panda3D 1.7 Game Developer's Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Implementing performance critical code in C++


While in direct comparison, compiled C++ code performs better than the same code ported to Python, it would be wrong to generally state that the use of the Python interpreter in Panda3D is detrimental to the performance of your game. This would be wrong and utter nonsense, as Python just acts as a simpler interface to the engine's core libraries. Most of a game's code that uses the Python interface of Panda3D consists of calls to the engine's APIs, which are implemented in C++ and simply forwarded by the Python runtime.

While this architecture generally delivers quite acceptable performance, there might be an occasion or two where, after thoroughly profiling and optimizing your Python code, you still might not have reached the performance goals you set for that piece of code. Only if you are sure about there not being any gains possible to achieve anymore should you start thinking about writing a C++ implementation of your code.

This recipe will...