• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
fir

C in game development

36 posts in this topic

I am big fan of C, not so much devoted to c++.

 

Does maybe someone know how much widely used is old good (and fast) c in game development (in relation to c++ usage) ? In big games?

 

[And besides that are here maybe fans of C who much prefer it than c++

like me, here? Asking for curiosity]

 

 

1

Share this post


Link to post
Share on other sites

I am big fan of C, not so much devoted to c++.

 

Does maybe someone know how much widely used is old good (and fast) c in game development (in relation to c++ usage) ? In big games?

 

[And besides that are here maybe fans of C who much prefer it than c++

like me, here? Asking for curiosity]

 

Not much at all, C doesn't provide any advantages over C++ these days when it comes to performance and has several disadvantages when it comes to security and productivity, C99 and C11 compiler support is still awful on Windows. (MSVC only supports C89) and using C++ still allows you to write c style code in areas where it is beneficial to do so.

1

Share this post


Link to post
Share on other sites

 

I am big fan of C, not so much devoted to c++.

 

Does maybe someone know how much widely used is old good (and fast) c in game development (in relation to c++ usage) ? In big games?

 

[And besides that are here maybe fans of C who much prefer it than c++

like me, here? Asking for curiosity]

 

Not much at all, C doesn't provide any advantages over C++ these days when it comes to performance and has several disadvantages when it comes to security and productivity, C99 and C11 compiler support is still awful on Windows. (MSVC only supports C89) and using C++ still allows you to write c style code in areas where it is beneficial to do so.

 

 

c offers a 'different style' - the main points for example

 

- procedural 

- not using templates

- static arrays way 

 

it has some advantages for me 

-1

Share this post


Link to post
Share on other sites

You can do that in C++ too, so that's no advantage.

 

 This is c-way, And if this is both c and c++ (as a  c heritage) I call it a c not c++ (c++ would be oop, templates, constructors and such stuff - way of writing)

 

[so here if I am talkimg about c, I think about such "c-way" of writing against "c++/oop way" of writing (coding)]

 

after that jump to my first question, is such procedural  "c - style" coding  present in this day big games debelopment or not too much

Edited by fir
0

Share this post


Link to post
Share on other sites

 

The following is going to be a bit of a rant.  Before I start, my intention is not to offend anyone, everyone is entitled to their own opinion.  With that out of the way, here is my story:
 
 
 

 

I seem to agree with most that (this about boilerplate and overcomplex weak design) (probably)

 

Personally I am writing almost exclusively c so I dont even know c++ to much. (I am moderately experienced, 100k lines in the backpack at my back)

 

As to communities I am personnaly the one c-liker person in my community (I use c++ compilers like mingw but do not use c++ features)

 

The people i talk with are always c++/oop people, (c++ community people) so I would be curious how it is in these days big game development (are such projects c++ oop stuff mostly or there is some big percentage of oldskul procedural c these days also)

 

I know it can be hard to answer because of people have their own experiences not neccesary 'statistic' of wide view of the 'industry' or something like that.

 

As to communities do you think that c++ community is much  larger than c community in general these days? I have no idea on that.

Edited by fir
0

Share this post


Link to post
Share on other sites

 


Does maybe someone know how much widely used is old good (and fast) c in game development (in relation to c++ usage) ? In big games?

 

In the United States, at least, the primary language used for AAA games right now is C++.  If you want to make AAA games, you should be comfortable using C++.  If you do not wish to use C++, this is going to really limit your options.

 

Many studios tend to favor the use of composition over inheritance, and Entity Component Systems are very popular (http://en.wikipedia.org/wiki/Entity_component_system).  Some studios have, in recent years, moved towards a more "functional" style of C++ programming (http://msdn.microsoft.com/en-us/magazine/jj553512.aspx), so it is worth being conversant in recent innovations in that area.

 

However, many people are completely abandoning C++ for non-AAA projects.  OO-languages are still fairly dominant, but really, your options are pretty wide open, if you're working on indie games.

 

 

well, nice

 

I could stand c++ but I am not to much devoted to it.

Not sure if I would like to go into big game bussines but it is always nice to coding person to know what 'they' are doing/coding.Tnx for info in the 2nd paragraph, I will check it.

Edited by fir
0

Share this post


Link to post
Share on other sites

OOP is successful in big project because it can offer the possibility to "prove" that a certain piece of code to do something "works" and it's immune from misinterpretations and abuse.

This is, of course, possible in most every language, but OOP seems to expose the basic concepts in a more direct way.

 

In languages like C, you can have a struct with functions doing "work" on them and, if use correctly, they work. The problem is that if you forget to call some "init" on your struct, or some "release" on your struct, or if you go there and change a value in that struct ignoring the fact that there are 3 more members that need to be changed to keep the struct in a "valid" state.

C++ (OOP in general) is an attempt to solve this by exposing objects with an interface that guarantee the validity of the data in every situation.

 

Now this seems to be the obvious way to go when writing programs in the large.. you see somebody's else class, you assume once you create it it'll be "ready to go" and that it'll be valid no matter what methods you call on it.

 

There goes the theory.. in practice, there seems to be a growing community of programmers that think that's not really the case.. and that all this bureaucracy in the languages is just moving the responsibilities around, from the user of the "black box" to the implementer of the "black box".. which sort of makes sense because the implementer should know better. But when there is a problem , then it is often hidden under countless layers of abstractions and constructs.

 

But in a perfect world, if you can choose between a mindset that goes:

 

// In C

// Instantiate a struct

MyStruct data;

 

// How I initialise this? Look for a function that looks like InitMyStruct.. found it

InitMyStruct(&data);

 

// Right, what can I do with this one? IDE can't help me, I have to guess a naming convention or potentially look in every possible .h

// for functions taking a MyStruct* as parameters.. ok got one

UpdateMember(&data);

 

// But... would this work too?

data.member=10;

 

// No way to know

// Now I am done with it... should I clean this up somehow? Start my endless search for something that looks like, cleanup, release, destroy.. you name it.

// Got it

ReleaseMyStruct(&data);

 

As opposed to the C++ "way":

 

MyClass c;

// No thinking, c is initialised and readu

 

// What can I do with this? Just write c. and get the IDE showing you the methods callable on c

c.UpdateMember();

 

// Can I do this?

c.member=10;

// If member is public, then it means it is possible to assume the member has no dependent members, so good to go

 

// Done with it? Should I worry about anything else? nope.. if there is clean up the destructor will take care of it

 

Why would you ever choose the C way?

 

Personally, I would feel "lost" in C after so many years of C++, but, I love coding in Google Go... and I really think that you guys in love with C should check Go out because reading your posts I had this feeling I was reading or listening to somebody of the Go team explaining the reasons behind the simplicity of Go and its relationship with C.

The mindset I have when using a Go library is totally different.. I dont rely on intellisense to suggest me the usage of a particular class, I open the implementation or the docs and read how to use it... as someone smarter than me put it: it looks like a polite conversation between engineers.. where, in C++ it often looks like the conversation between a paranoid father and a demented kid.

2

Share this post


Link to post
Share on other sites

I could stand c++ but I am not to much devoted to it.

 

 

It seems to me that you want to flame and/or complain about c++. There's no problem with that, but it won't come to an end, either. The points that are mentioned here as disadvantages of c++ are more or less problems of the people using it.

 

Sure the, oop-fizzbuzz example is funny, but that's because it is completely exaggerated.

 

I think there's no point in "being a fan of language x". It's a question of what feels best, what is best for the project in aspects that are important for the project.

0

Share this post


Link to post
Share on other sites

...

in that struct ignoring the fact that there are 3 more members that need to be changed to keep the struct in a "valid" state.

...

 

 

In c i do not use such approach you mention - as a c++ object as a shield interface for some "its internal state inconsistency" against weak users

(probably I used to  evade internal states in such type modules at all. (I would be must think a little about that to explain the difference)

 

Do not have to fight with that because it does not seem to appear at all.Though I do not work in a team , I never handed a module/c-file to somebody and said  use it such-and-such, so i do not know. But probably as I said I prefer the stateles modules (As speaking of some side-internal-state to spoil)

 

Also I do not use such alone object structures you mention:

I do not used just one of it  - all my data practicaly are few big global tables of instances only - got initialisations but got no  'destruction' at all - when I need container for thousands of bullets which are of short living I use something like a pool of structures in the static array - its quite efficient and clear (though is staticaly limitted to some arbitrary limit - so it is some kind overflow prone)

Edited by fir
-1

Share this post


Link to post
Share on other sites

 


I could stand c++ but I am not to much devoted to it.

 

 

It seems to me that you want to flame and/or complain about c++. There's no problem with that, but it won't come to an end, either. The points that are mentioned here as disadvantages of c++ are more or less problems of the people using it.

 

No I really do not want to flame, If it goes it way it was no my intention. I do not want to convince somebody not to use c++ use c or something like that. Im mainly curious what is in use in big titles production thise days and what it look like,

(And mainly if procedural c is in usage here 'yet' - becouse I am personaly liker of that) If somebody does know. Thats all Do not want to flame on that.

Edited by fir
0

Share this post


Link to post
Share on other sites

 

all my data practicaly are few big global tables of instances only

 

ya sure, globals everywhere.. why not? tongue.png

 

Surely it's faster to hack together a small simple program like this... but do you really think companies investing millions should approach their software with the same careless attitude you show here?

 

Global state is a proven major source of bugs and general impossibility to maintain a software that grows beyond a certain size.. most modern language design is targeted towards eliminating global state and shared state. They DO require more thinking and pre-design of your code, but that's what might save the company from ending up with an unmanageable mess of spaghetti code.

 

I hope you understand that trying to propose a bunch of big global state in C-style as solution to any problem is going to get you out of any decent job interview in 30 seconds.

 

 

I do not know how would it be in a very large game project

I was not talkin on that, this would quite different topic 

 

Many big systems are written in c so they probably are build around some global tables [?] and it is not necessary a  mess

 

But this is different topic - (though interesting to: are big c-code system build around of bunch of some big global tables with data ?- this 'globalness' is no problem for me necessary, worse thing is that they are static sized tables and i do not know how achive flexibility in such static array approach, If they use a linked list with heavy malloc free it would be slow i think, maybe some mixed approach linked arrays or something like that - I do not know)

 

[but this all is maybe a kind of digression so maybe I will cut it here - though if somebody do know (depth architecture of some big c-based systems) I would like to know about it its interesting to learn]

Edited by fir
-1

Share this post


Link to post
Share on other sites

Using C for games certainly isn't impossible but I find myself just recrafting a toy version of C++ with macros etc...

 

The following was a small prototype game developed using C a while back (compiled using Clang/Emscripten)

http://50.57.98.84:8080/legfria/

 

Some notes...

- I really missed exceptions.

- One level of inheritance is possible (using update, draw function pointers) but more gets really fiddly

- Works great with SDL (and OpenGL) and don't need to worry about fiddly unique_ptr deleter functions etc...

- Compiles in a fraction of the time as C++. Probably about 10% time taken (with Emscripten).

- Much smaller output size (matters more with Emscripten than a .bin for Linux or .so for Android)

- Compiles with minor tweaks in any "C family compiler" Objective-C, C++ (so quite portable perhaps)

- glm maths library is C++... this was a pain because I like using a "standard" maths library rather than a hand rolled one.

- Debugging C with lldb or gdb is trivial compared to C++.

Edited by Karsten_
0

Share this post


Link to post
Share on other sites

 

I do not know how would it be in a very large game project

I was not talkin on that, this would quite different topic 

 

 

 

wtf? In your original post you talk about "big games" and now you say you are not talking about that? Make up your mind.

 

Anyway, my advice to you would be to study software design and different modern languages... C++,C#, F#, Haskell, Go, Rust.. expand your vision, try to understand what they bring on the table and what they are trying to solve. Approaching problem solving with big globals will just bring you bugs and broken software.. also you won't be able to communicate with other devs because you'll be missing the vocabulary..  it's 2013, software design has evolved in the last 50 years and so should you if you want to be relevant in this industry... it's fine to like and prefer C, but it should be the result of learning and experimenting with different techs.. not the result of lazyness and desire to treat eveything as a big global spaghetti ball.

2

Share this post


Link to post
Share on other sites

 

 

I do not know how would it be in a very large game project

I was not talkin on that, this would quite different topic 

 

 

 

wtf? In your original post you talk about "big games" and now you say you are not talking about that? Make up your mind.

 

Anyway, my advice to you would be to study software design and different modern languages... C++,C#, F#, Haskell, Go, Rust.. expand your vision, try to understand what they bring on the table and what they are trying to solve. Approaching problem solving with big globals will just bring you bugs and broken software.. also you won't be able to communicate with other devs because you'll be missing the vocabulary..  it's 2013, software design has evolved in the last 50 years and so should you if you want to be relevant in this industry... it's fine to like and prefer C, but it should be the result of learning and experimenting with different techs.. not the result of lazyness and desire to treat eveything as a big global spaghetti ball.

 

 

Main topic was question Is there 'old' c-way programming present in

todays big title productions and at how much big extent -

not arguing "how to write" big programs in c (the second is much heavier topic), (also noting about spaghetti balls and stuff)

0

Share this post


Link to post
Share on other sites

I have no qualms with OOP, in fact it is a very natural way of thinking: people naturally quantize data and methods in order to achieve a more organized train of thought. Computer memory is lossless and void of distraction, so computers can do one thing for one year and (assuming the program doesn't use consistently more memory after each execution cycle) and not lose any memory and not be "distracted." Computers are procedural and can only execute one thing at a time (yes you have multi-core systems and OpenCL/CUDA, but for the most part this is true).

 

I like C. I really like C. You can tell by my signature what I feel about the future of computing and what language I like. I think OOP is a good way to design a program, but not the optimal way to implement it. OOP in C is not the solution. Folks that pretty much re-write the C++ runtime in C for their program and then bash C++ are better off to just quit programming altogether. I find C very suitable for games because games are based off of the game loop. While some people think that since games have discreet and definitive systems (audio, graphics, etc.) that they are all just waiting for C++ implementation, but that is false. C++ is, IMHO, almost trying to get the computer to think like a human. C, IMHO, is almost like trying to think like a computer. I will still be writing my game and tool suite in C.

-1

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0