How much do I loose for using C++ ?

Return to C++ coding using Panda3D

How much do I loose for using C++ ?

Postby Juggernaut » Thu Apr 26, 2012 8:37 am

In the manual it has been said -

Recommendation: Use Python

Caution: we do not recommend writing Panda3D programs in 100% C++. Instead, we suggest writing your programs in mostly-python, with a little C++ here and there. The reasons we suggest this are:

First, because we've tried it very successfully. Both Disney and Carnegie-Mellon have been creating applications in python with excellent results. All the commercial Disney games that use Panda3D are written in mostly-python. It is very easy to attain excellent performance using mostly-python, and the development is a lot quicker and easier than using C++.

Second, there are parts of Panda3D that are written in python. These are not the speed-critical parts. For instance, the scene graph browser is written in python. The heads-up-display code is in python. If you reject python entirely, you lose access to a lot of important functionality.

Third, the entire Panda3D manual is in python. Also, all the sample programs are in python. It is much harder to learn Panda3D if you try to translate the manual from python to C++ at the same time as you're trying to learn Panda3D.


My question to C++ users, how much do I loose feature wise for using Panda with C++ instead of python.
Juggernaut
 
Posts: 90
Joined: Sat Feb 11, 2012 5:46 am

Postby atari314 » Thu Apr 26, 2012 10:09 am

I don't believe we actually have a choice.

For instance, if you can't allow your code to be easily readable (python's bytecode or plain python), either is the C++'s way or the highway (cython is far from being reliable atm, unfortunately).
atari314
 
Posts: 47
Joined: Sun Mar 13, 2011 11:35 am

Postby drwr » Thu Apr 26, 2012 11:29 am

There are plenty of religious debates one way or the other about the appropriateness of either language on its own merits. I won't attempt to enter that debate, though I will say that I respectfully disagree with atari314's perhaps naive assessment.

But to answer the question, there are only a few high-level objects that are coded entirely in Python; and these are generally those objects whose interface is particularly Pythonic and not suited to the C++ language. Also, the required functionality is still provided by lower-level C++ objects that you have access to.

For instance, the Actor interface is Python, but you can use the lower-level Character interface in C++. The DirectGui interface is Python, but you can use the lower-level PGui interface in C++. The FSM class is only Python and doesn't have a C++ equivalent, but it's only a small class that relies on Python's duck typing and wouldn't really work in C++ anyway.

David
drwr
 
Posts: 11253
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Personally ...

Postby EdmundosTown » Sun Apr 29, 2012 12:56 am

Personally I have a better performance using C++ instead of Python, you only loose some packages (all replaceables by your own code or third party's ones), you loose some documentation too but translating from Python stuff is not too hard ...

In the other hand, I don't like python syntax ... I don't know why but I just hate it, specially OOP syntax. Anyway I think coding in C++ have more programmers-cache than programming in Python, If you say: "I have written a cool game with Python" they will think: "oh yeah? cool for you", but If you say: "I have written a cool game using C++" they will say: "Oh, It's fantastic! Can I see your code?" ... XD ok this last one is poor of sense but I had to say it.

I hope that help you with my personal focus. And sorry for my bad English :D Good coding.
EdmundosTown
 
Posts: 26
Joined: Mon Oct 17, 2011 1:36 pm
Location: Mexico City, Mexico

Postby Juggernaut » Sun Apr 29, 2012 1:38 am


"I have written a cool game with Python" they will think: "oh yeah? cool for you", but If you say: "I have written a cool game using C++" they will say: "Oh, It's fantastic! Can I see your code?" ... XD ok this last one is poor of sense but I had to say it.



Yes ..... the professional game industry only accepts C++ than any other language ....... that is the main reason I started with C++ and not with Python. C++ is the de-facto standard language for coding games in the professional industry. I wish C++ was as easy as BASIC. :)
Juggernaut
 
Posts: 90
Joined: Sat Feb 11, 2012 5:46 am

Postby wezu » Sun Apr 29, 2012 8:25 am

The player will give a sh... won't care what language was used to make a game.
Use what you like. Some people even like Java...

The only thing that one can loose using C++ is time.
I may be totally wrong, cause I'm a dancin' fool.
User avatar
wezu
 
Posts: 514
Joined: Tue May 19, 2009 1:03 pm

Postby Juggernaut » Sun Apr 29, 2012 10:26 am

The player will give a sh... won't care what language was used to make a game.
Use what you like. Some people even like Java...

The only thing that one can loose using C++ is time.


...... true ... indeed ...... but unfortunately ..... I have not heard of any largely computational intensive game like a multiplayer RTS to be built with something like Python or Java. Even if the engine core is RAW C++ power, the game logic and loops in a very massive game environment can slow the game down .... and then of course ...... players will do give a "sh**".

Python, Java, C# or whatever ...... they just do not come no where near to C/C++ if execution speed is considered. I have seen several instances on the internet where they even showed benchamark test results trying to prove that java / C# executes faster than C/C++ because their code gets optimized by the JIT compiler in real time for the machine they are running on. But that is only one side of the story. Because later at the bottom of the discussion topic they will admit that a properly written C/C++ code will beat every other language flat and square.

Oh yes ..... learning to write good C/C++ code is painstaking and the learning curve is steeper - even worse - coding / debugging / testing time is also much larger than other languages. But keep in in mind one thing - we are not building a desktop application here
...... we are writing serious games - and in today's industry ....... the coders want to leverage every computational power on the host machine's hardware - and in that respect C/C++ wins hands down.
Juggernaut
 
Posts: 90
Joined: Sat Feb 11, 2012 5:46 am

Why cache?

Postby EdmundosTown » Sun Apr 29, 2012 11:19 am

You can't compare C++ with Python because they are for different purposes, i.e. Python has been created for multiplatform coding as Java and C#, C++ isn't at all.

If you want to develop a game in Python there's no problem, but in game professional industry you will get more "respect" if you program it on C++, and I repeat IN PROF. GAME INDUSTRY.

It doesn't mean that Python are less than C++ ... :D It's my point.
EdmundosTown
 
Posts: 26
Joined: Mon Oct 17, 2011 1:36 pm
Location: Mexico City, Mexico

Postby Juggernaut » Sun Apr 29, 2012 11:31 am

@EdmundosTown : Fair enough ..... :)
Juggernaut
 
Posts: 90
Joined: Sat Feb 11, 2012 5:46 am

Postby wezu » Sun Apr 29, 2012 11:46 am

I think it's common practice that a game has a C/C++ core and a scripting language to drive the gameplay.

Just to name some games using Python:
-Mount&Blade
-Civilization IV (?)
-Metin2
-Battlefield Heroes
-EVE Online
-Pirates of the Caribbean :D
There may be more that I don't know of (this is just from the top of my head).

Many more games use Lua (but don't ask me to name any), and even more invent their own 'C-like' scripts (like nwscript used in NWN, KotOR and The Witcher).

I know that (some) programmers want their applications to run as-fast-as-possible but for games it really should be as-fast-as-it-is-needed and that's exactly 60FPS. C++ core + Python scripting can run that fast, so I for one won't bother with C++.


..Oh, and I have to take back what I wrote about the players that don't care - if a game is ever to be moded by player communities then it will make a difference if they can rewrite scripts in notepad or have to compile the exe anew.

But wait! Don't shoot! I'm not saying that C++ is bad, I'm just saying that Python is good enough.
I may be totally wrong, cause I'm a dancin' fool.
User avatar
wezu
 
Posts: 514
Joined: Tue May 19, 2009 1:03 pm

Yep

Postby EdmundosTown » Sun Apr 29, 2012 11:42 pm

Totally agree, and I think that need to check my Python isntalling because I get a big difference between both, with C++ I get 400-500 FPS but with Python I get 10 FPS :? I'll check why :D
EdmundosTown
 
Posts: 26
Joined: Mon Oct 17, 2011 1:36 pm
Location: Mexico City, Mexico


Return to C++ coding using Panda3D

Who is online

Users browsing this forum: Google [Bot] and 0 guests

cron