Jump to content

View more

Image of the Day

#ld38 #screenshotsaturday Mimosa Fizz action gif #2 https://t.co/TUzdppvfUL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

Is python fast enough for a simulation heavy game similar to Dwarf Fortress?

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
23 replies to this topic

#21 omercan   Members   


Posted 25 August 2012 - 08:55 AM

I'm currently developing an heavy simulation game and has already some experience with script languages in such an area. On some of my applications there were a very strong deceleration when I used Lua or plugin based dlls. Python Interfaces are not really different.

My fractal viewer was based at first on internal codes but this was bad and not really scalable. After that I used a very simple dll interface. The performance breaks down (nearly 30%!) . I also started a lua interface. The performance breaks down once more (nearly 50%!).

So on my opinion. Don't use scripting languages in big loops (10000 iterations and up) but you can use it for simple things.
This was my experience with scripting languages. I used lua the most of the time. But lua is a little bit faster than Python, so there shouldn't be much difference.

Reading, Reading, Reading... why do you read not more?
I have a blog: omercan1993.wordpress.com look there for more content :)
And I also do some art: omercan1993.deviantart.com
And whats about the Pear3DEngine? Never heard of it? Go and look!
Yeah, and currently I do this: SimuWorld

PS: Please look at this poll on my blog about scripting languages: A opinion poll about scripting language

#22 Grandmaster B   Members   


Posted 26 August 2012 - 03:25 AM

Python can be used for games and simulations but the need for using optimization algorithms, DLL bindings (ctypes) or Cython (http://www.cython.org/) may become mandetory. Python however is a very efficient programming language.

While it seems not as popular as Pygame, I can highly recommend Pyglet for rendering your game (2D or 3D).

#23 swiftcoder   Senior Moderators   


Posted 26 August 2012 - 12:15 PM

Python gets a bad rep for multi-threading due to the Global Interpreter Lock. There is however no reason why you can't use multiple processes (instead of threads), and communicate over pipes/shared memory/sockets (a la Chrome's process separation model). Especially when combined with tasklets/greenlets, this can be a very efficient model.

A word on PyPy:

CPython is obviously slow, and that is somewhat intrinsic to the fact that it is a straight-forward bytecode interpreter. Others have mentioned IronPython, native code modules, or hybrids thereof (cython, shedskin, etc.), to obtain better performance, but PyPy takes the cake for simplicity, being pretty much a drop-in replacement for CPython.

Is PyPy as fast as hand-coded C modules? Not yet, but it's getting closer. It is already significantly faster than CPython for most workloads, and even measures up to cython in some places. Plus there are the cases where a tracing JIT is just plain better at optimising than a static compiler...

Tristam MacDonald - Software Engineer @ Amazon - [swiftcoding] [GitHub]

#24 Servant of the Lord   Members   


Posted 26 August 2012 - 08:30 PM

Any thoughts on SDL vs SFML for c++?

I can't comment on the rest of the thread, and I'm not advocating C++ over Python, but if you do go the C++ route, I am advocating SFML over SDL (if you use C++).

Reason: SDL has somewhat lagged in development as of the past few years though it's still chugging along, SFML has a more C++ friendly interface, multi-window support, full hardware acceleration by default (SDL's is software by default with hardware optional). They both are well documented.
It's perfectly fine to abbreviate my username to 'Servant' or 'SotL' rather than copy+pasting it all the time.
All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal | [Fly with me on Twitter]

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.