Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 3 [4] 5 6

Author Topic: I want to try my hand at programming a real game... what language?  (Read 6864 times)

Blacken

  • Bay Watcher
  • Orange Polar Bear
    • View Profile
Re: I want to try my hand at programming a real game... what language?
« Reply #45 on: June 29, 2010, 02:00:04 pm »

Let's reiterate: Java isn't interpreted (except on really gimpy platforms that he's obviously not using). Java is JIT-compiled, as is .NET. Both can be (and often are) precompiled as well.

For the majority of tasks, Python/Psyco, Java, .NET, etc. are so close to native code performance that worrying about it is absolutely nonsensical. And if you hit those edge cases where you do need that performance, you can drop down into native code via Python importing, JNI, P/Invoke and marshalling, etc. when you need it instead of slumming at that level throughout your codebase.
Logged
"There's vermin fish, which fisherdwarves catch, and animal fish, which catch fisherdwarves." - Flame11235

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: I want to try my hand at programming a real game... what language?
« Reply #46 on: June 29, 2010, 03:02:16 pm »

Let's reiterate: Java isn't interpreted (except on really gimpy platforms that he's obviously not using). Java is JIT-compiled, as is .NET. Both can be (and often are) precompiled as well.
Thanks for correcting me there. I got the impression that Java is usually JIT-compiled though.

Quote
For the majority of tasks, Python/Psyco, Java, .NET, etc. are so close to native code performance that worrying about it is absolutely nonsensical. And if you hit those edge cases where you do need that performance, you can drop down into native code via Python importing, JNI, P/Invoke and marshalling, etc. when you need it instead of slumming at that level throughout your codebase.
While it doesn't matter much in most applications (and certainly not in the OP's case mind you), the JIT-compilation of Java and .NET, as well as the interpretation of Python/Ruby can and often do add some additional overhead, which makes it less suited for very intensive programs without invoking additional code to compensate for that, which are the methods you describe. It is very possible to attain high performance, it just takes some extra work compared to "natively fast" languages such as C or assembly (the fastest you can get without going into bytecode)


However, C's additional speed comes at another price. The reason C and it's brothers are generally so fast is because it does nothing behind the scenes, while for example Python handles a lot of garbage collection, type checking et cetera behind the scenes. This means that with the "slower languages" you usually don't have to worry about catching type exceptions and proper cleanup of loose wathervers that are floating around, making programming faster and less error-prone (you still need to be aware of it, because you can always cause exceptions the compiler/interpreter doesn't catch). However, that means that to get as fast as possible you sometimes need to override those checks and balances. In the end that means extra work compared to a properly designed C program. Hence me saying that it is possible to get Python as fast as C (at least within a very close margin) but you'll need to do some extra work for it. On the other hand, with C you'll need to do extra work to prevent it from screwing your program over.
« Last Edit: June 29, 2010, 03:05:03 pm by Virex »
Logged

DrPizza

  • Bay Watcher
    • View Profile
    • Ars Technica
Re: I want to try my hand at programming a real game... what language?
« Reply #47 on: June 29, 2010, 03:19:32 pm »

Other languages will actually let you know when something is impossible, rather than say "maybe, but I'm not telling you how...".
That's nonsense, of course, as long as we're talking about Turing-complete languages. They're all equally capable; what varies is how different tasks are expressed.

Some languages give you high-level constructs to make expressing ideas more direct and straightforward. C does not.

C does not tell you "this is impossible". It just tells you "the only way to express this will be complicated and baroque".

Quote
If I stuck with the C interface, I would have spent half of the time doing boilerplate, yes, but at least I would have accomplished my goal rather than givin up after wasing more time than a proper language would have needed total.
If the only overhead C imposed as a bit of boilerplate, the world would be a much better place.

Standard C challenge: write a program that asks the user to type in their name, reads in their name (i.e. whatever text they enter on the keyboard, up to a newline), and then writes back a message saying, say, "Hello <name>" (where <name> should obviously be replaced with the name they entered). A pretty basic task; so write a program that uses only standard C, and which is correct.
Logged

DrPizza

  • Bay Watcher
    • View Profile
    • Ars Technica
Re: I want to try my hand at programming a real game... what language?
« Reply #48 on: June 29, 2010, 03:30:57 pm »

ANY language with function overloading - or worse, operator overloading - is a disaster waiting to happen.
Then why are you advocating C?

C has both function and operator overloading.

The only even vaguely mainstream language I can think of off-hand that truly has neither is ocaml (and even that has an awkward corner, in that < and other comparison operators are, I believe, technically overloaded rather than just operating on interfaces. I would have to check, which I don't care enough to do).
« Last Edit: June 29, 2010, 03:50:26 pm by DrPizza »
Logged

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: I want to try my hand at programming a real game... what language?
« Reply #49 on: June 29, 2010, 03:32:18 pm »

Quote
If I stuck with the C interface, I would have spent half of the time doing boilerplate, yes, but at least I would have accomplished my goal rather than givin up after wasing more time than a proper language would have needed total.
If the only overhead C imposed as a bit of boilerplate, the world would be a much better place.

Standard C challenge: write a program that asks the user to type in their name, reads in their name (i.e. whatever text they enter on the keyboard, up to a newline), and then writes back a message saying, say, "Hello <name>" (where <name> should obviously be replaced with the name they entered). A pretty basic task; so write a program that uses only standard C, and which is correct.


I thought C added string support to the standard library some time ago? Or am I sorely mistaken here?


Also, function and operator overloading can come in handy at times, especially when you're not sure what kind of data the end user is going to feed into the function in the first place (You could of course add ways to handle that within the function or tell your user not to do that, but handling it gracefully trough overloading is a useful option too)
« Last Edit: June 29, 2010, 03:34:45 pm by Virex »
Logged

ThreeToe

  • The Natural
    • View Profile
    • http://www.bay12games.com
Re: I want to try my hand at programming a real game... what language?
« Reply #50 on: June 29, 2010, 03:47:48 pm »

Enough personal insults.  I don't want to hear about who's stupid etc.  I'm getting a lot of reports about this thread and I don't want to start handing out warnings.  Please be nice.
Logged
Show your true champion nature:  support Bay 12 games!

Blacken

  • Bay Watcher
  • Orange Polar Bear
    • View Profile
Re: I want to try my hand at programming a real game... what language?
« Reply #51 on: June 29, 2010, 05:34:45 pm »

I thought C added string support to the standard library some time ago? Or am I sorely mistaken here?
C added array-terminated-with-a-\0 support a very long time ago. This isn't really a "string" in the sense of most other languages.

There are ways to write "real" strings in C, but they are clunky.
Logged
"There's vermin fish, which fisherdwarves catch, and animal fish, which catch fisherdwarves." - Flame11235

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: I want to try my hand at programming a real game... what language?
« Reply #52 on: June 29, 2010, 08:34:11 pm »

Quote
If I stuck with the C interface, I would have spent half of the time doing boilerplate, yes, but at least I would have accomplished my goal rather than givin up after wasing more time than a proper language would have needed total.
If the only overhead C imposed as a bit of boilerplate, the world would be a much better place.

Standard C challenge: write a program that asks the user to type in their name, reads in their name (i.e. whatever text they enter on the keyboard, up to a newline), and then writes back a message saying, say, "Hello <name>" (where <name> should obviously be replaced with the name they entered). A pretty basic task; so write a program that uses only standard C, and which is correct.

The use I would have had would have had the only input in the form of a two-state sytem, where in the first it will respond to mouse clicks by transitioning into the second if the user clicks in one of two rectangles, and depending on the rectangle, one or the other preset string will be passed as initialization of stage two, and that would be the creation of a WebBrowser COM object, that would be the entire interface(and thus all input handled by external code), and then simply exiting when the user closes it.

With the only input being handled by a numeric input passed by windows along with WM_LBUTTONDOWN, the hidden pitfalls where code can fail during text input would be entirely irrelevant. The rest would be fairly standard procedure for the creation of a control at run-time.
Logged
Eh?
Eh!

DrPizza

  • Bay Watcher
    • View Profile
    • Ars Technica
Re: I want to try my hand at programming a real game... what language?
« Reply #53 on: June 29, 2010, 08:55:03 pm »

Good answer (not).

It is a rare program that never has to perform any kind of string manipulation.

And COM in C... what a fantastic idea. Yes, you can do it. But that doesn't mean you should.
Logged

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: I want to try my hand at programming a real game... what language?
« Reply #54 on: June 29, 2010, 10:57:00 pm »

Yes, I know that, but for comparison, it would have been easier and faster for me than trying to get the same result in VB.
Poor documentation and no hints as to why it shouldn't work, when it looks like it should.

At least with COM, there is no operator overloading(Binary standard, remember?), so that would be one major quagmire fewer, furthermore, the compiler didn't generate the window generation, so I would have had the control of how it works to generate it later as if it were still window creation time.

The problem is not finding the best way to do it, the problem is finding a way that works when the documentation fails.

In this case, no string manipulation would have occured, only passing and selecting constant strings.

And to get somewhat back on topic:
I wouldn't reccomend COM in C either, unless you want to understand how COM works on a level that is best described as the "dug too deep" of 2d DF. In fact, I wouldn't reccomend COM at all, unless you understood what it was and why it was the right tool, and were using it in a decent language for that kind of thing. Ignoring the cases where you don't need to know that it is being used, of course(Every VB form is full of COM/OLE, and you don't need to care about it, as the compiler does it all for you...)
Logged
Eh?
Eh!

DrPizza

  • Bay Watcher
    • View Profile
    • Ars Technica
Re: I want to try my hand at programming a real game... what language?
« Reply #55 on: June 30, 2010, 12:16:54 am »

Yes, I know that, but for comparison, it would have been easier and faster for me than trying to get the same result in VB.
Poor documentation and no hints as to why it shouldn't work, when it looks like it should.
But is that telling us facts about VB (or C#, or even C++, or any other language that does COM better than C), or just facts about you?

Quote
At least with COM, there is no operator overloading(Binary standard, remember?), so that would be one major quagmire fewer, furthermore, the compiler didn't generate the window generation, so I would have had the control of how it works to generate it later as if it were still window creation time.
C and C++ make operator overloading unavoidable. So does VB, for that matter. When you understand that, you'll understand why it's a good thing.

Quote
(Every VB form is full of COM/OLE, and you don't need to care about it, as the compiler does it all for you...)
Which certainly makes your C recommendation look peculiar.
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: I want to try my hand at programming a real game... what language?
« Reply #56 on: June 30, 2010, 03:05:51 am »

Yay, I started it!  :D

Sorry ThreeToe. And sorry, OP. These guys have these big red buttons just begging me to push them. And then they start pushing eachothers and it spirals into Language War. Happens every time, don't worry about it.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Supermikhail

  • Bay Watcher
  • The Dwarf Of Steel
    • View Profile
Re: I want to try my hand at programming a real game... what language?
« Reply #57 on: June 30, 2010, 08:32:00 am »

Hey, guys are you going to call me names if I say that I'd like to one day program a game in Object Pascal? because it's the first language I've programmed in and actually achieved some result, partially due to the nature of the text book I used.
Logged

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: I want to try my hand at programming a real game... what language?
« Reply #58 on: June 30, 2010, 09:13:05 am »

Personally, I would do it in C++, but that's because it's the one I'm actually familiar with.
Logged

Blacken

  • Bay Watcher
  • Orange Polar Bear
    • View Profile
Re: I want to try my hand at programming a real game... what language?
« Reply #59 on: June 30, 2010, 10:45:20 am »

Hey, guys are you going to call me names if I say that I'd like to one day program a game in Object Pascal? because it's the first language I've programmed in and actually achieved some result, partially due to the nature of the text book I used.
Object Pascal is fugly, but at least it is generally well-thought-out. I used to use what is now Embarcadero Delphi pretty regularly.
Logged
"There's vermin fish, which fisherdwarves catch, and animal fish, which catch fisherdwarves." - Flame11235
Pages: 1 2 3 [4] 5 6