Live data from Hacker News

Writing a 3D Game in C (in 2022)

aarongeisler.com

1–10 of 20 posts

Re: Writing a 3D Game in C (in 2022)

#3
Very nice.

That said even C has already a way too rich and complex syntax. ISO is doing planned obsolescence with its syntax instead of fixing it, and no the linux kernel is not written in C, but using a gcc-massively-extended C dialect.

Then it needs discipline: c89 with benign bits of c99/c11/etc.

A good move is to write/use a C coded game engine, I wish godot was plain and simple C.

Re: Writing a 3D Game in C (in 2022)

#4
Interesting read, thanks.

> C++ is the obvious choice but the syntax and endless features overwhelm me. I’m not a fan of OOP for game development - class-heavy C++ was not the right move

You can well use C++ with a very modest style, even completely without OO if needed; C++ has many advantages over C for large projects; the type system is more mature and it offers very useful features for modularization and memory management (which were already present in C++98, so it's easy to get a working compiler on virtually all platforms where there is a C compiler).

Re: Writing a 3D Game in C (in 2022)

#5

  > deep cloning of data with simple assignment a = b;
  > deep equality checks bool are_equal_by_value = memcmp(a, b, sizeof(some_struct_t));
Errr, wat? We seem to have very different understandings of "deep" in this context. Neither of the above are "deep" in the sense that pointers within the struct will not be followed with their referenced data copied/compared. These are shallow operations.

Re: Writing a 3D Game in C (in 2022)

#7
post #5

> deep cloning of data with simple assignment a = b; > deep equality checks bool are_equal_by_value = memcmp(a, b, sizeof(some_struct_t)); Errr, wat? We seem to have very different understandings of "deep" in this context. Neither of the above are "deep" in the sense that pointers within the struct will not be followed with their referenced data copied/compared. These are shallow operations.

You are correct in the case of nested pointers. I am using primitive types nearly exclusively. Good observation!

Re: Writing a 3D Game in C (in 2022)

#8
post #4

Interesting read, thanks. > C++ is the obvious choice but the syntax and endless features overwhelm me. I’m not a fan of OOP for game development - class-heavy C++ was not the right move You can well use C++ with a very modest style, even completely without OO if needed; C++ has many advantages over C for large projects; the type system is more mature and it offers very useful features for modularization and memory m…

That makes a lot of sense. Any resources you would recommend? I am getting tired of making C "wrappers" to work with C++ SDKs. Will probably need to bite the bullet on this.

Re: Writing a 3D Game in C (in 2022)

#9
post #5

> deep cloning of data with simple assignment a = b; > deep equality checks bool are_equal_by_value = memcmp(a, b, sizeof(some_struct_t)); Errr, wat? We seem to have very different understandings of "deep" in this context. Neither of the above are "deep" in the sense that pointers within the struct will not be followed with their referenced data copied/compared. These are shallow operations.

You are correct in the case of nested pointers. I am using primitive types nearly exclusively. Good observation!

I updated the post - really appreciate the attention to detail.

Re: Writing a 3D Game in C (in 2022)

#10

I don't understand why you would use C over C++ for anything other than random embedded devices where you have very intimate knowledge of the hardware. I guess you just really hate any hint of a type system?

I'm not suggesting C is better or that I made the correct choice here. My takeaway is that C is "doable" but not the most practical.
Post reply on HN