Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411528 Posts in 69377 Topics- by 58433 Members - Latest Member: Bohdan_Zoshchenko

April 28, 2024, 10:28:57 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)What's your favorite programming language?
Pages: 1 2 [3] 4 5 ... 12
Print
Author Topic: What's your favorite programming language?  (Read 21353 times)
R.D.
Level 2
**


Making a game about balls. Yepp.


View Profile WWW
« Reply #40 on: July 16, 2014, 12:55:07 AM »


Game Dev Tycoon is made in JavaScript. You can make an .exe (with C++, for example) that is a web browser ( just put chromium inside ), then make it read all javascript code (you should obfuscate it / minimize it) from the end of the .exe itself, and you're good to go.

This way you can not only use javascript, but CSS and HTML too, if you want.

Even easier: https://github.com/rogerwang/node-webkit

Just add a package.json file and you're golden. Web technologies are really rad. JavaScript/CSS/HTML are so damn powerful. If you don't aim for triple A, high-end games, it's really awesome to work with. All these new API and the performance boosts convinced me pretty much over night (I didn't like JS at all. Thought it would be slow and the codebase is hard to maintain. Turns out I was so wrong). Probably not many people would say that, I guess.
Logged

Geti
Level 10
*****



View Profile WWW
« Reply #41 on: July 16, 2014, 05:27:01 AM »

Compared to compiled languages, js is a significant slowdown. I also personally aren't a fan of dynamically typed languages or runtime error checking, especially for projects of medium size and up (lets say >25k sloc). If you're super disciplined I'm sure you can keep it clean somehow, but I've never enjoyed writing code like that.
Logged

Trash_Empire
Level 0
***



View Profile
« Reply #42 on: July 16, 2014, 05:34:50 AM »


Game Dev Tycoon is made in JavaScript. You can make an .exe (with C++, for example) that is a web browser ( just put chromium inside ), then make it read all javascript code (you should obfuscate it / minimize it) from the end of the .exe itself, and you're good to go.

This way you can not only use javascript, but CSS and HTML too, if you want.

Even easier: https://github.com/rogerwang/node-webkit

Just add a package.json file and you're golden. Web technologies are really rad. JavaScript/CSS/HTML are so damn powerful. If you don't aim for triple A, high-end games, it's really awesome to work with. All these new API and the performance boosts convinced me pretty much over night (I didn't like JS at all. Thought it would be slow and the codebase is hard to maintain. Turns out I was so wrong). Probably not many people would say that, I guess.


Thanks so much. This is perfect.
Logged
R.D.
Level 2
**


Making a game about balls. Yepp.


View Profile WWW
« Reply #43 on: July 16, 2014, 05:26:37 PM »

Compared to compiled languages, js is a significant slowdown. I also personally aren't a fan of dynamically typed languages or runtime error checking, especially for projects of medium size and up (lets say >25k sloc). If you're super disciplined I'm sure you can keep it clean somehow, but I've never enjoyed writing code like that.

Yeah, it really depends on what you want to do. Btw we have around 100k LOC. It's really easy to maintain "clean code". You just need a good engine that comes with a simple system to manage classes/objects. The regular game code stays the same. While you don't have ye ol' classes like C++/Java (flat hierarchy on inherit classes and so on), you can work the same way. Every checked out impact.js? (http://impactjs.com/) Our own engine is based on this one. Pretty much the most clean and minimal engine you can have. We changed around 95% of the code, while still using the basic principles. It's awesome, I admit I'm a fanboy.

But as said, if you prefer static typed languages it's totally fine. It's better to work with something your familiar with and feel 'home' it that makes sense. For a long time I used Java/C#. But the verbosity... I just couldn't stand it anymore for creating 2D games. I found my home in JS/HTML/CSS. But if I ever need to to some high-end stuff I probably go C/C++.
Logged

Geti
Level 10
*****



View Profile WWW
« Reply #44 on: July 16, 2014, 06:05:35 PM »

We've been splitting projects into engine and game, with the engine being the 100k+ sloc behemoth with all the performance hungry stuff in it (in KAG classic it was 130k, in the release version it's just under 100k due to the next part), and the game part being throwaway scripts specific to the game at hand, and less hungrily optimised.

I'd also hesitate to call 100k loc a clean and minimal engine.

Recently I'm personally moving away from OOP so it's not the class side of things that bothers me in JS - it's the fact that everything errors out at runtime rather than compile time (-> constant error), you can't optimise memory well without writing add-ons to the runtime, you have portability issues with no way to fix them other than waiting on browser vendors, your library support comes in the form of often unmaintained code built on a handful of different import mechanisms with often-intractable interoperability, and your tools aren't really up to scratch (though they're improving).

We checked out impact, quintus and phaser when looking into html5 gamedev; honestly, I didn't have much fun with any of them. impact was the most full featured, quintus was the easiest to get going with, and phaser had a nice interface but all of them suffered performance issues, underfeatured or incompatible sound APIs and again, varying import mechanisms and ways of building OOP/COP into the language.


Re: verbosity - Java is an issue there due to the forced OOP boilerplate and checked exceptions; I haven't written enough C# to comment. C can be very verbose, especially if you try to force an OOP approach onto it, but can end up pretty clean if you don't have massive complicated interfaces to deal with. I find true verbosity only creeps into C++ when you're dealing with deep hierarchies or over-designed interfaces, the rest is inherent to the problem at hand and doesn't go away by doing the same thing in JS.

More to the point I find that the same verbosity crept into our JS projects anywhere there was anything maths-intensive due to lack of operator overloads, and when taking an OOP approach in js you end up having to write the same crap in each function like you would in C - this.pos.x being the standard stupid example; twice as long as it would be in c++, and something that's often found multiple times per line. At least when writing OOP in C++ you can avoid the this pointer on everything - yes in js you can "sneak around this" with var pos = this.pos; but for any function that does something more than just adding two vectors you end up with a huge list of forward declarations like you would in C.


Of course, I know people really like JS, but I can never get my head around why you would want to write anything big in it if you can program in anything else.
Logged

Belimoth
Level 10
*****


high-heeled cyberbully


View Profile
« Reply #45 on: July 16, 2014, 07:51:35 PM »

Hey it's me, the guy who uses Monkey

it's good.

Baby developers reading this thread please don't learn C++ just to make games, yes I know eigenbom is very attractive, that's not the point.
Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #46 on: July 16, 2014, 11:17:04 PM »

Hey it's me, the guy who uses Monkey

it's good.

Baby developers reading this thread please don't learn C++ just to make games, yes I know eigenbom is very attractive, that's not the point.


Logged

R.D.
Level 2
**


Making a game about balls. Yepp.


View Profile WWW
« Reply #47 on: July 17, 2014, 04:03:07 AM »

We've been splitting projects into engine and game, with the engine being the 100k+ sloc behemoth with all the performance hungry stuff in it (in KAG classic it was 130k, in the release version it's just under 100k due to the next part), and the game part being throwaway scripts specific to the game at hand, and less hungrily optimised.

We do the same, seems like I didn't made this clear in my previous post.

Quote
Recently I'm personally moving away from OOP so it's not the class side of things that bothers me in JS - it's the fact that everything errors out at runtime rather than compile time (-> constant error), you can't optimise memory well without writing add-ons to the runtime, you have portability issues with no way to fix them other than waiting on browser vendors, your library support comes in the form of often unmaintained code built on a handful of different import mechanisms with often-intractable interoperability, and your tools aren't really up to scratch (though they're improving).

I wouldn't go this far as to say you can't optimize well. As said. it depends completely on what you want to achieve. Browsers evolve pretty fast these days and I don't think that many -widely- used libraries come unmaintained. Not with the ones I work with at least. I also never encountered any problems with porting (And we use pretty modern features). There is stuff like this now: http://www.w3.org/. So as soon as you have a standard you have it in all browsers. Minus IE... I give you that... Also I think that there is unmaintained code everywhere. Maybe it's a bit more in JS though. But I get what your saying. It's nice to have compile time errors (ironically JS gets compiled, just at runtime).


Quote
Re: verbosity - Java is an issue there due to the forced OOP boilerplate and checked exceptions; I haven't written enough C# to comment. C can be very verbose, especially if you try to force an OOP approach onto it, but can end up pretty clean if you don't have massive complicated interfaces to deal with. I find true verbosity only creeps into C++ when you're dealing with deep hierarchies or over-designed interfaces, the rest is inherent to the problem at hand and doesn't go away by doing the same thing in JS.

More to the point I find that the same verbosity crept into our JS projects anywhere there was anything maths-intensive due to lack of operator overloads, and when taking an OOP approach in js you end up having to write the same crap in each function like you would in C - this.pos.x being the standard stupid example; twice as long as it would be in c++, and something that's often found multiple times per line. At least when writing OOP in C++ you can avoid the this pointer on everything - yes in js you can "sneak around this" with var pos = this.pos; but for any function that does something more than just adding two vectors you end up with a huge list of forward declarations like you would in C.

Yes, that is true. Although I don't mind this that much. I'm using IDEs a lot and for JS, WebStorm/PhpStorm is simply the best. I really enjoy working with the code and get results so fast and with so little work. Auto-complete and live templates are so awesome. So "twice as long" is just what I see, not what I write. But I guess you could say this about every language that has good IDE support.

Quote
Of course, I know people really like JS, but I can never get my head around why you would want to write anything big in it if you can program in anything else.

Of course I can't talk for everyone but for me it's simply the connectivity of the web and the ambition to transform the browser into an efficient platform. It already is efficient. Again, if it's enough for what I want to do: 2D games. You can make a 2D game with a stable 60 FPS loop no problem. You can use things like the WebAudio API which I love a lot. You can easily connect code with visuals. Creating UI is much more rewarding than creating them in any other language. CSS + HTML is simply the best combo you get. You can manipulate stuff in realtime with JS. (For instance we have a flexible system for creating editors. I did this: http://bit.ly/UdIslh in one work-day. You don't even need to use canvas to create a game. You could use a combination of HTML elements and CSS styling. (like here: http://www.nicalis.com/) I like a lot of other things too. But really. It all comes done to what you what to do and how much work you're willing to put into it. I get all browsers/desktop/mobile support and WiiU support which makes me pretty happy.
Logged

Geti
Level 10
*****



View Profile WWW
« Reply #48 on: July 17, 2014, 04:23:58 PM »

We've had w3c for ages :^) they're part of the reason a lot of the web APIs suck, and a lot of vendor additions still exist where w3c "misses" some nice piece of functionality, then takes ages to consolidate that back into the standard, and then takes ages for _that_ to be implemented back into the browsers and the per-vendor specific code is often never removed and still found in code examples around the web years later.

Quote
I wouldn't go this far as to say you can't optimize well. As said. it depends completely on what you want to achieve.
You can't optimise memory well at all (you simply don't have the types for it, and the duck typing table based object model JS has means you get bloat even in simple objects). While everything is JIT compiled; the language itself makes getting truly fast code together a nightmare (hence asm.js), and because you cant optimise your memory layout you can't get good cache performance, which is very important for fast code on modern machines. You also lose out on threading, and though webgl is making good inroads towards using the GPU for portable graphics, using it for compute is probably going to remain infeasible or inefficient.

Quote
So "twice as long" is just what I see, not what I write. But I guess you could say this about every language that has good IDE support.
Twice as long also has performance ramifications though, as it's an extra level of indirection; you drop it if you pull all the references out into locals, but then you have forward-dec boilerplate in every function. In C/++ the level of indirection is still there on first access, but you get prefetching and caching from your nicely optimised memory layout.

Quote
Creating UI is much more rewarding than creating them in any other language.
For simple UI I agree that markup is fine for pulling everything together and styling it, but the editor you posted looked like it could be built in an hour or two using any GUI toolkit (unity's, irrlicht's, ogre's...), and there you often have "native" grid systems instead of having to build your own in CSS.

Quote
I get all browsers/desktop/mobile support and WiiU support which makes me pretty happy.
The easy browser support is the only thing I'm jealous of (it's a nice "no bullshit" publishing solution that I miss from flash development, and like about unity), but either way it's clear that we just have different preferences.
 Shrug


Baby developers reading this thread please don't learn C++ just to make games, yes I know eigenbom is very attractive, that's not the point.
Or, if you do, do it through someone qualified to teach you instead of "THE INTERNET". I've had a few very gentle papers on C++ for general development and gamedev tailored to beginners; if you've got the money and are of the tertiary-education-going age, definitely consider looking into getting taught.
Logged

R.D.
Level 2
**


Making a game about balls. Yepp.


View Profile WWW
« Reply #49 on: July 17, 2014, 04:44:13 PM »

Quote
[..] but either way it's clear that we just have different preferences.
 Shrug

Yeah, I guess it comes done to this :D The ongoing -sometimes- religious war: static vs. dynamic. I actually enjoy both but just like dynamic more Smiley
If you care you could try our game CrossCode (it's just a TechDemo, almost 2 years old). Just like GameDev Tycoon our main release platform is Desktop. At last the technology should never cloud your view for good games. But we often have people that never thought this game is completely based on web technologies, which is great in my opinion, showing that your game can be fun with any language/engine/editor.
Logged

Geti
Level 10
*****



View Profile WWW
« Reply #50 on: July 17, 2014, 05:37:14 PM »

I actually came across your game when we were looking into the technology, it's one of the things that made us consider trying html5 out "for real". Of course it doesn't matter how a game's put together in terms of how fun it is - there's fun stuff made with game maker and RPG toolkit, and fun stuff made with asm and blood sweat and tears, as well as everything in between. Even Java.
Logged

MorleyDev
Level 0
***

"It is not enough for it to just work"


View Profile WWW
« Reply #51 on: July 17, 2014, 05:55:32 PM »

Really depends what I'm working on.

I'm what some would call "test-obsessed", I am quite fond of Test-First and Test-Driven Development. And somehow I remain a defender of C++. I'm of the opinion that one can easily write clean, well-tested, portable and safe code in the language, especially now C++11/14 is here. But it's use-cases are still somewhat small nowadays.

For more businessy-enterprisey things I do prefer C# to Java as a language, Java just has more smaller things that annoy me. But for the kind of problems I'd solve with C# or Java, I'd often rather use Scala. Though I've been playing with F# a bit lately, so if I'm in .NET space I'd probably mix-n-match F# and C#. If in JVM space, Scala. What can I say? I love me functional programming patterns, languages that inherently encourage writing purely functional code complement my attitude to coding well since SOLID principles and TDD tend to lead to more pure and functional code anyway.

And Scala/Java and F#/C# have the best toolage out there, between IntelliJ and Resharper. So much refactoring toolage, so much goodness. Makes it very easy to follow "Red Green Refactor".

For small quick-scripts, I'll go for Javascript (in-browser or with node.js for running them locally). But Javascript isn't a language I'd choose for anything more than a small web service or script. Maintaining large code-bases in Javascript is something I find infuriating. I actually can't stand Javascript from a language point of view but it's hard to avoid it.

I do prefer static languages to dynamic, simply because they are more self-documenting. I can actually look at a function definition and tell what the parameters need to be. Means I don't need to look at the documentation as often or commit needless brain power to remembering those parameters without prompts, freeing me up to actually write the damn code. That being said, I don't like it when a static language doesn't provide compile-time type-deduction. Hence one of the reasons I like C++11, C# and Scala, I guess.
« Last Edit: July 17, 2014, 06:15:41 PM by MorleyDev » Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #52 on: July 17, 2014, 06:55:46 PM »

I imagine test-driven development in the indie gamedev scene is basically non-existent. A lot of things are hard to test with code. How's your experience Morley?
Logged

Belimoth
Level 10
*****


high-heeled cyberbully


View Profile
« Reply #53 on: July 17, 2014, 07:04:17 PM »

Haha yeah fuck tests, also fuck error catching.
Logged

Geti
Level 10
*****



View Profile WWW
« Reply #54 on: July 17, 2014, 07:46:23 PM »

I imagine test-driven development in the indie gamedev scene is basically non-existent. A lot of things are hard to test with code.
using TDD for actual game code doesn't make sense, but our Web API and some other back end infrastructure was written with TDD, as correctness was very important there. I also find tests very useful when writing certain fiddly engine systems, to be sure of what's going on and prevent breakage down the line.
Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #55 on: July 17, 2014, 09:12:36 PM »

Yeah sure, TDD makes sense for server-based functionality like adding highscores, searching for a server, or whatever, but that's a discrete input->output system. Also testing engine components is different from approaching engine programming with a TDD mindset. Anyway, let's get back to the OP.

I wouldn't recommend C++ to any beginners. But I agree that the fundamentals of C++ should be learnt at a university, if you can find one that teaches it these days. After that dig into open codebases like UE4 or Wesnoth or IDtech or Raknet or Box2D to see how idiomatic, flexible, schizophrenic, ugly, and beautiful the language can be. Personally I avoid any complex constructions or patterns and use a mostly flat hierarchy of things to get the job done. I find entity/component-based design is simpler when thinking about a system, although C++ has a few missing pieces that make my ideal system possible. E.g., I'd love to say entity.transform.x and have .transform map to a function call, but them's the breaks.
Logged

R.D.
Level 2
**


Making a game about balls. Yepp.


View Profile WWW
« Reply #56 on: July 18, 2014, 04:05:04 AM »

I wouldn't recommend C/C++ for beginners too. But I would say that it's good to get into it as soon as understand the basic concept of programming when you want to make high-end stuff. If you only care about 2D games with simple graphics, you can achieve a lot by swinging with Java/C+/JS or a game maker. Unity is pretty popular these days although I personally don't like that much.

@Geti
Really? Wow that's surprising! Hope you had a good time!
Logged

MorleyDev
Level 0
***

"It is not enough for it to just work"


View Profile WWW
« Reply #57 on: July 18, 2014, 06:18:27 AM »

C++ for learning? Does have one advantage I can think of: You can feel the pain.

Odd thing to say, but let me explain. A lot of software development has been about trying to make things easier to work with, ideas like OOP and functional programming are trying to solve problems encountered with 'traditional' procedural code. So if you start with Java, for example, you may learn how to write OOP code but you'll be missing a real understanding of the why, you've never felt the pain of a procedural project. With C++, you can start off very procedural and then progress to objects. You feel the pain, and even could learn how to react when feeling the pain: By taking time to fix the problem and try a new approach.

That being said, I would probably recommend Python over C++ for learning. You can still start procedural and transition to objects, but without C++'s...C++ness. Shame mypy seems to had died. It's Python with optional static typing, which could be great for learning.

But C++ is something I recommend for university students of Computer Science, if only because it actually teaches you the concepts you should know that other languages tend to hide (heap vs stack, for example).

I imagine test-driven development in the indie gamedev scene is basically non-existent. A lot of things are hard to test with code. How's your experience Morley?

I've only written games for hobbiest work or university at the moment, nothing I'd call professional quality. I have experimented with using tests whilst recreating some of the classics (e.g Space Invaders, Pac-Man, Pong) but that's it. Professionally, I've only ever worked in the business side of software so I'm not speaking with definitive authority here. I do know of several professional studios that practice TDD (High Moon and CCP are the typical examples).

Going of my admittedly little experience, the validity depends on the underlying technology you're using. It is generally possible when you have full code ownership or with certain frameworks or engines. A lot of the C# you write in Unity can be tested, for example, and Unity even comes with built-in tools to help with tests.

When you think about it any logical update or event handling is ultimately:
Get the information it wants about the current state.
Manipulate the information to produce new state information.
Write the new state information back to the system.

You can easily have tests covering that process. And it's not difficult,so long as you split each logical update into it's most discrete parts. TDD is about the D more than the T (wow that sounds wrong), forcing you to think about the expected results of a function call and encouraging you to architect your code in ways that make those results obvious and explicit and then confirming that the code is doing what you think it is.

Specification/Acceptance/System tests are more difficult in games, since you can't easily drive a complete end-to-end workflow like you can with business software, and probably not worth the effort to write and maintain since I'd suspect they won't give that same benefit. Anyway, getting way off topic xD
« Last Edit: July 18, 2014, 06:33:05 AM by MorleyDev » Logged

s_l_m
Level 8
***


Open to collabs


View Profile
« Reply #58 on: July 18, 2014, 09:03:47 AM »

Honestly? I think everyone should learn C++ and Assembly of some sort even if you never use them (and believe me, I make an effort not to) because those are the languages that all others are compared with and will give you a better understanding of what makes other languages special. Learning Haxe or something without knowing C++ is kind of like learning to play an 8-String guitar without learning a 6-string first, you could totally do it but you won't understanding what makes it different from the norm.
Logged

Think happy thoughts.
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #59 on: July 18, 2014, 09:39:49 AM »

yeah I'm a fan of learning c++ early and doing lots of projects with it. It makes learning another language easy in many cases.

Plus understanding that allocating objects isn't free in higher languages will probably mean you'll structure your code in C#/Java to be more performant intrinsically.
Logged

Pages: 1 2 [3] 4 5 ... 12
Print
Jump to:  

Theme orange-lt created by panic