I understand the want for simplicity in C (and Go gets closer, but has its issues), however, it seems in the end it drags you down. Just having the C++ ability to have objects doing things is very helpful. But yeah, C++ has the ability to get very complicated But it's your choice to have "complicated C++". Limit yourself to some functionalities and it's much more manageable. Use basic STL and keep it simple (also C++…
Better yet, avoid STL altogether and use Qt. It makes C++ very manageable and uncomplicated.
Why I Write Games in C
241–250 of 303 posts
Re: Why I Write Games in C
#242How about Nim? [1] [2] To me it is in many ways a "nicer and safer C". Sure it's not as mature as C, but what is? What it does have going for it is portability (it compiles to C so it shares C's portability), a soft real-time GC which can be manually controlled [3], generics, AST macros and much more. 1: http://nim-lang.org 2: https://github.com/nim-lang/nim 3: http://nim-lang.org/docs/gc.html#realtime-support
The main developer being a bottleneck is one. His intense focus has led to a bunch of neat features, but it's also made the language a bit crazy and incoherent and, in some cases, unfinished -- as if the author lost interest halfway through. The syntax is beautiful in some places, weirdly warty in others (the {.pragma.} syntax is a particular eyesore). It's full of odd, quirky features that seem like the author had a sudden idea but never considered if it was a good one to give a permanent place in the language. At such a young age it already feels crufty.
Nim is also not strict enough for my taste. Supporting nil (as default behavior) in this day and age is not really acceptable.
Re: Why I Write Games in C
#243He mentioned a bunch of languages, and I'm not sure why he doesn't look into something like Kotlin. It's the JVM so you get maturity and it's fast as hell (ran a few economics-related benchmarks on my machine, OpenJDK 8 beat both C++ and Fortran!), has great IDE support (Intellij IDEA - which will actually translate Java into Kotlin if you want to translate snippets), and it doesn't strong-arm you into an OO style. A…
Making games on the JVM is a lot of fun, but the garbage collector does limit what you can do (the OP mentions this as one of the drawbacks of Go).
Not to mention, Unity uses a garbage collector (for all the C# bits, which is a very significant part), as does Unreal (their own written in C++), and even game-oriented languages like Flash and Haxe have garbage collectors. I'm not sure it's as big a problem as popular wisdom would state.
Edit - here's some documentation from Oracle about tuning the GC: https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gc...
Re: Why I Write Games in C
#244Earlier quoted context omitted.
>The ability to have objects doing things C-structs work fine. In my experience, for things like games, C-structs are capable of doing everything you need objects to do. The lack of polymorphism and other OO stuff, makes C code easier to reason about and maintain.
The original creator of the C++ STL has said in interviews that after a long career of C++ development, he still never uses -- and sees no use for -- any model of inheritance for anything. I've since learned that my own C++ code is much better when I very sparingly, or never, subclass anything. This has the added benefit of also never using vtables.
Re: Why I Write Games in C
#245Earlier quoted context omitted.
Considering that vector, map, etc are widely used and expected features of software development, I would think that good libraries in C exist for these already, so you don't have to even write your own 100 lines. Are there any?
GLib (not to be confused with glibc) from the GNOME project has a wide range of functionality -- generic lists, hash tables, strings etc.: https://en.m.wikipedia.org/wiki/GLib Qt, I believe, also comes with a bunch of "standard library" stuff unrelated to UIs.
Re: Why I Write Games in C
#246I write games as well (Written more than 10 games, though they are not very large at scale) and I write them in C++. Reasons being writing networking code (TCP/UDP) is much easier & efficient in C/C++ than any other language IMHO. And most of the code works across platforms.
This one feature had kept me using Tcl for a long time.
Re: Why I Write Games in C
#247Earlier quoted context omitted.
Who cares? Consoles are dead after this generation.
Why? Do you have any evidence to back up this claim? On the contrary, it seems both the Xbox One and PS4 are doing a roaring trade, with gaming overtaking Hollywood in terms of market size and revenue
The global life to date figures are 12.4 million Wii Us sold since November, 2012. 19.2 million Xbox Ones and 35.3 million PS4 sold since November, 2013.
Contrast that with PC shipments, where 70 million in one quarter is considered a bad result: http://betanews.com/2015/10/09/pc-shipments-decline-in-windo...
Or contrast it with the iPad's quarterly sales: http://www.statista.com/statistics/269915/global-apple-ipad-...
In FY2014 Apple sold 250 million iOS devices: http://www.geeky-gadgets.com/apple-to-sell-its-billionth-ios...
Add in Android phones and tablets and the games consoles are dwarfed in comparison, even the 3DS which has sold the most of the current games console generation.
Re: Why I Write Games in C
#248The thing I miss most in C when I don't cheat and use a couple C++ features is templates. Specifically, a dynamically sized List implementation that is type-generic. If you do this in pure C, you have to pick your poison: 1. preprocessor abuse 2. void * 3. multiple redundant implementations of the data structure Dynamically sized lists are used so often, that this tends to be a problem in almost every C project. I wo…
BAH! 4. The "intrusive" containers, but of course. The one true way to do it in C. For one, you can keep items in multiple containers, all being on equal footing. None of that typical C++ mess, when this list is a primary storage for items, and those maps are secondary indexes, all sprinkled evenly with iterators. Intrusive containers don't own items, they merely organize them, which is exactly the right way to go ab…
Between using preprocessor directives in C and multiple inheritance in C++ (comes with associated complexity in the resulting client code), I'd always pick the latter.
[1] https://github.com/llvm-mirror/llvm/blob/release_37/include/... [2] https://github.com/llvm-mirror/llvm/blob/release_37/include/...
Re: Why I Write Games in C
#249Because he claims that reducing the possibility for bug is a main concern I feel two languages, in his nicely written write-up, are left out: Rust -- low-level like C, fast like C, more modern than C, specific ways to reduce categories of bugs (borrow checker), promotes a more functional way for programming Haskell -- not as low-level as C, but pretty fast (best possible performance was not his main concern), many wa…
Do you have any examples of AAA games (or even major indie ones) that use Rust or Haskell? Often I find that when people recommend a technology for game development, no professional game studios ever seem to use them. I'd love to be proven wrong though...
Re: Why I Write Games in C
#250Earlier quoted context omitted.
Why? Do you have any evidence to back up this claim? On the contrary, it seems both the Xbox One and PS4 are doing a roaring trade, with gaming overtaking Hollywood in terms of market size and revenue
I'm not sure sure about a roaring trade. Games consoles are niche platforms. Look at the numbers: http://www.vgchartz.com/ The global life to date figures are 12.4 million Wii Us sold since November, 2012. 19.2 million Xbox Ones and 35.3 million PS4 sold since November, 2013. Contrast that with PC shipments, where 70 million in one quarter is considered a bad result: http://betanews.com/2015/10/09/pc-shipments-declin…
1. https://en.wikipedia.org/wiki/Steam_(software)
2. http://recode.net/2014/02/26/a-long-tail-of-whales-half-of-m...