3 ms·
That advice never works. The problem is data structures. If your high-level prototype uses complex data structures of e.g. Python, you will not be able to acces
by miloshh 17y ago
That advice never works. The problem is data structures. If your high-level prototype uses complex data structures of e.g. Python, you will not be able to access them from C++. You will need to rewrite the whole thing anyway.
The only way you might get away with this approach is if your application is essentially a number of separate scripts that communicate through files. Then you can rewrite the key scripts in C++. But that is never the case for games.
- lutorm 17y agoPart of Civ IV (mostly gui stuff) is in python. They seem to be able to communicate with the C++ core fine.
- miloshh 17y agoBut I assume they did not write the game in Python and the optimize parts in C++. Quite the opposite - they wrote it in C++ and then found that some part (e.g. GUI) is growing in complexity while not being crucial for performance, at which point it is a good decision to use a scripting language for it. That is a pretty common approach, but what was suggested above (writing first in HLL and then rewriting parts in C++) is, to my knowledge, never done in practice.
- silentbicycle 17y agoWhile rather similar to Python, Lua has a simple stack-based C API that makes this far less of a problem. OTOH, Lua was designed for embedded use from the start, and its stand-alone interpreter comes second.