Jump to content
  • Advertisement
Sign in to follow this  
Gnorme

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

This topic is 2214 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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++?

Share this post


Link to post
Share on other sites
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. Edited by saejox

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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? Edited by Gnorme

Share this post


Link to post
Share on other sites

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++.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!