Author Topic: PYTHON: pros and cons for rougelike development  (Read 28938 times)

Skeletor

  • Rogueliker
  • ***
  • Posts: 580
  • Karma: +0/-0
  • villains ftw
    • View Profile
PYTHON: pros and cons for rougelike development
« on: January 28, 2019, 03:39:35 AM »
I am aware some people here love Python, others such as Krice don't like it.
I just would like to form an idea about it and welcome any input. In particular, what makes you like it in the context of roguelike development.
What I enjoy the most in roguelikes: Anti-Farming and Mac Givering my way out. Kind of what I also enjoy in life.

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: PYTHON: pros and cons for rougelike development
« Reply #1 on: January 30, 2019, 11:49:28 AM »
I think languages aren't "bad" in that sense if you can work with them, but I think languages often fail in game/regular program development, because they don't have a dedicated IDE. I think most game programmers are simple, they don't want to spend time in complex building schemes, at least I don't want. I want the project to compile and run when I hit one key. If python can't do that, it's not for me.

wire_hall_medic

  • Rogueliker
  • ***
  • Posts: 160
  • Karma: +0/-0
    • View Profile
Re: PYTHON: pros and cons for rougelike development
« Reply #2 on: January 30, 2019, 09:26:21 PM »
I feel like Python encourages sloppy programming. And to be honest, I mistype too often to be cool with a language where you don't explicitly declare your variables.

AgingMinotaur

  • Rogueliker
  • ***
  • Posts: 805
  • Karma: +2/-0
  • Original Discriminating Buffalo Man
    • View Profile
    • Land of Strangers
Re: PYTHON: pros and cons for rougelike development
« Reply #3 on: January 30, 2019, 11:27:29 PM »
I didn't know any programming when I started with Python. But I found it easy to get into, and so far it's been able to do what I want, so I haven't regretted my choice. The official documentation is clear and thorough, and there are tools available for many specialized tasks, often in the form of modules. For example pygame, libtcodpy or ncurses can provide you with a framework for quickly getting an @ moving on screen. I don't know how the documentation on libtcodpy is, but there's at least one tutorial that's supposed to be good.

In the context of (underground) Roguelike development, Python is adequate for many kind of projects. It can be quick'n'dirty enough that you can cough up a prototype for an idea in a day or two. But it can also be used for much larger projects. On computers, Python is quite portable, and it's easy to make binaries for at least the three major OSes. However, Python is not the thing if you want to develop for Android or iOS.

One objective weakness of the language is in terms of pure computational speed, but that probably won't matter much for many Roguelikes. But bottlenecks might come instead with stuff like AI if you have a lot of actors walking around and observing each other.

To mention it, Python is the closest thing to a "real" programming language I know at all. And while I don't know if Python encourages sloppy programming, I know I "get along" with my own, so you may have to take my advice with a grain of salt ;) I've thought about trying a game engine, but maybe for a different kind of project than my current clunky masterpiece. I imagine you get some more freedom with Python. Of course, you get even more if you drop down to deeper-level languages like C/C++. It would depend on your needs, tastes and way of thinking what fits best. I do sometimes feel the urge to learn at least a bit of C, if only to get a clearer grasp of the fundamentals. But I also wouldn't mind the possibility of merging C code with the Python scripts to speed up calculations here and there (those AI bottlenecks).

As always,
Minotauros
This matir, as laborintus, Dedalus hous, hath many halkes and hurnes ... wyndynges and wrynkelynges.

AgingMinotaur

  • Rogueliker
  • ***
  • Posts: 805
  • Karma: +2/-0
  • Original Discriminating Buffalo Man
    • View Profile
    • Land of Strangers
Re: PYTHON: pros and cons for rougelike development
« Reply #4 on: January 30, 2019, 11:30:20 PM »
I mistype too often to be cool with a language where you don't explicitly declare your variables.
That's actually a very good point! ::)

As always,
Minotauros
This matir, as laborintus, Dedalus hous, hath many halkes and hurnes ... wyndynges and wrynkelynges.

Skeletor

  • Rogueliker
  • ***
  • Posts: 580
  • Karma: +0/-0
  • villains ftw
    • View Profile
Re: PYTHON: pros and cons for rougelike development
« Reply #5 on: January 31, 2019, 05:20:45 PM »
@Minotsur, great reply thank you; what are the reason for the bottleneck effect you are referring to? do you know any roguelikes which would be not working good enough if they were written in python for this reason you mention?

@Krice: so python doesn't have a good user friendly IDE? what are some languages which have that in your opinion?

@wire_hall_medic: can you elaborate? not sure if I understand
What I enjoy the most in roguelikes: Anti-Farming and Mac Givering my way out. Kind of what I also enjoy in life.

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: PYTHON: pros and cons for rougelike development
« Reply #6 on: January 31, 2019, 09:06:39 PM »
@Krice: so python doesn't have a good user friendly IDE? what are some languages which have that in your opinion?

C++ always had the best ones. Even in ancient times we had Turbo C++, then later obviously Visual Studio. Code::Blocks is also quite ok, even it is a open source project.

AgingMinotaur

  • Rogueliker
  • ***
  • Posts: 805
  • Karma: +2/-0
  • Original Discriminating Buffalo Man
    • View Profile
    • Land of Strangers
Re: PYTHON: pros and cons for rougelike development
« Reply #7 on: February 02, 2019, 01:38:45 AM »
@Minotsur, great reply thank you; what are the reason for the bottleneck effect you are referring to? do you know any roguelikes which would be not working good enough if they were written in python for this reason you mention?
It can for instance arise with nested loops (loops of loops). I mentioned AI, because if you have a lot of actors moving at the same time, you risk doing a lot of calculations between each turn. For instance, my game sometimes has forests of semi-intelligent plants, which would mimic critter AI to do stuff like seed spitting at passers-by. But just adding all the plants to the game's list of actors caused the application to start to lag, so I had to build in some shortcuts to let the plants not be actors as such, but still able to do their thing.

Map generation can also be a CPU sink, especially if your code is a bit clunky, like searching through a lot of empty space multiple times, failing and retrying from scratch a lot, etc. At least, that occurs as loading before levels. In my game, it takes a few seconds now and then to generate a new chunk of the world map. I've looked into process threading as a way to avoid visible lag, by letting the game dynamically generate surrounding areas in the background, simultaneously as the player is playing.

Regarding other games this applies to, I can't with authority name any in particular. But I would imagine stuff like Dwarf Fortress, with a lot of moving parts and dwarfs minding their business. In any case, a fairly complex AI is still a lot less CPU-heavy than real time 3D rendering and such. If Python won't allow you to brute force your way through any grotesque mass of data, you can at least strive for good design in the first place. Ie. make the game's rules in a way that makes sense to you as the game master; instead of having a zillion things testing for a zillion conditions, focus on the interesting things/conditions that will actually occur 8)

As always,
Minotauros
This matir, as laborintus, Dedalus hous, hath many halkes and hurnes ... wyndynges and wrynkelynges.

Skeletor

  • Rogueliker
  • ***
  • Posts: 580
  • Karma: +0/-0
  • villains ftw
    • View Profile
Re: PYTHON: pros and cons for rougelike development
« Reply #8 on: February 04, 2019, 09:40:39 PM »
Thank you - this is really helpful.
What I enjoy the most in roguelikes: Anti-Farming and Mac Givering my way out. Kind of what I also enjoy in life.

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: PYTHON: pros and cons for rougelike development
« Reply #9 on: February 12, 2019, 09:49:28 AM »
I had a great experience with language Pharo that has IDE (it seems to be a core feature) but was so difficult to grasp that I quit after couple of minutes. Some languages and tools are like that, they require too much "smartness" and in the end it doesn't help writing code and programs in any way. Although I think I'm going to try Smalltalk if I can find some way to code it (Pharo is based on Smalltalk), because the syntax of Smalltalk is not that bad and it is a pure object-oriented language.

I think this is one of the reasons why some languages are more popular, because they require the least amount of work to set up and start writing programs.
« Last Edit: February 12, 2019, 09:53:18 AM by Krice »

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: PYTHON: pros and cons for rougelike development
« Reply #10 on: February 13, 2019, 08:17:39 AM »
(continuing rambling) Trying to find compiler/ide for other than C++ seems to be quite difficult in fact. Maybe that's actually the reason why C++ is so popular? I've tried to expand my programming knowledge by trying out different languages, but for Windows particular it's so hard to find anything that you can just download and start programming. Stuff coming from linux/open source is usually a nightmare to install or use and the only useful options are commercial which are often very expensive. I find this whole situation a bit ironic in this age of science.

Tzan

  • Rogueliker
  • ***
  • Posts: 193
  • Karma: +0/-0
    • View Profile
Re: PYTHON: pros and cons for rougelike development
« Reply #11 on: February 13, 2019, 06:20:44 PM »
Visual Studio 2017 for C#, its free.

Sereg

  • Newcomer
  • Posts: 8
  • Karma: +0/-0
  • Angel of Overconfidence
    • View Profile
    • Email
Re: PYTHON: pros and cons for rougelike development
« Reply #12 on: February 14, 2019, 04:42:04 AM »
I currently do the vast majority of my programming in Java - I plan to release a project here on the Early Dev forum in the near future which I've written entirely in Java.

Now, I haven't really had much experience with different sorts of IDEs, but I primarily use Eclipse for Java, and I find it meets my needs exceptionally well.

I am also in the process of learning other languages - Python and C among them - and while I tend to use Notepad++ for anything I do in C, there is actually an IDE available for Python called PyCharm. I have limited experience with it at this point, but it appears to have at least the same fundamental features for Python that Eclipse has for Java, although I'm still navigating the differences.

As far as languages themselves go, I'm not at all comfortable with Python yet - I, too, dislike the lack of explicit declaration of variables that was mentioned by a previous poster, and I also don't really like the inflated importance of formatting - in Java, it's a convenience, but in Python, it's an absolute necessity, and some of the habits I've gotten into with Java don't really align well with what Python demands. I'm much more interested in C - it shares many similarities with Java, and while you can make mistakes that simply aren't possible in Java, you also have that same margin of increased capability.

Maybe I will eventually come around to Python, but for now, I'm not a huge fan.

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: PYTHON: pros and cons for rougelike development
« Reply #13 on: February 15, 2019, 07:15:08 AM »
Visual Studio 2017 for C#, its free.

That's obvious, because it's also a C++ IDE and I have it. C# is not that interesting, but maybe I should give it another try.

Tzan

  • Rogueliker
  • ***
  • Posts: 193
  • Karma: +0/-0
    • View Profile
Re: PYTHON: pros and cons for rougelike development
« Reply #14 on: February 15, 2019, 04:15:57 PM »
C# is very similar to Java.
Unity uses C# and has a rogue-ish tutorial in the learning section.