Live data from Hacker News

Why I Write Games in C

jonathanwhiting.com

261–270 of 303 posts

Re: Why I Write Games in C

#261

Earlier quoted context omitted.

From the Wikipedia page that's 125 million currently active users. They define an active account as one which has been used in the last 90 days. 125 million active users is about double the combined lifetime sales of the Wii U, XBox One and the PS4, which demonstrates my point. It doesn't matter if an individual does or doesn't pay for a game on their phone. What matters is revenue. Worldwide iOS and Android games re…

I don't think you quite understand what is written on wiki page. There is no "currently" active users, there are just 125M active users according to Valve's definition of owning a product OR being logged in the last 90 days [1]. So the actual number of gaming PCs is less (I, for example, have two active accounts since I play PC games so rarely that I've lost credentials for the account I've created for Half-Life 2 an…

Sure. Mobile is the biggest segment of the video games market and growing: https://www.superdataresearch.com/blog/global-games-market-2...

Tencent is the biggest video game company in the world by revenue: http://www.newzoo.com/free/rankings/top-25-companies-by-game...

There are more mobile gamers in China than there are people in America: https://www.techinasia.com/china-mobile-gamers-america-peopl...

Games consoles aren't competitive with that scale.

Re: Why I Write Games in C

#262

Earlier quoted context omitted.

I don't think you quite understand what is written on wiki page. There is no "currently" active users, there are just 125M active users according to Valve's definition of owning a product OR being logged in the last 90 days [1]. So the actual number of gaming PCs is less (I, for example, have two active accounts since I play PC games so rarely that I've lost credentials for the account I've created for Half-Life 2 an…

Sure. Mobile is the biggest segment of the video games market and growing: https://www.superdataresearch.com/blog/global-games-market-2... Tencent is the biggest video game company in the world by revenue: http://www.newzoo.com/free/rankings/top-25-companies-by-game... There are more mobile gamers in China than there are people in America: https://www.techinasia.com/china-mobile-gamers-america-peopl... Games consoles…

I don't see comparable numbers here either, but if you want to believe this - good for you. I don't see anybody contemplating buying, say, Call of Duty game or saving money to buy magic mushrooms in some mobile game so, frankly, I don't even understand what are you comparing. My main objection was comparing total numbers of devices capable to play some kind of games vs dedicated gaming hardware, which, I hope we have sorted out.

Re: Why I Write Games in C

#263
post #66

How 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

I would love to see Nim succeed. I think there are a few roadblocks. 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 eyesor…

+1 Nim is too messy for me. And the codegen bugs are very annoying, just like black magic.

Also I don't like the Python-style with no end-marker. I'll be glad if Araq does plan to provide another syntax for Nim. But I fear the style war in the community.

Things I like about Nim: 1. Unified function syntax call, which makes my code more OO-like. 2. Many customizable operators and easy to grasp operator precedence. 3. The pegs library is small but very nice. I began Nim programming with it, wrote handy grammar validators with it, and finally got parser trees in pure Nim for the ASTs. Really fun. Not much, because I hope Nim could be simpler and get the most practical features done right. I am dizzy with its syntax and STL now.

Re: Why I Write Games in C

#264
post #83

Earlier quoted context omitted.

Have you any code shared on GitHub so I may see some real life Nim?

Sure. There is lots of repos: https://github.com/trending?l=nimrod Some highlights: Nimble package manager [1], Jester web framework [2], NES emulator [3], NimForum [4], SDL GUI library [5] And if you want some smaller code examples: http://nim-by-example.github.io/ , https://github.com/def-/nim-advent-of-code-2015 , https://github.com/def-/nim-unsorted 1: https://github.com/nim-lang/nimble 2: https://github.com/dom9…

Much obliged.

Re: Why I Write Games in C

#265
post #212
post #89

Because 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...

> Do you have any examples of AAA games (or even major indie ones) that use Rust or Haskell?

Nope, not in Rust AFAIK. Indie games in Haskell are around. Off the top of my mind, Niki and the Robots is written in Haskell.

> Often I find that when people recommend a technology for game development, no professional game studios ever seem to use them.

I was not so much recommending tech, just found these languages would fit nicely the list he assembled.

Re: Why I Write Games in C

#266
post #234
post #105

>Even more than that I care about the speed of the compiler. I am not a zen master of focus, and waiting 10+ seconds is wasteful, yes, but more importantly it breaks my flow. I flick over to Twitter and suddenly 5+ minutes are gone. Quick suggestion, has really helped me: take that 10 or 20 seconds waiting for compilation, and stare out a window. This gives your eyes much needed break from focusing on a computer moni…

Just make sure that nothing interesting is happening outside otherwise you will loose focus watching that :). And if I remember correctly then focusing close for a long time doesn't affect your vision but can cause headache.

This is wrong. Your eye muscles can tire over the long term if not given a chance to focus on other distances. It's like standing up all day without ever sitting down. The eyes are fundamentally muscles.

Re: Why I Write Games in C

#267
I've had this thought quite a few times.

Basically, if you want your software to last and work on lots of platforms (particularly if it is a game you put a lot of love into), using a lot of dependencies you worry about it.

I know I've written some things - not even games, that would be a major chore to port.

But C and OpenGL APIs are still going to be there, and there's a nice feeling of quietness when it's just you, libraries you know are going to be stable, and the code, and not having to wonder "is this fully baked?" or "which one of these libs is the best".

You can almost get paralyzed in finding the ideal tools and libs to use and keeping up with all of them. Whereas if you limit yourself to just what comes with the language (and maybe a few small things) a side project can be a lot more fun.

A side project is also often about the journey, not the destination, and people can get a lot of mileage out of building incredibly complicated weird things that not many people will know are even there (I don't really know how to play Dwarf Fortress and don't play it, but the idea of the history generator, terrain generator, and so on... all that runs before you play the game strike me as great examples - the kind of thought that this is incredibly impractical and therefore must have been a ton of fun to write)>

Re: Why I Write Games in C

#268

Earlier quoted context omitted.

Sure. Mobile is the biggest segment of the video games market and growing: https://www.superdataresearch.com/blog/global-games-market-2... Tencent is the biggest video game company in the world by revenue: http://www.newzoo.com/free/rankings/top-25-companies-by-game... There are more mobile gamers in China than there are people in America: https://www.techinasia.com/china-mobile-gamers-america-peopl... Games consoles…

I don't see comparable numbers here either, but if you want to believe this - good for you. I don't see anybody contemplating buying, say, Call of Duty game or saving money to buy magic mushrooms in some mobile game so, frankly, I don't even understand what are you comparing. My main objection was comparing total numbers of devices capable to play some kind of games vs dedicated gaming hardware, which, I hope we have…

Not really. I don't know what you're objecting to. The trend worldwide is away from console platforms. Look at the shift happening in the Canadian video game industry:

http://mobilesyrup.com/2015/11/22/mobile-game-revenue-will-s...

http://theesa.ca/wp-content/uploads/2015/11/ESAC_2015_Bookle...

Console game revenues down by 32% since 2013, mobile game revenues up by 20%. Mobile games on trend to overtake console games and investment is being directed to mobile studios and titles. Don't take it personally, it's just how it is.

Re: Why I Write Games in C

#269

Earlier quoted context omitted.

I like Rust, but sometimes it is pretty difficult to convince the compiler that one's code is safe. And this does not mean that the compiler is preventing unsafety; there are many safe programs that the compiler rejects. Also, the OP said that compile time was a priority, and compiling Rust code is closer to C++ speed than C.

> And this does not mean that the compiler is preventing unsafety; there are many safe programs that the compiler rejects. Two nits: 1. The compiler does prevent safety problems. It just happens to rule out some safe programs while doing so. (Although I think this is a bit of a misconception, because with the aliasing rules being used for optimization many things that the Rust compiler rejects that people think are s…

I think game programmers don't like type systems -- or rather, they prefer the minimal typing necessary for speed improvements and their ability to simplify basic static analysis (with tools or in their heads). I don't blame them, games are a lot of work even for relatively simple things, and to get anything done at a reasonable pace you just need to be able to churn out lots of code that compiles on the first try, and when it doesn't the mistakes should be easy to fix and minimize the time you're spending fighting with the type system (C++ templates come to mind as they're often avoided in games no small reason being the cryptic error messages they can produce). There might be an argument of familiarity, that eventually if they used Rust or Haskell enough it would all come to them as easy as C, but then well known Haskell promoters say things like "if you're using the type system right your code will never compile on the first time."

Re: Why I Write Games in C

#270

Earlier quoted context omitted.

I don't see comparable numbers here either, but if you want to believe this - good for you. I don't see anybody contemplating buying, say, Call of Duty game or saving money to buy magic mushrooms in some mobile game so, frankly, I don't even understand what are you comparing. My main objection was comparing total numbers of devices capable to play some kind of games vs dedicated gaming hardware, which, I hope we have…

Not really. I don't know what you're objecting to. The trend worldwide is away from console platforms. Look at the shift happening in the Canadian video game industry: http://mobilesyrup.com/2015/11/22/mobile-game-revenue-will-s... http://theesa.ca/wp-content/uploads/2015/11/ESAC_2015_Bookle... Console game revenues down by 32% since 2013, mobile game revenues up by 20%. Mobile games on trend to overtake console game…

The trend in the current generation is strongest so far (at least for Sony) http://www.ign.com/articles/2014/11/14/playstation-4-continu... and even for MS it's pretty good from what I remember. I am guessing all the analysts making these predictions are looking at Nintendo, which had been in decline since 1990s and only caught one lucky break with Wii. It's being back to its normal state will look like a declining trend only for somebody who learned about game consoles when Wii came out.

Doing trends for mobile games over short periods of time is entertaining but I am old enough to remember the same trend building that led to Zynga's IPO, social games were to kill console games before mobile games in the good old times of 2010-2011.

Post reply on HN