Qooper on 5/8/2014 at 11:36
So hey, hi!
Have you ever been in that nasty situation where your C++ project starts to take minutes to compile due to an #include < vector > or something similar in 100 of your compilation units? If you have, you're probably a game engine programmer like myself. My advice to you is stop being so obsessed with how things work and become a florist or an ant farmer. You'll live a much happier life that way. But in case you can't make those life choices, what are the options in this predicament? Let's see:
* There's the DON'T_USE_STL-trick, which is kinda nice and hurts only a couple of times.
* Then there are those precompiled header nonsenses that MS cooked up at some point.
* And then there's the unchanging mantra the GTK-crowd push on you every time they get the chance: use C.
Okay so there are other options too, but my point is these are all hacks, just like every other damn piece of successful tech in this world. C++ does not have a module system. At least not in the standard and definitely not yet. Clang++ might be getting something resembling a real import command some time in the near future, but right now they're just tracking the committee that makes decisions about the future of the C++ standard.
Right now I just want to take a break and do something fun for change, so I started designing and implementing a language of my own. Took some inspiration from Scala and Nimrod, and shortly after came up with the beginnings of a lang that compiles to C and then to native binary. Has a minimalistic syntax, has higher-level features like classes, algebraic data-types and pattern matching, has memory management, and at the same time supports low-level programming as well. Memory management and other nice features are optional and the language doesn't force the programmer to use them. So far writing the compiler has been a lot of fun and in a few days I should have something ready that can compile a rudimentary hello world.
I'm sure there are people on these forums that have implemented their own toy-languages. Please, share your experiences. I'd like to hear what you've learned about life, the universe and everything.
Gryzemuis on 5/8/2014 at 13:47
I pick option C: "use C".
Good that you're having fun. But I don't expect anyone here to have written their own computer language. And certainly not implemented it. I would guess that language and compiler stuff were interesting in the seventies, maybe eighties. I can not imagine anyone from the nineties or later to be interested in writing compilers. Heck, I'd be surprised if many people on TTLG could program at all. But let's hope someone here surprises me.
Oh, btw, there are many more subjects where software has been written that has a huge number of lines. Not just game engines.
Bjossi on 5/8/2014 at 14:40
I only wrote an interpreter for a very very simple toy language as an assignment last year. Not useful in any shape or form but did train me in writing parsing and interpreting logic.
Designing new compilers or languages from scratch is not much of a thing today I guess, but the subject of compiler development and theory is still very much relevant. Processors and their instruction sets change, and compilers should take advantage of that, not to mention there are usually innovative ways to speed up the compilation or the binary code it spits out that have yet to be discovered by some brilliant mind.
Me? I just use C, unless I'm forced to use something else. :p
Qooper on 5/8/2014 at 15:06
Quote Posted by Gryzemuis
I pick option C: "use C".
Well, I salute you sir :) My experience with C is that it inevitably causes you to learn precisely _everything_ about the gigatons of bookkeeping that modern languages and their compilers do for you behind the curtain. Try implementing a generic vector container. I dare you. And you'd better enjoy it too, otherwise I won't accept your results :D
Quote:
I would guess that language and compiler stuff were interesting in the seventies, maybe eighties. I can not imagine anyone from the nineties or later to be interested in writing compilers.
Hmm well perhaps language implementers are a minority. I mean surely they are, but new languages do pop up even today, and I'd even argue that we see more new languages now than we did 20 years ago. At some point managed languages were the thing, so we got Java and C#, and as a side-effect we got the JVM and .NET as platforms that people started writing languages on. But I see a new trend with very recent languages such as D, Go, Rust and Nimrod. These are languages that compile into native binary and perform very well compared to C++. I mean, Java and C# do too, but they have overhead when it comes to doing lots of small things or packing lots of small pieces of data. So these new languages tackle these issues and return back to the performance-centric philosophy of C and C++, and at the same time also provide modern features such as a module system and powerful tools for taking advantage of concurrent computation resources.
Also, some people enjoy making toy-languages such as the ones found on (
http://esolangs.org/wiki/Language_list) esolangs.
Quote:
Oh, btw, there are many more subjects where software has been written that has a huge number of lines. Not just game engines.
True true, but in these modern times most of those subjects are materialized using more modern languages than C++, like Java, C# or Python. This is because these languages provide much faster development cycles and even though these languages introduce memory and CPU overhead in certain places, in less time-critical applications the CPU power we currently have is more than enough. However, since game engines need to perform in real-time scenarios and be able to both crunch massive amounts of numbers and make numerous logic decisions in less than 16.7 milliseconds if you're aiming for a steady 60Hz, they are mostly implemented with C++. And since C++ is notorious for its include-mechanism that tends to slow large builds down, I made the bold connection between this problem and engine devs. But it was more of a joke than a serious conjecture.
Pyrian on 5/8/2014 at 15:16
Quote Posted by Qooper
There's the DON'T_USE_STL-trick, which is kinda nice and hurts only a couple of times.
Heh. I remember way back going "hey this is cool" and doing some stuff with STL. Slowed our game to a stuttering mess. Haven't used it since... Granted, I haven't done much C++ at all since, but still.
Quote Posted by Gryzemuis
Heck, I'd be surprised if many people on TTLG could program at all.
Hmm? I thought we had quite a few. Some people just script, but that can count, IMO.
I understand the frustration and temptation. It seems like there are SOOO many languages (why do I need to know HTML, CSS, JavaScript, SQL, and whatever backend language(s) are being used, just to debug a simple webpage?), and none of them are quite...right. Reminds me of this (
http://xkcd.com/927/) XKCD.
Gryzemuis on 5/8/2014 at 17:08
Quote Posted by Pyrian
I thought we had quite a few (programmers).
I forgot that our roots lie in a game that was made for MIT grad students.
Bjossi on 5/8/2014 at 17:10
Quote Posted by Qooper
Well, I salute you sir :) My experience with C is that it inevitably causes you to learn precisely _everything_ about the gigatons of bookkeeping that modern languages and their compilers do for you behind the curtain. Try implementing a generic vector container. I dare you. And you'd better enjoy it too, otherwise I won't accept your results :D
A vector container in itself would be easy to make, but a datatype-generic one would require a little more work involving sizeofs, pointers, bit offsets and such. I'm more than done with that stuff for a while after writing my own malloc package from scratch few months ago. :p
Yakoob on 5/8/2014 at 18:30
Or you can go with C#, the nice syntax and ideas of C++ with better built-in functionality. I think it's my favorite lanugage so far, glad Unity supports it (although MonoDevelop kills my inner soul).
While not quite a compiler, I did create "script nodes" in my node-based conversation system back on Postmortem. Over time it evolved, with more nodes and scripts, becoming pretty robust with conditionals, switch statements, variables, different compares etc. While not at the level of Unreal's Kismet by any means, it was actually powerful enough to implement a bunch of debugging tools for my early testing:
Inline Image:
http://unboundcreations.com/images/karaski/devblog/karas28_mr_debug.jpgI did further integrate it into a node-based quest system which could mange itself (complete or add tasks/quests) with script nodes alone. Albeit, it the soft-scriptendess of it has been problematic as well.
Quote Posted by Bjossi
A vector container in itself would be easy to make, but a datatype-generic one would require a little more work involving sizeofs, pointers, bit offsets and such. I'm more than done with that stuff for a while after writing my own malloc package from scratch few months ago. :p
While we're bragging, I wrote a whole Reflection system in C++ for Postmortem. Took me like 3 weeks but once done I could very easily add reflection to ANY class thanks to automatic macros and recursively nested templates. I then wrote a custom serailizer/desiralizer and could effectively define and load ANY in-game class at runtime from a simple text file. It even supported inheritance, structs, arrays, enums, and linking objects via pointers even across different files. It proved really nifty in later stages of dev where I added whole UI menus or new characters without needing to recompile anything :p [/brag]
Quote Posted by Pyrian
Heh. I remember way back going "hey this is cool" and doing some stuff with STL. Slowed our game to a stuttering mess. Haven't used it since... Granted, I haven't done much C++ at all since, but still.
OH, what kind of stuff? YOu mean just standard containers (vector etc.) or algorithms? I only ever used the containers really and never had an issue. I also avoided iterators since they can break if you modify whatever you are iterating over (which was a case more often than you'd think).
demagogue on 6/8/2014 at 03:39
What is a RP, a rupee?
I think writing your own programming language is very interesting. I'd try it if I could.
I wrote a natural language once anyway.
Qooper on 6/8/2014 at 08:49
Quote Posted by demagogue
What is a RP, a rupee?
I wish. It was a tongue-in-cheek reference to games like Master of Orion where research projects cost research points.
Why can't you try writing your own programming language? Tell me about it in your own natural language that you've made. I'd really like to see what it looks like :)