Temple of The Roguelike Forums
Development => Programming => Topic started by: QubeNub on July 01, 2014, 11:38:52 AM
-
Hello folks,
I'm about to start writing a game which i have been gathering ideas about for some time now. It will be a roguelike focussed on magic, spellcrafting, time travelling, proc. gen. content and maybe more.
The problem is that I can't decide which language to program in and which library to use for the display.
I've tried things like LWJGL, LibGDX, Libtcod and even only using Java AWT to write to the screen.
Now the ideas that I have mean that the game will need A LOT of processing power during things like time travelling and such.
I want to use a language/library that is optimized and fast.
I'm a developer by profession so the language choice doesn't really matter.
I was hoping that people here could make some suggestions and maybe tell why you made that suggestion?
Thanks in advance!
QubeNub
-
I'm a developer by profession so the language choice doesn't really matter.
In roguelike world it doesn't mean anything if you are a developer. Well, maybe you get slightly better starting skills. If you were any good at programming you would already know that language does matter. Some languages are better for large scale programs. Speed can become a problem with complex gameplay, because there is more AI and generic program flow stuff than things related to graphics.
-
What I meant is that I will be able to work with almost any language, I don't really know which languages are faster than others in terms of logic.
-
Use the language you're the most proficient with. Unless it's COBOL, Fortran or sth like that.
-
Python and Libtcod seems to be very popular.
I stuck with Gamemaker, but will probably move on soon to something else. Maybe the ToME engine.
-
Yes, Libtcod looks exactly the kind of library I want to use.
But I don't know for sure if python has good performance when doing a lot of calculations/memory read/writes.
-
Python's performance is largely irrelevant. It is great for prototyping (looks much like pseudo-code) and it is easy to profile. When you identify a section of code that is a performance bottleneck, you can implement that section in another language as a lib and call it from Python (or just use Cython which is a mix of C and Python). Python has a ton of libraries available that are already tested and optimized which may fit your needs (Cython + NumPy is excellent for high performance arrays).
The major reason to use Python or similar (Lua w/LuaJIT for example) is it allows you to quickly get a working prototype and test your ideas. It gives you a 'fail fast' - quick iteration development cycle. I find it also helps to avoid premature low level optimizations and concentrate on algorithmic optimization.
-
If you know Java:
https://github.com/SquidPony (https://github.com/SquidPony) is a Java full-service text and graphical tile roguelike (or any grid game really) library. I've used it for all of my several 7dRLs and several other projects. Which is no surprise, I made it :D
You can see in my source for Assault Fish (at the link above) how to do some really cool things with it, like Perlin Noise and transparent overlays, and animations.
You can also see other things I've done with it at my site http://squidpony.com/ (http://squidpony.com/)
(cross posted since it applies here too. kinda surprising there's a sudden interest in Java, it's been all Unity for the last year)
-
Have to 2nd Eben here. If you've seen his games you can tell he knows what he's talking about.
-
It's kind of surprising to hear a developer ask someone else's opinion about what language s/he ought to use for a project.
I mean -- you know these languages, right? You know your own skills? You know what you want do do? And it still isn't obvious to you?
I don't claim that there's any objectively obvious choice; just that you of all people ought to know exactly what language you can achieve your objective in. There's some combination of things you want to do, some list of attributes you want your final game to have? And that doesn't inform your language choice?
For example, if you want other people to contribute much, you'll probably avoid really complex languages that not very many people can code in. If you want to make a game that plays in a straight console mode, you'll pick a language that has bindings to the ncurses library. If you want to make a game that allows you to write plugins and just add them to your code so that work seamlessly without you having to touch any of the existing code, you'll use a language that allows you to define a plugin interface. If you want to make an Android game, you'll probably write in Java. If you want to make a Unix game, you'll need to play nice with system calls defined in C, which means either writing in C/C++ or picking a language with a good FFI or a good set of bindings for all the system stuff you need. If you want to train yourself to have better Lisp-fu, you'll probably use Lisp.
And so on. I mean, seriously... you want to do the project, but you don't already know what language you want to write it in? How's that even possible?
-
The major reason to use Python or similar (Lua w/LuaJIT for example) is it allows you to quickly get a working prototype and test your ideas.
Python has been quoted as extremely great language yet where are all roguelikes written in python?
-
The major reason to use Python or similar (Lua w/LuaJIT for example) is it allows you to quickly get a working prototype and test your ideas.
Python has been quoted as extremely great language yet where are all roguelikes written in python?
Probably some guys who started programming started before Python was invented and do not want to change language. Or they want to work on a lower level than Python.
-
The major reason to use Python or similar (Lua w/LuaJIT for example) is it allows you to quickly get a working prototype and test your ideas.
Python has been quoted as extremely great language yet where are all roguelikes written in python?
http://www.roguebasin.com/index.php?title=Python#Roguelike_games_in_Python (http://www.roguebasin.com/index.php?title=Python#Roguelike_games_in_Python)
If you notice, you'll see a lot of 7drl and alpha tags, Python is great for prototyping and fast development. I'm not sure how many finished roguelikes were prototyped in Python and then gradually migrated to C.
-
It's kind of surprising to hear a developer ask someone else's opinion about what language s/he ought to use for a project.
I mean -- you know these languages, right? You know your own skills? You know what you want do do? And it still isn't obvious to you?
I don't claim that there's any objectively obvious choice; just that you of all people ought to know exactly what language you can achieve your objective in. There's some combination of things you want to do, some list of attributes you want your final game to have? And that doesn't inform your language choice?
For example, if you want other people to contribute much, you'll probably avoid really complex languages that not very many people can code in. If you want to make a game that plays in a straight console mode, you'll pick a language that has bindings to the ncurses library. If you want to make a game that allows you to write plugins and just add them to your code so that work seamlessly without you having to touch any of the existing code, you'll use a language that allows you to define a plugin interface. If you want to make an Android game, you'll probably write in Java. If you want to make a Unix game, you'll need to play nice with system calls defined in C, which means either writing in C/C++ or picking a language with a good FFI or a good set of bindings for all the system stuff you need. If you want to train yourself to have better Lisp-fu, you'll probably use Lisp.
And so on. I mean, seriously... you want to do the project, but you don't already know what language you want to write it in? How's that even possible?
I would go further than this. If you're writing a roguelike and you don't already have a team, the team is you (and if you have a team, you should be talking to your team, not random people on the internet). If you don't actually know a programming language and how to program in it, then you don't have a serious project and you won't have a serious project for years. If you do know a programming language and it's not LOGO or something along those lines, then you know you can write a roguelike in that language. If you know a programming language that's exotic enough that there would be issues of distribution and whatever else, then you probably know what you're doing and wouldn't be asking a question like this.
In other words, these questions get way too much indulgence. Here's a flow chart:
do you know a programming language? ----> NO
| |
| |
V V
YES then stop talking about your "roguelike project"
|
|
V
then write the game in that language
The basic error here is thinking that it makes a huge difference what programming language you use. Guys, they're all Turing equivalent and they're all built to perform roughly the same kinds of tasks (particularly the ones someone asking a question like this might know or have heard of). Yes, there are some differences on the margins, but this is a boring conversation that happens thousands of times a day all over the internet. Any mentally awake programmer (that is, someone who may conceivably write a roguelike game) would be aware of some this discussion (or better, have the sense not to seek it out).
-
Yes, Libtcod looks exactly the kind of library I want to use.
But I don't know for sure if python has good performance when doing a lot of calculations/memory read/writes.
Backend of Eve Online has loads of Python code in it (Stackless Python, but Python still). And with Python you might get the program up and running faster too (shorter development cycle).
But it really would make sense to use the language you're most proficient with, especially if your goal is to write a game and not to learn a new language.
If I were to write a new roguelike, I would choose Python, because the ease of development and pleasantness of the language. I could write CPU intensive parts with C/C++, but most likely I wouldn't have to. Definitely I would do that only after observed performance problems and proper profiling. Distributing the game in easy to run format would require some extra steps, but it's doable.
If I wanted to easily share the game with other people, I would pick C#, because it's a modern language that is pretty pleasant to work with and the resulting program is easier to distribute than Python program. However, I would have to pay attention to differences between Mono and MS CLR implementation and support if I wanted people with different OSes to play the game.
If I wanted to learn something exotic, I would choose Erlang or F#, just because :) (or write my own language)
-
And with Python you might get the program up and running faster too (shorter development cycle).
What actually makes python faster in development? In my mind it's just another language. I've seen many examples (text book examples without any context to real development) of short code that would require bla bla blaa lines of code in C++, but really, it's not the point at all. The actual lines of code has very small role in what game development is.
-
And with Python you might get the program up and running faster too (shorter development cycle).
What actually makes python faster in development? In my mind it's just another language. I've seen many examples (text book examples without any context to real development) of short code that would require bla bla blaa lines of code in C++, but really, it's not the point at all. The actual lines of code has very small role in what game development is.
Big part of it comes from the syntax that requires less ceremonies than some other languages. Another part comes from the ability to run code interactively, which allows you to get the feel of the problem you're solving easier. Lot of this of course depends on the person writing the code. If one absolutely wants to have a language where compiler checks for used types, then Python most likely is wrong choice. A big thing to me currently is the fact that functions are first class citizens and I can construct them run time. Again nothing that regular OO wouldn't be able to solve elegantly, but again, it needs a bit more work.
But you're definitely correct, it's just another language. It isn't perfect and it isn't correct solution to everything.
-
A big thing to me currently is the fact that functions are first class citizens and I can construct them run time.
Try C++11, if you are familiar with C++ you're gonna love std::function :)
-
A big thing to me currently is the fact that functions are first class citizens and I can construct them run time.
Try C++11, if you are familiar with C++ you're gonna love std::function :)
C++ is one of those languages that I'm not really comfortable with writing :) I wrote a shoot-em up long time ago with C++ and that convinced me that I should learn something else. But that's just a personal preference really and I find it really great that the language is being developed and updated with new features.
-
Thank you all for your responses and advice!
I've chosen for Python with Libtcod since I haven't written much in higher level languages yet.
I also see these kind of projects as an excuse to learn something new.
I am currently most proficient with Java, C# and those kind of languages (also did a lot in C but didn't really like the super low level programming to build games) so something 'new' like Python would be a welcome asset to my skills.
Thanks again and I will post something when I have something playable!
QubeNub
-
The major reason to use Python or similar (Lua w/LuaJIT for example) is it allows you to quickly get a working prototype and test your ideas.
Python has been quoted as extremely great language yet where are all roguelikes written in python?
Legacy systems, if I were to start a roguelike or similar from scratch, the core would be either Python or Lua.
For example, if you want other people to contribute much, you'll probably avoid really complex languages that not very many people can code in.
This can not be overstated, if you start your project in a non-mainstream language, you're pretty much going to be doomed to be the only developer.
If it weren't for this, my split of language choices would be between Python, Lisp, and Perl instead of Python and Lua.
If you want to make an Android game, you'll probably write in Java.
Never Java, not even once. The Android NDK exists, you can write for that with C++.
The basic error here is thinking that it makes a huge difference what programming language you use. Guys, they're all Turing equivalent and they're all built to perform roughly the same kinds of tasks
I agree with the rest of your post, but language choice can have orders-of-magnitude impact on your game's performance, your development velocity, and your ability to attract other developers, it absolutely makes a huge difference.
Try C++11, if you are familiar with C++ you're gonna love std::function :)
DDA made the jump to C++11 recently, and there's so much awesome available now.
-
Why not Java?
-
Because it's an utterly terrible language that delivers on none of the things it promises.
"really truly object oriented" - has magic objects that programmers cannot replicate, such as magic handling for enum.
Terribly broken inheritance model that the *language author* has acknowledged was a mistake.
"totally portable" - only if you don't talk to your OS, which is exactly the issue every other language has, but Java gets in your way when you try to address it.
"easy concurrency" - only using Java versions of threads, meaning they are crippled in many key ways. No ability to fork whatsoever.
I find it to require even more verbose constructs and boilerplate than its main competition, c++, which is one of the main things that make me avoid c++ for everything.
Totally ridiculous GC performance for any serious program. Second-long pauses for garbage collection that the language explicitly prevents you from managing in any way are unacceptable.
Ludicrous memory bloat.
VM tuning, this should simply not be something you have to do to make your program performant.
Requiring users to install and maintain a really massive runtime in order to play my game.
It has good libraries and good documentation, those are the only positives that stand out. As of C++11 the std libraries are on par for my uses. (Java's libraries are better in enterprise settings, but I really just want the data structures and algorithmic stuff, not glue layers for databases and such)
-
Because it's an utterly terrible language that delivers on none of the things it promises.
And yet, people have made great games in both it, and tonnes of arguably worse languages. Got a languages you wouldn't wish on your worst enemy? People have more than likely written games other people have enjoyed in it.
Just pick one and start working. Those who can, do, those who can't, just talk about it.
-
"really truly object oriented" - has magic objects that programmers cannot replicate, such as magic handling for enum.
Terribly broken inheritance model that the *language author* has acknowledged was a mistake.
Could you provide more details on these two? Not that I want to advocate Java, which is insanely slow, limits programmer's every step, and of course "portability" of Java code is a huge bullshit. However, I have no idea what is wrong with Java's enums and I have never heard such comments about the inheritance model (at least not from the language authors, a link is welcome!).
-
For anyone who considered using Go but gave up due to lack of generics:
https://github.com/clipperhouse/gen (https://github.com/clipperhouse/gen)
Ok, its not by the Go dev team, but.. its generics for Go.
There is also a minimal replacement for curses available in Go, termbox-go. A few libraries exist as well with a graphs library in the works that looks very promising for pathfinding and related tasks.
Have to admit, though I really like Python, I find it tempting!
Hope this helps,
Omnivore
-
Because it's an utterly terrible language that delivers on none of the things it promises.
Wow, that's a strong opinion. I've worked on huge projects in Java, and highly regard it, even though I'm mostly a C++ developer. In fact, after two years of working with Java I probably wouldn't touch C++ again if not for the C++11 standard. Still, in many ways Java is light years ahead of C++.
What's your experience working with Java?
-
Isn't Java just a C++ without pointers and multiple inheritance? I remember it something like that.
-
Isn't Java just a C++ without pointers and multiple inheritance? I remember it something like that.
"No pointers" in Java is just another broken promise of that language. The error you'll encounter most of the time is "null pointer exception", just like in C++. However, in C++ (as you know) you are able to debug and fix such errors very quickly. In Java you cannot, as Java hides the details from you.
-
Isn't Java just a C++ without pointers and multiple inheritance? I remember it something like that.
"No pointers" in Java is just another broken promise of that language. The error you'll encounter most of the time is "null pointer exception", just like in C++. However, in C++ (as you know) you are able to debug and fix such errors very quickly. In Java you cannot, as Java hides the details from you.
Java doesn't have pointers, but references. There's a nice and simple explanation how they differ from C pointers at http://programmers.stackexchange.com/questions/141834/how-is-a-java-reference-different-from-a-c-pointer
The best thing (in my opinion) about Java is the run time environment, which allows new languages to leverage old libraries.
-
Java doesn't have pointers, but references. There's a nice and simple explanation how they differ from C pointers at http://programmers.stackexchange.com/questions/141834/how-is-a-java-reference-different-from-a-c-pointer
They don't actually differ as Java references are implemented using C pointers - that's why the exception message I have mentioned complains about a "null pointer". My point is that something is happening under the hood and the programmer cannot understand what his code is doing. So you may have pretty references instead of ugly pointers, but as soon as you do something wrong in the code, Java shows its ugly nullpointerexceptionary face.
-
For what it's worth, I program in C (and other languages but the roguelike game I'm working on is in C).
And pointers are, honestly, no big deal once you understand their limitations and design properly for them. They are useful and efficient but you don't ever want more than one copy of a pointer to dynamically allocated data to exist in a persistent structure because you don't ever want one that *still* exists after you free something. They are succinct and handy but you don't ever want to assign a pointer to point at anything whose scope is narrower or whose extent is shorter than that of the pointer.
All these rules are just plain sense and follow directly from what a pointer is. You just have to understand what it is and keep them in mind when designing your program.
I see languages like Java getting it wrong with references, because people want something they can use like pointers but want the sharp edges filed down. The problem isn't that the knife is sharp, the problem is that they're cutting in the wrong direction.
-
Totally agree with Bear.
From my experience, I've seen a lot of students struggle similarly with arrays. At start it feels complicated with all these matrix and cube and whatnot analogues, full of nuances of unknown importance like which dimension stored first and which of them can or cannot be of different size. But given just a bit of practice this suddenly becomes totally obvious to the point of not being worth mentioned.
Also, modern C++ brings memory control on a bit higher level allowing to express/enforce memory ownership right in the code.
-
Because it's an utterly terrible language that delivers on none of the things it promises.
And yet, people have made great games in both it, and tonnes of arguably worse languages. Got a languages you wouldn't wish on your worst enemy? People have more than likely written games other people have enjoyed in it.
Just because you CAN use the language to do something doesn't mean the language is any good. As mushroom patch points out, they are after all Turing complete, so in theory you can write any program in any language. The important distinction is the experience of writing the game, and sometimes performance issues when running the resulting program.
Just pick one and start working. Those who can, do, those who can't, just talk about it.
Wait, are you seriously saying a prospective program author should not consider the pros and cons of the language they use? The process of deciding on a programming language, platform, libraries, etc is a critical piece of defining your project, it can easily decide whether your project succeeds or fails.
"really truly object oriented" - has magic objects that programmers cannot replicate, such as magic handling for enum.
Terribly broken inheritance model that the *language author* has acknowledged was a mistake.
Could you provide more details on these two? Not that I want to advocate Java, which is insanely slow, limits programmer's every step, and of course "portability" of Java code is a huge bullshit. However, I have no idea what is wrong with Java's enums and I have never heard such comments about the inheritance model (at least not from the language authors, a link is welcome!).
The enum thing is just an example. The enum class has a special property of being a runtime-enforced singleton. The recommended way to implement a singleton class is to make it a subclass of enum so you can get that magic. This is an absurd way to operate, why can't classes just ask to be included in the magic without subclassing enum? There are quite a lot of other built-in Java classes and operations that are similarly privileged, which makes a mockery of the hype about the language being "pure" OO.
http://www.javaworld.com/article/2073649/core-java/why-extends-is-evil.html third paragraph.
To be fair, the inheritance model for C++ is pretty damn broken too, but it's flexible enough that it's not a problem to simply ignore it, and "pure OO" is not a strongly stated goal of the language, which is why I don't criticize C++ as harshly for it's OO failings as I do Java.
-
Because it's an utterly terrible language that delivers on none of the things it promises.
And yet, people have made great games in both it, and tonnes of arguably worse languages. Got a languages you wouldn't wish on your worst enemy? People have more than likely written games other people have enjoyed in it.
Just because you CAN use the language to do something doesn't mean the language is any good. As mushroom patch points out, they are after all Turing complete, so in theory you can write any program in any language. The important distinction is the experience of writing the game, and sometimes performance issues when running the resulting program.
You're making an argument against a point I never made. The language is good, if someone has already made good games in it. That's it. No argument. No nonsense about turing completeness, which someone looking for a language doesn't have to care about. You claimed Java was no good, yet you only offered subjective opinions and bitterness.
Just pick one and start working. Those who can, do, those who can't, just talk about it.
Wait, are you seriously saying a prospective program author should not consider the pros and cons of the language they use? The process of deciding on a programming language, platform, libraries, etc is a critical piece of defining your project, it can easily decide whether your project succeeds or fails.
No, that's you projecting your opinion onto what I said. Likely the doer will see that some other game was written in this language, and then say that's the one for me. And it will be good enough. Point in case: Minecraft, which was written in Java. The post I responded to was you going on a personal rant about how people shouldn't use Java. I argue that is better to go and choose a language based on it having been used for a game you like, than to go on a forum and to get the biased opinions of whomever likes the sound of their own voice the most.
-
I see languages like Java getting it wrong with references, because people want something they can use like pointers but want the sharp edges filed down. The problem isn't that the knife is sharp, the problem is that they're cutting in the wrong direction.
Some people cut with their left hand, some people cut with their right and others who have no hands probably cut with their feet. Java is the right direction for some people, and C the wrong. Not everyone is the same. People boil things down to right and wrong, and claim their side is the right, without establishing that it is the only possible right or conflating an ideal perfection that helps no-one with the solution which should be adopted.
-
Totally agree with Bear.
From my experience, I've seen a lot of students struggle similarly with arrays. At start it feels complicated with all these matrix and cube and whatnot analogues, full of nuances of unknown importance like which dimension stored first and which of them can or cannot be of different size. But given just a bit of practice this suddenly becomes totally obvious to the point of not being worth mentioned.
Yes, a lot of the issues people have with things, are often simply repeated and not understood or selectively picked out as well known myths to use to substantiate their side as being the right side. Pointers is easy to learn. Just one detail amongst many.
Also, modern C++ brings memory control on a bit higher level allowing to express/enforce memory ownership right in the code.
Some of the most disappointing code I have ever had to fix, has been written in C++. People who wrote acceptable code in C would get lazy in C++ and introduce careless bugs.. to do with pointers even. That doesn't mean that C++ is bad, just that it isn't a panacea for solving C's reputed problems. Anyone can write bad code in any language, after all.
-
After reading this thread, I feel terrible for programming my roguelike games/prototypes in Java! It was my first language and the one I'm most used to and enjoy. Plus the portability of it and libgdx are huge positives to me.
I was relatively unaware of all the downfalls of Java, but I still like the language. Informative thread so far with all the responses.
-
Just because you CAN use the language to do something doesn't mean the language is any good. As mushroom patch points out, they are after all Turing complete, so in theory you can write any program in any language. The important distinction is the experience of writing the game, and sometimes performance issues when running the resulting program.
You're making an argument against a point I never made. The language is good, if someone has already made good games in it. That's it. No argument. No nonsense about turing completeness, which someone looking for a language doesn't have to care about.
"The language is good, if someone has already made good games in it." is precisely the point I'm arguing against. Analogy time, "A spoon is a good digging tool if someone has already excavated a good ditch with one.". It's an utterly absurd argument that ignores the fact that the measure of a programming language is not whether it CAN do something, but whether it is well-suited to doing it.
You claimed Java was no good, yet you only offered subjective opinions and bitterness.
No, I offered a number of failings of the language, none of which you've addressed. The issues I mentioned make Java a painful environment to operate in.
Wait, are you seriously saying a prospective program author should not consider the pros and cons of the language they use? The process of deciding on a programming language, platform, libraries, etc is a critical piece of defining your project, it can easily decide whether your project succeeds or fails.
No, that's you projecting your opinion onto what I said. Likely the doer will see that some other game was written in this language, and then say that's the one for me. And it will be good enough. Point in case: Minecraft, which was written in Java. The post I responded to was you going on a personal rant about how people shouldn't use Java.
So what you are saying is the only measure of whether a language is suitable for a purpose is that it has been used for it previously? How then do you distinguish among the languages that all have that trait? Likewise both good and successful games have been written in nearly any language you care to mention. This was precisely my point with turing completeness, you CAN write a game in any language, that's not an issue. The issue is which one will get in your way the least.
I argue that is better to go and choose a language based on it having been used for a game you like, than to go on a forum and to get the biased opinions of whomever likes the sound of their own voice the most.
This is a terrible criteria for choosing a language, what if your programming style and abilities are utterly different from the author of the game you're basing your decision on? Are you operating under the assumption that such a prospective game author knows nothing about programming language features? If the discussion about the pros and cons of various programming languages go over your head, and/or you have insufficient experience to evaluate the merits of the arguments being made, of course you shouldn't base your decision on said arguments, but neither should you base it on popularity of a particular game, which is based more on circumstance, the style of the author, and social forces than on which tools were used to make it.
After reading this thread, I feel terrible for programming my roguelike games/prototypes in Java! It was my first language and the one I'm most used to and enjoy. Plus the portability of it and libgdx are huge positives to me.
I was relatively unaware of all the downfalls of Java, but I still like the language. Informative thread so far with all the responses.
I think Java is a terrible language, but I don't see why anyone should feel bad for writing things in it. No matter what your language of choice is, it's an extremely good idea to broaden your horizons and get experience with new programming languages, not least of which because it will give you a perspective to chose which language is best for a given task.
-
I think Java is a terrible language, but I don't see why anyone should feel bad for writing things in it. No matter what your language of choice is, it's an extremely good idea to broaden your horizons and get experience with new programming languages, not least of which because it will give you a perspective to chose which language is best for a given task.
Well after reading your thought-out explanations, it seems like Java is not the best of choice for roguelikes (I learned a bit from the cons you listed, good to know). Seems like a taboo language! I'll still use it because it's the language I feel most efficient in and I do enjoy it. Although it is really verbose...
As far as broadening my programming language horizons, I couldn't agree more. I've learned C# this past year, and I'll be taking classes this fall in C and Python. So I have no doubt I'll continue learning new languages while I finish college and during my own time. I'm forever learning. But I agree, choose the best language/tool for the job depending on the task.
For the record, this forum is chock full of good info for roguelike creation, so glad I discovered it.
-
I have also observed people who write good C code getting careless when given C++ and making dumb mistakes they wouldn't make in C. I've thought about it and tried to understand it a lot, because I'm one of the people who makes dumb mistakes more easily in C++.
C has semantics that are simple enough to be ... relaxing? I don't know if relaxing is the right word, but in C it causes me no stress to understand everything the statements are doing. At least I won't often think a statement does something and then realize it's doing something else.
And in C++ it's more effort. Not impossible, or even really hard, but more effort. Staying aware of all the overloads and knowing exactly which overload I'm calling, knowing which effect is had by a keyword that means one of three or five different things depending on where it's encountered, etc. One thing that bites me again and again is getting callbacks and code that's going to get stuck into some template expansions right so that the situation when the callback happens, or the scope where the template is expanded, is exactly what it needs to be to be bugfree. There's just a lot more stuff in C++ that looks *almost* alike but does something subtly different or gets inserted as raw code in a dozen contexts that you aren't thinking about all of when you write it. So C++, for me at least, requires a higher level of mental focus to write well in.
It's lame, but I find that my ability to code well just doesn't last as many hours in C++ as it does in C. If my time is taken up with meetings or some other non-flowstate activity, and I have 2 hours a day to actually code? Then C++ is more productive. But If I can focus on code all day long? My brain will stop sorting all the stuff it needs to sort in C++ after about three hours and then I'll be useless for coding in any language. In C I can maintain flow state for six or even ten hours at a stretch, and if I actually have more than, say, four hours a day for writing code, then in the long run I get more done (and done correctly) in C than in C++.
I used to think this effect would go away as I got used to C++ but it hasn't.
-
People who wrote acceptable code in C would get lazy in C++ and introduce careless bugs.. to do with pointers even. That doesn't mean that C++ is bad, just that it isn't a panacea for solving C's reputed problems.
If you behave well and write rigid constructors and destructors that handle the class resources then it's actually easy to avoid pointer problems and memory related bugs. When you become more advanced in C++ you start to realize that pointers change to handles of an instance and kind of become the instance (object) itself. It's also easier to maintain ownership of instances with container classes. I would go as far as to say if you have problems with pointers in C++ you are still programming in C.
-
[...]
"The language is good, if someone has already made good games in it." is precisely the point I'm arguing against. Analogy time, "A spoon is a good digging tool if someone has already excavated a good ditch with one.". It's an utterly absurd argument that ignores the fact that the measure of a programming language is not whether it CAN do something, but whether it is well-suited to doing it.
[...]
So what you are saying is the only measure of whether a language is suitable for a purpose is that it has been used for it previously? How then do you distinguish among the languages that all have that trait? Likewise both good and successful games have been written in nearly any language you care to mention. This was precisely my point with turing completeness, you CAN write a game in any language, that's not an issue. The issue is which one will get in your way the least.
I'm just guessing here, but I suspect that chooseusername is making a point not too different from the one I attempted to make: Namely, any language someone who asks this question (in more than just idle curiosity) has heard of will be "good enough" and that the most important thing is to make a decision and write something.
You raise the question of which languages among various reasonable choices are better or worse and in particular, you say Java is so bad you shouldn't use it. On the other hand, quite a few people find themselves in the (perhaps unenviable) position of knowing Java, having some experience with it, and not knowing anything else nearly as well. For these people, obviously the answer is Java. (And it would be unfortunate, if a little silly, were someone to see your discussion and think, "Damn, what am I doing writing a game in Java? I should go learn another language first!")
More to the point, among these reasonable language choices, the differences are not particularly interesting fodder for discussion. It's surface level generalities that you could read about anywhere (except Q&A style sites that sensibly close such discussions as unproductive).
-
IDK, I've used java for all my games (and also use it for the commercial application I work on as a job). It has its quirks and flaws just like any language, but I'll never understand the hard-on some people get for rallying against it. Its not just here, but I've heard it in other places too.
It might be that some people don't like the level of control they think they're missing out on when it comes to references, garbage collection and a more rigid type hierachy? I get that for an experienced programmer, these things count against java - but they're a very good reason to pick it up for those less experienced.
In fact, if a developer doesn't know enough about programming to even know what language best suits their needs then, IMO its the perfect choice. Now obviously you can write bad code in any language, but forcing a new developer to write verbose code under a rigid type hierachy, while hiding pointers and memory management is a great thing.
Then when this inexperienced programmers game turns into a hairy spaghettified mess anyway, they'll have theoretically learnt some of the strengths and weaknesses of the language and be ready to take on the extra features of something more hardcore like C++.
-
It might be that some people don't like the level of control they think they're missing out on when it comes to references, garbage collection and a more rigid type hierachy? I get that for an experienced programmer, these things count against java - but they're a very good reason to pick it up for those less experienced.
In fact, if a developer doesn't know enough about programming to even know what language best suits their needs then, IMO its the perfect choice. Now obviously you can write bad code in any language, but forcing a new developer to write verbose code under a rigid type hierachy, while hiding pointers and memory management is a great thing.
Then when this inexperienced programmers game turns into a hairy spaghettified mess anyway, they'll have theoretically learnt some of the strengths and weaknesses of the language and be ready to take on the extra features of something more hardcore like C++.
I don't dislike Java for not having pointers, or being an interpreted language, or having a VM, or having GC*. I love the hell out of Ptyhon**, Perl, and lisp in addition to C and C++. There's even a place for such monstrosities as bash and tcl in certain tasks. My problem is that for any feature or subset of features Java has, there's some other language that does them better. It's not that Java has the wrong features, it's that it's bad at them.
*I don't follow what you're saying about type heirarchy.
**Python is hands down my pick for new programmers.
-
*I don't follow what you're saying about type heirarchy.
Multiple inheritance is not a thing in Java.
A class can only fully inherit/extend from one other class, so in order to have polymorphism through other vectors, a class must instead implement interfaces. These interfaces are like empty classes so the only thing that can be inherited from them is the type and the requirement to implement the methods they say you must.
This can be a massive pain sometimes, but I think leads to better designed programs overall.
-
In fact I'm fine with a language that has interfaces as the *ONLY* inheritance mechanism.
I think that taking the "reuse the implementation" approach off the table does lead to better designed programs.
But then, I was never the biggest fan of OO methods in the first place; It fits too well into a lazy programming mindset that tends to ignore or subclass rather than understand and fix basic design problems.
-
Well, overuse of inheritance is a fairly common mistake:
Stack Overflow: Prefer composition over inheritance? (http://stackoverflow.com/questions/49002/prefer-composition-over-inheritance)
MSDN blogs: Seven deadly sins of programming - Sin #2 (http://blogs.msdn.com/b/ericgu/archive/2006/07/24/677225.aspx)
Herb Sutter: Uses and Abuses of Inheritance, Part 1 (http://www.gotw.ca/publications/mill06.htm)
That said, the inheritance (multiple or not) is not an evil by itself, yet adds more flexibility. This way, for example, C++ had its own "default methods" long before those were deemed necessary and introduced in Java 8 (i find ironic the fact modern Java does have kind of multiple inheritance now).
-
*I don't follow what you're saying about type heirarchy.
Multiple inheritance is not a thing in Java.
A class can only fully inherit/extend from one other class, so in order to have polymorphism through other vectors, a class must instead implement interfaces. These interfaces are like empty classes so the only thing that can be inherited from them is the type and the requirement to implement the methods they say you must.
This can be a massive pain sometimes, but I think leads to better designed programs overall.
Aah yes that, actually I think multiple inheritance is generally a terrible idea, interfaces or some similar limited model like composition is generally the way to go. So that one falls into the same category of not disagreeing with the feature set, but disliking the implementation.
-
There is no such thing as a perfect language, which is why we not only have so many languages already, new ones crop up constantly.
Java is about my 20th language or so (counting different flavors of BASIC and Pascal as different languages) and it's been my go-to for the past several years. The only time I've run into something that it couldn't handle easily was direct serial port connection to a specific legacy video camera.
On the subject of Java Enum, they are flipping brilliant and all languages need them. Having full fledged singleton objects as a language feature means having the appropriate level of control for meaning of enum objects while still allowing Pascal style records and utility functions. And anyone reading the code will know immediately how they're meant to be used. I see them as the same kind of leap as having GOSUB instead of just GOTO
Back to the OP, pretty much every language is equally good for roguelikes, especially if you're intending to do a text only approach. If you're going to do a graphics approach then the library is the important choice and the language is more of an add-on.
-
I'm glad that this thread didn't devolve into the typical my-language/your-language argument in which nothing is learned, but instead, we were all able to come together as a community around our shared disgust with Java. It warms my heart.
By the way, I'd like to hear opinions about C# versus C++ and other languages. I'm mainly a Python programmer so I think either one would be a big change of pace for me, but I'm interested in both languages as possible new tools. C# and the whole microsoft stack (visual studio, SQL Server, .NET, ASP, etc.) are used a lot at my work, so I might go for that one. Is it a better tool for producing packaged software with good performance than Python? How does the language and its performance compare to C++. As for C++, I'm thinking it might help me become a better programmer by forcing me to learn more computer-sciency stuff like dealing with memory, threads, data structures, and so forth, but I'm worried about learning a lot of powerful features just to forget them again for lack of need to use them. How useful is C++ really?
-
As for C++, I'm thinking it might help me become a better programmer by forcing me to learn more computer-sciency stuff like dealing with memory, threads, data structures, and so forth, but I'm worried about learning a lot of powerful features just to forget them again for lack of need to use them. How useful is C++ really?
C++ is still *the* language for video games and applications where performance is critical, but you have to put the effort to make your program fast, it's not magic. C++11 is massively nicer than the last standard, so if you start, start from that. Wrt forgetting powerful features, if you really want to learn them, apply them by starting with tetris, then make more simple games, etc etc - if you start with a big one from the get-go you're doomed.
-
Either C# or C++ will generally be a lot faster than Python. Of the two, it will generally be possible to get C++ to run faster, but it all depends on what and how you're writing it.
As a production language I prefer C#, because it's generally faster to get something up and running in it, but as a learning experience C++ is great - I found that after learning and using C++ for a bit it made me a much better programmer in other languages because I had a better understanding of what those languages were doing 'behind the scenes'. So, the language I would suggest depends on what you're looking to get out of it.
Also, I wouldn't pay too much attention to the Java haters. It's not my favourite language and I can see why its 'my way or the highway' approach to some things can alienate people used to different languages, but its a perfectly good choice that's very similar to C#.