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

Started by
22 comments, last by Servant of the Lord 11 years, 8 months ago
Would I end up running in to problems down the line trying to make a simulation heavy game with python? am I stuck using c++?
Advertisement
python cant handle that much computation.

look at dwarf fortress. written in c++ still runs slow on high end machines.

edit:

considering OP has a need to ask this question,
i can assume he/she is not a guru.
just go with what you have experience with.

about the performance comparison:

bad written code will run slow no matter what language it is written.
but with C/C++ you can at least know that you are reason why the game runs slow.

i find it silly to even compare C execution speed with CPython's or PyPy's.
If Python is fast enough to run Eve, it's fast enough to run a simulation game.
Define "simulation heavy."


You could easily write a program that bogs down a modern machine using Python. Or C++. Or any other language.

Conversely, you can probably do a lot more than you might think if you're careful about performance at an algorithmic level.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]


If Python is fast enough to run Eve, it's fast enough to run a simulation game.


I'm not familiar with it but how much simulation is actually going on (and is it calling into optimized, native code to do the heavy lifting), and is it going on client-side or server-side?


I agree that the standard answer is typically, "If you have to ask, it's likely that you aren't going to do anything that would push the boundaries if you use the right algorithms." But on the other hand, if the OP really does aim for the scale and detail of Dwarf Fortress, then we do see that DF does struggle to keep up. I don't really know how tight the code is, but I do trust that the author of Dwarf Fortress isn't a fool, and I'd be surprised if he were doing anything foolish that amounted to more overhead than what a language like python (assuming non-compiled) has implicitly.

If the scope and detail of what the OP wants to do are significantly less ambitious, then the need for greatest performance diminishes, of course.


It would be an interesting exercise for the OP to do some prototyping and see what the results are.

throw table_exception("(? ???)? ? ???");

Thank you for the responses smile.png

The project is in it's infancy, but I'm trying to make sure I start off on the right foot. I've never programmed something intensive enough for me to have to worry about the limitations of a language.

Any thoughts on SDL vs SFML for c++?

and for Python would Pyglet or Pygame be better?

I'm not familiar with it but how much simulation is actually going on (and is it calling into optimized, native code to do the heavy lifting), and is it going on client-side or server-side?


Regardless of any of these questions, simply handling the rate of traffic has to be way more operations per time than dealing with the number of actors in a DF world. Admittedly, DF's stuff is 'heavier' but regardless, there's nothing even close intrinsic to DF that somehow limits the OP to C++.

python cant handle that much computation.

look at dwarf fortress. written in c++ still runs slow on high end machines.


DF isn't a shining example of good C++ code.(DF is fairly inefficient, single threaded and keeps missing the cache), Yes it is an impressive game but you could rewrite it from scratch in pretty much any other language and get better performance.
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

Thank you for the responses smile.png

The project is in it's infancy, but I'm trying to make sure I start off on the right foot. I've never programmed something intensive enough for me to have to worry about the limitations of a language.

Any thoughts on SDL vs SFML for c++?

and for Python would Pyglet or Pygame be better?


Assuming you're comfortable with both C++ and Python, then once you've decided on a language the standard answer is just to use whichever of you have the most experience with. SFL or SFML for C++, or Pyglet or Pygame for Python.

That said. I have experience with both SFML and Pygame and I enjoyed using SFML a lot more (Though that might be me preferring C++). Use whatever you like. If you start making your game and it turns out you need to change to something else it probably won't take that long because most of these libraries are pretty similiar.
Once upon a time I was writing a marching cubes terrain renderer in Python (using Panda3D.) I had read on their forums that Python is internally limited to one actual thread, even though it provides a threading interface to 'fake' real multi-threading. So if you ever want to not be limited to one CPU core, you'll want to verify whether or not that's true today before you get too far with Python.

This topic is closed to new replies.

Advertisement